Skip to main content
Glama

multi

Execute multiple AnkiConnect actions sequentially to automate Anki tasks like creating decks, adding notes, managing cards, and syncing collections in a single operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionsYesArray of AnkiConnect actions to execute in sequence. Example: [{"action": "createDeck", "params": {"deck": "My Deck"}}, {"action": "addNote", "params": {"note": {...}}}]

Implementation Reference

  • Full registration of the 'multi' tool using server.tool(), which registers the tool name, input schema for batch actions, and the handler function.
    server.tool( 'multi', { actions: z .array( z.object({ action: z .enum([ // Card Actions 'answerCards', 'areDue', 'areSuspended', 'cardsInfo', 'cardsModTime', 'cardsToNotes', 'findCards', 'forgetCards', 'getEaseFactors', 'getIntervals', 'relearnCards', 'setDueDate', 'setEaseFactors', 'setSpecificValueOfCard', 'suspend', 'suspended', 'unsuspend', // Deck Actions 'changeDeck', 'cloneDeckConfigId', 'createDeck', 'deckNames', 'deckNamesAndIds', 'deleteDecks', 'getDeckConfig', 'getDecks', 'getDeckStats', 'removeDeckConfigId', 'saveDeckConfig', 'setDeckConfigId', // Note Actions 'addNote', 'addNotes', 'addTags', 'canAddNotes', 'canAddNotesWithErrorDetail', 'clearUnusedTags', 'deleteNotes', 'findNotes', 'getNoteTags', 'getTags', 'notesInfo', 'notesModTime', 'removeEmptyNotes', 'removeTags', 'replaceTags', 'replaceTagsInAllNotes', 'updateNote', 'updateNoteFields', 'updateNoteModel', 'updateNoteTags', // Model Actions 'createModel', 'findAndReplaceInModels', 'findModelsById', 'findModelsByName', 'modelFieldAdd', 'modelFieldDescriptions', 'modelFieldFonts', 'modelFieldNames', 'modelFieldRemove', 'modelFieldRename', 'modelFieldReposition', 'modelFieldSetDescription', 'modelFieldSetFont', 'modelFieldSetFontSize', 'modelFieldsOnTemplates', 'modelNames', 'modelNamesAndIds', 'modelStyling', 'modelTemplateAdd', 'modelTemplateRemove', 'modelTemplateRename', 'modelTemplateReposition', 'modelTemplates', 'updateModelStyling', 'updateModelTemplates', // Media Actions 'deleteMediaFile', 'getMediaDirPath', 'getMediaFilesNames', 'retrieveMediaFile', 'storeMediaFile', // Statistics Actions 'cardReviews', 'getCollectionStatsHTML', 'getLatestReviewID', 'getNumCardsReviewedByDay', 'getNumCardsReviewedToday', 'getReviewsOfCards', 'insertReviews', // Graphical Actions 'guiAddCards', 'guiAnswerCard', 'guiBrowse', 'guiCheckDatabase', 'guiCurrentCard', 'guiDeckBrowser', 'guiDeckOverview', 'guiDeckReview', 'guiEditNote', 'guiExitAnki', 'guiImportFile', 'guiSelectCard', 'guiSelectedNotes', 'guiSelectNote', 'guiShowAnswer', 'guiShowQuestion', 'guiStartCardTimer', 'guiUndo', // Miscellaneous Actions 'apiReflect', 'exportPackage', 'getActiveProfile', 'getProfiles', 'importPackage', 'loadProfile', 'multi', 'reloadCollection', 'requestPermission', 'sync', 'version', ]) .describe('Name of the AnkiConnect action to execute'), params: z .record(z.any()) .optional() .describe( 'Parameters object for the action (structure depends on the specific action)' ), version: z .number() .optional() .default(6) .describe('API version for the action (defaults to 6)'), }) ) .describe( 'Array of AnkiConnect actions to execute in sequence. Example: [{"action": "createDeck", "params": {"deck": "My Deck"}}, {"action": "addNote", "params": {"note": {...}}}]' ), }, async ({ actions }) => { try { // Type assertion needed due to yanki-connect's strict typing for action names const results = await ankiClient.miscellaneous.multi({ actions: actions as Array<{ action: any; params?: any; version?: number; }>, }); return { content: [ { type: 'text', text: `Multi-action results: ${JSON.stringify(results, null, 2)}`, }, ], }; } catch (error) { throw new Error( `Failed to execute multi-action: ${error instanceof Error ? error.message : String(error)}` ); } } );
  • The execution handler for the 'multi' tool. It calls ankiClient.miscellaneous.multi with the provided actions array and formats the results as a text response.
    async ({ actions }) => { try { // Type assertion needed due to yanki-connect's strict typing for action names const results = await ankiClient.miscellaneous.multi({ actions: actions as Array<{ action: any; params?: any; version?: number; }>, }); return { content: [ { type: 'text', text: `Multi-action results: ${JSON.stringify(results, null, 2)}`, }, ], }; } catch (error) { throw new Error( `Failed to execute multi-action: ${error instanceof Error ? error.message : String(error)}` ); } }
  • Zod schema for the 'multi' tool input, validating an array of action objects each with 'action' (enum of all AnkiConnect actions), optional 'params', and 'version'.
    { actions: z .array( z.object({ action: z .enum([ // Card Actions 'answerCards', 'areDue', 'areSuspended', 'cardsInfo', 'cardsModTime', 'cardsToNotes', 'findCards', 'forgetCards', 'getEaseFactors', 'getIntervals', 'relearnCards', 'setDueDate', 'setEaseFactors', 'setSpecificValueOfCard', 'suspend', 'suspended', 'unsuspend', // Deck Actions 'changeDeck', 'cloneDeckConfigId', 'createDeck', 'deckNames', 'deckNamesAndIds', 'deleteDecks', 'getDeckConfig', 'getDecks', 'getDeckStats', 'removeDeckConfigId', 'saveDeckConfig', 'setDeckConfigId', // Note Actions 'addNote', 'addNotes', 'addTags', 'canAddNotes', 'canAddNotesWithErrorDetail', 'clearUnusedTags', 'deleteNotes', 'findNotes', 'getNoteTags', 'getTags', 'notesInfo', 'notesModTime', 'removeEmptyNotes', 'removeTags', 'replaceTags', 'replaceTagsInAllNotes', 'updateNote', 'updateNoteFields', 'updateNoteModel', 'updateNoteTags', // Model Actions 'createModel', 'findAndReplaceInModels', 'findModelsById', 'findModelsByName', 'modelFieldAdd', 'modelFieldDescriptions', 'modelFieldFonts', 'modelFieldNames', 'modelFieldRemove', 'modelFieldRename', 'modelFieldReposition', 'modelFieldSetDescription', 'modelFieldSetFont', 'modelFieldSetFontSize', 'modelFieldsOnTemplates', 'modelNames', 'modelNamesAndIds', 'modelStyling', 'modelTemplateAdd', 'modelTemplateRemove', 'modelTemplateRename', 'modelTemplateReposition', 'modelTemplates', 'updateModelStyling', 'updateModelTemplates', // Media Actions 'deleteMediaFile', 'getMediaDirPath', 'getMediaFilesNames', 'retrieveMediaFile', 'storeMediaFile', // Statistics Actions 'cardReviews', 'getCollectionStatsHTML', 'getLatestReviewID', 'getNumCardsReviewedByDay', 'getNumCardsReviewedToday', 'getReviewsOfCards', 'insertReviews', // Graphical Actions 'guiAddCards', 'guiAnswerCard', 'guiBrowse', 'guiCheckDatabase', 'guiCurrentCard', 'guiDeckBrowser', 'guiDeckOverview', 'guiDeckReview', 'guiEditNote', 'guiExitAnki', 'guiImportFile', 'guiSelectCard', 'guiSelectedNotes', 'guiSelectNote', 'guiShowAnswer', 'guiShowQuestion', 'guiStartCardTimer', 'guiUndo', // Miscellaneous Actions 'apiReflect', 'exportPackage', 'getActiveProfile', 'getProfiles', 'importPackage', 'loadProfile', 'multi', 'reloadCollection', 'requestPermission', 'sync', 'version', ]) .describe('Name of the AnkiConnect action to execute'), params: z .record(z.any()) .optional() .describe( 'Parameters object for the action (structure depends on the specific action)' ), version: z .number() .optional() .default(6) .describe('API version for the action (defaults to 6)'), }) ) .describe( 'Array of AnkiConnect actions to execute in sequence. Example: [{"action": "createDeck", "params": {"deck": "My Deck"}}, {"action": "addNote", "params": {"note": {...}}}]' ), },

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