Skip to main content
Glama

add_notes

Add notes to Anki decks using specified models, fields, and tags. Streamline card creation with structured input for efficient study material organization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
notesYesArray of notes to add

Implementation Reference

  • Registration of the 'add_notes' MCP tool, including input schema (array of notes with deck/model/fields/tags) and handler that formats and calls ankiClient.note.addNotes in batch, reporting success/failure counts.
    server.tool( 'add_notes', { notes: z .array( z.object({ deckName: z.string().describe('Name of the deck to add the note to'), modelName: z.string().describe('Name of the note model/type'), 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'), }) ) .describe('Array of notes to add'), }, async ({ notes }) => { try { const formattedNotes = notes.map((note) => ({ ...note, tags: note.tags || [], })); const results = await ankiClient.note.addNotes({ notes: formattedNotes }); const successCount = results?.filter((result) => result !== null).length || 0; const failureCount = (results?.length || 0) - successCount; return { content: [ { type: 'text', text: `Batch note addition completed. Successfully added: ${successCount} notes, Failed: ${failureCount} notes. Results: ${JSON.stringify(results)}`, }, ], }; } catch (error) { throw new Error( `Failed to add notes: ${error instanceof Error ? error.message : String(error)}` ); } }
  • Input schema definition for the add_notes tool using Zod.
    { notes: z .array( z.object({ deckName: z.string().describe('Name of the deck to add the note to'), modelName: z.string().describe('Name of the note model/type'), 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'), }) ) .describe('Array of notes to add'),
  • The handler function for add_notes: processes input notes array, ensures tags, calls underlying ankiClient batch add, computes stats, returns formatted response.
    async ({ notes }) => { try { const formattedNotes = notes.map((note) => ({ ...note, tags: note.tags || [], })); const results = await ankiClient.note.addNotes({ notes: formattedNotes }); const successCount = results?.filter((result) => result !== null).length || 0; const failureCount = (results?.length || 0) - successCount; return { content: [ { type: 'text', text: `Batch note addition completed. Successfully added: ${successCount} notes, Failed: ${failureCount} notes. Results: ${JSON.stringify(results)}`, }, ], }; } catch (error) { throw new Error( `Failed to add notes: ${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