Tools: Schemas, Annotations, Results and Tool Design
Tools are the model-controlled primitive: the server describes each one with a name, a description and a JSON Schema for its arguments, and the client calls it with `tools/call`. Know the exact result shape (content blocks, `structuredContent`, `isError`), the two error channels, why annotations are only hints, and how to design a small, well-described tool surface that a model can use without drowning its context.
Key points
- 1
A tool definition has a required
nameandinputSchema, plus optionaltitle,description,icons,outputSchemaandannotations. Display-name precedence istitle, thenannotations.title, thenname. - 2
inputSchemaMUST be a valid JSON Schema object (nevernull) withtype: "object"at the root; any JSON Schema 2020-12 keyword is allowed (2026-07-28 loosened this). With no$schemathe dialect is 2020-12. For a tool with no parameters the recommended schema is{ "type": "object", "additionalProperties": false }. - 3
Tool names SHOULD be 1 to 128 characters, case-sensitive, unique within a server, and use only ASCII letters, digits,
_,-and.. Aggregating hosts SHOULD disambiguate collisions with their own prefix;serverInfo.nameis not guaranteed unique. - 4
Results carry a
contentarray of blocks (text,image,audio,resource_link, embeddedresource), optionalstructuredContentand optionalisError(absent means false), plusresultType: "complete"in 2026-07-28. Linked resources need not appear inresources/list. - 5
If
outputSchemais declared, servers MUST return conformingstructuredContentand clients SHOULD validate it. A tool returning structured content SHOULD also return the serialized JSON in a text block for older clients.structuredContentmay now be any JSON value, including an array. - 6
Two error channels: protocol errors (unknown tool, request failing the
CallToolRequestschema, server failures) are JSON-RPC errors, for example-32602for an unknown tool. Tool execution errors (API failures, bad values such as a past date or wrong date format, business rules) are results withisError: trueand an actionable message. Clients SHOULD pass execution errors to the model; protocol errors only MAY be passed. - 7
Annotations
readOnlyHint(default false),destructiveHint(default true),idempotentHint(default false) andopenWorldHint(default true) are hints.destructiveHintandidempotentHintonly matter whenreadOnlyHintis false. Clients MUST treat annotations as untrusted unless the server is trusted. - 8
tools/listMUST NOT vary per connection or as a side effect of other requests, but MAY vary by the authorization on the request. Servers SHOULD return a deterministic order for client caching and prompt-cache hits; results carryttlMsandcacheScope, andlistChangedservers sendnotifications/tools/list_changedto clients listening withtoolsListChanged: true. - 9
No protocol sessions: cross-call state uses an explicit, opaque, server-minted handle returned by a creation tool and passed back as an argument. Check the caller's authorization against the handle every call, state the lifetime in the description, and return an
isErrorresult for expired handles. - 10
A broken Streamable HTTP stream means the client re-issues the call as a new request with a new id, so side-effecting tools need their own idempotency keys.
- 11
Server MUSTs: validate all inputs, enforce access control, rate limit, sanitize outputs. Client SHOULDs: confirm sensitive operations, show inputs before calling, validate results, set timeouts, log usage, never auto-fetch network
$refs (reject unresolvable ones) and bound the cost of composition-heavy schemas. - 12
Design for the model: a few workflow-level tools rather than one per endpoint, descriptions written for a new colleague, unambiguous parameter names (
user_id), enums for closed sets, high-signal and bounded responses (pagination, filtering, aresponse_formatchoice), actionable error text, and evaluations with realistic tasks and held-out sets.
Common traps
Returning a JSON-RPC error for a fixable input problem: the model may never see it. Use
isError: truewith a message that says how to fix the call.Treating
readOnlyHint: truefrom an arbitrary server as permission to auto-run a tool; annotations are untrusted hints and never replace authorization.Assuming an omitted
destructiveHintmeans safe: it defaults totrue, andopenWorldHintdefaults totruetoo.Writing
"required": trueinside a property; in 2020-12requiredis an array on the parent object, and the boolean form fails meta-schema validation.Deduplicating retries on the JSON-RPC id, or keeping state under
Mcp-Session-Id: re-issued calls get new ids, and sessions no longer exist in 2026-07-28.Unlocking extra tools after a
logincall on the same connection; lists may vary by request credentials, not by earlier requests.Using
tools/listpagination to shrink huge tool outputs; protocol pagination is for list operations, so tools must page or truncate their own results.
Read the source
Further reading
Suggest a resourceNo extra reading for Tools: Schemas, Annotations, Results and Tool Design yet. Found a guide, video or cheat sheet that made it click? Share it and help the next learner.
Test yourself on Tools: Schemas, Annotations, Results and Tool Design
Ten questions, with the answer and explanation after each one.