Skip to content

fix: strip non-standard numeric format annotations from MCP JSON schemas#114

Merged
mike1858 merged 1 commit intomainfrom
fix/use-actual-model-versus-stated-model-in-piebald-analyzer
Feb 13, 2026
Merged

fix: strip non-standard numeric format annotations from MCP JSON schemas#114
mike1858 merged 1 commit intomainfrom
fix/use-actual-model-versus-stated-model-in-piebald-analyzer

Conversation

@mike1858
Copy link
Member

@mike1858 mike1858 commented Feb 13, 2026

schemars emits format values like "uint64", "int32", and "double" for Rust numeric types. These are not defined by the JSON Schema spec and cause noisy warnings in strict validators such as ajv (used by OpenCode).

Add a RecursiveTransform that strips these non-standard format annotations from all MCP request/response types that contain numeric fields.

Closes #113

Summary by CodeRabbit

  • Bug Fixes
    • Improved JSON Schema generation to automatically remove non-standard numeric format annotations while preserving standard formats like date-time, ensuring better schema compliance and third-party tool compatibility.

schemars emits format values like "uint64", "int32", and "double" for
Rust numeric types. These are not defined by the JSON Schema spec and cause
noisy warnings in strict validators such as ajv (used by OpenCode).

Add a RecursiveTransform that strips these non-standard format annotations
from all MCP request/response types that contain numeric fields.

Closes #113
@mike1858 mike1858 enabled auto-merge (squash) February 13, 2026 20:17
@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

A private helper function is introduced to strip non-standard numeric JSON Schema format annotations from schemas. This function is applied via RecursiveTransform to multiple public schema-annotated structs during schema generation, while preserving standard formats. Unit tests verify the stripping behavior and format retention.

Changes

Cohort / File(s) Summary
Schema Format Sanitization
src/mcp/types.rs
Adds private strip_non_standard_format() helper function to remove non-standard numeric formats (uint64, int64, uint8, int8, etc.) from JSON schemas. Applies RecursiveTransform with this helper to multiple public structs. Includes unit tests verifying non-standard formats are stripped while preserving standard formats like date-time. Adds necessary RecursiveTransform import.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 When schemas grew crowded with format warnings bright,
Our rabbit swept clean through uint64 blight,
A RecursiveTransform, so clever and neat,
Stripped non-standard noise—made OpenCode sweet,
Now silently schemas sing, pure and so light! 🎉

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/use-actual-model-versus-stated-model-in-piebald-analyzer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mike1858 mike1858 changed the title fix(piebald): use per-message model instead of chat-level model fix: strip non-standard numeric format annotations from MCP JSON schemas Feb 13, 2026
@mike1858 mike1858 merged commit f2bd2fc into main Feb 13, 2026
5 of 6 checks passed
@mike1858 mike1858 deleted the fix/use-actual-model-versus-stated-model-in-piebald-analyzer branch February 13, 2026 20:19
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.

MCP JSON Schema emits "format": "uint64" causing noisy warnings in OpenCode

1 participant