vercel/ai · error · Error

Host tool ${toolName} must use an object JSON Schema for MCP

Error message

Host tool ${toolName} must use an object JSON Schema for MCP.

What it means

Error "Host tool ${toolName} must use an object JSON Schema for MCP." thrown in vercel/ai.

Source

Thrown at packages/harness-acp/src/v1/bridge/host-tool-mcp-server.ts:145

    }),
  };
}

function requireObjectSchema({
  toolName,
  schema,
}: {
  toolName: string;
  schema: unknown;
}): Tool['inputSchema'] {
  if (
    schema == null ||
    typeof schema !== 'object' ||
    Array.isArray(schema) ||
    (Reflect.get(schema, 'type') !== undefined &&
      Reflect.get(schema, 'type') !== 'object')
  ) {
    throw new Error(
      `Host tool ${toolName} must use an object JSON Schema for MCP.`,
    );
  }
  return schema as Tool['inputSchema'];
}

function toCallToolResult({
  result,
}: {
  result: HostToolMCPInvocationResult;
}): CallToolResult {
  return {
    content: [
      {
        type: 'text',
        text: stringifyOutput({ output: result.output }),
      },
    ],

View on GitHub (pinned to 69428b1f8b)

When it happens

Trigger: Thrown at packages/harness-acp/src/v1/bridge/host-tool-mcp-server.ts:145 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/afd57ec8c3df1e6a. Report an issue: GitHub.