Merge pull request #1460 from MortenHusted/fix/unknown-params

M0.9: commands, MCP tools and batch steps refuse names they don't take (#1413)
This commit is contained in:
BFlat
2026-10-29 13:40:58 +07:00
committed by GitHub
31 changed files with 498 additions and 86 deletions
+3 -1
View File
@@ -133,7 +133,9 @@ Runs commands in a headless session (a new document, or `--in`), printing one JS
```
The whole script is **one undo step**, and it is **all-or-nothing**, exactly like running the same
commands through `command.batch` (the MCP tool `batch`, the control channel, plugins). A step named
commands through `command.batch` (the MCP tool `batch`, the control channel, plugins). A step key
other than `command`, `params` and `as`, or a parameter the command's doc (`figcraft-cli commands`)
doesn't list, fails the script with an error naming it (`ids` and `id` are always taken). A step named
with `"as"` can be used by later steps: `{"$ref": "name"}` in a step's params is the `id` in that
step's result (`{"$step": n}` does the same by zero-based position), and `"field"` takes another key
or a slash path such as `ids/0`. So a step can target a layer an earlier step of the same script
+2 -1
View File
@@ -99,7 +99,8 @@ Run any command (the same ids as the menus, shortcuts, Actions palette, CLI and
calls never open dialogs: dialog requests are dropped. Returns the command's result (creation
commands return `{"id": N}`). Paints (`fills`, `strokes`, `paint`) take a colour, the full paint
JSON or the gradient shorthand `{"type":"linearGradient","stops":["#hex","#hex"],"from"?,"to"?}`
(as in `docs/mcp.md`).
(as in `docs/mcp.md`). A parameter the command's doc (`engine.commands`) doesn't list is an error
naming it and the ones it takes, never ignored; `ids` and `id` are always taken.
```json
{"id":1,"method":"engine.execute","params":{"command":"shape.rectangle","params":{"x":10,"y":10,"width":100,"height":50}}}
+4
View File
@@ -1894,6 +1894,10 @@ turned off 0°.
Tool failures come back as results with `isError: true` and a message; protocol problems (unknown
tool, malformed JSON, wrong parameter types) are JSON-RPC errors. Nothing crashes the server.
A name a tool or command doesn't take (`run_command {args}` for `params`, a step key other than
`command`, `params` and `as`, or a parameter its `list_commands` entry doesn't list, such as
`comment.list {filterr}`) is an error that lists the names it does take, never ignored; `ids` and
`id` are taken by every command.
## Resources