export_all_collections
Export all workspace collections, documents, and hierarchies in specified formats (Outline-Markdown, JSON, HTML) for backup, migration, or archiving. Initiates an asynchronous operation with status and file access details.
Instructions
Exports the entire workspace content to a downloadable file.
IMPORTANT: This tool starts an asynchronous export operation which may
take time to complete, especially for large workspaces. The function
returns information about the operation, including its status. When
the operation is complete, the file can be downloaded or accessed via
Outline's UI. The export includes all collections, documents, and
their
hierarchies in the specified format.
Use this tool when you need to:
- Create a complete backup of all workspace content
- Migrate content to another system
- Archive all workspace documents
- Get a comprehensive export of knowledge base
Args:
format: Export format ("outline-markdown", "json", or "html")
Returns:
Information about the export operation and how to access the file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | outline-markdown |
Implementation Reference
- MCP tool handler implementation for 'export_all_collections'. Initiates export using OutlineClient and returns formatted file operation status.@mcp.tool( annotations=ToolAnnotations( readOnlyHint=True, destructiveHint=False, idempotentHint=True, ) ) async def export_all_collections(format: str = "outline-markdown") -> str: """ Exports the entire workspace content to a downloadable file. IMPORTANT: This tool starts an asynchronous export operation which may take time to complete, especially for large workspaces. The function returns information about the operation, including its status. When the operation is complete, the file can be downloaded or accessed via Outline's UI. The export includes all collections, documents, and their hierarchies in the specified format. Use this tool when you need to: - Create a complete backup of all workspace content - Migrate content to another system - Archive all workspace documents - Get a comprehensive export of knowledge base Args: format: Export format ("outline-markdown", "json", or "html") Returns: Information about the export operation and how to access the file """ try: client = await get_outline_client() file_operation = await client.export_all_collections(format) if not file_operation: return "Failed to start export operation." return _format_file_operation(file_operation) except OutlineClientError as e: return f"Error exporting collections: {str(e)}" except Exception as e: return f"Unexpected error: {str(e)}"
- Utility function used by the handler to format file operation results into user-friendly text output.def _format_file_operation(file_operation: Optional[Dict[str, Any]]) -> str: """Format file operation data into readable text.""" if not file_operation: return "No file operation data available." # Get the file operation details state = file_operation.get("state", "unknown") type_info = file_operation.get("type", "unknown") name = file_operation.get("name", "unknown") file_operation_id = file_operation.get("id", "") # Format output output = f"# Export Operation: {name}\n\n" output += f"State: {state}\n" output += f"Type: {type_info}\n" output += f"ID: {file_operation_id}\n\n" # Provide instructions based on the state if state == "complete": output += "The export is complete and ready to download. " output += ( "Use the ID with the appropriate download tool to retrieve " "the file.\n" ) else: output += "The export is still in progress. " output += ( f"Check the operation state again later using the ID: " f"{file_operation_id}\n" ) return output
- OutlineClient method called by the tool handler to perform the API request for exporting all collections.async def export_all_collections( self, format: str = "outline-markdown" ) -> Dict[str, Any]: """ Export all collections to a file. Args: format: The export format (outline-markdown, json, or html) Returns: FileOperation data that can be queried for progress """ response = await self.post( "collections.export_all", {"format": format} ) return response.get("data", {})
- src/mcp_outline/server.py:31-32 (registration)Server initialization calls register_all(mcp), which chains to registering the collection tools including export_all_collections.# Register all features register_all(mcp)