remove_document
Delete a specific document from the DocNav-MCP server using its unique identifier to manage document storage and organization.
Instructions
Remove a document from the navigator.
Args:
doc_id: Document identifier (UUID)
Returns:
Success or error message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc_id | Yes |
Implementation Reference
- server.py:190-205 (handler)MCP tool handler for 'remove_document', decorated with @mcp.tool(). It calls the navigator's remove_document method and returns a formatted success or error message based on the boolean result.@mcp.tool() def remove_document(doc_id: str) -> str: """Remove a document from the navigator. Args: doc_id: Document identifier (UUID) Returns: Success or error message """ success = navigator.remove_document(doc_id) if success: return f"Document '{doc_id}' removed successfully" else: return f"Document '{doc_id}' not found or could not be removed"
- docnav/navigator.py:806-825 (helper)Core logic in Navigator class's remove_document method: validates doc_id as UUID, then deletes the document from loaded_documents and document_metadata dictionaries if present, returning True on success or False otherwise.def remove_document(self, doc_id: str) -> bool: """Remove a document from the navigator. Args: doc_id: UUID-based document identifier Returns: True if document was removed, False if not found """ try: uuid.UUID(doc_id) except ValueError: return False if doc_id in self.loaded_documents: del self.loaded_documents[doc_id] if doc_id in self.document_metadata: del self.document_metadata[doc_id] return True return False