model_updateModelTemplates
Update templates of an existing Anki flashcard model by specifying the model name and defining new Front/Back templates.
Instructions
Modifies the templates of an existing model by name.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | Model object. Must include 'name' (model name) and 'templates' (dict of template name to Front/Back definitions). |
Implementation Reference
- src/anki_mcp/model_service.py:97-110 (handler)Handler function for the 'model_updateModelTemplates' tool (registered as 'updateModelTemplates' in model service, prefixed to 'model_' upon import). Takes a model dict with name and templates, calls 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)
- src/anki_mcp/__init__.py:26-26 (registration)Imports the model_mcp server into the main anki_mcp, prefixing all its tool names with 'model_' (resulting in 'model_updateModelTemplates').await anki_mcp.import_server("model", model_mcp)
- Input schema definition for the tool: a dictionary containing 'name' and 'templates' for the model.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: