bear_trash_note
Move a Bear note to trash using its ID. The note remains recoverable from Bear's trash.
Instructions
Move a Bear note to the trash. This is a soft delete — the note can be recovered from Bear's trash. The note is identified by its ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Note ID (uniqueIdentifier) |
Implementation Reference
- mcp-server/src/tools.ts:311-333 (handler)Definition of the bear_trash_note tool with its schema, metadata, and buildArgs function that constructs the CLI command ['trash', id, '--json'] to move a Bear note to the trash.
bear_trash_note: { tool: { name: "bear_trash_note", description: "Move a Bear note to the trash. This is a soft delete — the note can be recovered from Bear's trash. The note is identified by its ID.", inputSchema: { type: "object" as const, properties: { id: { type: "string", description: "Note ID (uniqueIdentifier)", }, }, required: ["id"], }, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, }, }, buildArgs: (input) => ["trash", String(input.id), "--json"], }, - mcp-server/src/tools.ts:316-325 (schema)Input schema requiring a single 'id' string parameter to identify which note to trash.
inputSchema: { type: "object" as const, properties: { id: { type: "string", description: "Note ID (uniqueIdentifier)", }, }, required: ["id"], }, - mcp-server/src/index.ts:29-30 (registration)The tool is registered via the ListToolsRequestSchema handler which exposes all tools (including bear_trash_note) from the tools map.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: Object.values(tools).map((t) => t.tool), - mcp-server/src/index.ts:33-89 (registration)The CallToolRequestSchema handler dispatches calls to the correct tool handler by name, invoking bear_trash_note's buildArgs to construct CLI args.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: input } = request.params; const handler = tools[name]; if (!handler) { return { content: [{ type: "text", text: `Unknown tool: ${name}` }], isError: true, }; } const params = (input ?? {}) as Record<string, unknown>; // Validate bear_edit_note: need at least one edit operation if (name === "bear_edit_note") { const hasAppend = params.append_text !== undefined; const hasBody = params.body !== undefined; const hasSetFm = params.set_frontmatter !== undefined && Object.keys(params.set_frontmatter as object).length > 0; const hasRemoveFm = Array.isArray(params.remove_frontmatter) && (params.remove_frontmatter as unknown[]).length > 0; const hasFm = hasSetFm || hasRemoveFm; if (!hasAppend && !hasBody && !hasFm) { return { content: [ { type: "text", text: "Provide 'append_text', 'body', 'set_frontmatter', or 'remove_frontmatter'.", }, ], isError: true, }; } if (hasAppend && hasBody) { return { content: [ { type: "text", text: "Provide either 'append_text' or 'body', not both.", }, ], isError: true, }; } } 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);