readwise_search_highlights
Search and filter highlights across documents by text, fields like title, author, or tags, and specific books. Streamline finding key insights with precision and control.
Instructions
Advanced search across all highlights using text queries and field-specific filters. Equivalent to official Readwise MCP search functionality.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bookId | No | Filter results to specific book | |
| fieldQueries | No | Specific field searches (like full_text_queries) | |
| limit | No | Maximum number of results to return | |
| textQuery | No | Main text to search for across all highlight content (like vector_search_term) |
Implementation Reference
- The core handler function that implements the readwise_search_highlights tool. It initializes the Readwise client, constructs search parameters from input args, calls the searchHighlights API, processes the results to essential fields, and returns formatted JSON response.export async function handleSearchHighlights(args: any) { const client = await initializeClient(); const params = { textQuery: args.textQuery, fieldQueries: args.fieldQueries, bookId: args.bookId, limit: args.limit, }; const response = await client.searchHighlights(params); // Strip to essentials const minimal = response.data.map(result => ({ text: result.highlight.text, note: result.highlight.note || undefined, book: result.book.title, author: result.book.author, score: result.score })); return { content: [ { type: 'text', text: JSON.stringify(minimal, null, 2), }, ], }; }
- The input schema definition for the readwise_search_highlights tool, including parameters for textQuery, fieldQueries, bookId, and limit.{ name: 'readwise_search_highlights', description: 'Advanced search across all highlights using text queries and field-specific filters. Equivalent to official Readwise MCP search functionality.', inputSchema: { type: 'object', properties: { textQuery: { type: 'string', description: 'Main text to search for across all highlight content (like vector_search_term)', }, fieldQueries: { type: 'array', items: { type: 'object', properties: { field: { type: 'string', enum: ['document_title', 'document_author', 'highlight_text', 'highlight_note', 'highlight_tags'], description: 'Field to search in', }, searchTerm: { type: 'string', description: 'Term to search for in the specified field', }, }, required: ['field', 'searchTerm'], }, description: 'Specific field searches (like full_text_queries)', }, bookId: { type: 'number', description: 'Filter results to specific book', }, limit: { type: 'number', description: 'Maximum number of results to return', }, }, additionalProperties: false, }, },
- src/handlers/index.ts:57-58 (registration)The switch case registration that maps the tool name 'readwise_search_highlights' to the handleSearchHighlights function.case 'readwise_search_highlights': return handleSearchHighlights(args);
- src/handlers/index.ts:15-15 (registration)Import statement for the handleSearchHighlights function used by the tool.handleSearchHighlights,