Skip to main content
Glama

note_updateNoteFields

Modify the fields of an existing Anki flashcard note to update its content and media attachments.

Instructions

Modifies the fields of an existing note.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteYesA dictionary representing the note to update. Must include 'id' and 'fields'. Optionally 'audio', 'video', or 'picture'.

Implementation Reference

  • Handler function that defines and implements the 'updateNoteFields' tool (prefixed to 'note_updateNoteFields' on registration). It validates input via Pydantic and calls the AnkiConnect API.
    @note_mcp.tool( name="updateNoteFields", description="Modifies the fields of an existing note." ) async def update_note_fields_tool( note: Annotated[ Dict[str, Any], Field( description="A dictionary representing the note to update. Must include 'id' and 'fields'. Optionally 'audio', 'video', or 'picture'." ), ], ) -> None: return await anki_call("updateNoteFields", note=note)
  • Registers all tools from note_mcp (including updateNoteFields) into the main anki_mcp server with the 'note_' prefix, making it available as 'note_updateNoteFields'.
    await anki_mcp.import_server("note", note_mcp)
  • Shared helper function used by all tools to make HTTP requests to the AnkiConnect API, executing the actual 'updateNoteFields' action.
    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
  • Pydantic schema definition for the tool's input parameter 'note', specifying the required structure.
    note: Annotated[ Dict[str, Any], Field( description="A dictionary representing the note to update. Must include 'id' and 'fields'. Optionally 'audio', 'video', or 'picture'." ), ], ) -> None: return await anki_call("updateNoteFields", note=note)

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