Skip to content

Conversation

@corylanou
Copy link

Problem

Chrome DevTools MCP and other MCP servers use JSON Schema draft-07 where exclusiveMinimum/exclusiveMaximum are numeric values. However, kin-openapi (used for OpenAPI 3.0 schema parsing) expects them as booleans (draft-04 format).

This causes failures like:

conv mcp tool input schema fail(unmarshal): ...

Solution

Pre-process input schemas to convert numeric exclusive bounds to boolean format before unmarshaling:

  • exclusiveMinimum: 5minimum: 5, exclusiveMinimum: true
  • exclusiveMaximum: 10maximum: 10, exclusiveMaximum: true

The conversion is recursive, handling nested schemas in:

  • properties
  • items (arrays)
  • additionalProperties
  • allOf, anyOf, oneOf, not

Testing

Tested with Chrome DevTools MCP which uses draft-07 schemas extensively.

🤖 Generated with Claude Code

corylanou and others added 2 commits December 28, 2025 20:02
Chrome DevTools MCP and other MCP servers use JSON Schema draft-07 where
exclusiveMinimum/exclusiveMaximum are numeric values representing the
actual bounds. However, kin-openapi (OpenAPI 3.0) expects these fields
as booleans that modify the minimum/maximum values (draft-04 format).

This fix recursively processes input schemas to convert:
- exclusiveMinimum: N → minimum: N, exclusiveMinimum: true
- exclusiveMaximum: N → maximum: N, exclusiveMaximum: true

Handles nested schemas in properties, items, additionalProperties,
and schema composition keywords (allOf, anyOf, oneOf, not).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds comprehensive tests for convertExclusiveBoundsToBoolean():
- Simple exclusiveMinimum/exclusiveMaximum conversion
- Both bounds together
- Already boolean values (draft-04 style, unchanged)
- No exclusive bounds (unchanged)
- Nested properties
- Array items
- allOf composition
- additionalProperties
- Real-world Chrome DevTools MCP schema example
- Invalid JSON handling (returns unchanged)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant