Skip to main content
Glama
debugg-ai

Debugg AI MCP

Official
by debugg-ai

Delete Environment

delete_environment

Delete an environment by UUID, cascading removal of its credentials. Returns success confirmation or a not found error for invalid or already deleted UUID.

Instructions

Delete an environment by UUID. Returns {deleted: true, uuid}. Destructive — cascades per backend behavior (credentials under the env are typically removed). Defaults to the project resolved from the current git repo; pass projectUuid to target a different project. Returns isError:true with NotFound when the uuid doesn't exist or was already deleted.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uuidYesUUID of the environment to delete. Required.
projectUuidNoOptional: UUID of the target project. Defaults to git-auto-detect.

Implementation Reference

  • Main handler function for delete_environment. Resolves project UUID (from input or git repo detection), calls client.deleteEnvironment(), and returns {deleted: true, uuid}. Handles 404 errors with a NotFound response.
    export async function deleteEnvironmentHandler(
      input: DeleteEnvironmentInput,
      _context: ToolContext,
    ): Promise<ToolResponse> {
      const start = Date.now();
      logger.toolStart('delete_environment', { uuid: input.uuid, projectUuid: input.projectUuid });
    
      try {
        const client = new DebuggAIServerClient(config.api.key);
        await client.init();
    
        let projectUuid = input.projectUuid;
        if (!projectUuid) {
          const repoName = detectRepoName();
          if (!repoName) return notFound(input.uuid, 'no git repo detected and no projectUuid provided');
          const project = await client.findProjectByRepoName(repoName);
          if (!project) return notFound(input.uuid, `no project found for repo "${repoName}"`);
          projectUuid = project.uuid;
        }
    
        try {
          await client.deleteEnvironment(projectUuid, input.uuid);
          logger.toolComplete('delete_environment', Date.now() - start);
          return {
            content: [{ type: 'text', text: JSON.stringify({ deleted: true, uuid: input.uuid }, null, 2) }],
          };
        } catch (err: any) {
          if (err?.statusCode === 404 || err?.response?.status === 404) {
            return notFound(input.uuid, `backend returned 404 for project ${projectUuid}`);
          }
          throw err;
        }
      } catch (error) {
        logger.toolError('delete_environment', error as Error, Date.now() - start);
        throw handleExternalServiceError(error, 'DebuggAI', 'delete_environment');
      }
    }
  • Tool definition and registration for delete_environment. buildDeleteEnvironmentTool() defines the tool with name, title, description, and inputSchema. buildValidatedDeleteEnvironmentTool() pairs the schema with the handler.
    export function buildDeleteEnvironmentTool(): Tool {
      return {
        name: 'delete_environment',
        title: 'Delete Environment',
        description: DESCRIPTION,
        inputSchema: {
          type: 'object',
          properties: {
            uuid: { type: 'string', description: 'UUID of the environment to delete. Required.' },
            projectUuid: { type: 'string', description: 'Optional: UUID of the target project. Defaults to git-auto-detect.' },
          },
          required: ['uuid'],
          additionalProperties: false,
        },
      };
    }
    
    export function buildValidatedDeleteEnvironmentTool(): ValidatedTool {
      const tool = buildDeleteEnvironmentTool();
      return { ...tool, inputSchema: DeleteEnvironmentInputSchema, handler: deleteEnvironmentHandler };
    }
  • Zod schema for delete_environment input: uuid (required UUID string) and projectUuid (optional UUID string).
    export const DeleteEnvironmentInputSchema = z.object({
      uuid: z.string().uuid(),
      projectUuid: z.string().uuid().optional(),
    }).strict();
    export type DeleteEnvironmentInput = z.infer<typeof DeleteEnvironmentInputSchema>;
  • Service method deleteEnvironment that performs the HTTP DELETE call to api/v1/projects/{projectUuid}/environments/{envUuid}/.
    /**
     * Delete an environment. Used by evals to clean up throwaway test envs.
     */
    public async deleteEnvironment(projectUuid: string, envUuid: string): Promise<void> {
      if (!this.tx) throw new Error('Client not initialized — call init() first');
      await this.tx.delete(`api/v1/projects/${projectUuid}/environments/${envUuid}/`);
    }
  • tools/index.ts:33-33 (registration)
    Registration of buildDeleteEnvironmentTool() in tools array.
    buildDeleteEnvironmentTool(),
Behavior4/5

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

With no annotations, the description carries the burden of behavioral disclosure. It mentions destructiveness, cascading effects (credentials removed), and error handling (NotFound on missing uuid). This is good transparency, though the cascading behavior is described vaguely as 'typically removed.'

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

Conciseness4/5

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

The description is three sentences, front-loading the core action and return value. It is concise without redundancy, though the phrase 'cascades per backend behavior' is slightly vague. Overall, it is efficiently structured.

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

Completeness3/5

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

Given no output schema or annotations, the description covers the main behavior, return shape, and error case. However, it lacks details on permissions, rate limits, or non-existence edge cases beyond NotFound. It is adequate but not fully comprehensive for a destructive tool.

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

Parameters4/5

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

The schema already describes both parameters with 100% coverage. The description adds value by explaining the default behavior of projectUuid (git-auto-detect) and the error return when uuid is not found, which goes beyond the schema's basic descriptions.

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

Purpose5/5

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

The description clearly states the tool's action: 'Delete an environment by UUID.' It specifies the resource (environment) and the operation (delete), and distinguishes itself from siblings like create_environment, update_environment, and search_environments by explicitly indicating a destructive action.

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

Usage Guidelines3/5

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

The description explains the default project resolution and how to target a different project via projectUuid, but does not explicitly compare with sibling tools (e.g., delete_project) or state when not to use this tool. The guidance is present but limited.

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/debugg-ai/debugg-ai-mcp'

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