Skip to main content
Glama

dev-kit-mcp-server

remove.py1.62 kB
"""Module for removing files and directories in the workspace.""" import shutil from dataclasses import dataclass from pathlib import Path from typing import Any, Dict from ...core import AsyncOperation @dataclass class RemoveFileOperation(AsyncOperation): """Class to Remove a file or folder.""" name = "remove_file" 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() 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, }

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