inputSchema. MCP-B can infer literal schemas, convert
Standard JSON Schema implementations, and attach
outputSchema metadata for typed MCP results.
The WebMCP Community Group draft remains the
authority for the browser’s tool dictionary.
Infer input from a JSON Schema literal
Install the declaration package when you want TypeScript to infer the handler input:Install the type declarations
as const satisfies JsonSchemaForInference:
If a schema is loaded or widened at runtime, narrow the handler input yourself. MCP-B cannot infer
specific fields from a broad runtime type. See the @mcp-b/webmcp-types
reference for supported inference keywords.
Convert a Standard JSON Schema implementation
MCP-B hooks accept Standard JSON Schema v1 objects directly. Pass a Zod 4.2 schema as theinputSchema in usewebmcp or
@mcp-b/react-webmcp.
For direct registerTool() calls, convert the schema through the MCP-B adapter and validate inside
the handler:
Install the adapter and Zod
search-tool.ts
Add MCP-B output metadata
AddoutputSchema when an MCP client needs typed structured data. Declare the descriptor
separately so ToolDescriptorFromSchema checks the returned value:
search-summary-tool.ts
outputSchema is MCP-B metadata for output inference and structured MCP responses. If your handler
constructs an MCP CallToolResult directly, include schema-compatible structuredContent as well
as human-readable content. The package reference lists the
output inference types.
