claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] API Error: 400 JSON schema is invalid. It must match JSON Schema draft 2020-12

Open andig opened this issue 5 months ago • 1 comments

Environment

  • Platform (select one):
    • [ ] Anthropic API
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [x] Other: custom MCP server
  • Claude CLI version: 1.0.35 (Claude Code)
  • Operating System: macOS
  • Terminal: Warp

Bug Description

Receiving this error when invoking tool. I can list tools fine and I can invoke tools using mcp-inspector.

Steps to Reproduce

Tool call returns this response (which seems ok to me):

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "Title: evcc REST-API\nVersion: latest"
      }
    ]
  }
}

Expected Behavior

An indication why this error triggers, or no error

Additional Context

This doesn't happen when the tool call response contains schema information:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "Title: evcc REST-API\nVersion: latest"
      }
    ],
    "schema": {
      "properties": {},
      "type": "object"
    },
    "usage": "call info <json-args>",
    "next_steps": [
      "list",
      "schema info"
    ]
  }
}

but it's not clear how this relates to tools....custom.input_schema

The tool definition itself as returned by tool/list looks correct:

      {
        "annotations": {},
        "description": "Show API metadata: title, version, description, and terms of service.",
        "inputSchema": {
          "properties": {},
          "type": "object"
        },
        "name": "info"
      },

andig avatar Jun 30 '25 17:06 andig

Seems it is almost impossible to figure out which tool might be causing the issue. It seems it is not the tool invoked but actually a tool that is part of tools/list. It would be super helpful if the tool name could be printed.

andig avatar Jun 30 '25 18:06 andig

Invalid, sorry for the noise.

andig avatar Jul 01 '25 06:07 andig

@andig how did you figure out the solution?

maddymanu avatar Jul 08 '25 21:07 maddymanu

In my specific case the schema was indeed invalid by missing $ref'ed objects. The Claude Error message is crap since it doesn't tell you which tool it is having problems with...

andig avatar Jul 08 '25 21:07 andig

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 10 '25 14:08 github-actions[bot]