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
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the operation is a 'get' (read-only) and describes the return format, but doesn't mention potential limitations like pagination, rate limits, permissions needed, or what happens with empty/no decks. It provides basic behavioral context but lacks depth.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with zero waste: first states purpose, second specifies return format. Front-loaded with the core action, no redundant information, and appropriately sized for a simple tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter read tool with no annotations and no output schema, the description covers purpose and return format adequately. However, it lacks details on error cases, empty responses, or performance characteristics that would help an agent use it robustly. It's minimally complete but has gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0 parameters and 100% schema description coverage, the baseline is 4. The description doesn't need to explain parameters, and it appropriately focuses on the tool's purpose and output instead.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Gets'), resource ('complete list of deck names and their respective IDs'), and output format ('dictionary mapping deck names to their IDs'). It distinguishes from sibling 'deck_deckNames' by specifying it returns both names AND IDs, not just names.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context (when you need both deck names and IDs), but doesn't explicitly state when NOT to use it or name alternatives. It differentiates from 'deck_deckNames' by mentioning IDs, providing some guidance on tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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