bear_search
Search across Bear note titles, tags, and body content. Returns ranked results with text snippets, including locked notes indication.
Instructions
Full-text search across Bear note titles, tags, and body content. Returns matching notes ranked by relevance (title matches first, then tag, then body). Body matches include a text snippet with surrounding context. Locked/private notes will match by title but may not match body searches — results include 'locked: true' for these notes. If you can't find content you expect, try listing notes to check if the relevant note is locked.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query text | |
| limit | No | Maximum number of results (default 20) | |
| since | No | Only notes modified after this date (YYYY-MM-DD, or: today, yesterday, last-week, last-month) | |
| before | No | Only notes modified before this date (YYYY-MM-DD) |
Implementation Reference
- mcp-server/src/tools.ts:85-113 (schema)Definition and input schema for the bear_search tool. Defines the ToolHandler entry with tool name, description, inputSchema (query, limit, since, before), and annotations.
bear_search: { tool: { name: "bear_search", description: "Full-text search across Bear note titles, tags, and body content. Returns matching notes ranked by relevance (title matches first, then tag, then body). Body matches include a text snippet with surrounding context. Locked/private notes will match by title but may not match body searches — results include 'locked: true' for these notes. If you can't find content you expect, try listing notes to check if the relevant note is locked.", inputSchema: { type: "object" as const, properties: { query: { type: "string", description: "Search query text", }, limit: { type: "number", description: "Maximum number of results (default 20)", }, since: { type: "string", description: "Only notes modified after this date (YYYY-MM-DD, or: today, yesterday, last-week, last-month)", }, before: { type: "string", description: "Only notes modified before this date (YYYY-MM-DD)", }, }, required: ["query"], }, - mcp-server/src/tools.ts:120-127 (handler)buildArgs handler for bear_search. Constructs the CLI arguments: 'search', the query string, '--json', and optional '--limit', '--since', '--before'. This is the function that executes the tool logic by building the command-line invocation for the bcli binary.
buildArgs: (input) => { const args = ["search", String(input.query), "--json"]; if (input.limit) args.push("--limit", String(input.limit)); if (input.since) args.push("--since", String(input.since)); if (input.before) args.push("--before", String(input.before)); return args; }, }, - mcp-server/src/index.ts:29-31 (registration)Registration of all tools via ListToolsRequestSchema and CallToolRequestSchema handlers. The bear_search tool is registered as part of the 'tools' object exported from tools.ts, listed via Object.values(tools).map(t => t.tool), and called via handler.buildArgs(params).
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: Object.values(tools).map((t) => t.tool), }));