set_card_specific_values
Modify specific properties of an Anki card by setting new values for selected keys, such as due date, interval, or queue status, using the card ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cardId | Yes | Card ID to modify | |
| keys | Yes | Array of card property keys to modify | |
| newValues | Yes | Array of new values (must match the length of keys) |
Implementation Reference
- src/tools/cards.ts:494-521 (handler)Handler function that executes the tool: validates input lengths, calls ankiClient.card.setSpecificValueOfCard to update card properties, and returns success status.async ({ cardId, keys, newValues }) => { try { if (keys.length !== newValues.length) { throw new Error('Number of keys must match number of new values'); } const results = await ankiClient.card.setSpecificValueOfCard({ card: cardId, keys, newValues, }); const successCount = results.filter(Boolean).length; return { content: [ { type: 'text', text: `Successfully updated ${successCount} out of ${keys.length} values for card ${cardId}`, }, ], }; } catch (error) { throw new Error( `Failed to set card values: ${error instanceof Error ? error.message : String(error)}` ); } } );
- src/tools/cards.ts:465-493 (schema)Input schema using Zod: cardId (number), keys (array of enum card properties), newValues (array of strings matching keys length).{ cardId: z.number().describe('Card ID to modify'), keys: z .array( z.enum([ 'data', 'did', 'due', 'factor', 'flags', 'id', 'ivl', 'lapses', 'left', 'mod', 'odid', 'odue', 'ord', 'queue', 'reps', 'type', 'usn', ]) ) .describe('Array of card property keys to modify'), newValues: z .array(z.string()) .describe('Array of new values (must match the length of keys)'), },
- src/tools/cards.ts:463-521 (registration)Registration of the tool using server.tool(), including name, input schema, and handler function.server.tool( 'set_card_specific_values', { cardId: z.number().describe('Card ID to modify'), keys: z .array( z.enum([ 'data', 'did', 'due', 'factor', 'flags', 'id', 'ivl', 'lapses', 'left', 'mod', 'odid', 'odue', 'ord', 'queue', 'reps', 'type', 'usn', ]) ) .describe('Array of card property keys to modify'), newValues: z .array(z.string()) .describe('Array of new values (must match the length of keys)'), }, async ({ cardId, keys, newValues }) => { try { if (keys.length !== newValues.length) { throw new Error('Number of keys must match number of new values'); } const results = await ankiClient.card.setSpecificValueOfCard({ card: cardId, keys, newValues, }); const successCount = results.filter(Boolean).length; return { content: [ { type: 'text', text: `Successfully updated ${successCount} out of ${keys.length} values for card ${cardId}`, }, ], }; } catch (error) { throw new Error( `Failed to set card values: ${error instanceof Error ? error.message : String(error)}` ); } } );