Skip to main content
Glama

model_modelFieldAdd

Add a custom field to an existing Anki flashcard model to organize and customize your study material.

Instructions

Adds a new field to an existing model.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNameYesName of the model to modify.
fieldNameYesName of the new field to add.
indexNoOptional 0-based index to insert the field at.

Implementation Reference

  • The handler function `add_model_field_tool` that executes the tool logic by preparing parameters and calling `anki_call('modelFieldAdd', **params)`.
    async def add_model_field_tool(                                                     
        modelName: Annotated[str, Field(description="Name of the model to modify.")],
        fieldName: Annotated[str, Field(description="Name of the new field to add.")],
        index: Annotated[
            Optional[int],
            Field(description="Optional 0-based index to insert the field at."),
        ] = None,
    ) -> None:
        params: Dict[str, Any] = {"modelName": modelName, "fieldName": fieldName}
        if index is not None:
            params["index"] = index
        return await anki_call("modelFieldAdd", **params)
  • Registers the tool named 'modelFieldAdd' on the `model_mcp` FastMCP instance.
    @model_mcp.tool(
        name="modelFieldAdd", description="Adds a new field to an existing model."
    )
    async def add_model_field_tool(                                                     
        modelName: Annotated[str, Field(description="Name of the model to modify.")],
        fieldName: Annotated[str, Field(description="Name of the new field to add.")],
        index: Annotated[
            Optional[int],
            Field(description="Optional 0-based index to insert the field at."),
        ] = None,
    ) -> None:
        params: Dict[str, Any] = {"modelName": modelName, "fieldName": fieldName}
        if index is not None:
            params["index"] = index
        return await anki_call("modelFieldAdd", **params)
  • Registers the `model_mcp` tools under the 'model' prefix in the main `anki_mcp`, resulting in tool name 'model_modelFieldAdd'.
    await anki_mcp.import_server("model", model_mcp)
  • Pydantic schema definitions for the tool inputs using Annotated and Field.
        modelName: Annotated[str, Field(description="Name of the model to modify.")],
        fieldName: Annotated[str, Field(description="Name of the new field to add.")],
        index: Annotated[
            Optional[int],
            Field(description="Optional 0-based index to insert the field at."),
        ] = None,
    ) -> None:

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