Skip to main content
Glama

model_createModel

Create custom note types in Anki by defining fields and card templates to organize flashcards according to your learning needs.

Instructions

Creates a new model (note type). Returns the created model object.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNameYesThe name for the new model.
inOrderFieldsYesList of field names in order.
cardTemplatesYesList of card template definitions. Each dict needs 'Name', 'Front', 'Back'.
cssNoOptional CSS for the model.
isClozeNoSet to true if this is a Cloze model.
modelIdNoOptional model ID to use.

Implementation Reference

  • Handler function executing the logic for tool 'model_createModel' by calling AnkiConnect's 'createModel' API.
    @model_mcp.tool(
        name="createModel",
        description="Creates a new model (note type). Returns the created model object.",
    )
    async def create_model_tool(
        modelName: Annotated[str, Field(description="The name for the new model.")],
        inOrderFields: Annotated[
            List[str], Field(description="List of field names in order.")
        ],
        cardTemplates: Annotated[
            List[Dict[str, Any]],
            Field(
                description="List of card template definitions. Each dict needs 'Name', 'Front', 'Back'."
            ),
        ],
        css: Annotated[
            Optional[str], Field(description="Optional CSS for the model.")
        ] = None,
        isCloze: Annotated[
            Optional[bool], Field(description="Set to true if this is a Cloze model.")
        ] = False,
        modelId: Annotated[
            Optional[int], Field(description="Optional model ID to use.")
        ] = None,                                   
    ) -> Dict[str, Any]:
        params: Dict[str, Any] = {
            "modelName": modelName,
            "inOrderFields": inOrderFields,
            "cardTemplates": cardTemplates,
            "isCloze": isCloze,
        }
        if css is not None:
            params["css"] = css
        if modelId is not None:
            params["modelId"] = modelId
        return await anki_call("createModel", **params)
  • Registers the 'model_mcp' FastMCP server (containing the createModel tool) into the main 'anki_mcp' with 'model_' prefix, resulting in 'model_createModel'.
    await anki_mcp.import_server("model", model_mcp)
  • Creates the 'model_mcp' FastMCP instance where the 'createModel' tool is registered (later prefixed).
    model_mcp = FastMCP(name="AnkiModelService")
  • Utility function that performs HTTP POST to AnkiConnect API, used by the handler to invoke 'createModel'.
    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                                                                        
Behavior2/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 of behavioral disclosure. While it states the tool creates a model and returns the created object, it lacks critical details: whether this requires specific permissions, if it's idempotent, what happens on duplicate model names, error conditions, or rate limits. For a creation tool with no annotation coverage, this is insufficient.

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 extremely concise—two brief sentences that state the action and the return value without any fluff. It's front-loaded with the primary purpose, making it efficient for quick comprehension. Every word earns its place.

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?

Given the complexity (a creation tool with 6 parameters, no annotations, and no output schema), the description is minimally adequate but has clear gaps. It covers the basic purpose and return value, but lacks usage guidelines, behavioral details, and output specifics. Without an output schema, the description should ideally hint at the structure of the 'created model object,' but it doesn't.

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 fully documents all 6 parameters. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain relationships between parameters like how inOrderFields relates to cardTemplates). With high schema coverage, the baseline score of 3 is appropriate as the description doesn't enhance parameter understanding.

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 ('Creates a new model') and specifies the resource ('model (note type)'), which distinguishes it from other creation tools like deck_createDeck or note_addNote. However, it doesn't explicitly differentiate from all sibling tools, such as model_updateModelStyling or model_updateModelTemplates, which also modify models but in different ways.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether a model must not already exist), when to use model_updateModelStyling instead, or any constraints on usage. This leaves the agent without context for 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