deck_deckNames
Retrieve all deck names for the current user to manage Anki flashcards efficiently. Simplifies access and organization of study materials.
Instructions
Gets the complete list of deck names for the current user. Returns a list of deck names.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/anki_mcp/deck_service.py:29-35 (handler)Handler function for the 'deck_deckNames' tool. It calls `anki_call('deckNames')` to retrieve the list of deck names via AnkiConnect API.@deck_mcp.tool( name="deckNames", description="Gets the complete list of deck names for the current user. Returns a list of deck names.", ) async def list_deck_names_tool() -> List[str]: return await anki_call("deckNames")
- src/anki_mcp/__init__.py:23-23 (registration)Registers all tools from `deck_mcp` (including 'deckNames') under the 'deck_' namespace, making it available as 'deck_deckNames' in the main MCP server.await anki_mcp.import_server("deck", deck_mcp)
- src/anki_mcp/common.py:8-23 (helper)The `anki_call` helper function used by the handler to make HTTP requests to the AnkiConnect API at http://127.0.0.1:8765.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