Skip to main content
Glama

add_note

Add a flashcard to an Anki deck with custom fields, tags, and optional images. Supports code formatting, MathJax, and image attachments via URL, file path, or base64 data.

Instructions

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deckNameYes
modelNameYes
fieldsYes
tagsNo
pictureNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description compensates by detailing behavior for image attachment (three methods, preferred path), code formatting, and MathJax. It explains the picture parameter structure and important preferences. It does not mention side effects like triggering reviews or potential errors, but the coverage is good.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is relatively long but well-structured with examples and sections. It front-loads the purpose and then details usage. Some redundancy exists (e.g., repeating the picture structure), but it is organized. It could be more concise without losing clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of the tool (5 parameters, nested objects, no output schema in view), the description is quite complete. It covers all parameters, image handling, formatting, and use conditions. It lacks details on return values, but since an output schema exists (per context), this may be acceptable. Overall, it enables correct usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description explains all parameters: deckName and modelName as strings, fields as a dict, tags as optional list, and picture as a list of dicts with detailed sub-fields (filename, url, path, data, fields, skipHash). This adds significant meaning beyond the sparse input schema, which has 0% description coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Add a flashcard to Anki', which directly conveys the tool's purpose. The verb 'add' and resource 'flashcard' are specific. However, it does not explicitly differentiate from sibling tools like 'update_note_fields' or 'search_notes', though the action is distinct.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description instructs users to look at examples and get approval before adding a flashcard, providing clear usage conditions. It also includes detailed guidelines for code and MathJax formatting. However, it does not mention when not to use the tool or suggest alternatives like 'update_note_fields' for modifying existing notes.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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