Skip to content

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

fix(#269): list_commands filter matches id, label, tab and panel, not params docs

bherbruckbf607582440c
diff --git a/crates/mcp/src/tools.rs b/crates/mcp/src/tools.rs
index a2981b0160..3adf306f66 100644
--- a/crates/mcp/src/tools.rs
+++ b/crates/mcp/src/tools.rs
@@ -45,7 +45,8 @@ pub fn tool_definitions() -> Vec<Value> {
"The command catalog: id, label, toolbar tab/panel, shortcut, one-line parameter docs and whether the command is \
enabled right now. Ids are dotted and lower-case (solid.extrude, sketch.create, \
solid.fillet, sketch.inspect, timeline.rollback). Optional case-insensitive \
- substring `filter` over id, label, panel and params.",
+ substring `filter` over id, label, tab and panel (not the parameter docs, so a command id \
+ finds that command rather than every command whose docs mention it).",
obj(json!({"filter": string("Substring to match, e.g. \"sketch\", \"fillet\", \"pattern\"")}), &[]),
true,
false,
@@ -310,9 +311,8 @@ fn dispatch(b: &mut dyn Backend, name: &str, a: &Map<String, Value>) -> Result<V
let all = b.call("engine.commands", json!({}))?;
let Some(f) = str_arg(a, "filter").map(str::to_lowercase).filter(|f| !f.is_empty()) else { return Ok(all) };
let hit = |c: &Value| {
- ["id", "label", "panel", "tab", "params"]
- .iter()
- .any(|k| c.get(*k).and_then(Value::as_str).is_some_and(|s| s.to_lowercase().contains(&f)))
+ // Not "params": many docs name other commands (e.g. "usable in sketch.delete"), #269.
+ ["id", "label", "panel", "tab"].iter().any(|k| c.get(*k).and_then(Value::as_str).is_some_and(|s| s.to_lowercase().contains(&f)))
};
Ok(Value::Array(all.as_array().map(|v| v.iter().filter(|c| hit(c)).cloned().collect()).unwrap_or_default()))
}
diff --git a/docs/mcp.md b/docs/mcp.md
index 61cc4782a2..ff4259868e 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -48,7 +48,7 @@ Claude Desktop (`claude_desktop_config.json`), bridged to a running app:
| Tool | Arguments | What it does |
|---|---|---|
-| `list_commands` | `filter?` | The command catalog: id, label, tab/panel, shortcut, parameter docs, enabled now. |
+| `list_commands` | `filter?` | The command catalog: id, label, tab/panel, shortcut, parameter docs, enabled now. `filter` matches id, label, tab and panel. |
| `execute` | `command`, `params?` | Run any command with JSON parameters (`list_commands` shows them). Failures leave the design unchanged. |
| `batch` | `commands: [{command, params}]`, `rollback?` (default true) | Run steps in order, stop at the first error and undo the completed steps. The reply names the failing step (`failed.index`, `failed.command`, `failed.error`) and every result before it. |
| `inspect_design` | `measure?` (default true), `sketches?` (default true) | Parameters, timeline (type, suppressed, rolled back, error, warning, timing), bodies (volume, area, centre of mass, bbox, face/edge/vertex counts, visible), sketches (curves, points, constraints, profiles, DOF, solve status, visible), selection, undo depth. Hide helper sketches, bodies or construction planes with `execute` `browser.visibility` (`{items, visible}` or `{folder, visible}`). |