MCP · Tools
vite-doctor/mcptoolswarnSuggestion
Why it happens
h3-mcp (okmcp) turns a plain thrown Error into an isError tool result the model can read and react to, but it lets an h3 HTTPError through as a JSON-RPC protocol error. Clients treat that as a broken server rather than a failed tool call, and on the 2026-07-28 revision h3-mcp answers HTTP 500 with -32603 Internal error and drops the message. nitro-mcp-toolkit and @nuxtjs/mcp-toolkit convert HTTPError themselves, so this applies to h3-mcp only.
Fix
Throw a plain Error with the message the model should see, or return { content: [...], isError: true }.
Example
Return the failure as a tool result
Before
defineTool({
name: 'get_order',
inputSchema,
handler: async ({ id }) => {
const order = await findOrder(id)
if (!order) throw createError({ status: 404, message: `Order ${id} not found` })
return orderResult(order)
},
})
After
defineTool({
name: 'get_order',
inputSchema,
handler: async ({ id }) => {
const order = await findOrder(id)
if (!order) throw new Error(`Order ${id} not found`)
return orderResult(order)
},
})
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/no-http-error-in-tool