bear_context_sync
Syncs qualifying Bear notes to the local context library, updating changed notes and removing outdated ones to keep the curated knowledge base current.
Instructions
Sync qualifying Bear notes to the local context library. Adds new notes, updates changed notes, and removes notes that no longer qualify (tag removed, trashed, etc.). Regenerates the index. Only touches the bear/ directory — external/ and inbox/ are untouched. Call this when the user asks to sync, refresh, or update their context.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Force full re-sync (re-download all notes) |
Implementation Reference
- mcp-server/src/tools.ts:789-814 (registration)Tool registration in the 'tools' record with tool definition (name, description, inputSchema, annotations) and buildArgs that constructs CLI arguments ['context', 'sync', '--json'] with optional '--force' flag. The handler is not a separate function -- the tool's logic is entirely contained in the registration object itself (buildArgs method).
bear_context_sync: { tool: { name: "bear_context_sync", description: "Sync qualifying Bear notes to the local context library. Adds new notes, updates changed notes, and removes notes that no longer qualify (tag removed, trashed, etc.). Regenerates the index. Only touches the bear/ directory — external/ and inbox/ are untouched. Call this when the user asks to sync, refresh, or update their context.", inputSchema: { type: "object" as const, properties: { force: { type: "boolean", description: "Force full re-sync (re-download all notes)", }, }, }, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, }, }, buildArgs: (input) => { const args = ["context", "sync", "--json"]; if (input.force) args.push("--force"); return args; }, }, - mcp-server/src/tools.ts:794-801 (schema)Input schema for bear_context_sync: accepts a single optional boolean parameter 'force'.
inputSchema: { type: "object" as const, properties: { force: { type: "boolean", description: "Force full re-sync (re-download all notes)", }, }, - mcp-server/src/bcli.ts:256-268 (helper)Helper that executes the bcli CLI with the arguments ['context', 'sync', '--json', '--force'?] built by the tool handler, with automatic re-authentication on auth errors.
export async function execBcliWithReauth( args: string[], ): Promise<{ stdout: string; stderr: string }> { try { return await execBcli(args); } catch (error) { if (error instanceof AuthError) { await performReauth(); return await execBcli(args); } throw error; } }