Skip to main content
Glama
anki-connect-mcp
by SolarianGG

api.execute

api_execute

Runs 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

NameRequiredDescriptionDefault
commandsYesOrdered commands [{"method": "notes.create", "params": {...}}] using API method names (dot form). Each runs after the previous finishes; results are not substituted into later params.
timeoutSecondsNoMCP option (not sent to Anki): how long to wait for completion. A timeout does not cancel the work; the pending record is returned.
waitForCompletionNoMCP option (not sent to Anki): poll operations.get until the operation finishes and return its final record. If false, return the operation handle.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds substantial context beyond the annotations: execution continues after errors, the batch is never an atomic transaction, a session change fails remaining commands, undo is per command, and timeout does not cancel outstanding work. However some of that duplicates existing structured facts, and the description does not explain how results are keyed to input commands or the write semantics implied by destructiveHint=false for a dispatcher that can invoke mutations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the core action and constraints in two dense sentences, then gives compact metadata (scope, effect, completion, undo), the long-running behavior, and the error set. Every line carries information an agent needs, and the no-nesting and no-atomicity warnings are placed where they will be read before the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description carries the return burden and mostly does: it says the server waits and returns the final operation record, or the handle when waitForCompletion is false, and how a timeout behaves. The main gap is that it never states that per-command results are returned in command order (or how to correlate a failed command with its index), which matters for a 100-item batch.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the dot-form method names, no result substitution, and the waitForCompletion/timeoutSeconds server-side polling behavior. The description only points back to those parameters ('see waitForCompletion / timeoutSeconds') without adding syntax or format detail of its own, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: execute a list of Anki-Connect API method calls sequentially, with completion barriers and independent results. The batch-dispatch nature clearly distinguishes it from the ~70 single-purpose siblings such as notes_create or cards_move, so an agent can identify what it is without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides concrete when-not rules: no nested api.execute, no application.exit or profiles.switch, pin the active collection session because a session change fails remaining collection-scoped commands. It stops short of explicitly routing the agent to individual sibling methods for single operations, leaving that inference to the caller.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools