Skip to main content
Glama

reader_delete_document

Destructive

Delete one or more documents from your Readwise Reader library by providing their document IDs. This action removes the documents and returns a count of deleted items.

Instructions

Delete one or more documents from your Readwise Reader library.

Args:
    ids: (Required) Array of document IDs to delete (at least one)

Returns:
    DeleteDocumentResponse with deleted count and ids

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
deletedYes
idsYes

Implementation Reference

  • main.py:612-670 (handler)
    The async function reader_delete_document that implements the tool's core logic: validates IDs, calls the Reader API's /delete/{doc_id}/ endpoint for each ID, collects deleted IDs, and returns a DeleteDocumentResponse.
    @mcp.tool(
        name="reader_delete_document",
        annotations=ToolAnnotations(
            readOnlyHint=False,
            destructiveHint=True,
            idempotentHint=False,
            openWorldHint=True,
        ),
    )
    async def reader_delete_document(
        ids: List[str],
    ) -> DeleteDocumentResponse:
        """
        Delete one or more documents from your Readwise Reader library.
    
        Args:
            ids: (Required) Array of document IDs to delete (at least one)
    
        Returns:
            DeleteDocumentResponse with deleted count and ids
        """
        ctx = get_reader_context()
        logger.info(f"reader_delete_document: {len(ids)} documents")
    
        try:
            # Validate IDs
            if not ids:
                raise ValueError("IDs array is required and cannot be empty.")
            if not isinstance(ids, list):
                raise ValueError("IDs must be an array of document IDs.")
    
            deleted_ids = []
            for doc_id in ids:
                try:
                    response = await ctx.client.delete(f"/delete/{doc_id}/")
                    response.raise_for_status()
                    deleted_ids.append(doc_id)
                except httpx.HTTPStatusError as e:
                    if e.response.status_code == 404:
                        logger.warning(f"Document not found: {doc_id}, skipping...")
                    else:
                        logger.error(f"Error deleting {doc_id}: {e}")
    
            return DeleteDocumentResponse(
                deleted=len(deleted_ids),
                ids=deleted_ids,
            )
    
        except httpx.HTTPStatusError as e:
            if e.response.status_code == 401:
                raise ValueError("Authentication failed. Please check your access token.")
            elif e.response.status_code == 429:
                raise _rate_limit_error(e.response)
            raise
        except ValueError as e:
            raise
        except Exception as e:
            logger.error(f"Error in reader_delete_document: {str(e)}")
            raise ValueError(f"Failed to delete documents: {str(e)}")
  • The DeleteDocumentResponse dataclass schema with 'deleted' (int) and 'ids' (List[str]) fields.
    @dataclass
    class DeleteDocumentResponse:
        """Response from deleting document(s)"""
        deleted: int
        ids: List[str]
  • main.py:612-619 (registration)
    The @mcp.tool registration decorator with name='reader_delete_document', annotations including destructiveHint=True.
    @mcp.tool(
        name="reader_delete_document",
        annotations=ToolAnnotations(
            readOnlyHint=False,
            destructiveHint=True,
            idempotentHint=False,
            openWorldHint=True,
        ),
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already provide destructiveHint=true and readOnlyHint=false, so the destructive nature is clear. Description adds that the tool returns a response with deleted count and ids, but does not elaborate on other behaviors like idempotency or error states.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is two sentences plus structured args/returns, front-loaded with the main purpose. Every sentence adds value with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple parameter set and presence of an output schema, the description covers the essential: what it does, the parameter, and the return type. It could mention idempotency implications or failure scenarios, but for a basic delete tool it is adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description specifies that 'ids' is an array of document IDs and requires at least one. This adds meaning beyond the schema, which only has title 'Ids' and type.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool deletes documents from the Readwise Reader library. It specifies the verb 'delete' and the resource 'documents', distinguishing it from sibling tools like create, list, or update.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description indicates it can delete one or more documents and requires at least one ID. While it does not explicitly state when to use alternatives, the context of sibling tools makes the purpose clear, and the constraint on the parameter is helpful.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/xinthink/reader-mcp-server'

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