LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangChain
  • Universal
  • Hub
  • Node
  • Load
  • Serializable
  • Encoder Backed
  • File System
  • In Memory
LangChain Core
  • Agents
  • Caches
  • Base
  • Dispatch
  • Web
  • Manager
  • Promises
  • Chat History
  • Context
  • Base
  • Langsmith
  • Documents
  • Embeddings
  • Errors
  • Example Selectors
  • Indexing
  • Base
  • Chat Models
  • Llms
  • Profile
  • Load
  • Serializable
  • Memory
  • Messages
  • Tool
  • Output Parsers
  • Openai Functions
  • Openai Tools
  • Outputs
  • Prompt Values
  • Prompts
  • Retrievers
  • Document Compressors
  • Runnables
  • Graph
  • Singletons
  • Stores
  • Structured Query
  • Tools
  • Base
  • Console
  • Log Stream
  • Run Collector
  • Tracer Langchain
  • Stream
  • Async Caller
  • Chunk Array
  • Context
  • Env
  • Event Source Parse
  • Format
  • Function Calling
  • Hash
  • Json Patch
  • Json Schema
  • Math
  • Ssrf
  • Stream
  • Testing
  • Tiktoken
  • Types
  • Vectorstores
Text Splitters
MCP Adapters
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangChain
UniversalHubNodeLoadSerializableEncoder BackedFile SystemIn Memory
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsLlmsProfileLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingHashJson PatchJson SchemaMathSsrfStreamTestingTiktokenTypesVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/coremessagesToolCallChunk
Interfaceā—Since v1.0

ToolCallChunk

A chunk of a tool call (e.g., as part of a stream). When merging ToolCallChunks (e.g., via AIMessageChunk.add), all string attributes are concatenated. Chunks are only merged if their values of index are equal and not None.

Copy
interface ToolCallChunk

Example

Copy
const leftChunks = [
  {
    name: "foo",
    args: '{"a":',
    index: 0
  }
];

const leftAIMessageChunk = new AIMessageChunk({
  content: "",
  tool_call_chunks: leftChunks
});

const rightChunks = [
  {
    name: undefined,
    args: '1}',
    index: 0
  }
];

const rightAIMessageChunk = new AIMessageChunk({
  content: "",
  tool_call_chunks: rightChunks
});

const result = leftAIMessageChunk.concat(rightAIMessageChunk);
// result.tool_call_chunks is equal to:
// [
//   {
//     name: "foo",
//     args: '{"a":1}'
//     index: 0
//   }
// ]

Properties

property
args: string

The arguments to the tool call

property
id: string

An optional identifier for the document.

Ideally this should be unique across the document collection and formatted as a UUID, but this will not be enforced.

property
index: number

Index of block in aggregate response

property
name: TName
property
type: "tool_call_chunk"
View source on GitHub