get_notes_like
Search Bear Notes for content containing specific text strings to quickly locate relevant information within your notes database.
Instructions
Get notes that include a specific text string
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| like | Yes | Find notes that have this text |
Implementation Reference
- src/mcp_bear/database.py:52-82 (handler)The `get_notes_like` function in `src/mcp_bear/database.py` executes a SQL query against the Bear Notes database to search for notes containing specific text in their title or body, and returns them as a list of dictionaries.
def get_notes_like(search_text: str) -> list[dict[str, Any]]: """Search for notes containing specific text in title or body.""" db_path = get_bear_db_path() conn = sqlite3.connect(db_path) conn.row_factory = sqlite3.Row cursor = conn.cursor() try: # Use parameterized query to prevent SQL injection query = """ SELECT * FROM ZSFNOTE WHERE ZARCHIVED=0 AND (ZTEXT LIKE ? OR ZTITLE LIKE ?); """ search_pattern = f"%{search_text}%" cursor.execute(query, (search_pattern, search_pattern)) 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()