add_card
Create flashcards in Anki using HTML formatting for front and back content to support spaced repetition learning.
Instructions
Create a new flashcard in Anki for the user. Must use HTML formatting only. IMPORTANT FORMATTING RULES:
Must use HTML tags for ALL formatting - NO markdown
Use for ALL line breaks
For code blocks, use with inline CSS styling
Example formatting:
Line breaks:
Code:
Lists: and tags
Bold:
Italic:
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| front | Yes | The front of the card. Must use HTML formatting only. | |
| back | Yes | The back of the card. Must use HTML formatting only. |
Implementation Reference
- index.ts:256-280 (handler)Executes the add_card tool: creates a new Anki note with HTML-formatted front and back content in the Default deck (Basic model), adds it via client.note.addNote, retrieves the cardId via query on noteId, returns confirmation.case "add_card": { const front = String(args.front); const back = String(args.back); const note = { note: { deckName: 'Default', fields: { Back: back, Front: front, }, modelName: 'Basic', }, }; const noteId = await client.note.addNote(note); const cardId = (await client.card.findCards({ query: `nid:${noteId}` }))[0]; return { content: [{ type: "text", text: `Created card with id ${cardId}` }] }; }
- index.ts:173-190 (registration)Tool registration including name, detailed description with HTML formatting instructions, and input schema defining required 'front' and 'back' string properties.{ name: "add_card", description: "Create a new flashcard in Anki for the user. Must use HTML formatting only. IMPORTANT FORMATTING RULES:\n1. Must use HTML tags for ALL formatting - NO markdown\n2. Use <br> for ALL line breaks\n3. For code blocks, use <pre> with inline CSS styling\n4. Example formatting:\n - Line breaks: <br>\n - Code: <pre style=\"background-color: transparent; padding: 10px; border-radius: 5px;\">\n - Lists: <ol> and <li> tags\n - Bold: <strong>\n - Italic: <em>", inputSchema: { type: "object", properties: { front: { type: "string", description: "The front of the card. Must use HTML formatting only." }, back: { type: "string", description: "The back of the card. Must use HTML formatting only." } }, required: ["front", "back"] } },
- index.ts:176-189 (schema)Input schema for add_card tool, specifying object with required 'front' and 'back' fields as strings, with descriptions emphasizing HTML-only formatting.inputSchema: { type: "object", properties: { front: { type: "string", description: "The front of the card. Must use HTML formatting only." }, back: { type: "string", description: "The back of the card. Must use HTML formatting only." } }, required: ["front", "back"] }