Skip to content

Commit b9bba0b

Browse files
wenhaozhaowenhaozhaoCopilot
authored
Fix: remove erroneous definitions_path (#264)
* fix bug, 1 remove erroneous definitions_path setting,"#/components/schemas/" is used for openapi3 2 show meta_schema * Update crates/rmcp/src/handler/server/tool.rs Remove the commented-out settings.inline_subschemas line to avoid confusion and clean up dead code. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: wenhaozhao <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent d45136c commit b9bba0b

File tree

1 file changed

+3
-4
lines changed
  • crates/rmcp/src/handler/server

1 file changed

+3
-4
lines changed

crates/rmcp/src/handler/server/tool.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ use crate::{
1414
};
1515
/// A shortcut for generating a JSON schema for a type.
1616
pub fn schema_for_type<T: JsonSchema>() -> JsonObject {
17-
let mut settings = schemars::r#gen::SchemaSettings::default();
17+
// explicitly to align json schema version to official specifications.
18+
// https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2025-03-26/schema.json
19+
let mut settings = schemars::r#gen::SchemaSettings::draft07();
1820
settings.option_nullable = true;
1921
settings.option_add_null_type = false;
20-
settings.definitions_path = "#/components/schemas/".to_owned();
21-
settings.meta_schema = None;
2222
settings.visitors = Vec::default();
23-
settings.inline_subschemas = false;
2423
let generator = settings.into_generator();
2524
let schema = generator.into_root_schema_for::<T>();
2625
let object = serde_json::to_value(schema).expect("failed to serialize schema");

0 commit comments

Comments
 (0)