Skip to main content
Glama

tf_get_schema

Idempotent

Retrieves exact arguments and nested blocks for one Terraform type at the pinned provider version, so you can validate writable fields before editing resource, data, or ephemeral blocks.

Instructions

Exact arguments and nested blocks for one type at the PINNED provider version. Use BEFORE writing or editing any resource/data/ephemeral block; only arguments listed here exist. 'computed (read-only)' attributes cannot be set. kind: resource | data | ephemeral. Executes code: unless the schema is cached, this runs terraform providers schema, which starts the provider plugins installed under dir/.terraform/providers (with credential environment variables removed; they still run as your user).

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": {
      "type_name": "<type_name>"
    },
    "name": "tf_get_schema"
  }
}

Input Schema

NameRequiredDescriptionDefault
dirNoTerraform root module directory (must already be initialized), inside the server's directory or TERRAFORM_CWD_MCP_ALLOWED_DIRS. Default: TERRAFORM_CWD_MCP_DIR, else the server's working directory.
kindNoresource | data | ephemeralresource
max_depthNoNested block levels to expand (default 3)
type_nameYesFull type name, e.g. aws_s3_bucket
description_charsNoTruncate each description to this many characters; 0 = no limit (default 160)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.2.0
    • changedInput schema / properties / dir / description
      Previous value: -"Terraform root module directory (must already be initialized). Default: TERRAFORM_CWD_MCP_DIR, else the server's working directory."New value: +"Terraform root module directory (must already be initialized), inside the server's directory or TERRAFORM_CWD_MCP_ALLOWED_DIRS. Default: TERRAFORM_CWD_MCP_DIR, else the server's working directory."
  2. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

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

Annotations declare openWorldHint and readOnlyHint=false; the description adds meaningful context beyond them: it executes `terraform providers schema`, starts provider plugins under dir/.terraform/providers, strips credential env vars while still running as the user, and that 'computed (read-only)' attributes cannot be set. Useful, but it omits other operational details such as latency/caching behavior specifics and failure modes, so it is solid rather than exemplary.

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?

Front-loaded with the purpose and the imperative before the operational caveat. Dense but nearly every clause carries information; the lengthy parenthetical about credential env vars is the only part that could be trimmed.

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 5-parameter tool with no output schema, the description should say more about what the returned schema looks like (structure, how max_depth/description_chars affect it). It covers the semantic constraint on computed attributes and execution mechanics, but leaves return-shape understanding to inference.

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 every parameter is already documented in the schema; the description only restates the kind enum and adds the pinned-version framing. Baseline 3 is appropriate since the description adds little parameter-specific meaning beyond the schema.

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+resource: return exact arguments and nested blocks for one type at the pinned provider version. The scoping (pinned version, single type, kind selector) makes it distinguishable from siblings like tf_search_types and tf_check_arguments without opening any schema.

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?

Gives an explicit precondition: 'Use BEFORE writing or editing any resource/data/ephemeral block', plus the constraint that only listed arguments exist. It does not name alternatives (e.g., tf_search_types for discovery or tf_check_arguments for validation), so the when-not side is left implicit.

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