delete_decks
Remove specified Anki decks and optionally delete associated cards to manage and organize your study materials efficiently.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deckNames | Yes | Array of deck names to delete | |
| deleteCards | No | Whether to delete the cards in the decks as well |
Implementation Reference
- src/tools/decks.ts:35-64 (registration)Full registration of the 'delete_decks' MCP tool, including Zod input schema and async handler function that deletes specified decks (optionally including cards) via ankiClient.deck.deleteDecks and returns success message.server.tool( 'delete_decks', { deckNames: z.array(z.string()).describe('Array of deck names to delete'), deleteCards: z .boolean() .default(true) .describe('Whether to delete the cards in the decks as well'), }, async ({ deckNames, deleteCards }) => { try { await ankiClient.deck.deleteDecks({ decks: deckNames, cardsToo: deleteCards as true, // Type assertion needed due to yanki-connect's strict typing }); return { content: [ { type: 'text', text: `Successfully deleted decks: ${deckNames.join(', ')}${deleteCards ? ' (including cards)' : ' (cards preserved)'}`, }, ], }; } catch (error) { throw new Error( `Failed to delete decks "${deckNames.join(', ')}": ${error instanceof Error ? error.message : String(error)}` ); } } );