Skip to main content
Glama

deck_deckNamesAndIds

Retrieve all deck names and their corresponding IDs to identify and manage Anki flashcard collections.

Instructions

Gets the complete list of deck names and their respective IDs. Returns a dictionary mapping deck names to their IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the tool 'deckNamesAndIds' (prefixed to 'deck_deckNamesAndIds'), which calls the AnkiConnect API to retrieve deck names and IDs.
    @deck_mcp.tool( name="deckNamesAndIds", description="Gets the complete list of deck names and their respective IDs. Returns a dictionary mapping deck names to their IDs.", ) async def list_deck_names_and_ids_tool() -> Dict[str, int]: return await anki_call("deckNamesAndIds")
  • Registers the deck_mcp tools with the 'deck' prefix, making 'deckNamesAndIds' available as 'deck_deckNamesAndIds'.
    await anki_mcp.import_server("deck", deck_mcp)
  • Utility function used by the handler to make asynchronous HTTP requests to the AnkiConnect server.
    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
  • Imports the deck_mcp instance containing the deck tools.
    from .deck_service import deck_mcp

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