note_deleteNotes
Remove specific notes from Anki flashcards by specifying their IDs. This tool streamlines note management within the Anki-MCP server, ensuring efficient deletion of unwanted or outdated flashcard content.
Instructions
Deletes notes with the given IDs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notes | Yes | A list of note IDs to delete. |
Implementation Reference
- src/anki_mcp/note_service.py:72-76 (handler)Handler function for the 'deleteNotes' tool (prefixed to 'note_deleteNotes'). Executes by calling AnkiConnect's deleteNotes via anki_call.@note_mcp.tool(name="deleteNotes", description="Deletes notes with the given IDs.") async def delete_notes_tool( notes: Annotated[List[int], Field(description="A list of note IDs to delete.")], ) -> None: return await anki_call("deleteNotes", notes=notes)
- src/anki_mcp/__init__.py:9-9 (registration)Imports the note_mcp server which contains the note_deleteNotes tool.from .note_service import note_mcp
- src/anki_mcp/__init__.py:24-24 (registration)Registers the note_mcp tools under the 'note_' prefix in the main anki_mcp server, making 'deleteNotes' available as 'note_deleteNotes'.await anki_mcp.import_server("note", note_mcp)
- src/anki_mcp/common.py:8-23 (helper)Helper function anki_call used by the handler to make HTTP requests to AnkiConnect API.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
- src/anki_mcp/note_service.py:74-74 (schema)Input schema definition for the notes parameter using Pydantic.notes: Annotated[List[int], Field(description="A list of note IDs to delete.")],