Skip to main content
Glama

card_reviews

Fetch card reviews from a specified deck in Anki MCP, starting from a given Unix time, to track and manage learning progress efficiently.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deckYesName of the deck to get reviews for
startIDYesLatest unix time not included in the result

Implementation Reference

  • Registers the 'card_reviews' MCP tool, including input schema (deck name and start timestamp) and handler function that fetches reviews via ankiClient.statistic.cardReviews and returns formatted text content with JSON data.
    'card_reviews', { deck: z.string().describe('Name of the deck to get reviews for'), startID: z.number().describe('Latest unix time not included in the result'), }, async ({ deck, startID }) => { try { const reviews = await ankiClient.statistic.cardReviews({ deck, startID }); return { content: [ { type: 'text', text: `Found ${reviews.length} card reviews for deck "${deck}" after timestamp ${startID}`, }, { type: 'text', text: JSON.stringify(reviews, null, 2), }, ], }; } catch (error) { throw new Error( `Failed to get card reviews for deck "${deck}": ${error instanceof Error ? error.message : String(error)}` ); } } );
  • The core handler function for the 'card_reviews' tool. It calls the Anki statistic API to retrieve card reviews for the specified deck after the given start timestamp and formats the response as MCP content.
    async ({ deck, startID }) => { try { const reviews = await ankiClient.statistic.cardReviews({ deck, startID }); return { content: [ { type: 'text', text: `Found ${reviews.length} card reviews for deck "${deck}" after timestamp ${startID}`, }, { type: 'text', text: JSON.stringify(reviews, null, 2), }, ], }; } catch (error) { throw new Error( `Failed to get card reviews for deck "${deck}": ${error instanceof Error ? error.message : String(error)}` ); } }
  • Input schema for the 'card_reviews' tool using Zod: requires 'deck' (string) and 'startID' (number, unix timestamp).
    { deck: z.string().describe('Name of the deck to get reviews for'), startID: z.number().describe('Latest unix time not included in the result'), },
  • Related MCP resource 'card_reviews' that provides card reviews data via URI template, using the same underlying ankiClient.statistic.cardReviews method.
    server.resource( 'card_reviews', new ResourceTemplate('anki:///statistics/decks/{deckName}/reviews/{startID}', { list: undefined, }), async (uri, { deckName, startID }) => { const deckNameString = Array.isArray(deckName) ? deckName[0] : deckName; const startIDString = Array.isArray(startID) ? startID[0] : startID; if (!deckNameString) { throw new Error('Deck name is required'); } if (!startIDString) { throw new Error('Start ID is required'); } const startIDNumber = parseInt(startIDString, 10); if (isNaN(startIDNumber)) { throw new Error(`Invalid start ID: ${startIDString}`); } try { const reviews = await ankiClient.statistic.cardReviews({ deck: deckNameString, startID: startIDNumber, }); return { contents: [ { uri: uri.href, mimeType: 'application/json', text: JSON.stringify(reviews, null, 2), }, ], }; } catch (error) { throw new Error( `Failed to get card reviews for deck "${deckNameString}": ${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