Skip to main content
Glama

Preview Infrastructure Plan

tfplan
Idempotent

PREVIEW: Run terraform plan to preview infrastructure changes Runs a terraform plan for an InsideOut session without applying any changes. This lets the user review what will be created/changed/destroyed before committing. Returns job_id, plan_id, and project_id. Use tflogs to stream the plan output. After the plan completes, use tfdeploy with plan_id to apply the exact plan. SINGLE-FLIGHT: only one TF job per session at a time. If another job is already in flight, tfplan returns tf_job_conflict with the live job_id — attach with tfstatus/tflogs, or pass force_new=true to override. REQUIRES: session_id from convoopen response (format: sess_v2_...). OPTIONAL: sandbox (boolean, default false) — plans real generated Terraform. Set to true for cheap sandbox template (testing only). OPTIONAL: force_new (boolean, default false) - bypass the single-flight guard. Use only when the existing run is provably wedged. CREDENTIAL HANDLING: Same as tfdeploy - credentials must be configured first.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "session_id": "<session_id>"
    },
    "name": "tfplan"
  }
}

Input Schema

NameRequiredDescriptionDefault
sandboxNoWhen true, plan against the sandbox stack; when false (default), plan the real generated Terraform.
force_newNoWhen true, bypass the single-flight guard and force a new plan even if one is already running.
session_idYesSession ID from convoopen — pass back EXACTLY as returned, including the ?token=... suffix (format: sess_v2_*?token=*). The suffix is part of the session credential; never strip it when summarizing.

Output Schema

NameRequiredDescriptionDefault
hintsNoGuidance for the calling agent: what to do next and which tools relate to this result.
job_idNoID of the plan job. Follow it with tfstatus.
plan_idNoPlan ID. Pass it to tfdeploy (with project_id) to apply exactly this plan.
successNoTrue when the plan job was started.
project_idNoProject ID that goes with plan_id on tfdeploy.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "hints": {
      +      "description": "Guidance for the calling agent: what to do next and which tools relate to this result.",
      +      "properties": {
      +        "next_actions": {
      +          "description": "Suggested next steps, in order, often as ready-to-run tool calls.",
      +          "items": {
      +            "description": "One suggested next step.",
      +            "type": "string"
      +          },
      +          "type": [
      +            "null",
      +            "array"
      +          ]
      +        },
      +        "related_tools": {
      +          "description": "Names of tools that are useful after this result.",
      +          "items": {
      +            "description": "A tool name.",
      +            "type": "string"
      +          },
      +          "type": [
      +            "null",
      +            "array"
      +          ]
      +        }
      +      },
      +      "type": [
      +        "null",
      +        "object"
      +      ]
      +    },
      +    "job_id": {
      +      "description": "ID of the plan job. Follow it with tfstatus.",
      +      "type": "string"
      +    },
      +    "plan_id": {
      +      "description": "Plan ID. Pass it to tfdeploy (with project_id) to apply exactly this plan.",
      +      "type": "string"
      +    },
      +    "project_id": {
      +      "description": "Project ID that goes with plan_id on tfdeploy.",
      +      "type": "string"
      +    },
      +    "success": {
      +      "description": "True when the plan job was started.",
      +      "type": "boolean"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed4 schema fields changed
    • addedInput schema / properties / force_new / description
      Added value: +"When true, bypass the single-flight guard and force a new plan even if one is already running."
    • addedInput schema / properties / sandbox / description
      Added value: +"When true, plan against the sandbox stack; when false (default), plan the real generated Terraform."
    • addedInput schema / properties / session_id / description
      Added value: +"Session ID from convoopen — pass back EXACTLY as returned, including the ?token=... suffix (format: sess_v2_*?token=*). The suffix is part of the session credential; never strip it when summarizing."
    • addedInput schema / properties / session_id / pattern
      Added value: +"^sess_v2_[0-9A-Za-z]+\\?token=[0-9a-f]+$"
  3. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Goes well beyond the annotations by disclosing the single-flight guard, the tf_job_conflict response and its handling, returned identifiers, and credential prerequisites. The one gap is that it never reconciles its 'without applying any changes' framing with readOnlyHint=false — an agent is not told that a job/plan artifact is still created or whether state is refreshed.

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?

Well front-loaded with labeled sections (PREVIEW, SINGLE-FLIGHT, REQUIRES, OPTIONAL, CREDENTIAL HANDLING) that make it scannable. Slight redundancy between the header line and the second sentence ('preview' vs 'without applying any changes') costs it a point.

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

Completeness5/5

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

Given an output schema covers return values and annotations cover the safety profile, the description supplies everything else needed to invoke correctly: prerequisite session format, conflict behavior, override condition, credential requirement, and the follow-up deploy step.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds genuine value: it frames session_id as coming from convoopen, states the exact sess_v2_... format, and constrains force_new ('Use only when the existing run is provably wedged'), which the schema does not.

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?

States a specific verb and resource ('Run terraform plan to preview infrastructure changes') and immediately scopes it as non-applying. It is clearly distinguishable from siblings tfdeploy, tflogs, tfstatus, and tfdestroy, which the description names directly.

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

Usage Guidelines5/5

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

Explicit when-to-use plus alternatives: 'Use tflogs to stream the plan output', 'After the plan completes, use tfdeploy with plan_id to apply', and the force_new escape hatch versus attaching with tfstatus/tflogs on tf_job_conflict. Nothing is left to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources