Skip to main content
Glama

delete_document

Moves a document to trash or permanently deletes it from the MCP Outline Server. Documents can be restored within 30 days unless permanent deletion is specified. Use to remove unwanted, obsolete, or sensitive content and clean up your workspace.

Instructions

Moves a document to trash or permanently deletes it. IMPORTANT: When permanent=False (the default), documents are moved to trash and retained for 30 days before being permanently deleted. During this period, they can be restored using the restore_document tool. Setting permanent=True bypasses the trash and immediately deletes the document without any recovery option. Use this tool when you need to: - Remove unwanted or unnecessary documents - Delete obsolete content - Clean up workspace by removing documents - Permanently remove sensitive information (with permanent=True) Args: document_id: The document ID to delete permanent: If True, permanently deletes the document without recovery option Returns: Result message confirming deletion

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_idYes
permanentNo

Implementation Reference

  • The core handler function for the 'delete_document' MCP tool. Handles both trash and permanent deletion via OutlineClient, with detailed error handling and user feedback.
    @mcp.tool( annotations=ToolAnnotations( readOnlyHint=False, destructiveHint=True, idempotentHint=True ) ) async def delete_document( document_id: str, permanent: bool = False ) -> str: """ Moves a document to trash or permanently deletes it. IMPORTANT: When permanent=False (the default), documents are moved to trash and retained for 30 days before being permanently deleted. During this period, they can be restored using the restore_document tool. Setting permanent=True bypasses the trash and immediately deletes the document without any recovery option. Use this tool when you need to: - Remove unwanted or unnecessary documents - Delete obsolete content - Clean up workspace by removing documents - Permanently remove sensitive information (with permanent=True) Args: document_id: The document ID to delete permanent: If True, permanently deletes the document without recovery option Returns: Result message confirming deletion """ try: client = await get_outline_client() if permanent: success = await client.permanently_delete_document( document_id ) if success: return "Document permanently deleted." else: return "Failed to permanently delete document." else: # First get the document details for the success message document = await client.get_document(document_id) doc_title = document.get("title", "Untitled") # Move to trash (using the regular delete endpoint) response = await client.post( "documents.delete", {"id": document_id} ) # Check for successful response if response.get("success", False): return f"Document moved to trash: {doc_title}" else: return "Failed to move document to trash." except OutlineClientError as e: return f"Error deleting document: {str(e)}" except Exception as e: return f"Unexpected error: {str(e)}"
  • Helper method in OutlineClient used by delete_document for permanent deletion. Makes API call to Outline's documents.delete with permanent=True flag.
    async def permanently_delete_document(self, document_id: str) -> bool: """ Permanently delete a document by ID. Args: document_id: The document ID to permanently delete. Returns: Success status. """ response = await self.post( "documents.delete", {"id": document_id, "permanent": True} ) return response.get("success", False)
  • Registration point where document_lifecycle.register_tools(mcp) is called, conditionally based on OUTLINE_READ_ONLY env var, enabling the delete_document tool.
    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)
  • Higher-level registration in features/__init__.py calling documents.register(mcp), which leads to document_lifecycle tools.
    documents.register(mcp)
  • Top-level registration in server.py calling register_all(mcp), initiating the chain that registers the delete_document tool.
    register_all(mcp)

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