Skip to main content
Glama

model_modelFieldRemove

Remove a field from an Anki flashcard model to simplify note structure and eliminate unnecessary data fields.

Instructions

Removes a field from an existing model.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNameYesName of the model to modify.
fieldNameYesName of the field to remove.

Implementation Reference

  • The core handler function for the tool 'model_modelFieldRemove'. It invokes AnkiConnect's modelFieldRemove action to remove a field from a model.
    @model_mcp.tool(
        name="modelFieldRemove", description="Removes a field from an existing model."
    )
    async def remove_model_field_tool(                                                        
        modelName: Annotated[str, Field(description="Name of the model to modify.")],
        fieldName: Annotated[str, Field(description="Name of the field to remove.")],
    ) -> None:
        return await anki_call("modelFieldRemove", modelName=modelName, fieldName=fieldName)
  • Registers the model service tools under the 'model_' prefix, making 'modelFieldRemove' available as 'model_modelFieldRemove'.
    await anki_mcp.import_server("model", model_mcp)
  • Utility function used by the handler to communicate with 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                                                                        
  • Creates the sub-MCP instance for model tools where the tool is decorated and registered locally.
    model_mcp = FastMCP(name="AnkiModelService")

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