bear_context_push_to_bear
Converts external files to permanent Bear notes by creating a new note from file content, tagging it as #context (with optional subtag), and deleting the original file. Ideal for archiving matured external content into Bear.
Instructions
Push an external file to Bear as a new note. Creates a Bear note from the file content, tags it with #context (+ optional subtag), and removes the original external file. Use when external content has matured enough to become a permanent Bear note.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | Filename in external/ to push | |
| subtag | No | Sub-tag (e.g., 'architecture' → #context/architecture) | |
| title | No | Override note title (defaults to title extracted from content) |
Implementation Reference
- mcp-server/src/tools.ts:1098-1135 (handler)The full implementation of the bear_context_push_to_bear tool. It defines the tool metadata (name, description, inputSchema with required filename and optional subtag/title), annotations, and the buildArgs function that constructs the CLI args ['context', 'push', filename, '--json'] with optional --subtag and --title flags.
bear_context_push_to_bear: { tool: { name: "bear_context_push_to_bear", description: "Push an external file to Bear as a new note. Creates a Bear note from the file content, tags it with #context (+ optional subtag), and removes the original external file. Use when external content has matured enough to become a permanent Bear note.", inputSchema: { type: "object" as const, properties: { filename: { type: "string", description: "Filename in external/ to push", }, subtag: { type: "string", description: "Sub-tag (e.g., 'architecture' → #context/architecture)", }, title: { type: "string", description: "Override note title (defaults to title extracted from content)", }, }, required: ["filename"], }, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, }, }, buildArgs: (input) => { const args = ["context", "push", String(input.filename), "--json"]; if (input.subtag) args.push("--subtag", String(input.subtag)); if (input.title) args.push("--title", String(input.title)); return args; }, }, - mcp-server/src/index.ts:29-31 (registration)The tool is registered into the MCP server via the tools map exported from tools.ts. ListToolsRequestSchema exposes all tool definitions, and CallToolRequestSchema dispatches to the handler by name.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: Object.values(tools).map((t) => t.tool), })); - mcp-server/src/index.ts:80-90 (helper)The execution logic: handler.buildArgs(params) produces the arguments, then execBcliWithReauth runs the bcli CLI with those args (this tool does not use stdin).
try { const args = handler.buildArgs(params); let result: { stdout: string; stderr: string }; // Check if this tool needs stdin piping const stdinData = handler.usesStdin?.(params) ?? null; if (stdinData !== null) { result = await execBcliWithStdinAndReauth(args, stdinData); } else { result = await execBcliWithReauth(args); }