Anki MCP

v0.1.2
io.github.Ryhus/anki-mcp Checked 1 day ago Published 10 days ago

Manage local Anki notes, cards, decks, note types, media, and deck packages via AnkiConnect.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list-decks List decks

Lists all Anki decks with their IDs and hierarchy metadata.

create-deck Create deck

Creates a deck or returns the existing deck with the same name. Use "::" to create nested decks.

ParameterTypeDescription
name *stringFull deck name. Use "::" between parent and child deck names, for example "Languages::German".

rename-deck Rename or move a deck

Previews a native Anki deck rename or move under an existing parent. Preserves deck and card identity, reviews descendant paths, and requires the impact hash and explicit confirmation before applying. Requires AnkiConnect v1.

ParameterTypeDescription
name *stringExact current full deck path
newName *stringNew full path; the destination parent must already exist
confirmRenameboolean
dryRunboolean
expectedImpactHashstringImpact hash from the reviewed rename preview

list-deck-presets List deck presets

Lists Anki deck presets and how many normal decks use each one. Requires AnkiConnect v1.

ParameterTypeDescription
limitinteger
offsetinteger

get-deck-preset Get deck preset

Reads a deck preset's settings and the decks that use it. Pass a preset ID or a normal deck ID. Requires AnkiConnect v1.

ParameterTypeDescription
deckIdintegerResolve the preset currently assigned to this normal deck
presetIdinteger

create-deck-preset Create deck preset

Creates an unassigned deck preset from native defaults or an existing preset. Does not replace or assign a preset. Requires AnkiConnect v1.

ParameterTypeDescription
name *string
cloneFromPresetIdintegerCopy an existing preset instead of using Anki defaults

update-deck-preset Update deck preset

Previews a preset rename or a patch to learning, display order, or audio options, showing every deck using it. Requires an impact hash and explicit confirmation to apply. Does not request full FSRS rescheduling. Requires AnkiConnect v1.

ParameterTypeDescription
presetId *integer
confirmChangesboolean
dryRunboolean
expectedImpactHashstring
namestring
settingsobject

assign-deck-preset Assign deck preset

Previews assigning a preset to explicitly selected normal decks, without adding descendants or requesting full FSRS rescheduling. Requires an impact hash and explicit confirmation. Requires AnkiConnect v1.

ParameterTypeDescription
deckIds *arrayExplicit normal deck IDs; descendants are not automatically included
presetId *integer
confirmChangesboolean
dryRunboolean
expectedImpactHashstring

delete-deck-preset Delete unused deck preset

Previews deletion of one unused, non-Default deck preset. Never reassigns decks automatically. Requires an impact hash and explicit confirmation. Requires AnkiConnect v1.

ParameterTypeDescription
presetId *integer
confirmDeletionboolean
dryRunboolean
expectedImpactHashstring

get-deck-stats Get deck statistics

Returns scheduler counts for selected decks, or for all decks when no names are provided. Fails if a requested deck does not exist.

ParameterTypeDescription
namesarrayDecks to inspect. Omit to return statistics for every deck.

get-card-decks Get card decks

Groups the specified card IDs by their current deck.

ParameterTypeDescription
cardIds *arrayIDs of cards whose deck assignments should be returned

move-cards-to-deck Move cards to deck

Moves cards to another deck. Creates the target deck if it does not exist and removes the cards from filtered decks before moving them.

ParameterTypeDescription
cardIds *arrayIDs of cards to move
targetDeck *stringDestination deck. It will be created if it does not exist.

delete-deck-and-cards Delete deck and cards

Previews deletion of one normal deck and all descendants. Applying requires dryRun: false, the reviewed impactHash as expectedImpactHash, and confirmDeletion: true. Changed deck identities, Card placement, or Note data block deletion. Default/filtered decks, borrowed-out Cards, incomplete data, and excessive impact are blocked. Surviving sibling Cards in other decks are preserved and verified. No backup or rollback is created.

