note_addNote
Add a new note to an Anki deck by specifying deck name, model, fields, and optional tags or media attachments.
Instructions
Creates a new note using the given deck, model, fields, and tags. Returns the ID of the created note or null if the note could not be created.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"note": "<note>"
},
"name": "note_addNote"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | Yes | A dictionary representing the note to add. Should include 'deckName', 'modelName', 'fields', and optionally 'tags', 'options', 'audio', 'video', 'picture'. |
Implementation Reference
- src/anki_mcp/note_service.py:43-56 (handler)Handler for the 'note_addNote' tool. Defines the tool logic which proxies to AnkiConnect's 'addNote' via anki_call. The prefix 'note_' is added during registration.
@note_mcp.tool( name="addNote", description="Creates a new note using the given deck, model, fields, and tags. Returns the ID of the created note or null if the note could not be created.", ) async def add_note_tool( note: Annotated[ Dict[str, Any], Field( description="A dictionary representing the note to add. Should include 'deckName', 'modelName', 'fields', and optionally 'tags', 'options', 'audio', 'video', 'picture'." ), ], ) -> Optional[int]: return await anki_call("addNote", note=note) - src/anki_mcp/__init__.py:24-24 (registration)Registers the note service tools with prefix 'note', transforming 'addNote' into 'note_addNote'.
await anki_mcp.import_server("note", note_mcp) - src/anki_mcp/common.py:8-23 (helper)Shared helper function that performs HTTP POST requests to the AnkiConnect server, used by all tool handlers including note_addNote.
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