MCP · Tools

MCP0014Describe MCP tool output as an object

Report MCP tools whose `outputSchema` is an array or primitive schema, or that return an array or primitive as `structuredContent`. Servers that speak only the 2026-07-28 revision are skipped.

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
Copyright © 2026