Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

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

Mateusz Sych62a7f903f252
diff --git a/crates/mcp/src/server.rs b/crates/mcp/src/server.rs
index de49f34d4b..3d205457b4 100644
--- a/crates/mcp/src/server.rs
+++ b/crates/mcp/src/server.rs
@@ -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 {
diff --git a/crates/mcp/src/tests.rs b/crates/mcp/src/tests.rs
index fb6bdd46ea..d78bf5b087 100644
--- a/crates/mcp/src/tests.rs
+++ b/crates/mcp/src/tests.rs
@@ -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");
+ }
+}