Skip to main content
Glama

infracost_cloud_delete_guardrail

Remove cost guardrails from Infracost Cloud to manage cloud spending policies and governance rules for Terraform infrastructure.

Instructions

Delete a guardrail from Infracost Cloud. Requires INFRACOST_SERVICE_TOKEN environment variable.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orgSlugNoOrganization slug from Infracost Cloud (defaults to INFRACOST_ORG env var)
guardrailIdYesGuardrail ID to delete

Implementation Reference

  • The primary MCP tool handler for 'infracost_cloud_delete_guardrail'. Validates input, resolves orgSlug from args or config, delegates to API client for deletion, handles errors, and returns formatted MCP response.
    async handleDeleteGuardrail(args: z.infer<typeof DeleteGuardrailSchema>) {
      if (!this.cloudApiClient) {
        throw new Error('INFRACOST_SERVICE_TOKEN is not configured for Infracost Cloud API operations');
      }
    
      const orgSlug = args.orgSlug || this.config.orgSlug;
      if (!orgSlug) {
        throw new Error('Organization slug is required. Provide it via orgSlug parameter or set INFRACOST_ORG environment variable');
      }
    
      const { guardrailId } = args;
      const result = await this.cloudApiClient.deleteGuardrail(orgSlug, guardrailId);
    
      if (!result.success) {
        throw new Error(result.error || 'Delete guardrail request failed');
      }
    
      return {
        content: [
          {
            type: 'text',
            text: result.output || 'Guardrail deleted successfully',
          },
        ],
      };
    }
  • Zod schema defining the input parameters for the tool: optional orgSlug and required guardrailId.
    export const DeleteGuardrailSchema = z.object({
      orgSlug: z.string().optional().describe('Organization slug from Infracost Cloud (defaults to INFRACOST_ORG env var)'),
      guardrailId: z.string().describe('Guardrail ID to delete'),
    });
  • Core implementation performing the HTTP DELETE request to the Infracost Cloud API endpoint `/orgs/{orgSlug}/guardrails/{guardrailId}` using the service token.
    async deleteGuardrail(orgSlug: string, guardrailId: string): Promise<CommandResult> {
      try {
        const response = await fetch(
          `${INFRACOST_CLOUD_API_BASE}/orgs/${orgSlug}/guardrails/${guardrailId}`,
          {
            method: 'DELETE',
            headers: {
              Authorization: `Bearer ${this.serviceToken}`,
            },
          }
        );
    
        if (!response.ok) {
          const errorText = await response.text();
          return {
            success: false,
            error: `API request failed with status ${response.status}: ${errorText}`,
          };
        }
    
        return {
          success: true,
          output: 'Guardrail deleted successfully',
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Unknown error occurred',
        };
      }
    }
  • src/index.ts:657-675 (registration)
    Tool registration in the ListTools handler, including name, description, and input schema.
    {
      name: 'infracost_cloud_delete_guardrail',
      description:
        'Delete a guardrail from Infracost Cloud. Requires INFRACOST_SERVICE_TOKEN environment variable.',
      inputSchema: {
        type: 'object',
        properties: {
          orgSlug: {
            type: 'string',
            description: 'Organization slug from Infracost Cloud (defaults to INFRACOST_ORG env var)',
          },
          guardrailId: {
            type: 'string',
            description: 'Guardrail ID to delete',
          },
        },
        required: ['guardrailId'],
      },
    },
  • src/index.ts:774-777 (registration)
    Dispatch case in the CallToolRequest handler that parses args with schema and calls the tool handler.
    case 'infracost_cloud_delete_guardrail': {
      const validatedArgs = DeleteGuardrailSchema.parse(args);
      return await tools.handleDeleteGuardrail(validatedArgs);
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the authentication requirement (INFRACOST_SERVICE_TOKEN), which is crucial behavioral context. However, it lacks details on potential side effects (e.g., irreversible deletion, impact on associated resources), error handling, or rate limits, leaving gaps for a mutation tool.

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 two sentences, front-loaded with the core purpose and followed by a critical prerequisite. Every word earns its place with no redundancy or fluff, making it highly efficient and easy to parse.

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?

For a deletion tool with no annotations and no output schema, the description is minimally adequate. It covers the purpose and auth requirement but lacks details on behavioral traits (e.g., destructiveness, confirmation steps) and output expectations. Given the complexity of a delete operation, more context would be beneficial.

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%, so the schema fully documents both parameters (orgSlug, guardrailId). The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. This meets the baseline for high schema coverage.

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 specific action ('Delete') and resource ('a guardrail from Infracost Cloud'), distinguishing it from sibling tools like infracost_cloud_get_guardrail (read) and infracost_cloud_create_guardrail (create). It provides a complete verb+resource statement without being tautological.

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

Usage Guidelines4/5

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

The description explicitly states when to use this tool ('Delete a guardrail') and includes a prerequisite ('Requires INFRACOST_SERVICE_TOKEN environment variable'), which provides clear context. However, it does not specify when NOT to use it or name alternatives (e.g., update vs. delete), which prevents a perfect score.

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/phildougherty/infracost_mcp'

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