bear_attach_file
Attach files or images to Bear notes, uploading to iCloud and embedding in markdown. Insert at the end, before or after specific text, or after the title.
Instructions
Attach a file or image to an existing Bear note. The file is uploaded to iCloud and embedded in the note's markdown. Supports common image formats (jpg, png, gif, webp, heic) and other file types (pdf, zip, etc.). By default the attachment is appended to the end. Use 'after' or 'before' to place it relative to text in the note, or 'prepend' to put it right after the title.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Note ID (uniqueIdentifier) | |
| file_path | Yes | Absolute path to the file to attach | |
| after | No | Insert after the line containing this text | |
| before | No | Insert before the line containing this text | |
| prepend | No | Insert after the title line instead of at the end |
Implementation Reference
- mcp-server/src/tools.ts:452-481 (schema)Input schema for bear_attach_file tool: requires 'id' (note ID) and 'file_path' (absolute path to file). Optional: 'after', 'before' (string-based positioning), and 'prepend' (boolean for title-adjacent placement).
inputSchema: { type: "object" as const, properties: { id: { type: "string", description: "Note ID (uniqueIdentifier)", }, file_path: { type: "string", description: "Absolute path to the file to attach", }, after: { type: "string", description: "Insert after the line containing this text", }, before: { type: "string", description: "Insert before the line containing this text", }, prepend: { type: "boolean", description: "Insert after the title line instead of at the end", }, }, required: ["id", "file_path"], }, - mcp-server/src/tools.ts:488-499 (handler)Command builder for bear_attach_file. Constructs the bcli CLI arguments: calls the 'attach' subcommand with note ID and file path, plus optional --after, --before, --prepend flags.
buildArgs: (input) => { const args = [ "attach", String(input.id), String(input.file_path), "--json", ]; if (input.after) args.push("--after", String(input.after)); if (input.before) args.push("--before", String(input.before)); if (input.prepend) args.push("--prepend"); return args; }, - mcp-server/src/tools.ts:447-500 (registration)Registration of the bear_attach_file tool in the tools dictionary. Maps the tool name to a ToolHandler object containing the tool metadata (name, description, inputSchema, annotations) and the buildArgs function.
bear_attach_file: { tool: { name: "bear_attach_file", description: "Attach a file or image to an existing Bear note. The file is uploaded to iCloud and embedded in the note's markdown. Supports common image formats (jpg, png, gif, webp, heic) and other file types (pdf, zip, etc.). By default the attachment is appended to the end. Use 'after' or 'before' to place it relative to text in the note, or 'prepend' to put it right after the title.", inputSchema: { type: "object" as const, properties: { id: { type: "string", description: "Note ID (uniqueIdentifier)", }, file_path: { type: "string", description: "Absolute path to the file to attach", }, after: { type: "string", description: "Insert after the line containing this text", }, before: { type: "string", description: "Insert before the line containing this text", }, prepend: { type: "boolean", description: "Insert after the title line instead of at the end", }, }, required: ["id", "file_path"], }, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, }, }, buildArgs: (input) => { const args = [ "attach", String(input.id), String(input.file_path), "--json", ]; if (input.after) args.push("--after", String(input.after)); if (input.before) args.push("--before", String(input.before)); if (input.prepend) args.push("--prepend"); return args; }, },