Skip to main content
Glama

update_document

Modify or replace the title and content of an existing document. Use this tool to edit, append, or correct information in documents. Requires the full document content for updates with changes.

Instructions

    Modifies an existing document's title or content.
    
    IMPORTANT: This tool replaces the document content rather than just 

adding to it. To update a document with changed data, you need to first read the document, add your changes to the content, and then send the complete document with your changes.

    Use this tool when you need to:
    - Edit or update document content
    - Change a document's title
    - Append new content to an existing document
    - Fix errors or add information to documents
    
    Args:
        document_id: The document ID to update
        title: New title (if None, keeps existing title)
        text: New content (if None, keeps existing content)
        append: If True, adds text to the end of document instead of 
replacing
        
    Returns:
        Result message confirming update
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appendNo
document_idYes
textNo
titleNo

Implementation Reference

  • The primary handler for the 'update_document' tool. This async function, registered via @mcp.tool decorator, handles updating document title and/or content by calling the Outline API's documents.update endpoint. Supports optional append mode.
        annotations=ToolAnnotations(
            readOnlyHint=False,
            destructiveHint=True,
            idempotentHint=False,
        )
    )
    async def update_document(
        document_id: str,
        title: Optional[str] = None,
        text: Optional[str] = None,
        append: bool = False,
    ) -> str:
        """
        Modifies an existing document's title or content.
    
        IMPORTANT: This tool replaces the document content rather
        than just adding to it.
        To update a document with changed data, you need to first
        read the document, add your changes to the content, and
        then send the complete document with your changes.
    
        Use this tool when you need to:
        - Edit or update document content
        - Change a document's title
        - Append new content to an existing document
        - Fix errors or add information to documents
    
        Note: For Mermaid diagrams, use ```mermaidjs (not ```mermaid)
        as the code fence language identifier for proper rendering.
    
        Args:
            document_id: The document ID to update
            title: New title (if None, keeps existing title)
            text: New content (if None, keeps existing content)
            append: If True, adds text to the end of document
                instead of replacing
    
        Returns:
            Result message confirming update
        """
        try:
            client = await get_outline_client()
    
            # Only include fields that are being updated
            data: Dict[str, Any] = {"id": document_id}
    
            if title is not None:
                data["title"] = title
    
            if text is not None:
                data["text"] = text
                data["append"] = append
    
            response = await client.post("documents.update", data)
            document = response.get("data", {})
    
            if not document:
                return "Failed to update document."
    
            doc_title = document.get("title", "Untitled")
    
            return f"Document updated successfully: {doc_title}"
        except OutlineClientError as e:
            return f"Error updating document: {str(e)}"
        except Exception as e:
            return f"Unexpected error: {str(e)}"
  • Conditional registration of write tools including document_content.register_tools(mcp), which defines the update_document tool. Only enabled if OUTLINE_READ_ONLY env var is not set to true/1/yes.
    # Conditionally register write tools (disabled in read-only mode)
    if os.getenv("OUTLINE_READ_ONLY", "").lower() not in (
        "true",
        "1",
        "yes",
    ):
        document_content.register_tools(mcp)
        document_lifecycle.register_tools(mcp)
        document_organization.register_tools(mcp)
        batch_operations.register_tools(mcp)
  • Registration chain entry point: calls documents.register(mcp), leading to document content tools registration.
    # Register document management features
    documents.register(mcp)
  • Top-level registration: register_all(mcp) invoked after creating FastMCP instance, which cascades to include update_document tool.
    # Register all features
    register_all(mcp)
  • Docstring and type annotations defining the input schema (document_id: str, title/text: Optional[str], append: bool) and output (str confirmation message), along with usage guidelines and hints.
    """
    Modifies an existing document's title or content.
    
    IMPORTANT: This tool replaces the document content rather
    than just adding to it.
    To update a document with changed data, you need to first
    read the document, add your changes to the content, and
    then send the complete document with your changes.
    
    Use this tool when you need to:
    - Edit or update document content
    - Change a document's title
    - Append new content to an existing document
    - Fix errors or add information to documents
    
    Note: For Mermaid diagrams, use ```mermaidjs (not ```mermaid)
    as the code fence language identifier for proper rendering.
    
    Args:
        document_id: The document ID to update
        title: New title (if None, keeps existing title)
        text: New content (if None, keeps existing content)
        append: If True, adds text to the end of document
            instead of replacing
    
    Returns:
        Result message confirming update
    """
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly explains the destructive nature ('replaces the document content rather than just adding to it'), provides a workflow requirement ('need to first read the document'), and describes the append functionality. However, it doesn't mention permission requirements, rate limits, or error conditions.

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 clear sections (purpose, important note, usage guidelines, args, returns) and front-loaded key information. However, the 'when you need to' list includes redundant items ('Edit or update document content' and 'Fix errors or add information to documents' overlap), and the 'append' functionality is mentioned twice, slightly reducing efficiency.

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?

For a mutation tool with 4 parameters, 0% schema coverage, no annotations, and no output schema, the description does a good job explaining purpose, usage, parameters, and behavioral constraints. However, it doesn't describe the return value ('Result message confirming update') in detail or mention potential error cases, leaving some gaps in completeness.

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?

Schema description coverage is 0%, so the description must fully compensate. It provides detailed parameter explanations beyond the schema: 'document_id: The document ID to update', 'title: New title (if None, keeps existing title)', 'text: New content (if None, keeps existing content)', 'append: If True, adds text to the end of document instead of replacing'. This adds crucial semantic meaning to all four parameters.

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 clearly states the tool's purpose with specific verbs ('modifies', 'replaces', 'edit', 'update', 'change', 'append', 'fix', 'add') and resources ('existing document's title or content'). It distinguishes this tool from siblings like 'create_document' (creation vs. modification) and 'read_document' (write vs. read).

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 provides explicit usage contexts ('when you need to' list with four bullet points) and mentions the prerequisite of reading the document first for updates. However, it doesn't explicitly state when NOT to use this tool or name specific alternatives among siblings (e.g., 'create_document' for new documents vs. 'update_document' for existing ones).

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

Related 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/Vortiago/mcp-outline'

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