# msg_content_output

> **Function** in `langgraph.prebuilt`

📖 [View in docs](https://reference.langchain.com/python/langgraph.prebuilt/tool_node/msg_content_output)

Convert tool output to `ToolMessage` content format.

Handles `str`, `list[dict]` (content blocks), and arbitrary objects by attempting
JSON serialization with fallback to str().

## Signature

```python
msg_content_output(
    output: Any,
) -> str | list[dict]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `output` | `Any` | Yes | Tool execution output of any type. |

## Returns

`str | list[dict]`

String or list of content blocks suitable for `ToolMessage.content`.

---

[View source on GitHub](https://github.com/langchain-ai/langgraph/blob/aa322c13cd5f16a3f6254a931a4104e412cd687c/libs/prebuilt/langgraph/prebuilt/tool_node.py#L309)