delete_service_env
Remove environment variables from services in Coolify to manage configuration and maintain security by deleting sensitive or outdated data.
Instructions
Delete an environment variable from a service
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uuid | Yes | Service UUID | |
| env_uuid | Yes | Environment variable UUID |
Implementation Reference
- src/tools/handlers.ts:348-351 (handler)The core handler logic for the 'delete_service_env' tool within the main switch statement in handleTool. It validates required parameters (service uuid and env_uuid) and delegates the DELETE request to the CoolifyClient API endpoint /services/{uuid}/envs/{env_uuid}.case 'delete_service_env': requireParam(args, 'uuid'); requireParam(args, 'env_uuid'); return client.delete(`/services/${args.uuid}/envs/${args.env_uuid}`);
- src/tools/definitions.ts:1026-1035 (schema)The tool definition including name, description, and input schema (JSON Schema) for 'delete_service_env'. This is used for MCP tool listing and validation.name: 'delete_service_env', description: 'Delete an environment variable from a service', inputSchema: { type: 'object', properties: { uuid: { type: 'string', description: 'Service UUID' }, env_uuid: { type: 'string', description: 'Environment variable UUID' } }, required: ['uuid', 'env_uuid'] }
- src/index.ts:36-38 (registration)MCP server registration of all tools (including 'delete_service_env') via the ListToolsRequestHandler, which returns the definitions from getToolDefinitions() that includes this tool.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: getToolDefinitions() }));
- src/index.ts:41-67 (registration)MCP server CallToolRequestHandler that dispatches to handleTool (which routes to the specific handler case for 'delete_service_env') after read-only checks.this.server.setRequestHandler(CallToolRequestSchema, async (request) => { if (!this.client) { throw new McpError(ErrorCode.InternalError, 'Client not initialized'); } const { name, arguments: args } = request.params; // Block write operations in read-only mode if (isReadOnlyMode() && !READ_ONLY_TOOLS.includes(name)) { throw new McpError( ErrorCode.InvalidRequest, `Operation '${name}' is not allowed in read-only mode. Set COOLIFY_READONLY=false to enable write operations.` ); } try { const result = await handleTool(this.client, name, args || {}); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { if (error instanceof McpError) throw error; const message = error instanceof Error ? error.message : 'Unknown error'; throw new McpError(ErrorCode.InternalError, `Tool execution failed: ${message}`); } });
- src/tools/handlers.ts:504-508 (helper)Helper function used in the handler to validate and require specific parameters like 'uuid' and 'env_uuid'.function requireParam(args: ToolArgs, param: string): void { if (!args[param]) { throw new McpError(ErrorCode.InvalidParams, `${param} is required`); } }