model_modelFieldNames
Retrieve field names for a specific Anki flashcard model to understand its structure and customize content organization.
Instructions
Gets the list of field names for the provided model name.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| modelName | Yes | The name of the model. |
Implementation Reference
- src/anki_mcp/model_service.py:29-36 (handler)Handler implementation for the 'modelFieldNames' tool (prefixed to 'model_modelFieldNames' in main server). Takes modelName and calls AnkiConnect API via anki_call to retrieve field names.@model_mcp.tool( name="modelFieldNames", description="Gets the list of field names for the provided model name.", ) async def get_model_field_names_tool( modelName: Annotated[str, Field(description="The name of the model.")], ) -> List[str]: return await anki_call("modelFieldNames", modelName=modelName)
- src/anki_mcp/model_service.py:34-35 (schema)Input schema (modelName: str) and output type (List[str]) for the tool.modelName: Annotated[str, Field(description="The name of the model.")], ) -> List[str]:
- src/anki_mcp/__init__.py:26-26 (registration)Main registration step that imports model_mcp tools with 'model_' prefix, creating 'model_modelFieldNames'.await anki_mcp.import_server("model", model_mcp)
- src/anki_mcp/model_service.py:29-32 (registration)Local registration of the tool on the model_mcp FastMCP instance.@model_mcp.tool( name="modelFieldNames", description="Gets the list of field names for the provided model name.", )
- src/anki_mcp/common.py:8-23 (helper)Helper function used by the handler to make API calls to AnkiConnect server.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