Skip to main content
Glama

model_updateModelTemplates

Modify templates for an existing Anki flashcard model to update card layouts and formatting.

Instructions

Modifies the templates of an existing model by name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYesModel object. Must include 'name' (model name) and 'templates' (dict of template name to Front/Back definitions).

Implementation Reference

  • Handler function for the 'model_updateModelTemplates' tool (prefixed during registration). Defines input schema via Pydantic Annotated and Field, and executes by calling AnkiConnect's updateModelTemplates.
    @model_mcp.tool(
        name="updateModelTemplates",
        description="Modifies the templates of an existing model by name.",
    )
    async def update_model_templates_tool(
        model: Annotated[
            Dict[str, Any],
            Field(
                description="Model object. Must include 'name' (model name) and 'templates' (dict of template name to Front/Back definitions)."
            ),
        ],
    ) -> None:
        return await anki_call("updateModelTemplates", model=model)
  • Registers the model_mcp server into the main anki_mcp, prefixing tool names with 'model_' (resulting in 'model_updateModelTemplates').
    await anki_mcp.import_server("model", model_mcp)
  • Helper function used by the handler to make HTTP calls 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                                                                        
  • Imports the model_mcp instance containing the tool definitions.
    from .model_service import model_mcp
Behavior2/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 'modifies' implying a mutation, but doesn't disclose behavioral traits such as required permissions, whether changes are reversible, error handling, or rate limits. This is inadequate for a mutation tool with zero annotation coverage.

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 a single, efficient sentence with zero waste. It's front-loaded and appropriately sized, making it easy to parse quickly without unnecessary details.

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

Completeness2/5

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

Given this is a mutation tool with no annotations, no output schema, and nested parameters, the description is incomplete. It lacks details on behavior, error cases, or what the tool returns, which are critical for safe and effective use by an AI agent.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents the single parameter 'model' with its required fields. The description adds no additional meaning beyond implying the model must exist, which is minimal value. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the action ('modifies') and resource ('templates of an existing model'), making the purpose understandable. It distinguishes from sibling tools like model_createModel (creation) and model_modelTemplates (likely reading), but doesn't explicitly differentiate from model_updateModelStyling, which is similar but for styling rather than templates.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., model must exist), when not to use it, or compare it to related tools like model_updateModelStyling or model_modelTemplates, leaving usage context unclear.

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