> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trynito.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tool call streaming

> Tool-call fragments in a stream and how to reassemble them.

A tool call arrives in fragments inside `delta.tool_calls`, keyed by `index`. The non-streaming shape and the round-trip are on [Tool calling](/api/features/tool-calling).

## Start

The first fragment names the tool and assigns its `id`:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "index": 0, "id": "call_abc", "type": "function", "function": { "name": "get_weather" } }
```

## Argument Deltas

Each fragment carries the `index` and a piece of `arguments`:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "index": 0, "function": { "arguments": "{\"city\":" } }
```

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "index": 0, "function": { "arguments": " \"Paris\"}" } }
```

## Reassembling

One buffer per `index`. Record `id`, `type`, and `function.name` from the start fragment; concatenate each `function.arguments` piece; when the terminal chunk arrives with `finish_reason: tool_calls`, parse each buffer as JSON. The gateway does not send a final echo of the assembled arguments.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "choices": [ { "index": 0, "delta": {}, "finish_reason": "tool_calls" } ] }
```

Then run the tools, append each result as a `tool` message with the matching `tool_call_id`, and call again. The gateway routes function tools; it does not execute them.

## Related

* [Tool calling](/api/features/tool-calling)
* [Delta format](/api/api-reference/streaming-format/delta-format)
* [Finish reasons](/api/api-reference/chat-and-text/finish-reasons)
* [SSE transport](/api/api-reference/streaming-format/server-sent-events)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.