Skip to main content
Glama
martin-1103
by martin-1103

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

TableJSON Schema
NameRequiredDescriptionDefault
environmentIdYesEnvironment ID to delete

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)
            }
          ]
        };
      }
    }
  • 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
  • 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);
    }
  • 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
    ];
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Delete an environment' implies a destructive, irreversible mutation, but the description doesn't mention: what happens to associated resources, whether this requires special permissions, if there are confirmation prompts, what the success/failure responses look like, or any rate limits. For a destructive operation with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is maximally concise - a single three-word phrase that gets straight to the point. There's zero wasted language or unnecessary elaboration. While it may be too brief for completeness, as a standalone statement it's perfectly structured and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive deletion tool with no annotations and no output schema, the description is incomplete. It doesn't address critical context: what 'deleting an environment' entails (does it cascade to child resources?), what permissions are required, what the return value is, or error conditions. Given the complexity of environment management and the lack of structured safety hints, the description should provide more operational context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% (the single parameter 'environmentId' has a clear description), so the baseline is 3. The tool description adds no additional parameter information beyond what the schema already provides - it doesn't explain where to find environment IDs, what format they use, or provide examples. The description doesn't compensate for schema gaps because there are none to compensate for.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Delete an environment' clearly states the verb ('Delete') and resource ('environment'), making the basic purpose understandable. However, it doesn't differentiate from sibling tools like 'delete_flow' or 'delete_folder' - it's a generic statement that could apply to any deletion tool. The purpose is clear but lacks sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There are multiple sibling tools (create_environment, set_default_environment, update_environment_variables, list_environments, get_environment_details) that work with environments, but the description offers no context about when deletion is appropriate versus modification or querying. No exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

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/martin-1103/mcp2'

If you have feedback or need assistance with the MCP directory API, please join our Discord server