Skip to main content
Glama

anki_add_note

Add a flashcard to a specified Anki deck by providing the deck name, front, and back content for the note. Integrates with Anki via the AnkiConnect plugin.

Instructions

Add a flashcard to an Anki deck

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
backYesBack of the flashcard
deckNameYesThe target deck name
frontYesFront of the flashcard

Implementation Reference

  • src/index.ts:169-172 (registration)
    Registration of the 'addNote' tool in the ListToolsRequestSchema handler, defining its name, description, and input schema.
    { name: "addNote", description: "Create a single note", inputSchema: noteParameters,
  • Input schema definition (noteParameters) used by the 'addNote' tool for validating deckName, modelName, fields, and optional tags.
    const noteParameters = { type: "object", properties: { deckName: { type: "string", description: "Name of the deck to add note to", }, modelName: { type: "string", description: "Name of the note model/type to use", }, fields: { type: "object", description: "Map of fields to the value in the note model being used", }, tags: { type: "array", items: { type: "string", }, description: "Tags to apply to the note", }, }, required: ["deckName", "modelName", "fields"], };
  • Handler logic for the 'addNote' tool within the CallToolRequestSchema handler. It wraps arguments in {note: ...} and calls AnkiConnect's 'addNote' action via ankiRequest, returning the created note ID.
    case "addNote": const createdNoteId = await ankiRequest<number>( "addNote", { note: request.params.arguments }, ); return { toolResult: `Created note with the following ID: ${createdNoteId}`, };
  • Helper function 'ankiRequest' used by the 'addNote' handler to make API calls to AnkiConnect at localhost:8765.
    async function ankiRequest<T>(action: string, params: any = {}): Promise<T> { const response = await fetch("http://localhost:8765", { method: "POST", body: JSON.stringify({ action, version: 6, params, }), }); const { result } = (await response.json()) as AnkiRequestResult<T>; return result; }

Other Tools

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

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