ParameterTypeDescription
name *stringExact root deck name; its descendants are included in deletion
confirmDeletionbooleanMust be true after user approval when applying destructive deck/Card loss
dryRunboolean
expectedImpactHashstringimpactHash from a complete reviewed preview; required when applying

search-cards Search cards

Searches cards with Anki's native query syntax. In v1 mode, defaults to a native cursor page. Request pagination: offset for an exact total or a numeric position.

ParameterTypeDescription
query *stringNative Anki search query, for example "deck:French is:due", "tag:verb", or "prop:lapses>3". An empty query searches all cards.
cursorstringUse the previous nextCursor with the same query and limit. Omit it on the first cursor page.
limitinteger
offsetintegerSupplying an offset, even 0, selects offset mode unless pagination is explicit.
paginationstringDefaults to cursor when v1 is enabled and no offset is supplied. Use offset for an exact total or a numeric position.

get-card-details Get card details

Returns note fields and normalized scheduling information for specific cards. Reports missing IDs separately.

ParameterTypeDescription
cardIds *arrayOne to 20 card IDs whose fields and scheduling details should be returned
includeRenderedContentbooleanInclude rendered question and answer HTML, which may contain Anki's embedded styles. No separate CSS field is returned; use get-card-preview for HTML/CSS documents.

get-card-review-history Get card review history

Returns the most recent review events for up to 20 cards, with ratings and intervals converted into readable values.

ParameterTypeDescription
cardIds *arrayOne to 20 card IDs whose review history should be returned
limitPerCardinteger

get-card-preview Get card preview

Returns Anki-rendered HTML, shared CSS, and standalone static HTML documents for one existing card. Supports front/back and light/dark inspection without changing Anki. Not a screenshot: JavaScript, navigation, media, and external resources are disabled in documents. Raw source is untrusted.

ParameterTypeDescription
cardId *integerAnki card ID
sidestringWhich existing card side to inspect; Anki resolves fields and template filters
themestringDocument color scheme; dark adds Anki's nightMode and night_mode classes

predict-card-intervals Predict card intervals

Read-only scheduler predictions for Again, Hard, Good, and Easy on one card. Returns Anki's labels and interval amounts, not an exact due time or eligibility to review. Does not answer the card, change scheduling, or use custom states from the GUI reviewer. Requires AnkiConnect v1.

ParameterTypeDescription
cardId *integerOne existing card ID, for example from search-cards.

get-card-due-status Get card due status

Checks one card's due time and per-card scheduling eligibility in Anki, optionally including learn-ahead. New cards can be available without being due. Does not account for daily deck limits, promise the card will be shown next, or change Anki. Requires AnkiConnect v1.

ParameterTypeDescription
cardId *integerOne existing card ID, for example from search-cards.
includeLearnAheadbooleanTreat cards within Anki's learn-ahead window as available, without marking them due.

set-card-suspension Set card suspension

Suspends or unsuspends existing cards and verifies their saved suspension state. Missing Cards block the whole selection. Suspended cards do not appear during normal reviews.

ParameterTypeDescription
cardIds *arrayOne to 100 Anki card IDs
suspended *booleanTrue to suspend the cards, false to unsuspend them

set-card-flag Set card flag

Applies one of Anki's supported flag colors and verifies saved flags without exposing arbitrary internal card fields. Missing Cards block the whole selection; a write error stops later writes and may leave partial progress.

ParameterTypeDescription
cardIds *arrayOne to 100 Anki card IDs
flag *stringAnki flag color to apply, or none to remove the current flag

reschedule-cards Reschedule cards

Changes due dates and verifies the saved review state and requested date range using Anki's native search. Missing Cards block the whole selection. New cards become review cards, and ranges choose a random due date; never blindly retry after an error.

ParameterTypeDescription
cardIds *arrayOne to 100 Anki card IDs
due *stringAnki Set Due Date value: "0" means today, "1!" requests tomorrow with an interval reset under the current scheduler, and "3-7" chooses a random day in that range

reset-cards-to-new Reset cards to new

Resets scheduling and verifies the saved New state. Missing Cards block the whole selection. Anki may log the reset; review history and repetition counts are not promised to be erased. Never blindly retry after an error.

