bear_add_tag
Add a tag to a Bear note, including hierarchical tags like 'parent/child', making the note discoverable under both #parent and #parent/child.
Instructions
Add a tag to an existing Bear note. The tag is inserted into the note's markdown. Hierarchical tags like 'parent/child' also index every ancestor — so the note becomes discoverable under both #parent and #parent/child in Bear's sidebar.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Note ID (uniqueIdentifier) | |
| tag | Yes | Tag to add (without #) |
Implementation Reference
- mcp-server/src/tools.ts:534-566 (schema)Tool definition and schema for bear_add_tag. Defines the tool name, description, inputSchema (id and tag fields), and buildArgs that construct the CLI command ['tag', 'add', id, tag, '--json'].
bear_add_tag: { tool: { name: "bear_add_tag", description: "Add a tag to an existing Bear note. The tag is inserted into the note's markdown. Hierarchical tags like 'parent/child' also index every ancestor — so the note becomes discoverable under both #parent and #parent/child in Bear's sidebar.", inputSchema: { type: "object" as const, properties: { id: { type: "string", description: "Note ID (uniqueIdentifier)", }, tag: { type: "string", description: "Tag to add (without #)", }, }, required: ["id", "tag"], }, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, }, }, buildArgs: (input) => [ "tag", "add", String(input.id), String(input.tag), "--json", ], }, - mcp-server/src/index.ts:29-31 (registration)Registration via ListToolsRequestSchema handler. On L29-31, all tool definitions (including bear_add_tag) are exported from ./tools.js and registered by listing them via the MCP SDK's ListToolsRequestSchema.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: Object.values(tools).map((t) => t.tool), })); - mcp-server/src/index.ts:33-42 (registration)Execution handler for all tools (CallToolRequestSchema). On L33-42, the handler looks up the tool by name in the `tools` registry — when 'bear_add_tag' is called, it retrieves the ToolHandler and executes buildArgs(params) to construct the bcli command.
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, }; }