local_dev_cleanup
Remove temporary files and reset configurations in local development environments to maintain system performance and prepare for new projects.
Instructions
Clean up a local development environment
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env_id | Yes | Environment identifier |
Implementation Reference
- src/mcp_local_dev/server.py:57-68 (registration)Registers the local_dev_cleanup tool with MCP framework, defining name, description, and input schema requiring 'env_id'.types.Tool( name="local_dev_cleanup", description="Clean up a local development environment", inputSchema={ "type": "object", "properties": { "env_id": {"type": "string", "description": "Environment identifier"} }, "required": ["env_id"], }, ), ]
- src/mcp_local_dev/server.py:151-178 (handler)Implements the tool handler: retrieves environment by ID, calls cleanup_environment if found, returns JSON success/error response.elif name == "local_dev_cleanup": env = get_environment(arguments["env_id"]) if not env: return [ types.TextContent( type="text", text=json.dumps( { "success": False, "error": f"Unknown environment: {arguments['env_id']}", } ), ) ] cleanup_environment(env) return [ types.TextContent( type="text", text=json.dumps( { "success": True, "data": { "message": "Environment cleaned up successfully" }, } ), ) ]
- Core cleanup logic: removes environment from in-memory store and invokes sandbox cleanup.def cleanup_environment(env: Environment) -> None: """Clean up environment and its resources.""" if env.id in _ENVIRONMENTS: del _ENVIRONMENTS[env.id] cleanup_sandbox(env.sandbox)
- Retrieves environment from in-memory store by ID, used in handler.def get_environment(env_id: str) -> Optional[Environment]: """Get environment by ID.""" return _ENVIRONMENTS.get(env_id)