Repository navigation
MCP plugin: forward outputSchema for custom tools (enable structuredContent)
#16920
jhb-dev
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
@payloadcms/plugin-mcplets custom tools declare aninputSchema(viaparameters) but provides no way to declare anoutputSchema, even though the underlying@modelcontextprotocol/sdkfully supports it. As a result, custom tools cannot advertise a structured-output contract, and anystructuredContenta handler returns has no declared schema for clients to validate against — so spec-compliant clients ignore it.This is the same shape of pass-through gap as #16744 (tool annotations), in the same registration code path.
Current behavior
In
dist/mcp/getMcpHandler.js, custom tools are registered like this:Only
description,inputSchema, andannotationsare forwarded. There is nooutputSchemakey, and the custom-tool type exposes onlyparametersandannotations. A handler can already return{ content, structuredContent }(the return value passes through untouched), but without a declaredoutputSchemathestructuredContentis not spec-valid.Proposed behavior
Allow custom tool definitions to provide an optional
outputSchema(aZodRawShape, mirroring howinputSchemausesparameters/.shape) and forward it toserver.registerTool:plus an optional
outputSchema?: z.ZodRawShapeon the custom-tool type.@modelcontextprotocol/sdkhas supportedoutputSchema+structuredContentsince 1.10.x, so this is purely a pass-through gap in the plugin.Example consumer
Environment
@payloadcms/plugin-mcp: 3.84.1@modelcontextprotocol/sdk: 1.27.1All reactions