MCP · Tools
Report MCP tools that declare an `outputSchema` and return a result without `structuredContent`, directly or from a helper up to two calls deep. For nitro-mcp-toolkit, only explicit `toolResult()` envelopes are checked.
vite-doctor/mcptoolserrorSuggestion
Why it happens
A tool with an outputSchema promises structured results. h3-mcp (okmcp) answers a result without structuredContent with JSON-RPC error -32602, and the MCP SDK, which @nuxtjs/mcp-toolkit 0.x builds on, fails the call with an output validation error. nitro-mcp-toolkit, which @nuxtjs/mcp-toolkit 1.x builds on, fills structuredContent from a returned data object, but sends an explicit toolResult() envelope as written and fails validation if structured content is required and missing.
Fix
Return the data the outputSchema describes in structuredContent, and keep content as its text form.
Example
Return the structured result
Before
defineTool({
name: 'get_order',
outputSchema: { type: 'object', properties: { id: { type: 'string' } } },
handler: async () => ({ content: [{ type: 'text', text: 'ord_1' }] }),
})
After
defineTool({
name: 'get_order',
outputSchema: { type: 'object', properties: { id: { type: 'string' } } },
handler: async () => ({
content: [{ type: 'text', text: 'ord_1' }],
structuredContent: { id: 'ord_1' },
}),
})
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm vite-doctor . --rules mcp/tools/output-schema-needs-structured-content