Skip to content

fix: conform input schema to JSON Schema draft 2020-12#20

Merged
crowecawcaw merged 2 commits intocrowecawcaw:mainfrom
ElieDeloumeau:fix/json-schema-draft-2020-12
Jan 12, 2026
Merged

fix: conform input schema to JSON Schema draft 2020-12#20
crowecawcaw merged 2 commits intocrowecawcaw:mainfrom
ElieDeloumeau:fix/json-schema-draft-2020-12

Conversation

@ElieDeloumeau
Copy link
Copy Markdown
Contributor

The generated tool input schemas were invalid according to JSON Schema draft 2020-12 specification. The issue was that parameter properties were wrapped in a nested "schema" field instead of having the type directly in the property definition.

Changes:

  • Remove invalid nested "schema" field from parameter properties
  • Add "type" directly to parameter properties (conforming to spec)
  • Only include "description" field when help text is non-empty
  • Preserve support for "enum", "default", and other valid fields

Before (invalid):
{
"properties": { "param": { "description": null, "schema": { "type": "boolean" } } } }

After (valid):
{
"properties": { "param": { "type": "boolean" } } }

This fixes API errors when using click-mcp tools with Claude API: "tools.X.custom.input_schema: JSON schema is invalid"

ElieDeloumeau and others added 2 commits January 12, 2026 15:29
The generated tool input schemas were invalid according to JSON Schema
draft 2020-12 specification. The issue was that parameter properties
were wrapped in a nested "schema" field instead of having the type
directly in the property definition.

Changes:
- Remove invalid nested "schema" field from parameter properties
- Add "type" directly to parameter properties (conforming to spec)
- Only include "description" field when help text is non-empty
- Preserve support for "enum", "default", and other valid fields

Before (invalid):
{
  "properties": {
    "param": {
      "description": null,
      "schema": { "type": "boolean" }
    }
  }
}

After (valid):
{
  "properties": {
    "param": {
      "type": "boolean"
    }
  }
}

This fixes API errors when using click-mcp tools with Claude API:
"tools.X.custom.input_schema: JSON schema is invalid"

Co-Authored-By: Claude <noreply@anthropic.com>
Updated test assertions to check for the correct JSON Schema format
without the invalid nested "schema" field.

Changes:
- Remove ["schema"] accessor from property type checks
- Tests now expect properties to have "type" directly
- All 59 tests now pass

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Owner

@crowecawcaw crowecawcaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@crowecawcaw crowecawcaw merged commit fbab97f into crowecawcaw:main Jan 12, 2026
0 of 4 checks passed
@crowecawcaw
Copy link
Copy Markdown
Owner

Released with 0.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants