Skip to main content
Glama

infracost_cloud_list_guardrails

Retrieve all cost guardrails configured in Infracost Cloud to monitor and control cloud spending across your infrastructure.

Instructions

List all guardrails in Infracost Cloud. Requires INFRACOST_SERVICE_TOKEN environment variable.

Input Schema

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

Implementation Reference

  • Handler method in InfracostTools class that validates input with ListGuardrailsSchema, checks config, calls cloudApiClient.listGuardrails, and returns the formatted result.
    async handleListGuardrails(args: z.infer<typeof ListGuardrailsSchema>) {
      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 result = await this.cloudApiClient.listGuardrails(orgSlug);
    
      if (!result.success) {
        throw new Error(result.error || 'List guardrails request failed');
      }
    
      return {
        content: [
          {
            type: 'text',
            text: result.output || 'Guardrails retrieved successfully',
          },
        ],
      };
    }
  • Core API helper method that performs the GET request to Infracost Cloud API to list guardrails for the organization.
    async listGuardrails(orgSlug: string): Promise<CommandResult> {
      try {
        const response = await fetch(`${INFRACOST_CLOUD_API_BASE}/orgs/${orgSlug}/guardrails`, {
          method: 'GET',
          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}`,
          };
        }
    
        const data = (await response.json()) as GuardrailList;
    
        return {
          success: true,
          output: JSON.stringify(data, null, 2),
          data,
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Unknown error occurred',
        };
      }
    }
  • Zod schema for input validation of the tool, defining optional orgSlug parameter.
    export const ListGuardrailsSchema = z.object({
      orgSlug: z.string().optional().describe('Organization slug from Infracost Cloud (defaults to INFRACOST_ORG env var)'),
    });
  • src/index.ts:487-501 (registration)
    Tool registration in the MCP server's listTools response, including name, description, and input schema.
    {
      name: 'infracost_cloud_list_guardrails',
      description:
        'List all guardrails in 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)',
          },
        },
        required: [],
      },
    },
Behavior3/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. It mentions the authentication requirement (INFRACOST_SERVICE_TOKEN), which is valuable context. However, it doesn't describe what 'list all guardrails' entails—such as pagination, rate limits, or return format—leaving gaps in behavioral understanding for a read operation.

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 concise with two sentences: one stating the purpose and another noting the authentication requirement. It's front-loaded with the main action, but the second sentence could be integrated more smoothly, and there's minor room for improvement in flow.

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 the tool's low complexity (one optional parameter, no output schema, no annotations), the description is minimally adequate. It covers the purpose and authentication need but lacks details on output behavior (e.g., what data is returned) and doesn't leverage sibling context for completeness, making it functional but not fully comprehensive.

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?

The input schema has 100% description coverage, with the single parameter 'orgSlug' well-documented in the schema. The description adds no additional parameter information beyond what's in the schema, so it meets the baseline of 3 for high schema coverage without compensating value.

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

Purpose4/5

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

The description clearly states the verb ('List') and resource ('all guardrails in Infracost Cloud'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'infracost_cloud_get_guardrail' (singular) or 'infracost_cloud_list_tagging_policies', missing an opportunity for clearer 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 Guidelines3/5

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

The description provides some usage context by mentioning the required environment variable, which implies when the tool can be used (when authentication is set up). However, it doesn't offer explicit guidance on when to choose this tool over alternatives like 'infracost_cloud_get_guardrail' or 'infracost_cloud_list_tagging_policies', leaving usage decisions to inference.

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