bear_add_file
Add a file to an existing note in Bear App, specify the file path, target header, and insertion mode with options like append, prepend, or replace. Customize filename and control note visibility or editing.
Instructions
Add a file to an existing note
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| edit | No | Place cursor in note editor | |
| file | Yes | File path to add | |
| filename | No | Custom filename for the file | |
| header | No | Add file to specific header | |
| id | No | Note unique identifier | |
| mode | No | How to add the file | |
| new_window | No | Open in new window | |
| open_note | No | Open note after adding file | |
| selected | No | Selected text in note | |
| show_window | No | Show Bear window | |
| title | No | Note title |
Input Schema (JSON Schema)
{
"properties": {
"edit": {
"description": "Place cursor in note editor",
"type": "boolean"
},
"file": {
"description": "File path to add",
"type": "string"
},
"filename": {
"description": "Custom filename for the file",
"type": "string"
},
"header": {
"description": "Add file to specific header",
"type": "string"
},
"id": {
"description": "Note unique identifier",
"type": "string"
},
"mode": {
"description": "How to add the file",
"enum": [
"append",
"prepend",
"replace_all",
"replace"
],
"type": "string"
},
"new_window": {
"description": "Open in new window",
"type": "boolean"
},
"open_note": {
"description": "Open note after adding file",
"type": "boolean"
},
"selected": {
"description": "Selected text in note",
"type": "string"
},
"show_window": {
"description": "Show Bear window",
"type": "boolean"
},
"title": {
"description": "Note title",
"type": "string"
}
},
"required": [
"file"
],
"type": "object"
}
Implementation Reference
- src/index.ts:1036-1062 (handler)The main handler function for the 'bear_add_file' tool. It processes input arguments, builds a Bear 'add-file' callback URL using shared utilities, executes it, and returns a success 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, types, descriptions, and required fields.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)Tool registration in the ListTools response, including name, description, and schema.{ 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)Handler dispatch registration in the CallToolRequestSchema switch statement, mapping the tool name to its handler method.case "bear_add_file": return await this.addFile(args);