_format_tool_message() — langchain Function Reference
Architecture documentation for the _format_tool_message() function in shell_tool.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD b1223200_cf76_0d5b_1be6_44041f4fd7cf["_format_tool_message()"] 4e57a0ff_f1a5_e2e9_6949_569d7cd6d70a["ShellToolMiddleware"] b1223200_cf76_0d5b_1be6_44041f4fd7cf -->|defined in| 4e57a0ff_f1a5_e2e9_6949_569d7cd6d70a 8b644660_40e4_465a_3e51_e1a3166de4f9["_run_shell_tool()"] 8b644660_40e4_465a_3e51_e1a3166de4f9 -->|calls| b1223200_cf76_0d5b_1be6_44041f4fd7cf style b1223200_cf76_0d5b_1be6_44041f4fd7cf fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/langchain/agents/middleware/shell_tool.py lines 856–873
def _format_tool_message(
self,
content: str,
tool_call_id: str | None,
*,
status: Literal["success", "error"],
artifact: dict[str, Any] | None = None,
) -> ToolMessage | str:
artifact = artifact or {}
if tool_call_id is None:
return content
return ToolMessage(
content=content,
tool_call_id=tool_call_id,
name=self._tool_name,
status=status,
artifact=artifact,
)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _format_tool_message() do?
_format_tool_message() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/shell_tool.py.
Where is _format_tool_message() defined?
_format_tool_message() is defined in libs/langchain_v1/langchain/agents/middleware/shell_tool.py at line 856.
What calls _format_tool_message()?
_format_tool_message() is called by 1 function(s): _run_shell_tool.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free