model_updateModelStyling
Update CSS styling for Anki flashcard templates to customize appearance and formatting.
Instructions
Modifies the CSS styling of an existing model by name.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"model": "<model>"
},
"name": "model_updateModelStyling"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | Model object. Must include 'name' (model name) and 'css' (the new CSS string). |
Implementation Reference
- src/anki_mcp/model_service.py:116-124 (handler)The handler function that implements the tool's logic by calling the AnkiConnect 'updateModelStyling' API with the provided model object.
async def update_model_styling_tool( model: Annotated[ Dict[str, Any], Field( description="Model object. Must include 'name' (model name) and 'css' (the new CSS string)." ), ], ) -> None: return await anki_call("updateModelStyling", model=model) - src/anki_mcp/model_service.py:112-115 (registration)Registers the tool handler with name 'updateModelStyling' and description in the model_mcp FastMCP instance.
@model_mcp.tool( name="updateModelStyling", description="Modifies the CSS styling of an existing model by name.", ) - src/anki_mcp/__init__.py:26-26 (registration)Registers the model_mcp server (containing the tool) under the 'model' prefix in the main AnkiConnectMCP, making the tool available as 'model_updateModelStyling'.
await anki_mcp.import_server("model", model_mcp) - src/anki_mcp/common.py:8-24 (helper)Helper function used by the tool handler to make HTTP calls to the 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