find_cards
Search and retrieve specific cards in Anki using a custom query. Input a search string to locate relevant flashcards for efficient review and organization.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Anki search query to find cards |
Implementation Reference
- src/tools/cards.ts:50-71 (registration)The complete registration of the 'find_cards' tool using server.tool(), including the input schema (query: z.string()) and the handler function that executes ankiClient.card.findCards({ query }) to retrieve matching card IDs and formats the response.'find_cards', { query: z.string().describe('Anki search query to find cards'), }, async ({ query }) => { try { const cardIds = await ankiClient.card.findCards({ query }); return { content: [ { type: 'text', text: `Found ${cardIds.length} cards matching query "${query}": ${JSON.stringify(cardIds)}`, }, ], }; } catch (error) { throw new Error( `Failed to find cards: ${error instanceof Error ? error.message : String(error)}` ); } } );
- src/tools/cards.ts:54-70 (handler)The handler function for the 'find_cards' tool, which takes a query string, calls the Anki API via ankiClient.card.findCards, and returns a formatted text response with the list of found card IDs.async ({ query }) => { try { const cardIds = await ankiClient.card.findCards({ query }); return { content: [ { type: 'text', text: `Found ${cardIds.length} cards matching query "${query}": ${JSON.stringify(cardIds)}`, }, ], }; } catch (error) { throw new Error( `Failed to find cards: ${error instanceof Error ? error.message : String(error)}` ); } }
- src/tools/cards.ts:51-53 (schema)The Zod input schema for the 'find_cards' tool, defining a single 'query' parameter as a string describing the Anki search query.{ query: z.string().describe('Anki search query to find cards'), },