Skip to main content
Glama

remove_file

Destructive

Delete files or folders directly via the dev-kit-mcp-server by specifying the path, returning status and details of the removed item.

Instructions

Use instead of terminal: Remove a file or folder.

    Args:
        path: Path to the file or folder to remove

    Returns:
        A dictionary containing the status and path of the removed file or folder

    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The __call__ method implementing the remove_file tool logic: removes the specified file or directory after validation and returns a success dictionary.
    async def __call__(self, path: str) -> Dict[str, Any]:
        """Remove a file or folder.
    
        Args:
            path: Path to the file or folder to remove
    
        Returns:
            A dictionary containing the status and path of the removed file or folder
    
        """
        # Handle both model and direct path input for backward compatibility
    
        self._remove_folder(path)
        return {
            "status": "success",
            "message": f"Successfully removed: {path}",
            "path": path,
        }
  • Helper method that performs the actual file or directory removal after path validation.
    def _remove_folder(self, path: str) -> None:
        """Remove a file or folder at the specified path.
    
        Args:
            path: Path to the file or folder to remove
    
        Raises:
            FileNotFoundError: If the path does not exist
    
        """
        # Validate that the path is within the root directory
        root_path = self._root_path
        abs_path = self._validate_path_in_root(root_path, path)
    
        # Check if path exists
        file_path = Path(abs_path)
        if not file_path.exists():
            raise FileNotFoundError(f"Path does not exist: {path}")
    
        # Remove the file or folder
        if file_path.is_dir():
            shutil.rmtree(file_path)
        else:
            file_path.unlink()
  • Registers all tools from the tools module using ToolFactory, which includes RemoveFileOperation instantiated as the 'remove_file' tool.
    tool_factory = ToolFactory(fastmcp)
    tool_factory(["dev_kit_mcp_server.tools"], root_dir=root_dir, commands_toml=commands_toml)
  • Imports and exposes RemoveFileOperation in __all__ for dynamic tool discovery and registration.
    from .file_sys.remove import RemoveFileOperation
    from .file_sys.rename import RenameOperation
    from .git.add import GitAddOperation
    from .git.checkout import GitCheckoutOperation
    from .git.commit import GitCommitOperation
    from .git.create_branch import GitCreateBranchOperation
    from .git.diff import GitDiffOperation
    from .git.pull import GitPullOperation
    from .git.push import GitPushOperation
    from .git.status import GitStatusOperation
    
    # Check if PyGithub is available
    GITHUB_AVAILABLE = importlib.util.find_spec("github") is not None
    
    __all__ = [
        "CreateDirOperation",
        "EditFileOperation",
        "RemoveFileOperation",
  • Sets the tool name to 'remove_file' used during MCP tool registration.
    name = "remove_file"
Behavior4/5

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

The annotations include 'destructiveHint: true,' which already indicates this is a destructive operation. The description adds value by specifying that it removes 'a file or folder' and mentions the return format ('A dictionary containing the status and path'), providing useful context beyond the annotations. No contradiction with annotations is present.

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

Conciseness4/5

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

The description is well-structured with clear sections for Args and Returns, making it easy to parse. It's appropriately sized with no wasted sentences, though the 'Use instead of terminal' phrase could be more integrated or omitted if redundant, keeping it efficient but not perfect.

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

Completeness4/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 one parameter) and the presence of annotations and an output schema, the description is reasonably complete. It covers the purpose, parameter, and return value, though it could benefit from more detailed behavioral warnings or examples to fully compensate for the low schema coverage.

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?

The schema description coverage is 0%, so the description carries the full burden. It clearly explains the 'path' parameter as 'Path to the file or folder to remove,' adding essential meaning beyond the schema's basic type definition. However, it doesn't detail format constraints or examples, which slightly limits its effectiveness.

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: 'Remove a file or folder.' It specifies the verb ('Remove') and resource ('file or folder'), making it understandable. However, it doesn't explicitly differentiate from sibling tools like 'move_dir' or 'rename_file' beyond the basic action, which prevents a perfect score.

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 provides some usage context by stating 'Use instead of terminal,' implying this is a higher-level or safer alternative to raw terminal commands. However, it lacks explicit guidance on when to use this tool versus alternatives like 'move_dir' or 'rename_file,' and doesn't mention prerequisites or exclusions, leaving usage somewhat implied rather than clearly defined.

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

Related 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/DanielAvdar/dev-kit-mcp-server'

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