Skip to content

Conversation

@cli620
Copy link

@cli620 cli620 commented Dec 4, 2025

Summary

Implemented JSON Schema validation for MCP tool inputs and outputs to ensure consistent data contracts across all tools.

What Changed

1. Schema Structure

Created schemas/ directory with the following organization:

schemas/
├── <tool_name>/
│   ├── input.json    # JSON Schema for tool input validation
│   └── output.json   # JSON Schema for tool output validation
└── README.md         # Documentation and best practices

2. Schema Validator (mcp/schema_validator.py)

Implemented automated validation system that:

  • Loads JSON schemas for each tool
  • Validates tool inputs against input.json schema
  • Validates tool outputs against output.json schema
  • Provides CLI for batch validation: python3 -m mcp.schema_validator --all

3. Example Implementation

Implemented schemas for temporal_ranges tool as reference example

Testing

# Validate all schemas
uv run schema_validator

## [CMRNLP-38](https://bugs.earthdata.nasa.gov/browse/CMRNLP-38)

@cli620 cli620 changed the title Cmrnlp 38 CMRNLP-38 Define JSON Schemas for tool I/O under /schemas Dec 4, 2025
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.

3 participants