LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coremessagescontentToolCall
    Classā—Since v1.0

    ToolCall

    Copy
    ToolCall()

    Bases

    TypedDict

    Used in Docs

    • Quickstart
    • Workflows and agents

    Constructors

    Attributes

    View source on GitHub
    constructor
    __init__
    NameType
    typeLiteral['tool_call']
    idstr | None
    namestr
    argsdict[str, Any]
    indexNotRequired[int | str]
    extrasNotRequired[dict[str, Any]]
    attribute
    type: Literal['tool_call']

    Used for discrimination.

    attribute
    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.

    attribute
    name: str

    The name of the tool to be called.

    attribute
    args: dict[str, Any]

    The arguments to the tool call.

    attribute
    index: NotRequired[int | str]

    Index of block in aggregate response. Used during streaming.

    attribute
    extras: NotRequired[dict[str, Any]]

    Provider-specific metadata.

    Represents an AI's request to call a tool.

    Example:

    {"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".

    create_tool_call may also be used as a factory to create a ToolCall. Benefits include:

    • Automatic ID generation (when not provided)
    • Required arguments strictly validated at creation time