Manage flashcards
manage_flashcardsCreate, search, inspect, edit, tag, and delete Anki notes (flashcards) in your local collection via AnkiConnect, including batch import and dry-run validation.
Instructions
Create, search, inspect, edit, tag and delete Anki notes (flashcards) in the local collection via AnkiConnect. Use this for card content; use manage_decks for deck structure/limits, manage_models for note-type fields and templates, and manage_scheduling for review state (due cards, answering, suspend/unsuspend). For guidance on writing effective cards, use the "writing_good_flashcards" prompt.
Operations (set operation, then the listed parameters):
create: add one note. Needs deckName, modelName, fields; optional tags, allowDuplicate, duplicateScope. Writes immediately.
create_batch: add many notes. Give
notesinline ORfilePathto a .json (array of notes), .csv or .tsv file (header row = field names; optional tags, deck, model columns). Top-level deckName/modelName act as defaults that each note can override; top-level tags are added to every note. Notes are validated first (note type exists, field names match, duplicates, empty first field: each failure gets a reason), then sent sequentially in chunks of chunkSize (default 10). The result maps every note (#n plus the first ~40 chars of its first field) to its new note ID or failure reason. If Anki stops responding partway, it stops and lists which notes were saved and which to resend. Use dryRun: true to validate without writing. Prefer filePath for large imports: it keeps card text out of the conversation.update: change fields and/or replace tags of one note. Needs noteId plus fields and/or tags.
delete: permanently delete notes and all their cards. Needs noteIds. Cannot be undone.
find: read-only; which notes match a search (listed), or how many by tag/deck/model/state (groupBy). Needs query (Anki search syntax). Output is compact: a header with the total match count and next offset, then one line per note. Optional:
include: what each note carries. Default ["fields"] (field text, HTML stripped, each field cut to maxFieldChars, default 120; 0 = no limit). Add "tags", "deck", "model", "cards" (card IDs) or "state" (per card: new/learning/review/relearning/suspended/buried, interval, due date, reps, lapses, ease). [] returns IDs only. includeDetails: true = all of them.
groupBy: counts over ALL matches (ignores limit). "tag" | "deck" | "model" give {notes, cards, new, seen} per group; "state" gives card/note counts per queue. Use it for "how many cards per topic" or "how much of this deck have I seen"; for today's due counts per deck, use manage_decks get_stats.
limit (default 50), offset, format ("lines" default, or "json" for single-line JSON). Listings are capped at ~20k chars: past that you get the first notes that fit plus a hint to use groupBy, include or a narrower query/limit. Search power-ups: deck:"Interview prep", tag:verbs, is:new, is:due, is:suspended, rated:2:1 (answered Again in the last 2 days; the go-to for "what am I failing"), rated:7 (reviewed in the last 7 days), prop:ivl>=21 (mature), prop:lapses>=3 (leeches), added:7, "front:word". Combine with spaces (AND), "or", and "-" for NOT.
get_info: read-only card details. Needs cardIds (max 50).
add_tags / remove_tags: needs tags plus noteIds OR query (Anki search; the server finds the notes, any number). dryRun: true reports the match count and sample IDs without writing.
clear_empty: deletes every note with empty cards in the whole collection.
Fails with a clear message if Anki isn't running.
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": {
"operation": "<operation>"
},
"name": "manage_flashcards"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tags | No | create: tags for the note. create_batch: added to every note. update: replaces the note's tags. add_tags/remove_tags: tags to add/remove | |
| limit | No | find: max notes per page (default 50) | |
| notes | No | create_batch: notes to add (or use filePath instead) | |
| query | No | find (and add_tags/remove_tags instead of noteIds): Anki search query, e.g. 'deck:"Spanish" tag:verbs', "is:new", "rated:2:1" (answered Again in the last 2 days), "prop:ivl>=21" | |
| dryRun | No | create_batch: validate every note and report problems without writing anything. add_tags/remove_tags: report how many notes match (and sample IDs) without changing them. Rejected for other operations | |
| fields | No | create/update: field name -> value (HTML allowed). Names must match the note type, e.g. { "Front": "...", "Back": "..." } | |
| format | No | find: "lines" (default, one line per note/group) or compact single-line JSON | |
| noteId | No | update: ID of the note to change | |
| offset | No | find: notes to skip, for paging (default 0); use the returned next offset | |
| cardIds | No | get_info: card IDs (max 50) | |
| groupBy | No | find: return counts per tag/deck/model ({notes, cards, new, seen}) or per scheduling state, over ALL matches, instead of a listing | |
| include | No | find: what each listed note carries (default ["fields"]; [] = IDs only). fields = field text (HTML stripped, truncated), tags, deck, model, state = per-card queue/interval/due/reps/lapses/ease, cards = card IDs | |
| noteIds | No | delete/add_tags/remove_tags: note IDs to act on (add_tags/remove_tags: or use query) | |
| deckName | No | create: target deck (required). create_batch: default deck for notes without their own deckName | |
| filePath | No | create_batch: absolute path to a .json (array of notes like `notes`), .csv or .tsv file. CSV/TSV: header row = field names, plus optional "tags" (space-separated), "deck" and "model" columns. Use instead of notes | |
| chunkSize | No | create_batch: notes per AnkiConnect request (default 10) | |
| modelName | No | create: note type (required), e.g. "Basic". create_batch: default note type for notes without their own. Use manage_models list for field names | |
| operation | Yes | Which operation to run; see the tool description for required parameters | |
| maxFieldChars | No | find: truncate each field to this many characters (default 120; 0 = no limit) | |
| allowDuplicate | No | create/create_batch: add notes even if the first field duplicates an existing note (default false) | |
| duplicateScope | No | create/create_batch: where to look for duplicates: "collection" (default) or only the target "deck" | |
| includeDetails | No | find: shorthand for include: all of fields, tags, deck, model, state, cards |