Skip to main content
Glama

find-notes

Locate specific notes in Anki by querying the Anki MCP Server, enabling quick access to stored content for efficient note management.

Instructions

Find notes matching a query in Anki

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • The handler function for the 'find-notes' tool. It sends a 'notesInfo' request to Anki with the query, processes the notes by formatting fields, tags, and modification time, and returns formatted text content.
    async def find_notes(query: str) -> list[types.TextContent]: result = await make_anki_request("notesInfo", query=query) if result["success"]: notes = result["result"] if not notes: return [ types.TextContent( type="text", text=f"No notes found matching query: '{query}'", ) ] notes_info = [] for note in notes: note_id = note["noteId"] model_name = note["modelName"] tags = ", ".join(note["tags"]) if note["tags"] else "(no tags)" # Format fields fields_text = [] for field_name, field_data in note["fields"].items(): field_value = field_data["value"] # Truncate very long field values for display if len(field_value) > 100: field_value = field_value[:97] + "..." fields_text.append(f" - {field_name}: {field_value}") # Format modification time mod_time = datetime.fromtimestamp(note["mod"]).strftime("%Y-%m-%d %H:%M:%S") note_text = ( f"Note ID: {note_id}\n" f"Model: {model_name}\n" f"Tags: {tags}\n" f"Modified: {mod_time}\n" f"Fields:\n" + "\n".join(fields_text) + "\n" ) notes_info.append(note_text) return [ types.TextContent( type="text", text=f"Found {len(notes)} notes matching query: '{query}'\n\n" + "\n\n".join(notes_info), ) ] else: return [ types.TextContent( type="text", text=f"Failed to retrieve notes: {result['error']}", ) ]
  • Registers the 'find-notes' tool with the FastMCP app, linking it to the find_notes handler function.
    app.tool(name='find-notes', description='Find notes matching a query in Anki')(find_notes)
  • Type annotations define the input schema (query: str) and output schema (list[types.TextContent]) for the tool.
    async def find_notes(query: str) -> list[types.TextContent]:

Other Tools

Related Tools

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/johwiebe/anki-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server