Skip to main content
Glama
GILSMON

MCP Policy Gatekeeper

by GILSMON

delete_file

Remove files while enforcing organizational policies on naming conventions, security, and compliance rules before deletion.

Instructions

Delete a file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path

Implementation Reference

  • The handler logic for the 'delete_file' tool within the call_tool function. It resolves the provided path, checks if the file exists, deletes it using path.unlink() if it does, and returns an appropriate success or error message.
    elif name == "delete_file":
        path = resolve_path(arguments["path"])
        
        if not path.exists():
            return [TextContent(type="text", text=f"Error: File '{arguments['path']}' not found")]
        
        path.unlink()
        return [TextContent(type="text", text=f"✓ File deleted: {arguments['path']}")]
  • server.py:112-122 (registration)
    Registration of the 'delete_file' tool in the list_tools() function, including name, description, and input schema.
    Tool(
        name="delete_file",
        description="Delete a file",
        inputSchema={
            "type": "object",
            "properties": {
                "path": {"type": "string", "description": "File path"}
            },
            "required": ["path"]
        }
    ),
  • Input schema definition for the 'delete_file' tool, specifying the required 'path' parameter.
    inputSchema={
        "type": "object",
        "properties": {
            "path": {"type": "string", "description": "File path"}
        },
        "required": ["path"]
    }
  • Helper function used by the delete_file handler (and others) to resolve relative paths to absolute paths within the protected directory, enforcing security.
    def resolve_path(relative_path: str) -> Path:
        full_path = (PROTECTED_DIR / relative_path).resolve()
        if not str(full_path).startswith(str(PROTECTED_DIR)):
            raise ValueError("Access denied: Path outside protected directory")
        return full_path
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Delete a file' implies a destructive mutation, but it doesn't specify whether deletion is permanent, reversible (e.g., moves to trash), requires specific permissions, or has side effects (e.g., affecting linked resources). This leaves critical behavioral traits unaddressed for a destructive operation.

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 extremely concise with just three words, front-loaded with the core action. There's no wasted language, making it easy to parse quickly, though this brevity contributes to gaps in other dimensions.

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

Completeness2/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 no annotations and no output schema), the description is incomplete. It doesn't cover behavioral aspects like permanence or permissions, output details (e.g., confirmation message), or error handling, which are crucial for safe and effective use.

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

Parameters3/5

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

The input schema has 100% description coverage, with the 'path' parameter documented as 'File path'. The description adds no additional meaning beyond this, such as path format examples or constraints. According to the rules, with high schema coverage (>80%), the baseline is 3 even without param info in the description.

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

Purpose3/5

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

The description 'Delete a file' clearly states the action (delete) and resource (file), which is better than a tautology. However, it doesn't differentiate from sibling tools like 'create_file' or 'write_file' beyond the verb, and it lacks specificity about what type of file deletion occurs (permanent vs. trash, etc.).

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'write_file' for modifications or 'create_file' for new files. It doesn't mention prerequisites (e.g., file must exist) or exclusions, leaving the agent to infer usage from context alone.

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/GILSMON/mcpServer_as_gatekeeper'

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