Skip to main content
Glama

model_modelTemplates

Retrieve card template content for Anki flashcard models to review or modify formatting and structure.

Instructions

Returns an object indicating the template content for each card of the specified model.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNameYesThe name of the model.

Implementation Reference

  • The core handler function for the 'model_modelTemplates' tool (prefixed due to model_ namespace). It takes a modelName parameter, calls the AnkiConnect 'modelTemplates' API via anki_call helper, and returns the templates dictionary.
    @model_mcp.tool( name="modelTemplates", description="Returns an object indicating the template content for each card of the specified model.", ) async def get_model_templates_tool( modelName: Annotated[str, Field(description="The name of the model.")], ) -> Dict[str, Any]: return await anki_call("modelTemplates", modelName=modelName)
  • Creates the sub-MCP server 'model_mcp' (AnkiModelService) where the model_modelTemplates tool is registered via decorator.
    model_mcp = FastMCP(name="AnkiModelService")
  • Registers the model_mcp sub-server under the 'model' prefix to the main 'AnkiConnectMCP' server, enabling the full tool name 'model_modelTemplates'.
    await anki_mcp.import_server("model", model_mcp)
  • Shared helper function that performs HTTP requests to the AnkiConnect API (localhost:8765), used by the tool handler to execute the 'modelTemplates' action.
    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

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