mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-14 19:27:05 -04:00
MCP: describe_command and execute_command accept id again (#365 follow-up)
#365 rejects arguments missing from a tool's schema; both tools read `id` as an alias of `command`, so declare it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
7b41793ab4
commit
3df56ce9d9
3 files changed
+21
-4
No files matched your search
@@ -1053,3 +1053,14 @@ fn panicked_render_worker_finishes_with_an_error() {
|
||||
let reply: Value = serde_json::from_slice(&out).unwrap();
|
||||
assert_eq!(reply["result"]["isError"], true, "{reply}");
|
||||
}
|
||||
|
||||
/// `id` is an accepted alias of `command` (#365 made unknown keys an error).
|
||||
#[test]
|
||||
fn command_tools_accept_id_as_an_alias() {
|
||||
let mut s = server();
|
||||
let d = call_json(&mut s, "describe_command", json!({"id": "comp.new"}));
|
||||
assert_eq!(d["id"], "comp.new", "{d}");
|
||||
call_json(&mut s, "execute_command", json!({"id": "comp.new", "params": {"name": "Alias", "width": 64, "height": 36}}));
|
||||
let (_, err) = call(&mut s, "execute_command", json!({}));
|
||||
assert!(err, "neither key is an error");
|
||||
}
|
||||
@@ -537,7 +537,12 @@ static TOOLS: &[ToolDef] = &[
|
||||
name: "describe_command",
|
||||
description: "One command in full: id, label, menu path, shortcut, the `params` doc, a JSON Schema of its parameters (`schema`: properties, required, additionalProperties) and whether it can run now (`why` if not). Use before execute_command when unsure of the parameters; execute_command rejects unknown keys.",
|
||||
bridge_only: false,
|
||||
schema: || schema(json!({"command": {"type": "string", "description": "Command id, e.g. `layer.newText`."}}), &["command"]),
|
||||
schema: || {
|
||||
schema(
|
||||
json!({"command": {"type": "string", "description": "Command id, e.g. `layer.newText`."}, "id": {"type": "string", "description": "Alias of `command`."}}),
|
||||
&[],
|
||||
)
|
||||
},
|
||||
run: describe_command,
|
||||
},
|
||||
ToolDef {
|
||||
@@ -548,9 +553,10 @@ static TOOLS: &[ToolDef] = &[
|
||||
schema(
|
||||
json!({
|
||||
"command": {"type": "string", "description": "Command id, e.g. `comp.new`, `layer.newText`, `effect.apply` (see list_commands)."},
|
||||
"id": {"type": "string", "description": "Alias of `command`."},
|
||||
"params": {"type": "object", "description": "Command parameters as documented by list_commands.", "additionalProperties": true}
|
||||
}),
|
||||
&["command"],
|
||||
&[],
|
||||
)
|
||||
},
|
||||
run: execute_command,
|
||||
|
||||
+2
-2
@@ -80,8 +80,8 @@ See [MCP conventions](mcp.md) for core tools, resources, strict arguments, and r
|
||||
| Tool | What it does |
|
||||
|---|---|
|
||||
| `list_commands {filter?, enabled_only?, schemas?}` | Discover command ids, their param docs (and, with `schemas`, a JSON Schema each), and whether each can run now. |
|
||||
| `describe_command {command}` | One command in full: label, menu, shortcut, params doc, JSON `schema`, enabled / `why`. |
|
||||
| `execute_command {command, params?}` | Run any command (undoable). Unknown parameter keys are rejected with the accepted list. |
|
||||
| `describe_command {command \| id}` | One command in full: label, menu, shortcut, params doc, JSON `schema`, enabled / `why`. |
|
||||
| `execute_command {command \| id, params?}` | Run any command (undoable). Unknown parameter keys are rejected with the accepted list. |
|
||||
| `get_state` | Editor state (active comp, time, selections, tool) plus `app`: version, command and effect counts, export formats, parity summary. |
|
||||
| `run_script {code, name?}` | Run JavaScript with the After Effects-style scripting object model (`app.project`, `comp.layers.addText(…)`, `layer.property("ADBE Transform Group").property("ADBE Position").setValueAtTime(…)`…). Returns `{ok, result, output, error: {message, line, column}}`; edits are undoable. |
|
||||
| `get_project` / `get_comp {comp?}` | Project items, comp settings and layers. |
|
||||
|
||||
Reference in new issue
Block a user