Skip to main content
Glama

note_addNote

Add a new note to an Anki deck using specified fields, model, and tags. Enables structured flashcard creation with AnkiConnect integration.

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteYesA dictionary representing the note to add. Should include 'deckName', 'modelName', 'fields', and optionally 'tags', 'options', 'audio', 'video', 'picture'.

Implementation Reference

  • Handler implementation for the 'note_addNote' tool. The @tool decorator registers it as 'addNote' in the note_mcp namespace (prefixed to 'note_addNote' upon import). It wraps AnkiConnect's 'addNote' API call.
    @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)
  • Registration of the note_mcp server under the 'note' prefix in the main AnkiConnectMCP, which prefixes all note tools (e.g., 'addNote' becomes 'note_addNote').
    await anki_mcp.import_server("note", note_mcp)
  • Helper function used by the note_addNote handler to make asynchronous HTTP POST requests to the AnkiConnect server at http://127.0.0.1:8765, handling errors and returning results.
    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