Skip to main content
Glama

deck_deleteDecks

Delete Anki decks and their cards by specifying deck names and confirming card deletion.

Instructions

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

Input Schema

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

Implementation Reference

  • The handler function `delete_decks_tool` that implements the core logic of the `deck_deleteDecks` tool. It performs validation on the `cardsToo` parameter and invokes the AnkiConnect `deleteDecks` API via `anki_call`.
    @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)
  • Registers the `deck_mcp` tools (including `deleteDecks`) with the `deck_` prefix in the main `anki_mcp` server, resulting in the tool name `deck_deleteDecks`.
    await anki_mcp.import_server("deck", deck_mcp)
  • The `@deck_mcp.tool` decorator that registers the `delete_decks_tool` as the `deleteDecks` tool in the `deck_mcp` FastMCP instance.
    @deck_mcp.tool( name="deleteDecks", description="Deletes decks with the given names. The 'cardsToo' argument must be specified and set to true.",
  • The `anki_call` utility function used by the handler to make HTTP requests to the 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
  • Pydantic schema definitions for the tool's input parameters using Annotated and Field.
    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:

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