Skip to main content
Glama
netologist

Bear Notes MCP Server

by netologist

get_bear_note

Retrieve a specific note from Bear App using its unique identifier to access complete content and metadata.

Instructions

Get a specific Bear note by ID

Args: note_id: Bear note's unique identifier

Returns: Complete note content with metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
note_idYes

Implementation Reference

  • main.py:172-190 (handler)
    The main handler function for the 'get_bear_note' tool. Decorated with @mcp.tool() for registration. Retrieves a Bear note by ID using the helper function and returns it or an error message.
    @mcp.tool()
    def get_bear_note(note_id: str) -> Dict[str, Any]:
        """
        Get a specific Bear note by ID
        
        Args:
            note_id: Bear note's unique identifier
        
        Returns:
            Complete note content with metadata
        """
        try:
            note = get_note_by_id(note_id)
            if note:
                return note
            else:
                return {"error": "Note not found"}
        except Exception as e:
            return {"error": f"Error retrieving note: {str(e)}"}
  • Helper function that executes the core database query to fetch the Bear note by its unique ID from the SQLite database.
    def get_note_by_id(note_id: str) -> Optional[Dict[str, Any]]:
        """Get a specific note by ID"""
        conn = get_bear_db_connection()
        
        try:
            cursor = conn.execute("""
                SELECT 
                    ZUNIQUEIDENTIFIER as id,
                    ZTITLE as title,
                    ZTEXT as content,
                    ZCREATIONDATE as created_date,
                    ZMODIFICATIONDATE as modified_date
                FROM ZSFNOTE 
                WHERE ZUNIQUEIDENTIFIER = ? AND ZTRASHED = 0
            """, (note_id,))
            
            row = cursor.fetchone()
            if row:
                content = row["content"] or ""
                return {
                    "id": row["id"],
                    "title": row["title"] or "Untitled",
                    "content": content,
                    "created_date": row["created_date"],
                    "modified_date": row["modified_date"],
                    "word_count": len(content.split()) if content else 0
                }
            return None
            
        finally:
            conn.close()
  • main.py:19-26 (helper)
    Utility function to establish connection to the Bear App SQLite database.
    def get_bear_db_connection():
        """Connect to Bear database"""
        if not os.path.exists(BEAR_DB_PATH):
            raise FileNotFoundError(f"Bear database not found: {BEAR_DB_PATH}")
        
        conn = sqlite3.connect(BEAR_DB_PATH)
        conn.row_factory = sqlite3.Row  # Enable column name access
        return conn

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/netologist/mcp-bear-notes'

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