Skip to main content
Glama

move_document

Relocate a document to a new collection or parent while preserving its nested hierarchy. Use to reorganize content structure, change collections, or update document nesting within the MCP Outline Server.

Instructions

    Relocates a document to a different collection or parent document.
    
    IMPORTANT: When moving a document that has child documents (nested 
    documents), all child documents will move along with it, maintaining 
    their hierarchical structure. You must specify either collection_id or 
    parent_document_id (or both).
    
    Use this tool when you need to:
    - Reorganize your document hierarchy
    - Move a document to a more relevant collection
    - Change a document's parent document
    - Restructure content organization
    
    Args:
        document_id: The document ID to move
        collection_id: Target collection ID (if moving between collections)
        parent_document_id: Optional parent document ID (for nesting)
        
    Returns:
        Result message confirming the move operation
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_idNo
document_idYes
parent_document_idNo

Implementation Reference

  • The core handler function for the 'move_document' tool. It validates inputs, constructs the API request to Outline's documents.move endpoint, executes the move operation, and returns success/error messages. The function signature provides the input schema, and annotations indicate it's destructive and non-idempotent.
    @mcp.tool(
        annotations=ToolAnnotations(
            readOnlyHint=False,
            destructiveHint=True,
            idempotentHint=False,
        )
    )
    async def move_document(
        document_id: str,
        collection_id: Optional[str] = None,
        parent_document_id: Optional[str] = None,
    ) -> str:
        """
        Relocates a document to a different collection or parent document.
    
        IMPORTANT: When moving a document that has child documents (nested
        documents), all child documents will move along with it, maintaining
        their hierarchical structure. You must specify either collection_id or
        parent_document_id (or both).
    
        Use this tool when you need to:
        - Reorganize your document hierarchy
        - Move a document to a more relevant collection
        - Change a document's parent document
        - Restructure content organization
    
        Args:
            document_id: The document ID to move
            collection_id: Target collection ID (if moving between collections)
            parent_document_id: Optional parent document ID (for nesting)
    
        Returns:
            Result message confirming the move operation
        """
        try:
            client = await get_outline_client()
    
            # Require at least one destination parameter
            if collection_id is None and parent_document_id is None:
                return (
                    "Error: You must specify either a collection_id or "
                    "parent_document_id."
                )
    
            data = {"id": document_id}
    
            if collection_id:
                data["collectionId"] = collection_id
    
            if parent_document_id:
                data["parentDocumentId"] = parent_document_id
    
            response = await client.post("documents.move", data)
    
            # Check for successful response
            if response.get("data"):
                return "Document moved successfully."
            else:
                return "Failed to move document."
        except OutlineClientError as e:
            return f"Error moving document: {str(e)}"
        except Exception as e:
            return f"Unexpected error: {str(e)}"
  • The registration function for document organization tools, which defines and registers the move_document tool via the @mcp.tool decorator.
    def register_tools(mcp) -> None:
        """
        Register document organization tools with the MCP server.
    
        Args:
            mcp: The FastMCP server instance
        """
  • Registers document organization tools (including move_document) by calling document_organization.register_tools(mcp), conditionally if not in read-only mode.
    document_organization.register_tools(mcp)
  • Entry point for registering all document features, including organization tools with move_document, via documents.register(mcp).
    documents.register(mcp)
  • Imports helper functions from common.py used by the move_document handler: get_outline_client() to obtain the Outline API client and OutlineClientError for error handling.
    from mcp_outline.features.documents.common import (
        OutlineClientError,
        get_outline_client,
    )

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