note_updateNoteFields
Update specific fields of an existing Anki note using the 'anki-mcp' server. Modify text, audio, video, or picture content to refine and enhance flashcard details efficiently.
Instructions
Modifies the fields of an existing note.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | Yes | A dictionary representing the note to update. Must include 'id' and 'fields'. Optionally 'audio', 'video', or 'picture'. |
Implementation Reference
- src/anki_mcp/note_service.py:58-69 (handler)The handler function for the 'note_updateNoteFields' tool. It takes a note dictionary with 'id' and 'fields', and calls the AnkiConnect 'updateNoteFields' action via anki_call.@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)
- src/anki_mcp/__init__.py:23-27 (registration)Registers all service MCPs (including note_mcp containing updateNoteFields) into the main anki_mcp server with service prefixes like 'note_', resulting in 'note_updateNoteFields'.await anki_mcp.import_server("deck", deck_mcp) await anki_mcp.import_server("note", note_mcp) await anki_mcp.import_server("card", card_mcp) await anki_mcp.import_server("model", model_mcp) await anki_mcp.import_server("media", media_mcp)
- src/anki_mcp/common.py:8-23 (helper)Shared helper function that makes asynchronous HTTP POST requests to AnkiConnect API, used by all tool handlers including note_updateNoteFields.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