<!-- llms-explorer concept facts · https://llms-explorer.com/tree/ollama-anthropic-adapter-tool-use-block-fidelity/ · pack 2026-10-05 · ~1434 tokens -->

# Ollama Anthropic adapter tool_use block fidelity

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

Parent: [Mac local LLMs: Chat templates, reasoning and tool calling](https://llms-explorer.com/tree/mac-local-llms-chat-templates-reasoning-and-tool-calling/) · 1 facets · 19 facts · page: https://llms-explorer.com/tree/ollama-anthropic-adapter-tool-use-block-fidelity/

## 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](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- 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](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- 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](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- A message with several `thinking` blocks keeps only the last one (each assignment overwrites the string). — [source](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- A `system` array has its text blocks concatenated with no separator and non-text blocks (including `cache_control` metadata) are ignored. — [source](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- The `MessagesRequest` type parses `tool_choice` (with `disable_parallel_tool_use`) but no conversion code reads it. — [source](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- 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](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- `max_tokens` becomes `num_predict`, and `temperature`, `top_p`, `top_k` and `stop_sequences` map to the matching Ollama options. — [source](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- 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](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- 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](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- 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](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- 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](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- `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](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- `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](https://raw.githubusercontent.com/ollama/ollama/main/anthropic/anthropic.go)
- 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](https://github.com/ollama/ollama/issues/18346)
- An Ollama member answered issue 18346 by recommending a bigger and/or newer model trained on more harness data. — [source](https://github.com/ollama/ollama/issues/18346)
- 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](https://github.com/ollama/ollama/issues/13949)
- 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](https://medium.com/google-cloud/i-ran-gemma-4-as-a-local-model-in-codex-cli-7fda754dc0d4)
- 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: `asserted`
