Skip to main content
Glama

readwise_export_highlights

Export all highlights from Readwise with optional filtering by date, book IDs, or deletion status for bulk analysis or backup purposes.

Instructions

Export all highlights from Readwise with optional filtering. Perfect for bulk analysis or backup.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
updatedAfterNoOnly export highlights updated after this date (ISO 8601) - useful for incremental sync
idsNoComma-separated list of book IDs to export highlights from
includeDeletedNoInclude deleted highlights in export (default: false)
pageCursorNoCursor for pagination through large exports

Implementation Reference

  • The MCP tool handler function that executes the 'readwise_export_highlights' logic: initializes client, maps args to params, calls client.exportHighlights, formats response as MCP content.
    export async function handleExportHighlights(args: any) { const client = await initializeClient(); const params = { updatedAfter: args.updatedAfter, ids: args.ids, includeDeleted: args.includeDeleted, pageCursor: args.pageCursor, }; const response = await client.exportHighlights(params); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; }
  • Tool schema defining the name, description, and inputSchema parameters for 'readwise_export_highlights'.
    { name: 'readwise_export_highlights', description: 'Export all highlights from Readwise with optional filtering. Perfect for bulk analysis or backup.', inputSchema: { type: 'object', properties: { updatedAfter: { type: 'string', description: 'Only export highlights updated after this date (ISO 8601) - useful for incremental sync', }, ids: { type: 'string', description: 'Comma-separated list of book IDs to export highlights from', }, includeDeleted: { type: 'boolean', description: 'Include deleted highlights in export (default: false)', }, pageCursor: { type: 'string', description: 'Cursor for pagination through large exports', }, }, additionalProperties: false, }, },
  • Import registration of the handleExportHighlights function from highlights-handlers.js into the main handler dispatcher.
    import { handleListHighlights, handleCreateHighlight, handleExportHighlights, handleGetDailyReview, handleListBooks, handleGetBookHighlights, handleSearchHighlights, } from './highlights-handlers.js';
  • Dispatch registration in the main handleToolCall switch statement mapping tool name to handler.
    case 'readwise_export_highlights': return handleExportHighlights(args);
  • Core helper method in ReadwiseClient that makes the actual API request to Readwise /export/ endpoint with query parameters, handles errors including rate limits.
    async exportHighlights(params: ExportHighlightsParams = {}): Promise<APIResponse<ExportHighlightsResponse>> { try { const searchParams = new URLSearchParams(); Object.entries(params).forEach(([key, value]) => { if (value !== undefined) { searchParams.append(key, String(value)); } }); const query = searchParams.toString(); const endpoint = `/export/${query ? `?${query}` : ''}`; const result = await this.makeRequest<ExportHighlightsResponse>(endpoint, {}, true); return this.createResponse(result); } catch (error) { if (error instanceof Error && error.message.startsWith('RATE_LIMIT:')) { const seconds = parseInt(error.message.split(':')[1], 10); throw new Error(`Rate limit exceeded. Too many requests. Please retry after ${seconds} seconds.`); } throw error; } }

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