create_note
Create notes in Bear with titles, Markdown content, tags, and options to pin or open immediately.
Instructions
Create a new note in Bear
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | Note title | |
| text | No | Note content (supports Markdown) | |
| tags | No | List of tags to add (without # prefix) | |
| pin | No | Pin the note to the top | |
| open_note | No | Open the note in Bear after creation |
Implementation Reference
- src/mcp_bear/bear_url.py:28-65 (handler)The core logic that implements the create_note functionality by constructing a bear:// URL and invoking it via macOS 'open'.
def create_note( title: Optional[str] = None, text: Optional[str] = None, tags: Optional[list[str]] = None, pin: bool = False, open_note: bool = False ) -> dict[str, str]: """ Create a new note in Bear. Args: title: Note title text: Note content (supports Markdown) tags: List of tags to add (without # prefix) pin: Pin the note to the top of the list open_note: Open the note in Bear after creation Returns: Dictionary with operation result """ params = {} if title: params["title"] = title if text: params["text"] = text if tags: # Join tags with commas params["tags"] = ",".join(tags) if pin: params["pin"] = "yes" if open_note: params["open_note"] = "yes" query_string = urllib.parse.urlencode(params) url = f"bear://x-callback-url/create?{query_string}" return _open_bear_url(url) - src/mcp_bear/server.py:80-110 (registration)The MCP tool registration for 'create_note', defining its input schema.
name="create_note", description="Create a new note in Bear", inputSchema={ "type": "object", "properties": { "title": { "type": "string", "description": "Note title", }, "text": { "type": "string", "description": "Note content (supports Markdown)", }, "tags": { "type": "array", "items": {"type": "string"}, "description": "List of tags to add (without # prefix)", }, "pin": { "type": "boolean", "description": "Pin the note to the top", "default": False, }, "open_note": { "type": "boolean", "description": "Open the note in Bear after creation", "default": False, }, }, }, ), - src/mcp_bear/server.py:320-331 (handler)The handler logic within the MCP server that parses the tool arguments and calls the backend create_note function.
elif name == "create_note": if not isinstance(arguments, dict): raise ValueError("Invalid arguments") result = create_note( title=arguments.get("title"), text=arguments.get("text"), tags=arguments.get("tags"), pin=arguments.get("pin", False), open_note=arguments.get("open_note", False) ) return [TextContent(type="text", text=str(result))]