cards.search
cards_searchFind Anki cards with Anki search syntax, such as deck and due filters, and page through results using a cursor.
Instructions
Search cards using Anki search syntax.
Anki-Connect method cards.search. Scope: collection. Effect: read. Completion: completed. Undo: none.
Possible errors: collectionUnavailable, internalError, invalidParams, invalidSearch, staleCursor, 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": {
"query": "<query>"
},
"name": "cards_search"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sort | No | Optional browser-column sort, e.g. {"column": "noteFld", "direction": "ascending"} (`column` is an Anki browser column key such as noteFld, cardDue). Default: ascending ID order. | |
| limit | No | Page size, 1–1000 (default 100). | |
| query | Yes | Anki search query for cards, e.g. `deck:Japanese is:due`. An empty string matches all cards. | |
| cursor | No | Continuation token: `nextCursor` from the previous page of the same call. Omit for the first page. Repeat the same query, sort and limit; each cursor is single-use and expires after 10 minutes. `nextCursor: null` means there are no more pages. | |
| 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. |