create_tool_call() — langchain Function Reference
Architecture documentation for the create_tool_call() function in content.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ac6a4301_33e2_e3f2_52ef_1c8780d48bbc["create_tool_call()"] c7f11daf_e104_efbe_7225_f1d6da8e8630["content.py"] ac6a4301_33e2_e3f2_52ef_1c8780d48bbc -->|defined in| c7f11daf_e104_efbe_7225_f1d6da8e8630 style ac6a4301_33e2_e3f2_52ef_1c8780d48bbc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/messages/content.py lines 1318–1360
def create_tool_call(
name: str,
args: dict[str, Any],
*,
id: str | None = None,
index: int | str | None = None,
**kwargs: Any,
) -> ToolCall:
"""Create a `ToolCall`.
Args:
name: The name of the tool to be called.
args: The arguments to the tool call.
id: An identifier for the tool call.
Generated automatically if not provided.
index: Index of block in aggregate response.
Used during streaming.
Returns:
A properly formatted `ToolCall`.
!!! note
The `id` is generated automatically if not provided, using a UUID4 format
prefixed with `'lc_'` to indicate it is a LangChain-generated ID.
"""
block = ToolCall(
type="tool_call",
name=name,
args=args,
id=ensure_id(id),
)
if index is not None:
block["index"] = index
extras = {k: v for k, v in kwargs.items() if v is not None}
if extras:
block["extras"] = extras
return block
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does create_tool_call() do?
create_tool_call() is a function in the langchain codebase, defined in libs/core/langchain_core/messages/content.py.
Where is create_tool_call() defined?
create_tool_call() is defined in libs/core/langchain_core/messages/content.py at line 1318.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free