ParameterTypeDescription
cardIds *arrayOne to 100 Anki card IDs

start-card-relearning Start card relearning

Starts relearning for active Review cards and verifies the result. Current AnkiConnect may implement this as an Again answer, adding review history and changing repetitions/lapses. Cards may return directly to Review or be suspended by leech settings. Missing/non-Review Cards block the whole selection. Not idempotent; never blindly retry.

ParameterTypeDescription
cardIds *arrayOne to 100 Anki card IDs

list-note-types List note types

Lists the Anki note types available for creating notes, including their model IDs.

get-note-type-schema Get note type schema

Returns ordered fields, the Browser sort field (v1), card-template field usage, and a field-order revision hash for one Anki note type. Use this before creating notes or changing fields.

ParameterTypeDescription
modelName *stringAnki note type name. AnkiConnect calls note types "models" in its API.

get-note-type-design Get note type design

Returns the editable front/back HTML, shared CSS, fields, and revision hash for one Anki note type. Use this before proposing design changes.

ParameterTypeDescription
modelName *stringAnki note type name. AnkiConnect calls note types "models" in its API.

clone-note-type Clone note type

Creates an independent note type with the source's ordered fields, card template HTML, and shared CSS. In AnkiConnect v1 it preserves the Browser sort field and requires the reviewed clone hash before applying. Does not copy notes or cards.

ParameterTypeDescription
sourceModelName *stringExisting note type whose ordered fields, templates, CSS, and v1 sort field should be copied
targetModelName *stringUnique name for the new independent note type
dryRunbooleanWhen true, validate and preview the clone without creating a note type
expectedCloneHashstringHash returned by the reviewed clone preview; required for apply in v1.
expectedSourceDesignHashstringSource design hash required for legacy apply; v1 apply requires expectedCloneHash.
isClozebooleanOptional normal/Cloze override. By default the tool detects {{cloze:...}} filters in the source templates.

create-note-type Create note type

Creates a new Normal or Cloze note type from ordered fields, complete card templates, and shared CSS. Optionally selects its Browser sort field in AnkiConnect v1. Defaults to dry-run mode and does not create notes or cards.

ParameterTypeDescription
fields *arrayField names in their desired order. The first field is used for duplicate checks.
modelName *stringUnique name for the new Anki note type
templates *array
cssstringShared CSS for every card generated from the note type
dryRunbooleanWhen true, validate and preview the note type without creating it
isClozebooleanWhether to create an Anki Cloze note type
sortFieldstringExact name from fields. Requires AnkiConnect v1. Omit to use Anki's default first field.

rename-note-type Rename note type

Previews renaming an existing Note Type by ID. Changes only the type name, not fields, templates, Notes, or Cards. Applying requires the reviewed impact hash and explicit confirmation. Requires AnkiConnect v1.

ParameterTypeDescription
newName *string
noteTypeId *integerStable ID from list-note-types
confirmRenameboolean
dryRunbooleanPreview without modifying Anki
expectedImpactHashstringHash returned by the reviewed rename preview

set-note-type-sort-field Set note type sort field

Previews changing which field supplies the Anki Browser's Sort Field column for an existing Note Type. Does not reorder fields, edit templates, or change review scheduling. Applying requires the reviewed impact hash and explicit confirmation. Requires AnkiConnect v1.

ParameterTypeDescription
noteTypeId *integerStable ID from list-note-types or get-note-type-schema
sortField *stringExact existing field name from get-note-type-schema
confirmChangeboolean
dryRunbooleanPreview without modifying Anki
expectedImpactHashstringHash from the reviewed sort-field preview

delete-unused-note-type Delete unused note type

Previews deleting one explicitly selected Note Type. Refuses if any Note uses the type, even without Cards, or if it is the last Note Type. Requires the reviewed impact hash and explicit confirmation to apply. Requires AnkiConnect v1.

ParameterTypeDescription
noteTypeId *integerExplicit stable ID from list-note-types
confirmDeletionboolean
dryRunbooleanPreview without modifying Anki
expectedImpactHashstringHash from the reviewed deletion preview

