Skip to main content
Glama

terraform_output

Read Terraform output values from infrastructure configurations to retrieve deployment details and resource information for infrastructure management.

Instructions

Read Terraform output values

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryYesDirectory containing Terraform files
nameNoSpecific output name (optional, shows all if omitted)

Implementation Reference

  • The implementation of the terraform_output tool handler.
    export async function terraformOutput(args: Record<string, unknown>): Promise<string> {
      const directory = args.directory as string;
      if (!directory) throw new Error("Terraform directory is required");
      const name = args.name as string | undefined;
    
      const tfArgs = ["output", "-json"];
      if (name) tfArgs.push(name);
    
      try {
        const { stdout } = await execFileAsync("terraform", tfArgs, {
          cwd: directory,
          timeout: 30000,
        });
        const parsed = JSON.parse(stdout);
        return `Terraform outputs${name ? ` (${name})` : ""}:\n\n${JSON.stringify(parsed, null, 2)}`;
      } catch (error: any) {
        throw new Error(`Terraform output failed: ${error.stderr || error.message}`);
      }
    }
  • The input schema definition for the terraform_output tool.
    {
      name: "terraform_output",
      description: "Read Terraform output values",
      inputSchema: {
        type: "object" as const,
        properties: {
          directory: { type: "string", description: "Directory containing Terraform files" },
          name: { type: "string", description: "Specific output name (optional, shows all if omitted)" },
        },
        required: ["directory"],
      },
    },
  • The registration/dispatch logic for the terraform_output tool within the terraform tools handler.
    case "terraform_output": return terraformOutput(a);
Behavior2/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 states 'Read' implying a read-only operation, but doesn't disclose behavioral traits such as whether it requires Terraform initialization, what happens if the directory is invalid, or if there are rate limits. This leaves significant gaps for a tool with no annotation coverage.

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 a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to scan and understand quickly.

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 annotations and no output schema, the description is minimal but covers the basic purpose. For a read operation with two parameters, it's adequate but lacks details on behavior, error handling, or return format, which could help an agent use it correctly in context with sibling tools.

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. The description doesn't add any meaning beyond what the schema provides (e.g., it doesn't explain what 'output values' are in Terraform context or provide examples). Baseline 3 is appropriate when the schema does the heavy lifting.

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 'Read Terraform output values' clearly states the verb ('Read') and resource ('Terraform output values'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'terraform_state_show' or 'terraform_plan', which also involve reading Terraform data, so it misses full 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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention sibling tools like 'terraform_state_show' or 'terraform_plan', nor does it explain prerequisites or context for reading output values versus other Terraform operations.

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/batu-sonmez/infraclaude'

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