CallToolResult.
Register a tool
inputSchema accepts a Standard Schema implementation that can produce JSON
Schema. Zod is one option; ArkType and Valibot are also supported.
Return structured output
DeclareoutputSchema when clients need a typed structured result. Every
successful result from a schema-backed tool must include matching
structuredContent. An error result may instead set isError: true.
Bind a View
Export the tool reference from the server entry somcp-env.d.ts can expose
its input and output types to View code. Place the React entry at
views/<name>/view.tsx, set view.name to that directory name, and return its
data in structuredContent.
outputSchema, and one View can bind to only
one tool. The view reads the structured data while the model reads content.
Use request context
The second callback argument is scoped to the current request. It includes an abort signal, client-reported capability metadata, progress and logging methods, and the originating Hono request when HTTP context exists.ctx.auth is available only when the server has an OAuth provider; use its
verified provider user for access control.
Notify tool-list listeners
Publish a tool-list invalidation when the tools clients can discover have changed:tools/list
again. This notification does not register or replace tools; register tools
while constructing the server, before it starts handling requests.
Test tools
Runmcp-use dev, open the built-in inspector, and test valid inputs, schema
failures, error results, and structured output:
structuredContent.