ToolCall Class — langchain Architecture
Architecture documentation for the ToolCall class in tool.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 27276c28_d38d_debf_25e8_b07311b2ae39["ToolCall"] 210f83c5_4be3_e20e_b877_98a194178520["tool.py"] 27276c28_d38d_debf_25e8_b07311b2ae39 -->|defined in| 210f83c5_4be3_e20e_b877_98a194178520
Relationship Graph
Source Code
libs/core/langchain_core/messages/tool.py lines 206–239
class ToolCall(TypedDict):
"""Represents an AI's request to call a tool.
Example:
```python
{"name": "foo", "args": {"a": 1}, "id": "123"}
```
This represents a request to call the tool named `'foo'` with arguments
`{"a": 1}` and an identifier of `'123'`.
!!! note "Factory function"
`tool_call` may also be used as a factory to create a `ToolCall`. Benefits
include:
* Required arguments strictly validated at creation time
"""
name: str
"""The name of the tool to be called."""
args: dict[str, Any]
"""The arguments to the tool call as a dictionary."""
id: str | None
"""An identifier associated with the tool call.
An identifier is needed to associate a tool call request with a tool
call result in events when multiple concurrent tool calls are made.
"""
type: NotRequired[Literal["tool_call"]]
"""Used for discrimination."""
Defined In
Source
Frequently Asked Questions
What is the ToolCall class?
ToolCall is a class in the langchain codebase, defined in libs/core/langchain_core/messages/tool.py.
Where is ToolCall defined?
ToolCall is defined in libs/core/langchain_core/messages/tool.py at line 206.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free