add-note-type-field Add note type field

Adds an empty field to every note of one note type. Defaults to dry-run mode and does not add the field to card templates.

ParameterTypeDescription
fieldName *stringNew field name. Anki special field names such as Tags, Type, Deck, Card, and FrontSide are not allowed.
modelName *stringAnki note type name. AnkiConnect calls note types "models" in its API.
dryRunbooleanWhen true, validate and preview the field without modifying Anki
expectedSchemaHashstringHash returned by get-note-type-schema; required when dryRun is false and blocks stale writes
orderintegerOptional zero-based field order. Use 0 for the first field; omit to append.

rename-note-type-field Rename note type field

Renames a field across every note of one note type while preserving its values. Anki updates template references to the renamed field.

ParameterTypeDescription
modelName *stringAnki note type name. AnkiConnect calls note types "models" in its API.
newFieldName *stringNew field name. Anki special field names such as Tags, Type, Deck, Card, and FrontSide are not allowed.
oldFieldName *stringExisting Anki note-type field name
dryRunbooleanWhen true, validate and preview the rename without modifying Anki
expectedSchemaHashstringHash returned by get-note-type-schema; required when dryRun is false and blocks stale writes

reposition-note-type-field Reposition note type field

Moves a note-type field to a new zero-based order while preserving all note values. Defaults to dry-run mode.

ParameterTypeDescription
fieldName *stringExisting Anki note-type field name
modelName *stringAnki note type name. AnkiConnect calls note types "models" in its API.
newOrder *integerZero-based field order. Use 0 to make this the first field.
dryRunbooleanWhen true, validate and preview the new order without modifying Anki
expectedSchemaHashstringHash returned by get-note-type-schema; required when dryRun is false and blocks stale writes

delete-note-type-field Delete note type field

Permanently deletes one field and all of its values from every note of a note type. Requires a dry-run impact review, current schema hash, unchanged non-empty note count, and explicit data-loss confirmation.

ParameterTypeDescription
fieldName *stringExisting Anki note-type field name
modelName *stringAnki note type name. AnkiConnect calls note types "models" in its API.
confirmDataLossbooleanMust be true when dryRun is false to confirm permanent deletion of this field's values
dryRunbooleanWhen true, report the permanent data impact without modifying Anki
expectedNonEmptyNoteCountintegerNon-empty note count returned by the dry run; required when dryRun is false and blocks applying changed impact
expectedSchemaHashstringHash returned by get-note-type-schema; required when dryRun is false and blocks stale writes

add-note-type-template Add note type template

Adds a new card template to a Normal note type. Defaults to dry-run mode and reports how many existing notes may generate a new card.

ParameterTypeDescription
back *stringComplete HTML for the new back side
front *stringComplete HTML for the new front side
modelName *stringAnki note type name. AnkiConnect calls note types "models" in its API.
templateName *stringAnki card template name
confirmCardCreationbooleanMust be true when dryRun is false to confirm that Anki may generate a new card for each existing note
dryRunbooleanWhen true, validate and preview the template without modifying Anki
expectedDesignHashstringHash returned by get-note-type-design; required when dryRun is false and blocks stale writes
expectedNoteCountintegerExisting note count returned by the dry run; required when dryRun is false and blocks applying changed impact

rename-note-type-template Rename note type template

Renames one card template without changing its order, HTML, generated cards, or review history. Defaults to dry-run mode.

ParameterTypeDescription
modelName *stringAnki note type name. AnkiConnect calls note types "models" in its API.
newTemplateName *stringAnki card template name
oldTemplateName *stringAnki card template name
dryRunbooleanWhen true, validate and preview the rename without modifying Anki
expectedDesignHashstringHash returned by get-note-type-design; required when dryRun is false and blocks stale writes

reposition-note-type-template Reposition note type template

Moves one card template to a new zero-based order while preserving its HTML and existing card history. Defaults to dry-run mode.

