Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
num_cards_due_todayB

Get the number of cards due exactly today, with an optional deck filter.

list_decks_and_notesC

Get all decks (excluding specified patterns) and note types with their fields.

get_examplesA

Get example notes from Anki to guide your flashcard making. Limit the number of examples returned and provide a sampling technique:

    - random: Randomly sample notes
    - recent: Notes added in the last week
    - most_reviewed: Notes with more than 10 reviews
    - best_performance: Notes with less than 3 lapses
    - mature: Notes with interval greater than 21 days
    - young: Notes with interval less than 7 days

Args:
    deck: Optional[str] - Filter by specific deck (use exact name).
    limit: int - Maximum number of examples to return (default 5).
    sample: str - Sampling technique (random, recent, most_reviewed, best_performance, mature, young).
fetch_due_cards_for_reviewA

Fetch cards due for review, formatted for an LLM to present.

Args:
    deck: Optional[str] - Filter by specific deck name.
    limit: int - Maximum number of cards to fetch (default 5).
    today_only: bool - If true, only fetch cards due today. If false, fetch cards due up to MAX_FUTURE_DAYS ahead (currently {MAX_FUTURE_DAYS}).
submit_reviewsA

Submit multiple card reviews to Anki using ratings ('wrong', 'hard', 'good', 'easy').

Args:
    reviews: List of review dictionaries, each with:
        - card_id (int): The ID of the card reviewed.
        - rating (str): 'wrong', 'hard', 'good', or 'easy'.
add_noteA

Add a flashcard to Anki. Ensure you have looked at examples before you do this, and that you have got approval from the user to add the flashcard.

For code examples, use <code> tags to format your code.
e.g. <code>def fibonacci(n):
if n <= 1:
    return n
return fibonacci(n-1) + fibonacci(n-2)</code>

For MathJax, use the <math> tag to format your math equations. This will automatically render the math equations in Anki.
# e.g. <math>\frac{d}{dx}[3\sin(5x)] = 15\cos(5x)</math>

To attach images to a card, use the picture parameter. Each picture object must have a filename
and exactly one source (url, data, or path). The fields list specifies which card fields get the <img> tag inserted.

## How to attach images based on the source:

**User provides a URL:**
[{"url": "https://example.com/photo.jpg", "filename": "photo.jpg", "fields": ["Back"]}]

**User provides a local file (e.g. screenshot, downloaded image):**
[{"path": "/absolute/path/to/image.png", "filename": "image.png", "fields": ["Back"]}]

**Base64-encoded data (for small images only):**
[{"data": "iVBORw0KGgo...", "filename": "diagram.png", "fields": ["Back"]}]

IMPORTANT: When a user shares an image file or screenshot, prefer using "path" with the absolute
file path rather than trying to base64-encode the image contents. AnkiConnect reads the file directly
from disk which is faster and more reliable.

Args:
    deckName: str - The target deck name.
    modelName: str - The note type (model) name.
    fields: dict - Dictionary of field names and their string content.
    tags: List[str] - Optional list of tags.
    picture: List[dict] - Optional list of picture attachments. Each dict should have:
        - filename (str): Name for the stored image file.
        - url (str, optional): URL to download the image from.
        - path (str, optional): Absolute file path to a local image. Preferred for user-shared files.
        - data (str, optional): Base64-encoded image data.
        - fields (List[str]): Card field names where the <img> tag will be inserted.
        - skipHash (str, optional): MD5 hash to skip if file matches.
store_media_fileA

Store an image or media file in Anki's media folder.

Use this tool to store images that can be referenced in flashcard fields using
HTML img tags: <img src="filename">

This is useful when you need to:
- Store an image before creating a note (e.g. to reference it in multiple notes)
- Add an image to an existing card's field

Provide exactly one of url, data, or path:
- path: Absolute path to a local file. PREFERRED when the user shares an image file or screenshot.
- url: A URL to download the image from (e.g. "https://example.com/photo.jpg")
- data: Base64-encoded file content (for small images only)

IMPORTANT: When a user shares an image file or screenshot, prefer using "path" with the absolute
file path. AnkiConnect reads the file directly from disk, which avoids needing to base64-encode
large image files.

Args:
    filename: str - The filename to store the media as (e.g. "diagram.png").
    url: str - Optional URL to download the image from.
    data: str - Optional base64-encoded image data.
    path: str - Optional absolute path to a local file. Preferred for user-shared files.
search_notesA

Search for notes in Anki using the powerful built-in search syntax.

This tool allows you to find existing notes/flashcards using Anki's query language.
Results include note IDs which can be used for follow-up actions.

Tiered access — call this first to narrow by query, then drill in by ID:
- Default (`return_card_content=False`): cheap response with noteId + a
  ~80-char Front preview, so you can pick which IDs matter.
- `return_card_content=True`: full cleaned field content for every match.
- For scheduling/state details (queue, ease, interval, lapses, review
  history) on specific IDs, call `inspect_cards(note_ids=[...])`. Pass
  `properties=["fields"]` there if you also want the cleaned note content
  alongside the per-card stats in one call.

## Common Search Patterns

**Simple text search:**
- `dog` - notes containing "dog" (matches "doggy", "underdog")
- `dog cat` - notes with both "dog" AND "cat"
- `dog or cat` - notes with "dog" OR "cat"
- `-cat` - notes WITHOUT "cat"
- `"a dog"` - exact phrase match
- `w:dog` - whole word match only

