From af94b381a926cf8fb39643becf9b80da2f0f821e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 19 Nov 2025 11:51:52 +0000 Subject: [PATCH] Document default JSON schema validator in MCP client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds documentation for the CfWorkerJsonSchemaValidator that is now included by default in MCP client connections. This improves transparency about the default validation behavior and helps users understand that tool parameters are automatically validated. Synced from cloudflare/agents#665 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../docs/agents/model-context-protocol/mcp-client-api.mdx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/content/docs/agents/model-context-protocol/mcp-client-api.mdx b/src/content/docs/agents/model-context-protocol/mcp-client-api.mdx index a43762dfe1d..ef2b2506635 100644 --- a/src/content/docs/agents/model-context-protocol/mcp-client-api.mdx +++ b/src/content/docs/agents/model-context-protocol/mcp-client-api.mdx @@ -75,7 +75,7 @@ async addMcpServer( - **`callbackHost`** (string, optional) — Host for OAuth callback URL. If omitted, automatically derived from the incoming request - **`agentsPrefix`** (string, optional) — URL prefix for OAuth callback path. Default: `"agents"` - **`options`** (object, optional) — Connection configuration: - - **`client`** — MCP client configuration options (passed to `@modelcontextprotocol/sdk` Client constructor) + - **`client`** — MCP client configuration options (passed to `@modelcontextprotocol/sdk` Client constructor). By default, includes `CfWorkerJsonSchemaValidator` for validating tool parameters against JSON schemas. - **`transport`** — Transport layer configuration: - **`headers`** — Custom HTTP headers for authentication - **`type`** — Transport type: `"sse"`, `"streamable-http"`, or `"auto"` (tries streamable-http first, falls back to sse) @@ -115,6 +115,12 @@ export class MyAgent extends Agent { If the MCP server requires OAuth authentication, `authUrl` will be returned for user authentication. Connections persist across requests and the Agent will automatically reconnect if the connection is lost. +:::note[Default JSON Schema Validation] + +All MCP client connections automatically include JSON schema validation using `CfWorkerJsonSchemaValidator`. This ensures that tool parameters are validated against their schemas before execution, improving reliability and catching errors early. You can override this default by providing custom client options. + +::: + **Related:** - [OAuth handling guide](/agents/guides/oauth-mcp-client)