ParameterTypeDescription
modelName *stringAnki note type name. AnkiConnect calls note types "models" in its API.
newOrder *integerZero-based card template order. Use 0 to make it the first template.
templateName *stringAnki card template name
dryRunbooleanWhen true, validate and preview the new order without modifying Anki
expectedDesignHashstringHash returned by get-note-type-design; required when dryRun is false and blocks stale writes

delete-note-type-template Delete note type template

Permanently deletes one card template and every card generated from it. Reports notes that may lose their last card and requires explicit impact confirmation.

ParameterTypeDescription
modelName *stringAnki note type name. AnkiConnect calls note types "models" in its API.
templateName *stringAnki card template name
confirmCardDeletionbooleanMust be true when dryRun is false to confirm permanent deletion of generated cards and their review history
confirmNoteDeletionbooleanMust be true when affected notes would lose their last card and dryRun is false
dryRunbooleanWhen true, report the permanent card impact without modifying Anki
expectedCardCountintegerAffected card count returned by the dry run; required when dryRun is false and blocks applying changed impact
expectedDesignHashstringHash returned by get-note-type-design; required when dryRun is false and blocks stale writes
expectedNotesLosingLastCardCountintegerCount returned by the dry run for notes that would lose their last card; required when dryRun is false

update-note-type-styling Update note type styling

Validates and replaces the CSS shared by every card of one note type. Defaults to dry-run mode; applying requires expectedDesignHash. Reports applied only after reading back the exact CSS and confirming the Note Type identity and unchanged templates. A write/readback error may follow an applied change; do not blindly retry.

ParameterTypeDescription
css *stringComplete replacement CSS for the note type
modelName *stringAnki note type name. AnkiConnect calls note types "models" in its API.
dryRunbooleanWhen true, validate and report the proposed change without modifying Anki
expectedDesignHashstringHash returned by get-note-type-design; required when dryRun is false and blocks stale writes

update-note-type-templates Update note type templates

Validates and replaces selected front/back HTML templates for one note type. Defaults to dry-run mode and applies all requested sides in one Anki undo step.

ParameterTypeDescription
modelName *stringAnki note type name. AnkiConnect calls note types "models" in its API.
templates *array
dryRunbooleanWhen true, validate and report the proposed changes without modifying Anki
expectedDesignHashstringHash returned by get-note-type-design; required when dryRun is false and blocks stale writes

replace-note-type-text Replace literal text in Anki note type designs

Previews and validates a case-sensitive literal replacement in explicitly selected Note Types' front HTML, back HTML, and/or CSS. Does not replace Note field values. Applying requires AnkiConnect v1, a current impact hash, and explicit confirmation.

ParameterTypeDescription
find *stringLiteral case-sensitive search text, not a regular expression.
noteTypeIds *arrayExplicit selection of up to 20 Note Type IDs from list-note-types.
replace *stringLiteral replacement text. An empty string removes the matches.
targets *arrayChoose question (front HTML), answer (back HTML), and/or css.
confirmReplacementboolean
dryRunbooleanPreview without changing Anki.
expectedImpactHashstringHash from the reviewed replacement preview.

search-notes Search notes

Searches notes with Anki's native query syntax. In v1 mode, defaults to a native page with a continuation cursor. Request pagination: offset for an exact total or a numeric position.

ParameterTypeDescription
query *stringNative Anki search query, for example "deck:German tag:A1", "note:Basic", or "Front:*Hund*". An empty query searches all notes.
cursorstringUse the previous nextCursor with the same query and limit. Omit it on the first cursor page.
limitinteger
offsetintegerSupplying an offset, even 0, selects offset mode unless pagination is explicit.
paginationstringDefaults to cursor when v1 is enabled and no offset is supplied. Use offset for an exact total or a numeric position.

find-empty-notes Find empty notes

Read-only AnkiConnect v1 scan for Notes with no Cards, empty fields, or empty questions. Returns one page of candidates for review. This tool never deletes anything.

