MCP · MCP0014

Describe 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.
MCP0014vite-doctor/mcptoolserrorSuggestion

Run this rule

pnpm vite-doctor . --rules mcp/tools/object-output-schema

Why it matters

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.

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 } }
  },
})
Copyright © 2026