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
| Name | Required | Description | Default |
|---|---|---|---|
| cardIds | Yes | Array of card IDs to check |
Implementation Reference
- src/tools/cards.ts:104-126 (handler)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)}` ); } }
- src/tools/cards.ts:101-103 (schema)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'), },
- src/tools/cards.ts:99-127 (registration)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)}` ); } } );