ParameterTypeDescription
criterion *stringallFieldsEmpty checks all fields using Anki's HTML-aware emptiness; noCards finds Notes with no Cards; allQuestionsEmpty finds Notes whose possible Card questions all render empty in Anki.
cursorstringReuse nextCursor with the same criterion, query, and limit.
limitintegerMaximum candidates per page. This does not limit the initial scan.
querystringOptional native Anki search to restrict the scan, e.g. tag:inbox. An empty query scans all Notes.

get-note-details Get note details

Returns complete ordered fields with per-field hashes, tags, note type, modification time, and generated card IDs. Use fields[name].hash as expectedFieldHashes[name] when updating fields.

ParameterTypeDescription
noteIds *arrayOne to 20 note IDs whose complete fields and metadata should be returned

validate-note-drafts Validate note drafts

Checks candidate notes without creating them. Validates decks, note types, field names, existing media references, empty-card rules, and Anki duplicate rules.

ParameterTypeDescription
notes *arrayCandidate notes to validate without creating them

create-notes Create notes

Validates the complete batch before creating Notes, optionally merging existing media references. Returns a status for every input and preserves acknowledged IDs if readback fails. A null createdNoteCount means an unknown creation outcome; null cardIds means unverified readback. Partial/unknown outcomes are errors with structured results. Never blindly resend the whole batch; duplicate checks are not idempotency. No automatic retry or rollback.

ParameterTypeDescription
notes *arrayOne or more notes to validate and create as one batch

update-note-fields Update note fields

Previews partial field patches by default. To apply, set dryRun to false and provide expectedFieldHashes for every submitted field from get-note-details or a dry run. Validates the complete batch before writing and verifies saved values. Each submitted field replaces its complete value, including HTML.

ParameterTypeDescription
updates *array
dryRunbooleanPreview bounded raw HTML changes and full-value hashes without modifying Anki. Set false to apply with expectedFieldHashes.

convert-notes-to-note-type Convert notes to another Note Type

Previews moving explicit existing Notes to another Normal Note Type. Review target-to-source field and template maps, preserved/removed Card IDs, and possible new Cards. Apply only with the reviewed hash and confirmations. Does not duplicate Notes. Requires AnkiConnect v1.

ParameterTypeDescription
noteIds *arrayExplicit Note IDs belonging to the same source Note Type
targetNoteTypeId *integerExisting destination Note Type ID from list-note-types
confirmCardCreationbooleanRequired when native generation could create new Cards
confirmConversionboolean
confirmDataLossbooleanRequired when nonempty fields or existing Cards would be discarded
dryRunboolean
expectedImpactHashstringHash from a reviewed preview of this exact selection and mapping
fieldsarrayOne mapping per target field; null source leaves it empty. Omit to use Anki's suggested mapping.
templatesarrayOne mapping per target template; null source does not preserve an old Card in that slot. Omit to use Anki's suggestion.

edit-note-tags Edit note tags

Adds and removes selected tags on existing notes without replacing their complete tag lists.

ParameterTypeDescription
noteIds *arrayOne to 100 Anki note IDs
addarrayTags to add while preserving every other existing tag
removearrayTags to remove while preserving every other existing tag

replace-note-tag Replace a tag on selected notes

Previews replacing one whole tag on explicit Note IDs. Notes without the source tag are skipped. Does not recursively rename child tags, change unrelated tags, or apply to the whole collection. Requires AnkiConnect v1 and explicit confirmation of the reviewed preview to write.

ParameterTypeDescription
from *stringFull existing tag name to replace. Not a prefix or search query.
noteIds *arrayExplicit selection of up to 100 Note IDs. No collection-wide option.
to *stringOne replacement tag name. Anki may reuse registered casing.
confirmReplacementboolean
dryRunbooleanPreview without modifying Anki
expectedImpactHashstringHash from the reviewed replacement preview

list-tags List tags

Lists a bounded page of tags from the current Anki collection, optionally filtered by prefix.

ParameterTypeDescription
limitinteger
offsetinteger
prefixstringOptional case-insensitive tag prefix filter

delete-unused-tags Delete unused Anki tags

Previews and removes tag registrations that no Note uses in the active collection. Does not remove tags from Notes or delete Notes or Cards. Requires AnkiConnect v1 and confirmation of the reviewed preview.

