readwise_get_book_highlights
Retrieve all highlights from a specific book in your Readwise library by providing the book ID, enabling quick access to key passages and insights.
Instructions
Get all highlights from a specific book
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bookId | Yes | The ID of the book to get highlights from |
Implementation Reference
- The core handler function for the readwise_get_book_highlights tool. It initializes the Readwise client, fetches all highlights for the given bookId using the SDK client, strips the response to essential fields (id, text, note), and returns the data as a JSON-formatted text content block for MCP response.export async function handleGetBookHighlights(args: any) { const client = await initializeClient(); const response = await client.getBookHighlights(args.bookId); // Strip to essentials const minimal = response.data.map(h => ({ id: h.id, text: h.text, note: h.note || undefined })); return { content: [ { type: 'text', text: JSON.stringify(minimal, null, 2), }, ], }; }
- The tool definition including input schema for readwise_get_book_highlights, requiring a numeric bookId parameter.{ name: 'readwise_get_book_highlights', description: 'Get all highlights from a specific book', inputSchema: { type: 'object', properties: { bookId: { type: 'number', description: 'The ID of the book to get highlights from', }, }, required: ['bookId'], additionalProperties: false, }, },
- src/handlers/index.ts:8-16 (registration)Import statement registering the handleGetBookHighlights handler function from highlights-handlers.ts into the main tool dispatcher.import { handleListHighlights, handleCreateHighlight, handleExportHighlights, handleGetDailyReview, handleListBooks, handleGetBookHighlights, handleSearchHighlights, } from './highlights-handlers.js';
- src/handlers/index.ts:54-56 (registration)Switch case in the main handleToolCall function that registers and dispatches 'readwise_get_book_highlights' tool calls to the handler.case 'readwise_get_book_highlights': return handleGetBookHighlights(args);