feat(handlers): enrich semantic error messages with prescriptive tool hints to prevent LLM hallucination traps
This commit is contained in:
1 parent
cbef7e5291
commit
a24ef598a2
4 files changed
+11
-11
No files matched your search
@@ -230,7 +230,7 @@ impl McpTool for DeleteEntitiesHandler {
|
||||
});
|
||||
|
||||
if !missing.is_empty() {
|
||||
return Err(format!("Error: Entities not found: {}", missing.join(", ")));
|
||||
return Err(format!("Error: Entities not found: {}. Please use the search_nodes or read_graph tools to verify the exact entity names.", missing.join(", ")));
|
||||
}
|
||||
|
||||
let idx = state.get_search_index();
|
||||
@@ -271,7 +271,7 @@ impl McpTool for DeleteObservationsHandler {
|
||||
}
|
||||
});
|
||||
if !missing.is_empty() {
|
||||
return Err(format!("Error: Entities not found: {}", missing.join(", ")));
|
||||
return Err(format!("Error: Entities not found: {}. Please use the search_nodes or read_graph tools to verify the exact entity names.", missing.join(", ")));
|
||||
}
|
||||
Ok("Observations deleted".to_string())
|
||||
}
|
||||
@@ -299,7 +299,7 @@ impl McpTool for DeleteRelationsHandler {
|
||||
missing_count = to_rem.len() - (initial_len - master.relations.len());
|
||||
});
|
||||
if missing_count > 0 {
|
||||
return Err(format!("Error: {} relation(s) not found in graph", missing_count));
|
||||
return Err(format!("Error: {} relation(s) not found in graph. Please verify exact relation properties using read_graph.", missing_count));
|
||||
}
|
||||
Ok("Relations deleted".to_string())
|
||||
}
|
||||
@@ -527,7 +527,7 @@ impl McpTool for CondenseEntityHandler {
|
||||
}
|
||||
});
|
||||
if missing {
|
||||
return Err(format!("Error: Entity '{}' not found", req.entity_name));
|
||||
return Err(format!("Error: Entity '{}' not found. Please verify the exact entity name using search_nodes.", req.entity_name));
|
||||
}
|
||||
Ok("Entity condensed".to_string())
|
||||
}
|
||||
@@ -579,7 +579,7 @@ impl McpTool for MergeEntitiesHandler {
|
||||
});
|
||||
});
|
||||
if missing {
|
||||
return Err(format!("Error: Source entity '{}' not found", req.source_entity));
|
||||
return Err(format!("Error: Source entity '{}' not found. Please verify the exact entity name using search_nodes.", req.source_entity));
|
||||
}
|
||||
Ok("Entities merged".to_string())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user