Skip to main content
Glama

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
NameRequiredDescriptionDefault
bookIdNoFilter results to specific book
fieldQueriesNoSpecific field searches (like full_text_queries)
limitNoMaximum number of results to return
textQueryNoMain 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, }, },
  • The switch case registration that maps the tool name 'readwise_search_highlights' to the handleSearchHighlights function.
    case 'readwise_search_highlights': return handleSearchHighlights(args);
  • Import statement for the handleSearchHighlights function used by the tool.
    handleSearchHighlights,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/arnaldo-delisio/readwise-mcp-enhanced'

If you have feedback or need assistance with the MCP directory API, please join our Discord server