Ollama Anthropic adapter tool_use block fidelity
Parent: Mac local LLMs: Chat templates, reasoning and tool calling · Published reference · snapshot 2026-10-05
↓ Facts as markdownall context files
In `FromMessagesRequest` a `tool_use` block without `id` or `name` returns an error ("tool_use block missing required 'id' field" or 'name'), and its `input` becomes the Ollama tool call's `Arguments`.
These notes link each claim to its source. A source may be a research report hosted on this site rather than the primary document. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
Facts
- In `FromMessagesRequest` a `tool_use` block without `id` or `name` returns an error ("tool_use block missing required 'id' field" or 'name'), and its `input` becomes the Ollama tool call's `Arguments`. [source]
- A `tool_result` block becomes an Ollama message with role `tool` and `ToolCallID` set to `tool_use_id`; in a user turn the tool messages are placed before the user text message. [source]
- Content block types other than text, image, tool_use, tool_result, thinking, server_tool_use and web_search_tool_result fall to a default case that only counts them as unknown, so they are dropped without an error. [source]
- A message with several `thinking` blocks keeps only the last one (each assignment overwrites the string). [source]
- A `system` array has its text blocks concatenated with no separator and non-text blocks (including `cache_control` metadata) are ignored. [source]
- The `MessagesRequest` type parses `tool_choice` (with `disable_parallel_tool_use`) but no conversion code reads it. [source]
- An invalid tool `input_schema` fails the request with `invalid input_schema for tool "<name>"`; a tool whose `type` starts with `web_search` is mapped to a function named `web_search` with one required `query` string. [source]
- `max_tokens` becomes `num_predict`, and `temperature`, `top_p`, `top_k` and `stop_sequences` map to the matching Ollama options. [source]
- In streaming, a tool call is emitted whole: `content_block_start` with an empty input, one `input_json_delta` holding the complete marshalled arguments as `partial_json`, then `content_block_stop`; no incremental argument JSON. [source]
- Streaming de-duplicates tool calls by `tc.ID`, so a repeated chunk with the same ID emits nothing and a tool call with an empty ID would collide with any other empty-ID call. [source]
- Thinking is streamed as a `thinking` block with `thinking_delta` events; the delta type defines `signature_delta` but the stream converter never emits one, so streamed thinking blocks have no signature. [source]
- Thinking text that arrives after the thinking block was closed (after text or a tool call started) is not emitted, so interleaved thinking after the first content is lost. [source]
- `stop_reason` is `tool_use` whenever the response has any tool call, even when the done reason is `length`; otherwise `stop` maps to `end_turn`, `length` to `max_tokens`, and any other non-empty reason to `stop_sequence`. [source]
- `message_start` reports `input_tokens` from the first chunk's metrics, falling back to an estimate from the request when metrics are zero, and carries `cache_read_input_tokens` when present. [source]
- Issue 18346 (2026-09-09, Ollama 0.33.3, Windows, qwen3-coder 30.5B Q4_K_M, still open on 2026-10-04): with Claude Code's real Bash tool schema the model's `<function=Bash><parameter=command>` text came back as literal text, while a one-parameter `get_weather` schema returned a proper `tool_use` block. [source]
- An Ollama member answered issue 18346 by recommending a bigger and/or newer model trained on more harness data. [source]
- Issue 13949 (2026-01-27, Ollama 0.15.2 in Docker behind Traefik, open, label bug): Claude Code's `/v1/messages/count_tokens?beta=true` calls returned 404, later `/v1/messages?beta=true` calls returned 500 with doubling timeouts (10 s to 80 s), and the server became unresponsive until restarted. [source]
- A user in a Medium Codex test saw Ollama v0.20.3 route Gemma 4 tool-call responses to the reasoning field instead of `tool_calls` on Apple Silicon, with no reproduction on an NVIDIA GB10 under v0.20.5. [source]
- Inferred: Claude Code sees a model's unparsed native tool syntax as assistant text and, with `stop_reason: end_turn`, ends the turn instead of running the tool, which presents as an agent that "answers but never edits files". [source]
Children
- No children recorded.