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
| Name | Required | Description | Default |
|---|---|---|---|
| append | No | ||
| document_id | Yes | ||
| text | No | ||
| title | No |
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)}"
- src/mcp_outline/features/documents/__init__.py:43-53 (registration)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)
- src/mcp_outline/features/__init__.py:15-17 (registration)Registration chain entry point: calls documents.register(mcp), leading to document content tools registration.# Register document management features documents.register(mcp)
- src/mcp_outline/server.py:31-32 (registration)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 """