Skip to main content
Glama

reader_create_document

Save a URL or HTML document to your Readwise Reader library with optional metadata like title, author, tags, and location settings.

Instructions

Save a new document (URL) to your Readwise Reader library.

Args:
    url: (Required) URL to save. Can be a placeholder if no URL is available (e.g., https://yourapp.com#document1)
    html: Provide the document's content as valid HTML (Readwise will not scrape the URL)
    should_clean_html: Auto-clean HTML and parse metadata when html is provided (default: false)
    title: Override the detected title
    author: Override the detected author
    summary: Override the detected summary
    publishedDate: Publication date (ISO 8601 format)
    imageUrl: Cover image URL
    location: Where to save the document (new, later, archive, feed; default: new)
    category: Override the detected category (article, email, rss, highlight, note, pdf, epub, tweet, video)
    saved_using: Source identifier for the document (e.g., "MyApp")
    tags: List of tags to apply
    notes: Personal notes about the document

Returns:
    CreateDocumentResponse with id, url, title, and status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
htmlNo
should_clean_htmlNo
titleNo
authorNo
summaryNo
publishedDateNo
imageUrlNo
locationNonew
categoryNo
saved_usingNo
tagsNo
notesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
urlYes
titleYes
statusYes

Implementation Reference

  • main.py:286-399 (handler)
    The async function `reader_create_document` that implements the tool logic: validates inputs, builds payload, calls POST /save/ endpoint, and returns CreateDocumentResponse.
    async def reader_create_document(
        url: str,
        html: Optional[str] = None,
        should_clean_html: Optional[bool] = None,
        title: Optional[str] = None,
        author: Optional[str] = None,
        summary: Optional[str] = None,
        publishedDate: Optional[str] = None,
        imageUrl: Optional[str] = None,
        location: Optional[Literal["new", "later", "archive", "feed"]] = "new",
        category: Optional[Literal["article", "email", "rss", "highlight", "note", "pdf", "epub", "tweet", "video"]] = None,
        saved_using: Optional[str] = None,
        tags: Optional[List[str]] = None,
        notes: Optional[str] = None,
    ) -> CreateDocumentResponse:
        """
        Save a new document (URL) to your Readwise Reader library.
    
        Args:
            url: (Required) URL to save. Can be a placeholder if no URL is available (e.g., https://yourapp.com#document1)
            html: Provide the document's content as valid HTML (Readwise will not scrape the URL)
            should_clean_html: Auto-clean HTML and parse metadata when html is provided (default: false)
            title: Override the detected title
            author: Override the detected author
            summary: Override the detected summary
            publishedDate: Publication date (ISO 8601 format)
            imageUrl: Cover image URL
            location: Where to save the document (new, later, archive, feed; default: new)
            category: Override the detected category (article, email, rss, highlight, note, pdf, epub, tweet, video)
            saved_using: Source identifier for the document (e.g., "MyApp")
            tags: List of tags to apply
            notes: Personal notes about the document
    
        Returns:
            CreateDocumentResponse with id, url, title, and status
        """
        ctx = get_reader_context()
        logger.info(f"reader_create_document: url={url}, title={title}, location={location}")
    
        try:
            # Validate URL
            if not url:
                raise ValueError("URL is required. Provide a valid URL to save.")
    
            # Validate location
            if location:
                _validate_location(location, VALID_SAVE_LOCATIONS)
    
            # Validate category
            if category:
                _validate_category(category)
    
            # Build payload
            payload: Dict[str, Any] = {"url": url}
            if html:
                payload["html"] = html
            if should_clean_html is not None:
                payload["should_clean_html"] = should_clean_html
            if title:
                payload["title"] = title
            if author:
                payload["author"] = author
            if summary:
                payload["summary"] = summary
            if publishedDate:
                payload["published_date"] = publishedDate
            if imageUrl:
                payload["image_url"] = imageUrl
            if location:
                payload["location"] = location
            if category:
                payload["category"] = category
            if saved_using:
                payload["saved_using"] = saved_using
            if tags:
                payload["tags"] = tags
            if notes:
                payload["notes"] = notes
    
            # Make API request
            response = await ctx.client.post("/save/", json=payload)
            response.raise_for_status()
            data = response.json()
    
            # Parse response
            try:
                return CreateDocumentResponse(
                    id=data.get("id", ""),
                    url=data.get("url", ""),
                    title=data.get("title", "Untitled"),
                    status="created" if response.status_code == 201 else "updated",
                )
            except (TypeError, ValueError) as e:
                logger.error(f"Invalid API response format: {e}")
                raise ValueError(
                    "Unexpected response format from Reader API when creating document."
                )
    
        except httpx.HTTPStatusError as e:
            if e.response.status_code == 401:
                raise ValueError(
                    "Authentication failed. Please check your READWISE_ACCESS_TOKEN."
                )
            elif e.response.status_code == 400:
                error_detail = e.response.text
                raise ValueError(f"Invalid request: {error_detail}")
            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_create_document: {str(e)}")
            raise ValueError(f"Failed to create document: {str(e)}")
  • The `CreateDocumentResponse` dataclass defining the response schema (id, url, title, status).
    @dataclass
    class CreateDocumentResponse:
        """Response from creating/saving a document"""
        id: str
        url: str
        title: str
        status: Literal["created", "updated"]
  • main.py:277-284 (registration)
    The @mcp.tool decorator registering 'reader_create_document' with FastMCP, including ToolAnnotations.
    @mcp.tool(
        name="reader_create_document",
        annotations=ToolAnnotations(
            readOnlyHint=False,
            destructiveHint=False,
            idempotentHint=False,
            openWorldHint=True,
        ),
  • main.py:52-56 (helper)
    Constants: VALID_SAVE_LOCATIONS and VALID_CATEGORIES used for input validation in reader_create_document.
    # Reader API endpoints
    READER_API_BASE_URL = "https://readwise.io/api/v3"
    VALID_LOCATIONS = {"new", "later", "shortlist", "archive", "feed"}
    VALID_SAVE_LOCATIONS = {"new", "later", "archive", "feed"}
    VALID_CATEGORIES = {"article", "email", "rss", "highlight", "note", "pdf", "epub", "tweet", "video"}
  • Helper functions `_validate_location` and `_validate_category` used to validate input parameters.
    def _validate_location(location: str, valid_set: set = VALID_LOCATIONS) -> None:
        """Validate location parameter."""
        if location not in valid_set:
            raise ValueError(
                f"Invalid location '{location}'. "
                f"Must be one of: {', '.join(sorted(valid_set))}"
            )
    
    
    def _validate_category(category: str) -> None:
        """Validate category parameter."""
        if category not in VALID_CATEGORIES:
            raise ValueError(
                f"Invalid category '{category}'. "
                f"Must be one of: {', '.join(sorted(VALID_CATEGORIES))}"
            )
Behavior5/5

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

Annotations (readOnlyHint=false) align with description implying writes. The description adds behavioral details: url can be a placeholder, html bypasses scraping, and returns CreateDocumentResponse. No contradictions.

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

Conciseness4/5

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

The description is well-structured with a summary sentence followed by a bullet list of parameters and return type. It is relatively long but efficiently organized, with no redundant information.

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

Completeness5/5

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

Given 13 parameters, 0% schema coverage, and an output schema, the description covers all necessary aspects: parameter semantics, return format, and behavioral nuances (e.g., placeholder URLs, html override). No gaps.

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

Parameters5/5

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

With 0% schema description coverage, the description provides comprehensive details for all 13 parameters, including default values, alternatives (e.g., placeholder URL), and formatting (ISO 8601 for dates). This adds significant meaning beyond the schema.

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?

The description states 'Save a new document (URL) to your Readwise Reader library,' which is a specific verb+resource. It clearly distinguishes from sibling tools like reader_update_document or reader_delete_document, as it is the only creation tool.

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?

The description implicitly communicates usage for creating new documents but lacks explicit guidance on when to use this tool versus alternatives or when not to use it. However, it's clear from context that this is the only creation tool among siblings.

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