ToolCallChunk: {
    args?: string;
    id?: string;
    index?: number;
    name?: string;
    type?: "tool_call_chunk";
}

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.

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
// }
// ]