readwise_list_books
Easily list books with highlights in Readwise using filtering options like category, source, or update date. Ideal for organizing and accessing highlighted content.
Instructions
List books that have highlights in Readwise with optional filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Filter books by category | |
| last_highlight_at__gt | No | Filter books with last highlight after this date (ISO 8601) | |
| last_highlight_at__lt | No | Filter books with last highlight before this date (ISO 8601) | |
| page | No | Page number for pagination | |
| page_size | No | Number of results per page (default: 100, max: 1000) | |
| source | No | Filter books by source | |
| updated__gt | No | Filter books updated after this date (ISO 8601) | |
| updated__lt | No | Filter books updated before this date (ISO 8601) |
Implementation Reference
- The primary handler function that executes the 'readwise_list_books' tool. It initializes the Readwise client, maps input arguments to API parameters, calls client.listBooks(), processes the response to include essential fields (id, title, author, category, num_highlights), and returns the result as formatted JSON text content.export async function handleListBooks(args: any) { const client = await initializeClient(); const params = { page_size: args.page_size, page: args.page, category: args.category, source: args.source, updated__lt: args.updated__lt, updated__gt: args.updated__gt, last_highlight_at__lt: args.last_highlight_at__lt, last_highlight_at__gt: args.last_highlight_at__gt, }; const response = await client.listBooks(params); // Strip to essentials const minimal = { count: response.data.count, results: response.data.results.map(b => ({ id: b.id, title: b.title, author: b.author, category: b.category, num_highlights: b.num_highlights })) }; return { content: [ { type: 'text', text: JSON.stringify(minimal, null, 2), }, ], }; }
- The input schema definition for the 'readwise_list_books' tool, specifying parameters for pagination, filtering by category, source, dates, etc., used for MCP tool validation.{ name: 'readwise_list_books', description: 'List books that have highlights in Readwise with optional filtering', inputSchema: { type: 'object', properties: { page_size: { type: 'number', description: 'Number of results per page (default: 100, max: 1000)', }, page: { type: 'number', description: 'Page number for pagination', }, category: { type: 'string', enum: ['books', 'articles', 'tweets', 'supplementals', 'podcasts'], description: 'Filter books by category', }, source: { type: 'string', description: 'Filter books by source', }, updated__lt: { type: 'string', description: 'Filter books updated before this date (ISO 8601)', }, updated__gt: { type: 'string', description: 'Filter books updated after this date (ISO 8601)', }, last_highlight_at__lt: { type: 'string', description: 'Filter books with last highlight before this date (ISO 8601)', }, last_highlight_at__gt: { type: 'string', description: 'Filter books with last highlight after this date (ISO 8601)', }, }, additionalProperties: false, }, },
- src/handlers/index.ts:51-52 (registration)The switch case in the main tool dispatcher (handleToolCall) that registers and routes calls to the 'readwise_list_books' handler function.case 'readwise_list_books': return handleListBooks(args);