Skip to main content
Glama

get_cards_intervals

Retrieve study intervals for specified Anki flashcards, returning all intervals or just the most recent based on user preference.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cardIdsYesArray of card IDs to get intervals for
completeNoIf true, returns all intervals; if false, returns only the most recent

Implementation Reference

  • The handler function that implements the core logic of the 'get_cards_intervals' tool. It fetches intervals from Anki via ankiClient and returns formatted results.
    async ({ cardIds, complete = false }) => { try { const intervals = await ankiClient.card.getIntervals({ cards: cardIds, complete }); const result = cardIds.map((cardId, index) => ({ cardId, intervals: intervals[index], })); return { content: [ { type: 'text', text: `Intervals (${complete ? 'complete history' : 'most recent'}): ${JSON.stringify(result, null, 2)}`, }, ], }; } catch (error) { throw new Error( `Failed to get intervals: ${error instanceof Error ? error.message : String(error)}` ); } }
  • The Zod input schema defining parameters for the tool: required array of cardIds and optional complete boolean.
    { cardIds: z.array(z.number()).describe('Array of card IDs to get intervals for'), complete: z .boolean() .optional() .describe('If true, returns all intervals; if false, returns only the most recent'), },
  • The registration of the 'get_cards_intervals' tool using server.tool(), including schema and handler.
    server.tool( 'get_cards_intervals', { cardIds: z.array(z.number()).describe('Array of card IDs to get intervals for'), complete: z .boolean() .optional() .describe('If true, returns all intervals; if false, returns only the most recent'), }, async ({ cardIds, complete = false }) => { try { const intervals = await ankiClient.card.getIntervals({ cards: cardIds, complete }); const result = cardIds.map((cardId, index) => ({ cardId, intervals: intervals[index], })); return { content: [ { type: 'text', text: `Intervals (${complete ? 'complete history' : 'most recent'}): ${JSON.stringify(result, null, 2)}`, }, ], }; } catch (error) { throw new Error( `Failed to get intervals: ${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