ParameterTypeDescription
confirmDeletionbooleanConfirm cleanup of unused tags across the active collection.
dryRunbooleanPreview without modifying Anki.
expectedImpactHashstringHash from the reviewed tag cleanup preview.

delete-notes-and-cards Delete notes and cards

Previews deletion of explicit Note IDs and all their generated Cards. Defaults to dryRun. Applying requires the reviewed impactHash as expectedImpactHash and confirmDeletion: true. Missing Notes or changed profile, Note content, tags, or Card IDs block the entire batch. Successful deletion is verified with native searches. No backup or rollback is created.

ParameterTypeDescription
noteIds *arrayExplicit Note IDs; duplicates are ignored. Search queries are not accepted.
confirmDeletionbooleanMust be true when applying, after the user approves permanent Note/Card data loss
dryRunbooleanPreview Notes and generated Cards without deleting anything
expectedImpactHashstringimpactHash returned by a complete preview; required when dryRun is false

search-media-files Search media files

Returns a bounded, sorted page of filenames from Anki's current collection.media folder.

ParameterTypeDescription
limitinteger
offsetinteger
patternstringAnkiConnect glob pattern such as "*.mp3", "_logo*", or "gehen*"

get-media-file Get media file

Returns verified metadata for one exact Anki media file and can include a bounded image or audio preview.

ParameterTypeDescription
filename *stringPortable filename inside Anki's flat collection.media folder
includeContentbooleanReturn supported image or audio bytes as a native MCP content block when the file is small enough

store-media-file Store media file

Safely imports bounded media bytes into Anki from base64, a public HTTPS URL, or an explicitly allowed local directory. Existing files are never overwritten.

ParameterTypeDescription
filename *stringPortable filename inside Anki's flat collection.media folder
source *
collisionPolicystringrename lets Anki choose a non-conflicting filename; reject makes an existing filename an error
usagestringStatic template assets must start with an underscore so Anki's media checker preserves them

find-media-references Find media references

Scans note fields, Card Template HTML, and note-type CSS for exact references to one Anki media filename. Complete scans return a fingerprint for safe deletion. CSS parsing failures are reported separately and make counts incomplete; no fingerprint is issued.

ParameterTypeDescription
filename *stringPortable filename inside Anki's flat collection.media folder

attach-media-to-notes Attach media to notes

Safely appends or prepends references to existing Anki media without replacing unrelated note-field HTML. Defaults to dry-run mode.

ParameterTypeDescription
attachments *array
dryRunbooleanPreview exact field hashes and references without modifying Anki

detach-media-from-notes Detach media from notes

Removes exact image or sound references from selected note fields without deleting the media file. Defaults to dry-run mode.

ParameterTypeDescription
detachments *array
dryRunboolean

delete-media-file Delete media file

Previews exact Note, Card Template, and CSS references before moving one media file to Anki's media trash. Applying requires the reviewed file hash, reference count, reference fingerprint, and explicit confirmation. Incomplete Note or CSS scans block deletion even with confirmations enabled.

ParameterTypeDescription
filename *stringPortable filename inside Anki's flat collection.media folder
confirmBrokenReferencesbooleanMust be true when applying deletion while Notes, Card Templates, or CSS still reference the file
confirmDeletionbooleanMust be true when applying media deletion
dryRunbooleanInspect exact bytes and all detectable references without deleting the file
expectedReferenceCountintegerReference count returned by the dry run; required when applying
expectedReferenceFingerprintstringusage.referenceFingerprint returned by a complete dry run; required when applying, even if the reference count is unchanged
expectedSha256stringFile hash returned by the dry run; required when applying

get-study-stats Get study statistics

Reads collection-wide review counts for Anki's current study day and recent days with reviews. Does not change data or include per-deck counts.

ParameterTypeDescription
limitDaysintegerMaximum number of recent days with reviews. Days without reviews are omitted.

get-study-summary Get study summary

