set_bear_token
Configure your Bear app token to enable Claude Desktop integration for reading, creating, searching notes, and managing tags directly within Bear.
Instructions
Set the Bear app token for accessing existing notes. Get your token from Bear → Help → Advanced → API Token
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | Your Bear app token |
Implementation Reference
- src/index.ts:519-531 (handler)Handler for the set_bear_token tool. Extracts the token from arguments, saves it using saveToken function, and returns a success message.case "set_bear_token": { const token = String(args.token); saveToken(token); return { content: [ { type: "text", text: `Bear token has been saved successfully. Use check_bear_setup to test the connection.`, }, ], }; }
- src/index.ts:389-402 (schema)Schema definition and registration of the set_bear_token tool in the ListTools response.{ name: "set_bear_token", description: "Set the Bear app token for accessing existing notes. Get your token from Bear → Help → Advanced → API Token", inputSchema: { type: "object", properties: { token: { type: "string", description: "Your Bear app token", }, }, required: ["token"], }, },
- src/index-db.ts:279-290 (handler)Handler for the set_bear_token tool in the experimental DB version. Saves the token and returns a message.case "set_bear_token": { const token = String(args.token); saveToken(token); return { content: [ { type: "text", text: `Bear token saved. This experimental version attempts direct database access.`, }, ], }; }
- src/index-db.ts:175-187 (schema)Schema definition and registration of the set_bear_token tool in the experimental DB version's ListTools response.{ name: "set_bear_token", description: "Set the Bear app token for accessing existing notes", inputSchema: { type: "object", properties: { token: { type: "string", description: "Your Bear app token", }, }, required: ["token"], },
- src/index.ts:44-54 (helper)Helper function that saves the Bear token to a secure file in the user's home directory.function saveToken(token: string): void { try { if (!fs.existsSync(CONFIG_DIR)) { fs.mkdirSync(CONFIG_DIR, { recursive: true }); } fs.writeFileSync(TOKEN_FILE, token, 'utf8'); fs.chmodSync(TOKEN_FILE, 0o600); // Secure the token file } catch (error) { console.error("Error saving token:", error); } }