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
- ao-mcp-tools-list-and-call
- ao-tools-tool-choice-across-providers
- 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.
License: CC-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).
Cite this
iinventedlight. 2026. "The Claude tool-use loop: input_schema, tool_use and tool_result." iinventedlight Library, iil:note:6470kmz8, version of 2026-11-16. https://iinventedlight.com/library/notes/ao-tools-anthropic-tool-use-loop/. License: CC-BY-4.0.
@misc{iil_note_6470kmz8,
author = {{iinventedlight}},
title = {{The Claude tool-use loop: input\_schema, tool\_use and tool\_result}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-16},
url = {https://iinventedlight.com/library/notes/ao-tools-anthropic-tool-use-loop/},
note = {Permanent ID iil:note:6470kmz8. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-tools-anthropic-tool-use-loop.md.