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
| Name | Required | Description | Default |
|---|---|---|---|
| collection_id | No | ||
| document_id | Yes | ||
| parent_document_id | No |
Input Schema (JSON Schema)
{
"properties": {
"collection_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Collection Id"
},
"document_id": {
"title": "Document Id",
"type": "string"
},
"parent_document_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Parent Document Id"
}
},
"required": [
"document_id"
],
"title": "move_documentArguments",
"type": "object"
}
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 """
- src/mcp_outline/features/documents/__init__.py:51-51 (registration)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)
- src/mcp_outline/features/__init__.py:16-16 (registration)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, )