fix(#269): list_commands filter matches id, label, tab and panel, not params docs
Params docs name other commands ("usable in sketch.delete"), so filtering by
an id returned 56 commands. The filter now looks only at id, label, tab and
panel; the tool description and docs/mcp.md say so.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RjGw4gA5ZvKrU8MQP6sBgT
This commit is contained in:
1 parent
d9613e29cb
commit
bf60758244
2 files changed
+5
-5
No files matched your search
@@ -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()))
|
||||
}
|
||||
|
||||
+1
-1
@@ -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}`). |
|
||||
|
||||
Reference in new issue
Block a user