fix(mcp): propagate internal serialization errors instead of silently swallowing them to prevent LLM hallucination
This commit is contained in:
1 parent
f8925050db
commit
8f32a09399
13 files changed
+235
-63
No files matched your search
+3
-2
@@ -23,8 +23,9 @@ pub fn error(id: serde_json::Value, code: i32, message: &str) -> serde_json::Val
|
||||
pub fn tool_def<T: JsonSchema>(name: &str, fallback_desc: &str) -> serde_json::Value {
|
||||
let schema = schemars::schema_for!(T);
|
||||
let schema_val = serde_json::to_value(&schema).unwrap_or_default();
|
||||
|
||||
let desc = schema_val.get("description")
|
||||
|
||||
let desc = schema_val
|
||||
.get("description")
|
||||
.and_then(|d| d.as_str())
|
||||
.unwrap_or(fallback_desc)
|
||||
.to_string();
|
||||
|
||||
Reference in new issue
Block a user