Read-only structured Anki totals for the whole collection or one deck including its subdecks. Returns card and linked-note counts, recorded answers and time across available history, and current card categories. For today's workload use get-deck-stats. Requires AnkiConnect v1.

ParameterTypeDescription
deckIdintegerDeck ID from list-decks. Includes child decks. Omit for the whole collection.

export-deck-package Export Anki deck package

Previews a local .apkg export of one normal deck and its subdecks. Media is included; scheduling is opt-in. On confirmation, writes a new file under the configured export directory without overwriting existing files. Requires local AnkiConnect v1.

ParameterTypeDescription
deckId *integerID of one normal deck from list-decks; its subdecks are in scope.
confirmExportboolean
dryRunbooleanPreview without exporting a file or importing into Anki.
expectedImpactHashstringHash from the reviewed preview.
fileNamestringFile name only. Defaults to deck-<id>.apkg.
includeSchedulingbooleanInclude learning progress and review history.

import-deck-package Import Anki deck package

Previews a trusted local .apkg file and imports its reviewed bytes into the active Anki collection. Anki can update existing Notes and merge Note Types; it imports scheduling and deck presets when present. Preview does not calculate a collection diff. Requires local AnkiConnect v1.

ParameterTypeDescription
localPath *stringAbsolute path to a trusted .apkg inside ANKI_PACKAGE_IMPORT_DIR.
confirmImportbooleanAccept the import, including possible updates and learning progress.
dryRunbooleanPreview without exporting a file or importing into Anki.
expectedImpactHashstringHash from the reviewed preview.

get-collection-info Get active Anki collection information

Read the active profile, scheduler, and opaque collection session. Does not read Notes or Cards. Requires AnkiConnect v1.

refresh-collection Refresh Anki collection windows

Refresh open Anki windows, optionally clearing the supported Note Type cache first. Does not reopen the collection, sync, or repair data. Requires AnkiConnect v1.

ParameterTypeDescription
targetstringRefresh windows, or invalidate the supported note type cache first.

sync-collection Synchronize the active Anki collection

Preview or explicitly confirm a sync with Anki's configured server. A full sync may require the user to choose Upload or Download in Anki. Returns an operation ID, not completion. Requires AnkiConnect v1.

ParameterTypeDescription
confirmbooleanSet true only after the user approves the reviewed collection operation.
confirmationTokenstringShort-lived, one-use token returned by this tool's preview.
dryRunbooleanReview the active profile and proposal without running the operation.
includeMediabooleanRequest media sync, if enabled in the active profile.

check-collection-integrity Check and repair the active Anki database

Preview or explicitly confirm Anki's native Check Database operation. It can repair data and clear the Undo history; the preview does not check the database. Requires AnkiConnect v1.

ParameterTypeDescription
confirmbooleanSet true only after the user approves the reviewed collection operation.
confirmationTokenstringShort-lived, one-use token returned by this tool's preview.
dryRunbooleanReview the active profile and proposal without running the operation.

undo-collection-action Undo Anki's current undoable action

Preview or explicitly confirm a single native Undo. AnkiConnect cannot preview or select the undo entry; Undo can revert a manual action, not necessarily a change made through MCP. Never use it as automatic rollback. Requires AnkiConnect v1.

ParameterTypeDescription
confirmbooleanSet true only after the user approves the reviewed collection operation.
confirmationTokenstringShort-lived, one-use token returned by this tool's preview.
dryRunbooleanReview the active profile and proposal without running the operation.

get-collection-operation Get Anki collection operation status

Check a submitted sync, database check, or Undo without starting another. If waitingForUser, use Anki's UI and check the same operation ID again. Requires AnkiConnect v1.

ParameterTypeDescription
operationId *stringOperation ID returned by a collection tool on this MCP server.

cancel-collection-operation Request cancellation of an Anki collection operation

When the user asks to stop a sync, database check, or Undo, request cancellation of its operation ID from this running MCP server. Anki may refuse to stop a running operation. Acknowledgement is not completion or rollback; check get-collection-operation. Requires AnkiConnect v1.

ParameterTypeDescription
operationId *stringOperation ID returned by a collection tool on this MCP server.