get_notes
Retrieve all notes from Bear Notes on macOS to access, search, and manage your content through the MCP Bear server interface.
Instructions
Get all notes from Bear
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_bear/database.py:26-49 (handler)The actual handler function 'get_notes' which queries the SQLite database for non-archived notes.
def get_notes() -> list[dict[str, Any]]: """Retrieve all non-archived notes from Bear.""" db_path = get_bear_db_path() conn = sqlite3.connect(db_path) conn.row_factory = sqlite3.Row cursor = conn.cursor() try: cursor.execute("SELECT * FROM ZSFNOTE WHERE ZARCHIVED=0;") rows = cursor.fetchall() notes = [] for row in rows: notes.append({ "ZCREATIONDATE": row["ZCREATIONDATE"], "ZSUBTITLE": row["ZSUBTITLE"], "ZTEXT": row["ZTEXT"], "ZTITLE": row["ZTITLE"], "ZUNIQUEIDENTIFIER": row["ZUNIQUEIDENTIFIER"], }) return notes finally: conn.close() - src/mcp_bear/server.py:49-56 (registration)Registration of the 'get_notes' tool in the MCP server via the list_tools decorator.
Tool( name="get_notes", description="Get all notes from Bear", inputSchema={ "type": "object", "properties": {}, }, ), - src/mcp_bear/server.py:304-306 (handler)Call-site logic in the server's 'call_tool' handler that invokes 'get_notes' when requested.
if name == "get_notes": notes = get_notes() return [TextContent(type="text", text=str({"notes": notes}))]