fix: MCP instructions name body_topology, not a list_edges tool (#729)

The MCP server instructions now point to `body_topology` for finding edge points (there is no `list_edges` tool), with a test that every tool the instructions name exists.
This commit is contained in:
Mateusz Sych authored and GitHub committed 2026-10-13 11:38:54 -04:00
1 parent 11c03fb0ab
commit 62a7f903f2
2 files changed
+16 -1

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ and degrees in expressions (internally radians), Z is up. Model like in Fusion:
and dimension (`sketch.dimension {entities, value}`; values may name parameters), `sketch.finish`, then features \
(`solid.extrude {distance, operation?: new|join|cut|intersect}`, `solid.revolve`, `solid.fillet {edges: [[x,y,z] point on \
edge], radius}`, `solid.chamfer`, patterns, mirror, primitives). Use `batch` for several steps at once, \
`list_commands` for ids and parameter docs, `inspect_design` / `measure` to verify, `list_edges` to find edge points, \
`list_commands` for ids and parameter docs, `inspect_design` / `measure` to verify, `body_topology` to find edge points, \
`set_parameter` to drive the design and `screenshot` to look at it.";
pub struct Server {
+15
View File
@@ -621,3 +621,18 @@ fn compact_execute_uses_one_backend_call_and_keeps_removed_bodies() {
assert_eq!(b.calls, 1);
assert_eq!(v, json!({"feature": 7, "name": "Combine1", "created_bodies": [], "changed_bodies": ["Base"], "removed_bodies": ["Tool"]}));
}
/// Every tool the server instructions name (a bare `snake_case` word in backticks) is a real tool.
#[test]
fn instructions_name_only_real_tools() {
let mut s = server();
let init = call(&mut s, 1, "initialize", json!({"protocolVersion": PROTOCOL_VERSION, "capabilities": {}}));
let text = init["result"]["instructions"].as_str().unwrap().to_owned();
let tools: Vec<String> = tool_definitions().iter().map(|t| t["name"].as_str().unwrap().to_owned()).collect();
let named: Vec<&str> =
text.split('`').skip(1).step_by(2).filter(|w| !w.is_empty() && w.chars().all(|c| c.is_ascii_lowercase() || c == '_')).collect();
assert!(named.contains(&"body_topology"), "{named:?}");
for name in named {
assert!(tools.iter().any(|t| t == name), "the instructions name `{name}`, which is not a tool");
}
}