**Field-specific search:**
- `front:dog` - Front field exactly equals "dog"
- `front:*dog*` - Front field contains "dog"
- `front:` - Front field is empty
- `front:_*` - Front field is non-empty

**Deck and tag filters:**
- `deck:French` - cards in French deck (including subdecks)
- `deck:French -deck:French::*` - only top-level French deck
- `tag:vocab` - notes with "vocab" tag
- `tag:none` - notes without any tags
- `note:Basic` - notes using "Basic" note type

**Card state:**
- `is:due` - cards due for review
- `is:new` - new cards not yet studied
- `is:learn` - cards in learning phase
- `is:review` - review cards
- `is:suspended` - suspended cards
- `is:buried` - buried cards

**Card properties:**
- `prop:ivl>=10` - interval >= 10 days
- `prop:due=0` - due today
- `prop:due=1` - due tomorrow
- `prop:lapses>3` - lapsed more than 3 times
- `prop:ease<2.5` - easier than default
- `prop:reps<10` - reviewed fewer than 10 times

**Recent activity:**
- `added:7` - added in last 7 days
- `edited:3` - edited in last 3 days
- `rated:1` - answered today
- `rated:7:1` - answered "Again" in last 7 days
- `introduced:30` - first answered in last 30 days

**Combining searches:**
- `deck:Spanish tag:verb is:due` - due Spanish verbs
- `added:7 -is:review` - new cards added this week
- `(dog or cat) deck:Animals` - dog or cat in Animals deck

Args:
    query: The Anki search query string.
    limit: Maximum notes to return (1-100, default 20).
    return_card_content: If True, returns full cleaned field content per
        note. If False (default), returns a short Front preview per note.

Returns:
    JSON object with `query`, `total_found`, `returned`, and `notes`.
    Each note has `noteId`, `modelName`, `tags`, and either `preview`
    (default) or `fields` (when `return_card_content=True`).
inspect_cardsA

Inspect per-card state with sparse fieldset selection.

Provide EXACTLY ONE of `card_ids` or `note_ids`. When `note_ids` is given,
the tool resolves to all cards belonging to those notes via an `nid:` query.

Use `properties` to pick which categories of information to return. The
default keeps responses small; opt into the heavier categories explicitly.

Property categories:
  - `identity` — cardId, noteId, deck, modelName
  - `state` — suspended, queue, queue_label, type
  - `scheduling` — ease, interval, reps, lapses, raw_due
  - `timestamps` — modified_iso, last_review_iso (the latter only with `history`)
  - `history` — full review log (extra AnkiConnect call). Each entry has
    an ISO timestamp, an "again"/"hard"/"good"/"easy" rating, interval in
    days, and time taken in ms.
  - `fields` — cleaned, non-empty note field content (extra `notesInfo`
    round trip). Image Occlusion notes collapse to a single placeholder.
  - `all` — shorthand for every category above.

Default when `properties` is None: `["identity", "state", "scheduling"]`.

`include_history=True` is kept as a soft-deprecated alias — equivalent to
adding `"history"` to `properties`. Prefer the new param going forward.

Args:
    card_ids: List of card IDs to inspect.
    note_ids: List of note IDs; expands to every card on those notes.
    properties: List of property categories to include.
    include_history: Soft-deprecated alias for `properties=["history", ...]`.
update_note_fieldsB

Update the text content of one or more fields on an existing note.

Only fields you pass in are changed; omitted fields are left alone. MathJax
(`<math>...</math>`) and code blocks/inline code are auto-converted to the
same HTML representations used by `add_note`.

Args:
    note_id: Anki note ID (not a card ID).
    fields: Mapping of field name -> new value.
update_note_tagsA

Add and/or remove tags on one or more notes.

Tags MUST NOT appear in both `add` and `remove`. At least one of the two lists
must be non-empty.

Args:
    note_ids: Note IDs to modify.
    add: Tags to add (each tag should not contain spaces).
    remove: Tags to remove.
set_suspendedA

Suspend or unsuspend one or more cards.

Args:
    card_ids: Card IDs to act on (not note IDs).
    suspended: True to suspend, False to unsuspend.
change_deckA

Move cards into a different deck.

Operates on card IDs (AnkiConnect's `changeDeck` is card-scoped). If you only
have note IDs, call `inspect_cards(note_ids=...)` first — a single note's cards
can legitimately live in different decks, so this tool never silently expands
notes into cards.

Args:
    card_ids: Card IDs to move.
    deck: Target deck name (e.g. "Spanish::Verbs").
reschedule_cardsA

Manipulate the scheduling state of one or more cards.

Modes:
- `set_due`: Set the cards' due date. Requires `due`. Accepts AnkiConnect's
  `setDueDate` spec:
    * "1"   → due 1 day from now
    * "1-7" → randomly due between 1 and 7 days from now
    * "3!"  → due in 3 days AND reset interval to 3
- `forget`: Reset cards to the "new" queue (re-enters the learning pipeline).
- `relearn`: Move cards into the relearning queue.

Args:
    card_ids: Card IDs to reschedule.
    mode: One of "set_due", "forget", "relearn".
    due: Required for `mode="set_due"`; ignored otherwise.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/samefarrar/mcp-ankiconnect'

If you have feedback or need assistance with the MCP directory API, please join our Discord server