-
Notifications
You must be signed in to change notification settings - Fork 5
Description
The crate fails to compile when using any protocol version feature (2024_11_05, 2025_03_26, 2025_06_18, or draft) due to the validators module being defined multiple times.
Environment:
rust-mcp-schema: v0.7.5 (also affects git main branch)
rustc: 1.91.1
cargo: 1.91.1
OS: macOS
To Reproduce:
Create a new project:
Add to Cargo.toml:
Use in src/main.rs:
Run cargo build
Error Output:
Root Cause:
The define_schema_version! macro in src/generated_schema.rs is invoked for ALL protocol versions (2025_06_18, 2025_03_26, 2024_11_05, draft), and each invocation includes:
This causes multiple definitions of the validators module in the same scope, even when only one protocol version feature is enabled.
Affected Configurations:
✗ All protocol versions: 2024_11_05, 2025_03_26, 2025_06_18, draft
✗ With and without schema_utils feature
✗ Published v0.7.5 from crates.io
✗ Git main branch
Expected Behavior:
The crate should compile successfully when a single protocol version feature is enabled, with only that version's validators module included.
Suggested Fix:
The validators module should be conditionally included based on the active feature, or the macro should be restructured to avoid multiple definitions in the same scope.