Skip to main content
Glama

deck_deleteDecks

Delete specified Anki decks and their associated cards by providing deck names and confirming card deletion. Streamlines deck management within Anki-MCP server.

Instructions

Deletes decks with the given names. The 'cardsToo' argument must be specified and set to true.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cardsTooYesMust be true to confirm deletion of cards within the decks.
decksYesA list of deck names to delete.

Implementation Reference

  • The handler function for the 'deck_deleteDecks' tool (prefixed name). It validates that cardsToo is true and proxies the call to AnkiConnect's deleteDecks API.
    @deck_mcp.tool( name="deleteDecks", description="Deletes decks with the given names. The 'cardsToo' argument must be specified and set to true.", ) async def delete_decks_tool( decks: Annotated[List[str], Field(description="A list of deck names to delete.")], cardsToo: Annotated[ bool, Field( description="Must be true to confirm deletion of cards within the decks." ), ], ) -> None: if not cardsToo: raise ValueError("cardsToo must be true to delete decks.") return await anki_call("deleteDecks", decks=decks, cardsToo=cardsToo)
  • Registration of the deck_mcp server into the main anki_mcp with 'deck' prefix, making tools available as 'deck_*' (e.g., deck_deleteDecks).
    async def setup(run_server: bool = True): await anki_mcp.import_server("deck", deck_mcp) await anki_mcp.import_server("note", note_mcp) await anki_mcp.import_server("card", card_mcp) await anki_mcp.import_server("model", model_mcp) await anki_mcp.import_server("media", media_mcp)
  • Helper function used by the tool handler to make HTTP calls to AnkiConnect API.
    async def anki_call(action: str, **params: Any) -> Any: async with httpx.AsyncClient() as client: payload = {"action": action, "version": 6, "params": params} result = await client.post(ANKICONNECT_URL, json=payload) result.raise_for_status() result_json = result.json() error = result_json.get("error") if error: raise Exception(f"AnkiConnect error for action '{action}': {error}") response = result_json.get("result") if "result" in result_json: return response return result_json
  • Creation of the sub-MCP instance where deck tools like deleteDecks are registered.
    deck_mcp = FastMCP(name="AnkiDeckService")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ujisati/anki-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server