Skip to main content
Glama

add_note

Add a note to a specified Anki deck using a chosen note type, input fields, and optional tags for organized learning.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deckNameYesName of the deck to add the note to
fieldsYesObject with field names as keys and field content as values
modelNameYesName of the note model/type (e.g., "Basic", "Cloze")
tagsNoArray of tags to add to the note

Implementation Reference

  • The handler function for the 'add_note' tool that constructs a note and calls ankiClient.note.addNote to add it to Anki, returning success message or throwing error.
    async ({ deckName, modelName, fields, tags }) => { try { const note = { deckName, modelName, fields, tags: tags || [], }; const noteId = await ankiClient.note.addNote({ note }); if (noteId === null) { throw new Error('Failed to add note - possibly a duplicate or invalid fields'); } return { content: [ { type: 'text', text: `Successfully added note with ID: ${noteId}. Deck: "${deckName}", Model: "${modelName}", Tags: [${tags?.join(', ') || 'none'}]`, }, ], }; } catch (error) { throw new Error( `Failed to add note: ${error instanceof Error ? error.message : String(error)}` ); } }
  • Zod input schema for the 'add_note' tool defining parameters: deckName, modelName, fields, and optional tags.
    { deckName: z.string().describe('Name of the deck to add the note to'), modelName: z.string().describe('Name of the note model/type (e.g., "Basic", "Cloze")'), fields: z .record(z.string()) .describe('Object with field names as keys and field content as values'), tags: z.array(z.string()).optional().describe('Array of tags to add to the note'), },
  • Registration of the 'add_note' tool within the registerNoteTools function using server.tool(name, schema, handler). Note: This register function is exported but not called in the main server setup, which uses consolidated tools instead.
    'add_note', { deckName: z.string().describe('Name of the deck to add the note to'), modelName: z.string().describe('Name of the note model/type (e.g., "Basic", "Cloze")'), fields: z .record(z.string()) .describe('Object with field names as keys and field content as values'), tags: z.array(z.string()).optional().describe('Array of tags to add to the note'), }, async ({ deckName, modelName, fields, tags }) => { try { const note = { deckName, modelName, fields, tags: tags || [], }; const noteId = await ankiClient.note.addNote({ note }); if (noteId === null) { throw new Error('Failed to add note - possibly a duplicate or invalid fields'); } return { content: [ { type: 'text', text: `Successfully added note with ID: ${noteId}. Deck: "${deckName}", Model: "${modelName}", Tags: [${tags?.join(', ') || 'none'}]`, }, ], }; } catch (error) { throw new Error( `Failed to add note: ${error instanceof Error ? error.message : String(error)}` ); } } );

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

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