delete_environment
Remove an environment from the GASSAPI backend to manage API endpoints and testing workflows. Specify the environment ID to delete it from the system.
Instructions
Delete an environment
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environmentId | Yes | Environment ID to delete |
Input Schema (JSON Schema)
{
"properties": {
"environmentId": {
"description": "Environment ID to delete",
"type": "string"
}
},
"required": [
"environmentId"
],
"type": "object"
}
Implementation Reference
- The core handler function that implements the delete_environment tool logic. It validates the environmentId parameter, initializes the BackendClient and EnvironmentService, calls deleteEnvironment on the service, and formats a success or error response as MCP content.export async function handleDeleteEnvironment(args: any): Promise<McpToolResponse> { try { const { environmentId } = args; if (!environmentId) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: 'Environment ID is required' }, null, 2) } ] }; } const instances = await getInstances(); // Create environment service const envService = new EnvironmentService( instances.backendClient.getBaseUrl(), instances.backendClient.getToken() ); // Delete environment const response = await envService.deleteEnvironment(environmentId); if (!response.success) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: response.error || 'Failed to delete environment' }, null, 2) } ] }; } return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: 'Environment deleted successfully' }, null, 2) } ] }; } catch (error: any) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: error.message || 'Unknown error occurred while deleting environment' }, null, 2) } ] }; } }
- src/tools/environment/tools.ts:146-160 (registration)Defines and exports the deleteEnvironmentTool object, including name, description, input schema requiring environmentId, and references the handleDeleteEnvironment handler. This tool object is later included in environmentTools array.export const deleteEnvironmentTool: McpTool = { name: 'delete_environment', description: 'Delete an environment', inputSchema: { type: 'object', properties: { environmentId: { type: 'string', description: 'Environment ID to delete' } }, required: ['environmentId'] }, handler: handleDeleteEnvironment };
- The input schema for the delete_environment tool, specifying that it takes an object with a required 'environmentId' string parameter.inputSchema: { type: 'object', properties: { environmentId: { type: 'string', description: 'Environment ID to delete' } }, required: ['environmentId'] }, handler: handleDeleteEnvironment
- src/tools/index.ts:109-112 (registration)Registers the delete_environment tool handler in the createEnvironmentToolHandlers function using dynamic import of handleDeleteEnvironment, mapping it for the overall tool handler factory.'delete_environment': async (args: any) => { const { handleDeleteEnvironment } = await import('./environment/handlers/detailsHandler.js'); return handleDeleteEnvironment(args); }
- src/tools/environment/tools.ts:165-172 (registration)Exports the array of all environment tools including deleteEnvironmentTool, which is imported and included in the main ALL_TOOLS array in src/tools/index.ts for global registration.export const environmentTools = [ listEnvironmentsTool, getEnvironmentDetailsTool, createEnvironmentTool, updateEnvironmentVariablesTool, setDefaultEnvironmentTool, deleteEnvironmentTool ];