MCP · Tools
vite-doctor/mcptoolserrorSuggestion
Why it happens
MCP 2025-11-25 requires outputSchema to have type: "object" and structuredContent to be a JSON object. MCP SDK clients validate tools/list and reject the whole list when one tool's outputSchema isn't an object, and the SDK server ignores such a schema and fails every call of the tool.
Fix
Wrap the value in an object, such as { items: [...] }, and describe that object in outputSchema.
Example
Wrap a list in an object
Before
defineTool({
name: 'list_orders',
outputSchema: z.array(Order),
handler: async () => {
const orders = await listOrders()
return { content: [{ type: 'text', text: JSON.stringify(orders) }], structuredContent: orders }
},
})
After
defineTool({
name: 'list_orders',
outputSchema: z.object({ orders: z.array(Order) }),
handler: async () => {
const orders = await listOrders()
return { content: [{ type: 'text', text: JSON.stringify(orders) }], structuredContent: { orders } }
},
})
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/object-output-schema