bear_get_tags
Retrieve the full tag hierarchy from Bear, including note counts and pin status, to understand note organization.
Instructions
Get the full tag hierarchy from Bear. Returns all tags with their note counts and pin status. Useful for understanding how notes are organized.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- mcp-server/src/tools.ts:129-145 (schema)Definition of the bear_get_tags tool including schema (no input parameters), description, annotations, and buildArgs which produces the CLI args ['tags', '--json'].
bear_get_tags: { tool: { name: "bear_get_tags", description: "Get the full tag hierarchy from Bear. Returns all tags with their note counts and pin status. Useful for understanding how notes are organized.", inputSchema: { type: "object" as const, properties: {}, }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, }, }, buildArgs: () => ["tags", "--json"], }, - mcp-server/src/index.ts:29-31 (registration)The tool is registered via the ListToolsRequestSchema handler which iterates over all tools (including bear_get_tags) and returns their definitions.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: Object.values(tools).map((t) => t.tool), })); - mcp-server/src/index.ts:81-113 (handler)Generic tool execution handler in index.ts: calls handler.buildArgs(params) (which for bear_get_tags returns ['tags', '--json']), executes bcli with those args, and returns the JSON output.
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); } // Parse JSON output from bcli const stdout = result.stdout.trim(); if (!stdout) { return { content: [{ type: "text", text: "Command completed successfully." }], }; } // Validate it's JSON and pretty-print try { const parsed = JSON.parse(stdout); return { content: [ { type: "text", text: JSON.stringify(parsed, null, 2) }, ], }; } catch { // If bcli returned non-JSON, pass it through return { content: [{ type: "text", text: stdout }], }; }