packages.export
packages_exportExport a specified Anki deck as an .apkg package to a chosen filesystem path, optionally including review history and scheduling data for backup or sharing.
Instructions
Export the specified deck package.
Anki-Connect method packages.export. Scope: collection. Effect: filesystem. Completion: operation. Undo: none.
Long-running operation: by default the server waits for the final result (see waitForCompletion / timeoutSeconds).
Possible errors: cancelled, collectionUnavailable, internalError, invalidParams, ioError, notFound, staleSession.
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": {
"deck": "<deck>",
"path": "<path>"
},
"name": "packages_export"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deck | Yes | Deck to export: exactly one of {"id": "<deckId>"} or {"name": "<full deck name, e.g. Japanese::Verbs>"}. | |
| path | Yes | Output .apkg path on the machine running Anki. | |
| session | No | Optional. Collection session ID: the `session` field returned by `collection_get`. Usually omit it — the server then uses the session current at the time of the call. Pass it to make the call fail with `staleSession` instead of acting on a different profile/collection than the one your IDs, cursors and tokens came from. | |
| 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. | |
| includeScheduling | No | Include review history and scheduling. Default false. | |
| 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. |