readwise_update_document
Update a document's title, author, summary, published date, image URL, location, or category in Readwise Reader using the document ID for precise management and organization.
Instructions
Update a document in Readwise Reader
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| author | No | New author for the document | |
| category | No | New category for the document | |
| id | Yes | Document ID to update | |
| image_url | No | New image URL for the document | |
| location | No | New location for the document | |
| published_date | No | New published date (ISO 8601) | |
| summary | No | New summary for the document | |
| title | No | New title for the document |
Implementation Reference
- The handler function that implements the core logic for the readwise_update_document tool. It initializes the Readwise client, extracts the document ID and update data from arguments, calls the client's updateDocument method, and returns a formatted text response with success message and any API messages.export async function handleUpdateDocument(args: any) { const client = initializeClient(); const { id, ...updateData } = args as unknown as { id: string } & UpdateDocumentRequest; const response = await client.updateDocument(id, updateData); let responseText = `Document updated successfully!\nID: ${response.data.id}\nReader URL: ${response.data.url}`; if (response.messages && response.messages.length > 0) { responseText += '\n\nMessages:\n' + response.messages.map(msg => `${msg.type.toUpperCase()}: ${msg.content}`).join('\n'); } return { content: [ { type: 'text', text: responseText, }, ], }; }
- The input schema definition for the readwise_update_document tool, defining the expected parameters, types, descriptions, and requirements for tool calls.{ name: 'readwise_update_document', description: 'Update a document in Readwise Reader', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Document ID to update', }, title: { type: 'string', description: 'New title for the document', }, author: { type: 'string', description: 'New author for the document', }, summary: { type: 'string', description: 'New summary for the document', }, published_date: { type: 'string', description: 'New published date (ISO 8601)', }, image_url: { type: 'string', description: 'New image URL for the document', }, location: { type: 'string', enum: ['new', 'later', 'shortlist', 'archive', 'feed'], description: 'New location for the document', }, category: { type: 'string', enum: ['article', 'book', 'tweet', 'pdf', 'email', 'youtube', 'podcast'], description: 'New category for the document', }, }, required: ['id'], additionalProperties: false, }, },
- src/handlers/index.ts:26-28 (registration)Registration of the readwise_update_document tool in the central handler dispatcher switch statement, routing calls to the specific handleUpdateDocument function.case 'readwise_update_document': return handleUpdateDocument(args);
- src/types.ts:36-44 (schema)TypeScript interface defining the structure of the update data for documents, used in the handler for type assertion.export interface UpdateDocumentRequest { title?: string; author?: string; summary?: string; published_date?: string; image_url?: string; location?: 'new' | 'later' | 'shortlist' | 'archive' | 'feed'; category?: 'article' | 'book' | 'tweet' | 'pdf' | 'email' | 'youtube' | 'podcast'; }
- src/index.ts:24-26 (registration)MCP server registration for listing tools, which includes the readwise_update_document tool from the imported tools array.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });