Skip to main content
Glama

card_setSpecificValueOfCard

Modify specific properties of an Anki flashcard by updating key-value pairs for a single card, returning success indicators for each change.

Instructions

Sets specific values of a single card. Use with caution. Returns list of booleans indicating success for each key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cardYesThe ID of the card to modify.
keysYesList of card property keys to change (e.g., 'flags', 'odue').
newValuesYesList of new values corresponding to the keys.
warning_checkNoSet to True for potentially risky operations.

Implementation Reference

  • Handler function implementing the tool logic for 'card_setSpecificValueOfCard' (registered as 'setSpecificValueOfCard' on card_mcp, prefixed later). Includes input schema via Annotated Fields and calls AnkiConnect API.
    @card_mcp.tool( name="setSpecificValueOfCard", description="Sets specific values of a single card. Use with caution. Returns list of booleans indicating success for each key.", ) async def set_specific_card_value_tool( card: Annotated[int, Field(description="The ID of the card to modify.")], keys: Annotated[ List[str], Field( description="List of card property keys to change (e.g., 'flags', 'odue')." ), ], newValues: Annotated[ List[Any], Field(description="List of new values corresponding to the keys."), ], warning_check: Annotated[ Optional[bool], Field(description="Set to True for potentially risky operations."), ] = None, ) -> List[bool]: params: Dict[str, Any] = {"card": card, "keys": keys, "newValues": newValues} if warning_check is not None: params["warning_check"] = warning_check return await anki_call("setSpecificValueOfCard", **params)
  • Creation of the card_mcp FastMCP instance on which the tool is registered via decorator.
    card_mcp = FastMCP(name="AnkiCardService")
  • Mounts the card_mcp server into the main anki_mcp under 'card' namespace, prefixing tool names with 'card_' to produce 'card_setSpecificValueOfCard'.
    await anki_mcp.import_server("card", card_mcp)
  • Helper function used by the tool handler to invoke the AnkiConnect 'setSpecificValueOfCard' action via HTTP POST.
    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