Skip to main content
Glama

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:

  1. Must use HTML tags for ALL formatting - NO markdown

  2. Use for ALL line breaks

  3. For code blocks, use with inline CSS styling

  4. Example formatting:

    • Line breaks:

    • Code:

    • Lists: and tags

    • Bold:

    • Italic:

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
frontYesThe front of the card. Must use HTML formatting only.
backYesThe back of the card. Must use HTML formatting only.

Implementation Reference

  • 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"]
      }
    },
  • 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"]
    }

Tool Definition Quality

Score is being calculated. Check back soon.

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/scorzeth/anki-mcp-server'

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