bear_list_todos
Retrieve Bear notes with incomplete TODO items, showing titles, tags, and counts of complete and incomplete tasks. Use to identify pending action items.
Instructions
List Bear notes that have incomplete TODO items (markdown checkboxes like '- [ ]'). Returns each note's title, tags, and counts of complete/incomplete items.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of notes to return (default 30) |
Implementation Reference
- mcp-server/src/index.ts:29-103 (registration)Tools are registered with the MCP server via the ListToolsRequestSchema handler, which exposes all tools from the tools map (including bear_list_todos).
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: Object.values(tools).map((t) => t.tool), })); 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); } // 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 { - mcp-server/src/index.ts:33-45 (registration)The CallToolRequestSchema handler dispatches tool calls by name from the tools map, providing the execution pathway for bear_list_todos.
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>; - mcp-server/src/index.ts:14-14 (registration)The tools object (including bear_list_todos) is imported from ./tools.js.
import { tools } from "./tools.js"; - mcp-server/src/tools.ts:367-375 (schema)Input schema for bear_list_todos: accepts an optional 'limit' number parameter (default 30).
inputSchema: { type: "object" as const, properties: { limit: { type: "number", description: "Maximum number of notes to return (default 30)", }, }, }, - mcp-server/src/tools.ts:362-387 (handler)Full definition of the bear_list_todos tool handler. The buildArgs function constructs command-line arguments ['todo', '--json'] and optionally appends '--limit <value>'. This is executed via execBcliWithReauth (which calls the 'bcli todo --json' CLI command).
bear_list_todos: { tool: { name: "bear_list_todos", description: "List Bear notes that have incomplete TODO items (markdown checkboxes like '- [ ]'). Returns each note's title, tags, and counts of complete/incomplete items.", inputSchema: { type: "object" as const, properties: { limit: { type: "number", description: "Maximum number of notes to return (default 30)", }, }, }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, }, }, buildArgs: (input) => { const args = ["todo", "--json"]; if (input.limit) args.push("--limit", String(input.limit)); return args; }, },