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
+19
-7
@@ -612,16 +612,28 @@ mod tests {
|
||||
fn test_schema_extraction_includes_descriptions() {
|
||||
let schema = schema_for!(SetAcceptanceCriteriaTool);
|
||||
let schema_json = serde_json::to_value(&schema).unwrap();
|
||||
|
||||
let desc = schema_json.get("description").and_then(|d| d.as_str()).unwrap_or("");
|
||||
assert!(desc.contains("Define a strict checklist of acceptance criteria"), "Schema should include struct docstring as description");
|
||||
|
||||
|
||||
let desc = schema_json
|
||||
.get("description")
|
||||
.and_then(|d| d.as_str())
|
||||
.unwrap_or("");
|
||||
assert!(
|
||||
desc.contains("Define a strict checklist of acceptance criteria"),
|
||||
"Schema should include struct docstring as description"
|
||||
);
|
||||
|
||||
let schema2 = schema_for!(LogCodeChangeTool);
|
||||
let schema2_json = serde_json::to_value(&schema2).unwrap();
|
||||
let props = schema2_json.get("properties").expect("Missing properties");
|
||||
|
||||
|
||||
let file_path_prop = props.get("file_path").expect("Missing file_path property");
|
||||
let field_desc = file_path_prop.get("description").and_then(|d| d.as_str()).unwrap_or("");
|
||||
assert!(field_desc.contains("The path of the file that was changed"), "Schema should include field docstring as description");
|
||||
let field_desc = file_path_prop
|
||||
.get("description")
|
||||
.and_then(|d| d.as_str())
|
||||
.unwrap_or("");
|
||||
assert!(
|
||||
field_desc.contains("The path of the file that was changed"),
|
||||
"Schema should include field docstring as description"
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user