Skip to main content
Glama

deck_createDeck

Create a new empty Anki flashcard deck by specifying its name. The tool prevents overwriting existing decks and returns the unique deck ID upon successful creation.

Instructions

Creates a new empty deck. Will not overwrite an existing deck with the same name. Returns the ID of the created deck.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deckYesThe name of the deck to create (e.g., 'Japanese::Tokyo').

Implementation Reference

  • The core handler function for the 'deck_createDeck' tool (local name 'createDeck'), which creates a new Anki deck using the AnkiConnect API. Includes inline schema via Annotated and Field.
    @deck_mcp.tool( name="createDeck", description="Creates a new empty deck. Will not overwrite an existing deck with the same name. Returns the ID of the created deck.", ) async def create_deck_tool( deck: Annotated[ str, Field(description="The name of the deck to create (e.g., 'Japanese::Tokyo')."), ], ) -> int: return await anki_call("createDeck", deck=deck)
  • Registration of service MCPS into the main anki_mcp, specifically the 'deck' namespace import which prefixes deck_mcp tools like 'createDeck' to become 'deck_createDeck'.
    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)
  • The supporting anki_call utility function that performs HTTP requests to AnkiConnect API, used by the deck_createDeck handler.
    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 deck_mcp FastMCP instance where the deck_createDeck tool is defined via decorator.
    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