Skip to main content
Glama

check_cards_due

Identify cards with upcoming review dates by providing an array of card IDs, helping users manage their study schedule on the Anki MCP server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cardIdsYesArray of card IDs to check

Implementation Reference

  • Handler function that executes the logic for the 'check_cards_due' tool. It uses ankiClient to check if the provided card IDs are due and returns a formatted response with details.
    async ({ cardIds }) => { try { const areDue = await ankiClient.card.areDue({ cards: cardIds }); const result = cardIds.map((cardId, index) => ({ cardId, isDue: areDue[index], })); const dueCount = areDue.filter(Boolean).length; return { content: [ { type: 'text', text: `${dueCount} out of ${cardIds.length} cards are due. Details: ${JSON.stringify(result)}`, }, ], }; } catch (error) { throw new Error( `Failed to check if cards are due: ${error instanceof Error ? error.message : String(error)}` ); } }
  • Input schema validation for the 'check_cards_due' tool using Zod, requiring an array of numeric card IDs.
    { cardIds: z.array(z.number()).describe('Array of card IDs to check'), },
  • Registration of the 'check_cards_due' tool on the MCP server within the registerCardTools function, specifying the tool name, input schema, and handler.
    server.tool( 'check_cards_due', { cardIds: z.array(z.number()).describe('Array of card IDs to check'), }, async ({ cardIds }) => { try { const areDue = await ankiClient.card.areDue({ cards: cardIds }); const result = cardIds.map((cardId, index) => ({ cardId, isDue: areDue[index], })); const dueCount = areDue.filter(Boolean).length; return { content: [ { type: 'text', text: `${dueCount} out of ${cardIds.length} cards are due. Details: ${JSON.stringify(result)}`, }, ], }; } catch (error) { throw new Error( `Failed to check if cards are due: ${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