Skip to main content
Glama

model_modelNamesAndIds

Retrieve all Anki note type names with their corresponding IDs to manage and organize flashcard templates effectively.

Instructions

Gets the complete list of model (note type) names and their IDs. Returns a dictionary mapping model names to IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'model_modelNamesAndIds' tool. It invokes the AnkiConnect 'modelNamesAndIds' action via anki_call to fetch model names and IDs.
    @model_mcp.tool(
        name="modelNamesAndIds",
        description="Gets the complete list of model (note type) names and their IDs. Returns a dictionary mapping model names to IDs.",
    )
    async def list_model_names_and_ids_tool() -> Dict[str, int]:
        return await anki_call("modelNamesAndIds")
  • Registers the model_mcp FastMCP instance with the prefix 'model' to the main anki_mcp server, resulting in tools prefixed like 'model_modelNamesAndIds'.
    await anki_mcp.import_server("model", model_mcp)
  • Defines the tool schema via FastMCP decorator: no input parameters, returns Dict[str, int] of model names to IDs.
    @model_mcp.tool(
        name="modelNamesAndIds",
        description="Gets the complete list of model (note type) names and their IDs. Returns a dictionary mapping model names to IDs.",
    )
    async def list_model_names_and_ids_tool() -> Dict[str, int]:
        return await anki_call("modelNamesAndIds")
  • Helper function used by the handler to make HTTP POST requests to 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                                                                        
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the return type ('dictionary mapping model names to IDs'), which is useful behavioral context. However, it does not mention potential limitations like rate limits, permissions needed, or whether the list is cached, leaving some gaps in transparency for a read operation.

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?

The description is two concise sentences that are front-loaded with the core purpose and follow with return details. Every word adds value without redundancy, making it efficient and easy to parse for an AI agent.

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

Completeness4/5

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

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is mostly complete: it states the purpose and return format. However, it could improve by mentioning any prerequisites or behavioral traits (e.g., if it requires specific permissions), but for a straightforward read operation, it is largely adequate.

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?

The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description appropriately does not discuss parameters, focusing instead on the tool's purpose and output, which aligns with the baseline expectation for parameterless tools.

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 tool's purpose with a specific verb ('Gets') and resource ('complete list of model (note type) names and their IDs'), and distinguishes it from siblings like 'model_findModelsByName' (which searches) and 'model_modelFieldNames' (which focuses on fields). It precisely defines what the tool does without ambiguity.

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 for retrieving all model names and IDs, which is clear in context, but does not explicitly state when to use this tool versus alternatives like 'model_findModelsByName' (for searching) or 'deck_deckNamesAndIds' (for decks). It provides adequate context but lacks explicit exclusions or comparisons.

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