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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

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)}
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses the destructive nature through 'Delete' and adds a safety mechanism ('confirm' parameter), which is valuable behavioral context. However, it doesn't mention permissions needed, whether deletion is permanent or reversible, error handling, or rate limits, leaving gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise and well-structured: a one-sentence purpose statement followed by bullet-point-like sections for Args and Returns. Every sentence adds value without redundancy, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (destructive operation with 2 parameters), no annotations, and an output schema exists (suggesting return values are documented elsewhere), the description is moderately complete. It covers purpose and parameters but lacks behavioral details like error cases or side effects, which are important for a deletion tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains both parameters: 'filepath' as 'Path to the document to delete' and 'confirm' as 'Must be True to actually delete (safety check)', adding clear meaning beyond the bare schema. This covers both parameters adequately, though it doesn't detail format constraints for 'filepath'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Delete') and resource ('a Word document'). It distinguishes itself from sibling tools like 'copy_docx' or 'read_docx' by focusing on deletion, but doesn't explicitly differentiate from other destructive operations like potential file removal tools that might exist elsewhere.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage through the safety check parameter ('confirm: Must be True to actually delete'), suggesting when to use it for deletion confirmation. However, it doesn't provide explicit guidance on when to choose this tool versus alternatives like 'copy_docx' for backup before deletion or mention prerequisites like file existence checks.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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