check_cards_suspended
Identify and verify suspended card IDs on Anki MCP by inputting an array of card IDs for accurate status checks.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cardIds | Yes | Array of card IDs to check |
Implementation Reference
- src/tools/cards.ts:135-157 (handler)Handler function that executes the 'check_cards_suspended' tool logic: queries Anki via ankiClient to check suspension status for given card IDs, computes count, and returns formatted text response with details.async ({ cardIds }) => { try { const areSuspended = await ankiClient.card.areSuspended({ cards: cardIds }); const result = cardIds.map((cardId, index) => ({ cardId, isSuspended: areSuspended[index], })); const suspendedCount = areSuspended.filter((status) => status === true).length; return { content: [ { type: 'text', text: `${suspendedCount} out of ${cardIds.length} cards are suspended. Details: ${JSON.stringify(result)}`, }, ], }; } catch (error) { throw new Error( `Failed to check if cards are suspended: ${error instanceof Error ? error.message : String(error)}` ); } }
- src/tools/cards.ts:132-134 (schema)Input schema using Zod for validating the 'cardIds' parameter as an array of numbers.{ cardIds: z.array(z.number()).describe('Array of card IDs to check'), },
- src/tools/cards.ts:131-158 (registration)MCP tool registration call using server.tool(), specifying the tool name, input schema, and handler function.'check_cards_suspended', { cardIds: z.array(z.number()).describe('Array of card IDs to check'), }, async ({ cardIds }) => { try { const areSuspended = await ankiClient.card.areSuspended({ cards: cardIds }); const result = cardIds.map((cardId, index) => ({ cardId, isSuspended: areSuspended[index], })); const suspendedCount = areSuspended.filter((status) => status === true).length; return { content: [ { type: 'text', text: `${suspendedCount} out of ${cardIds.length} cards are suspended. Details: ${JSON.stringify(result)}`, }, ], }; } catch (error) { throw new Error( `Failed to check if cards are suspended: ${error instanceof Error ? error.message : String(error)}` ); } } );