bear_add_text
Add text to existing notes in Bear App with options to append, prepend, replace content, insert at headers, or use clipboard text.
Instructions
Add text to an existing note
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Note unique identifier | |
| title | No | Note title | |
| text | Yes | Text to add | |
| mode | No | How to add the text | |
| new_line | No | Force text on new line when appending | |
| header | No | Add text to specific header | |
| selected | No | Selected text in note | |
| clipboard | No | Get text from clipboard | |
| exclude_trashed | No | Exclude trashed notes | |
| open_note | No | Open note after adding text | |
| new_window | No | Open in new window | |
| show_window | No | Show Bear window | |
| edit | No | Place cursor in note editor | |
| timestamp | No | Prepend current date and time |
Implementation Reference
- src/index.ts:815-844 (handler)The handler function that implements the core logic for the 'bear_add_text' tool. It constructs parameters from input args, builds a Bear 'add-text' URL, executes it via open command, and returns a success message.private async addText(args: any) { const params: Record<string, string | boolean> = {}; if (args.id) params.id = args.id; if (args.title) params.title = args.title; if (args.text) params.text = args.text; if (args.mode) params.mode = args.mode; if (args.new_line) params.new_line = "yes"; if (args.header) params.header = args.header; if (args.selected) params.selected = args.selected; if (args.clipboard) params.clipboard = "yes"; if (args.exclude_trashed) params.exclude_trashed = "yes"; if (args.open_note) params.open_note = "yes"; if (args.new_window) params.new_window = "yes"; if (args.show_window) params.show_window = "yes"; if (args.edit) params.edit = "yes"; if (args.timestamp) params.timestamp = "yes"; const url = this.buildBearURL("add-text", params); await this.executeURL(url); return { content: [ { type: "text", text: `Added text to note in Bear${args.mode ? ` using mode: ${args.mode}` : ""}` } ] }; }
- src/index.ts:327-389 (schema)Input schema defining parameters and validation for the 'bear_add_text' tool.inputSchema: { type: "object", properties: { id: { type: "string", description: "Note unique identifier" }, title: { type: "string", description: "Note title" }, text: { type: "string", description: "Text to add" }, mode: { type: "string", enum: ["append", "prepend", "replace_all", "replace"], description: "How to add the text" }, new_line: { type: "boolean", description: "Force text on new line when appending" }, header: { type: "string", description: "Add text to specific header" }, selected: { type: "string", description: "Selected text in note" }, clipboard: { type: "boolean", description: "Get text from clipboard" }, exclude_trashed: { type: "boolean", description: "Exclude trashed notes" }, open_note: { type: "boolean", description: "Open note after adding text" }, new_window: { type: "boolean", description: "Open in new window" }, show_window: { type: "boolean", description: "Show Bear window" }, edit: { type: "boolean", description: "Place cursor in note editor" }, timestamp: { type: "boolean", description: "Prepend current date and time" } }, required: ["text"] }
- src/index.ts:709-710 (registration)Switch case registration that dispatches calls to the 'bear_add_text' handler function in the CallToolRequestSchema handler.case "bear_add_text": return await this.addText(args);
- src/index.ts:324-390 (registration)Tool registration in the ListToolsRequestSchema response, including name, description, and schema.{ name: "bear_add_text", description: "Add text to an existing note", inputSchema: { type: "object", properties: { id: { type: "string", description: "Note unique identifier" }, title: { type: "string", description: "Note title" }, text: { type: "string", description: "Text to add" }, mode: { type: "string", enum: ["append", "prepend", "replace_all", "replace"], description: "How to add the text" }, new_line: { type: "boolean", description: "Force text on new line when appending" }, header: { type: "string", description: "Add text to specific header" }, selected: { type: "string", description: "Selected text in note" }, clipboard: { type: "boolean", description: "Get text from clipboard" }, exclude_trashed: { type: "boolean", description: "Exclude trashed notes" }, open_note: { type: "boolean", description: "Open note after adding text" }, new_window: { type: "boolean", description: "Open in new window" }, show_window: { type: "boolean", description: "Show Bear window" }, edit: { type: "boolean", description: "Place cursor in note editor" }, timestamp: { type: "boolean", description: "Prepend current date and time" } }, required: ["text"] } },