Skip to main content
Glama

delete_docx

Remove Word documents from your system by specifying the file path and confirming deletion for safety.

Instructions

Delete a Word document.

Args: filepath: Path to the document to delete confirm: Must be True to actually delete (safety check)

Returns: Dictionary with status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYes
confirmNo

Implementation Reference

  • The implementation of the `delete_docx` tool which deletes a Word document after confirmation.
    @app.tool()
    def delete_docx(filepath: str, confirm: bool = False) -> dict[str, Any]:
        """
        Delete a Word document.
    
        Args:
            filepath: Path to the document to delete
            confirm: Must be True to actually delete (safety check)
    
        Returns:
            Dictionary with status
        """
        logger.info("Deleting document", extra={"tool": "delete_docx", "filepath": filepath})
    
        try:
            if not confirm:
                return {
                    "status": "warning",
                    "message": "Deletion requires confirm=True",
                }
    
            path = validate_docx_file(filepath)
            path.unlink()
    
            logger.info("Document deleted successfully", extra={"filepath": filepath})
    
            return {
                "status": "success",
                "message": f"Document deleted: {path.name}",
            }
        except DocxMcpError as e:
            logger.warning(e.message, extra={"tool": "delete_docx", "error_code": e.error_code})
            return {"status": "error", "error": e.message, "error_code": e.error_code}
        except Exception as e:
            logger.error(f"Unexpected error deleting document: {str(e)}")
            return {"status": "error", "error": str(e)}

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/Andrew82106/LLM_Docx_Agent_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server