readwise_delete_document
Remove unwanted documents from Readwise Reader by providing the document ID. This tool ensures efficient document management within the Readwise MCP Enhanced server.
Instructions
Delete a document from Readwise Reader
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Document ID to delete |
Implementation Reference
- The core handler function that implements the readwise_delete_document tool. It destructures the document ID from input args, initializes the Readwise client, calls deleteDocument on the client, formats a success response with any messages, and returns it in the expected MCP content format.export async function handleDeleteDocument(args: any) { const client = initializeClient(); const { id } = args as { id: string }; const response = await client.deleteDocument(id); let responseText = `Document ${id} deleted successfully!`; 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 tool schema definition including name, description, and input validation schema requiring a string 'id'.{ name: 'readwise_delete_document', description: 'Delete a document from Readwise Reader', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Document ID to delete', }, }, required: ['id'], additionalProperties: false, }, },
- src/handlers/index.ts:29-30 (registration)The dispatch registration in the main handler switch statement that routes calls to the specific handleDeleteDocument function.case 'readwise_delete_document': return handleDeleteDocument(args);