api.execute
api_executeRuns a batch of Anki-Connect commands sequentially with completion barriers, independent results, and error continuation for ordered operations.
Instructions
Execute commands sequentially with completion barriers and independent results.
Continue after errors. No nested api.execute, application.exit or profiles.switch commands. Pin the active collection session for collection-scoped commands; a session change fails remaining such commands. Validate each command with its named method schema. Never an atomic transaction.
Anki-Connect method api.execute. Scope: application. Effect: batch. Completion: operation. Undo: perCommand.
Long-running operation: by default the server waits for the final result (see waitForCompletion / timeoutSeconds).
Possible errors: internalError, invalidParams.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"commands": "<commands>"
},
"name": "api_execute"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commands | Yes | Ordered commands [{"method": "notes.create", "params": {...}}] using API method names (dot form). Each runs after the previous finishes; results are not substituted into later params. | |
| timeoutSeconds | No | MCP option (not sent to Anki): how long to wait for completion. A timeout does not cancel the work; the pending record is returned. | |
| waitForCompletion | No | MCP option (not sent to Anki): poll operations.get until the operation finishes and return its final record. If false, return the operation handle. |