bear_add_file
Add files to existing Bear notes by specifying file paths, insertion modes, and optional headers to organize content attachments.
Instructions
Add a file to an existing note
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Note unique identifier | |
| title | No | Note title | |
| selected | No | Selected text in note | |
| file | Yes | File path to add | |
| header | No | Add file to specific header | |
| filename | No | Custom filename for the file | |
| mode | No | How to add the file | |
| open_note | No | Open note after adding file | |
| new_window | No | Open in new window | |
| show_window | No | Show Bear window | |
| edit | No | Place cursor in note editor |
Implementation Reference
- src/index.ts:1036-1062 (handler)The handler function that implements the bear_add_file tool. It maps input arguments to Bear URL parameters, constructs the 'bear://x-callback-url/add-file' URL using buildBearURL, executes it with executeURL, and returns a confirmation message.private async addFile(args: any) { const params: Record<string, string | boolean> = {}; if (args.id) params.id = args.id; if (args.title) params.title = args.title; if (args.selected) params.selected = args.selected; if (args.file) params.file = args.file; if (args.header) params.header = args.header; if (args.filename) params.filename = args.filename; if (args.mode) params.mode = args.mode; 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"; const url = this.buildBearURL("add-file", params); await this.executeURL(url); return { content: [ { type: "text", text: `Added file to note in Bear${args.filename ? ` with filename: ${args.filename}` : ""}` } ] }; }
- src/index.ts:394-444 (schema)Input schema definition for the bear_add_file tool, specifying properties and required 'file' parameter.inputSchema: { type: "object", properties: { id: { type: "string", description: "Note unique identifier" }, title: { type: "string", description: "Note title" }, selected: { type: "string", description: "Selected text in note" }, file: { type: "string", description: "File path to add" }, header: { type: "string", description: "Add file to specific header" }, filename: { type: "string", description: "Custom filename for the file" }, mode: { type: "string", enum: ["append", "prepend", "replace_all", "replace"], description: "How to add the file" }, open_note: { type: "boolean", description: "Open note after adding file" }, 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" } }, required: ["file"] }
- src/index.ts:391-445 (registration)Registration of the bear_add_file tool in the list of available tools returned by ListToolsRequestSchema.{ name: "bear_add_file", description: "Add a file to an existing note", inputSchema: { type: "object", properties: { id: { type: "string", description: "Note unique identifier" }, title: { type: "string", description: "Note title" }, selected: { type: "string", description: "Selected text in note" }, file: { type: "string", description: "File path to add" }, header: { type: "string", description: "Add file to specific header" }, filename: { type: "string", description: "Custom filename for the file" }, mode: { type: "string", enum: ["append", "prepend", "replace_all", "replace"], description: "How to add the file" }, open_note: { type: "boolean", description: "Open note after adding file" }, 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" } }, required: ["file"] } },
- src/index.ts:711-712 (registration)Dispatch registration in the CallToolRequestSchema switch statement that routes to the addFile handler.case "bear_add_file": return await this.addFile(args);