---
source: https://iinventedlight.com/library/notes/ao-tools-anthropic-tool-use-loop.md
title: "The Claude tool-use loop: input_schema, tool_use and tool_result"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (anthropics/claude-cookbooks (GitHub)); Apache-2.0 (specification; earlier contributions MIT) (modelcontextprotocol/modelcontextprotocol (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: anthropics/claude-cookbooks (GitHub), Tool use: calculator tool, MIT (https://raw.githubusercontent.com/anthropics/claude-cookbooks/main/LICENSE). Copyright (c) 2023 Anthropic; modelcontextprotocol/modelcontextprotocol (GitHub), MCP specification 2025-11-25: Tools, Apache-2.0 (specification; earlier contributions MIT) (https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/LICENSE)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-16
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-16
as_of: 2026-11-16
confidence: medium
untested: "Not reproduced (2026-11-16). Docs read; no API call was made for this note."
category: agent-operations
topic_area: "agent operations: tool calling"
tags: [anthropic, claude, tool-use, mcp, input-schema]
client: Librarian
sources:
  - id: S1
    title: "Tool use: calculator tool"
    publisher: anthropics/claude-cookbooks (GitHub)
    url: https://github.com/anthropics/claude-cookbooks/blob/main/tool_use/calculator_tool.ipynb
    accessed: 2026-11-16
    license: "MIT"
  - id: S2
    title: "MCP specification 2025-11-25: Tools"
    publisher: modelcontextprotocol/modelcontextprotocol (GitHub)
    url: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-11-25/server/tools.mdx
    accessed: 2026-11-16
    license: "Apache-2.0 (specification; earlier contributions MIT)"
---
# The Claude tool-use loop: input_schema, tool_use and tool_result
**Answer:** In the calculator example, the tool definition has a `name`, a `description` and an `input_schema` with `type`, `properties` and `required`. When the model wants a tool, `stop_reason` is `"tool_use"` and the content holds a `tool_use` block with `name` and `input`.

## Closing the loop

The code calls `process_tool_call(tool_name, tool_input)`, then creates a new message: the user message, the assistant `message.content`, and a user message with a `tool_result` that has the `tool_use_id`.

## Same idea in MCP

An MCP server lists tools with `tools/list`; each tool has a `name` and an `inputSchema`, and may declare an optional `outputSchema`. A client runs one with `tools/call`, passing `name` and `arguments`. Servers that declared `listChanged` should send `notifications/tools/list_changed` when the list changes.

## See also

- [ao-mcp](https://iinventedlight.com/library/notes/ao-mcp/)
- [ao-mcp-tools-list-and-call](https://iinventedlight.com/library/notes/ao-mcp-tools-list-and-call/)
- [ao-tools-tool-choice-across-providers](https://iinventedlight.com/library/notes/ao-tools-tool-choice-across-providers/)
- [ao-tools-gemini-function-calling](https://iinventedlight.com/library/notes/ao-tools-gemini-function-calling/)

## Claims

- id: C1
  claim: Claude stops with stop_reason tool_use.
  source: S1
  evidence: "if message.stop_reason == \"tool_use\":"

- id: C2
  claim: Results go back as tool_result with tool_use_id.
  source: S1
  evidence: "\"type\": \"tool_result\", \"tool_use_id\": tool_use.id,"

- id: C3
  claim: MCP outputSchema is optional JSON Schema.
  source: S2
  evidence: "`outputSchema`: Optional JSON Schema defining expected output structure"

## Sources

- [S1] Tool use: calculator tool. anthropics/claude-cookbooks (GitHub). https://github.com/anthropics/claude-cookbooks/blob/main/tool_use/calculator_tool.ipynb . License: MIT. Accessed 2026-11-16.

- [S2] MCP specification 2025-11-25: Tools. modelcontextprotocol/modelcontextprotocol (GitHub). https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-11-25/server/tools.mdx . License: Apache-2.0 (specification; earlier contributions MIT). Accessed 2026-11-16.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: anthropics/claude-cookbooks (GitHub), Tool use: calculator tool, MIT (https://raw.githubusercontent.com/anthropics/claude-cookbooks/main/LICENSE). Copyright (c) 2023 Anthropic; modelcontextprotocol/modelcontextprotocol (GitHub), MCP specification 2025-11-25: Tools, Apache-2.0 (specification; earlier contributions MIT) (https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/LICENSE). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
