delete_file
Remove the current file in the editor-mcp server, a Python-based text editor for managing file operations through a standardized API.
Instructions
Delete current file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/text_editor/server.py:776-800 (handler)Implementation of the delete_file tool. This async function deletes the currently set file using os.remove after validation checks. It returns a success message or error.async def delete_file() -> Dict[str, Any]: """ Delete current file """ if self.current_file_path is None: return {"error": "No file path is set. Use set_file first."} try: if not os.path.exists(self.current_file_path): return {"error": f"File '{self.current_file_path}' does not exist."} os.remove(self.current_file_path) deleted_path = self.current_file_path self.current_file_path = None return { "status": "success", "message": f"File '{deleted_path}' was successfully deleted.", } except Exception as e: return {"error": f"Error deleting file: {str(e)}"}
- src/text_editor/server.py:776-776 (registration)Registration of the delete_file tool using the FastMCP @tool decorator.async def delete_file() -> Dict[str, Any]: