Skip to main content
Glama
matchs

Terraform Cloud MCP Server

by matchs

Get Run Details

get_run_details

Retrieve detailed information about a specific Terraform Cloud run using its unique ID to monitor infrastructure deployment status and configuration details.

Instructions

Get detailed information about a specific Terraform Cloud run by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
runIdYesRun ID (e.g., run-abc123)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
sourceYes
statusYes
messageYes
createdAtYes
workspaceYes
hasChangesYes
planStatusNo
applyStatusNo
isConfirmableYes
configurationVersionNo

Implementation Reference

  • The asynchronous handler function that executes the tool logic: fetches run details from Terraform Cloud API using tfCloudRequest, processes the data, and returns formatted structured content or error.
        try {
          const data = await tfCloudRequest(`/runs/${runId}`);
          const attrs = data.data.attributes;
          const relationships = data.data.relationships;
    
          const output = {
            id: data.data.id,
            status: attrs.status,
            message: attrs.message || 'No message',
            createdAt: attrs['created-at'],
            source: attrs.source,
            isConfirmable: attrs['is-confirmable'],
            hasChanges: attrs['has-changes'],
            planStatus: attrs['plan-status'] || undefined,
            applyStatus: attrs['apply-status'] || undefined,
            workspace: {
              id: relationships.workspace.data.id,
              name: attrs['workspace-name'] || 'Unknown'
            },
            configurationVersion: relationships['configuration-version']?.data ? {
              id: relationships['configuration-version'].data.id,
              source: attrs['configuration-version-source'] || 'Unknown'
            } : undefined
          };
    
          return {
            content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
            structuredContent: output
          };
        } catch (error) {
          const errorMsg = error instanceof Error ? error.message : String(error);
          return {
            content: [{ type: 'text', text: `Error: ${errorMsg}` }],
            isError: true
          };
        }
      }
    );
  • Zod-based inputSchema (requires runId) and outputSchema defining the expected tool input/output structures.
    {
      title: 'Get Run Details',
      description: 'Get detailed information about a specific Terraform Cloud run by its ID',
      inputSchema: {
        runId: z.string().describe('Run ID (e.g., run-abc123)')
      },
      outputSchema: {
        id: z.string(),
        status: z.string(),
        message: z.string(),
        createdAt: z.string(),
        source: z.string(),
        isConfirmable: z.boolean(),
        hasChanges: z.boolean(),
        planStatus: z.string().optional(),
        applyStatus: z.string().optional(),
        workspace: z.object({
          id: z.string(),
          name: z.string()
        }),
        configurationVersion: z.object({
          id: z.string(),
          source: z.string()
        }).optional()
      }
    },
    async ({ runId }) => {
  • src/index.ts:223-291 (registration)
    The server.registerTool call that registers the 'get_run_details' tool with its schema and handler function.
    server.registerTool(
      'get_run_details',
      {
        title: 'Get Run Details',
        description: 'Get detailed information about a specific Terraform Cloud run by its ID',
        inputSchema: {
          runId: z.string().describe('Run ID (e.g., run-abc123)')
        },
        outputSchema: {
          id: z.string(),
          status: z.string(),
          message: z.string(),
          createdAt: z.string(),
          source: z.string(),
          isConfirmable: z.boolean(),
          hasChanges: z.boolean(),
          planStatus: z.string().optional(),
          applyStatus: z.string().optional(),
          workspace: z.object({
            id: z.string(),
            name: z.string()
          }),
          configurationVersion: z.object({
            id: z.string(),
            source: z.string()
          }).optional()
        }
      },
      async ({ runId }) => {
        try {
          const data = await tfCloudRequest(`/runs/${runId}`);
          const attrs = data.data.attributes;
          const relationships = data.data.relationships;
    
          const output = {
            id: data.data.id,
            status: attrs.status,
            message: attrs.message || 'No message',
            createdAt: attrs['created-at'],
            source: attrs.source,
            isConfirmable: attrs['is-confirmable'],
            hasChanges: attrs['has-changes'],
            planStatus: attrs['plan-status'] || undefined,
            applyStatus: attrs['apply-status'] || undefined,
            workspace: {
              id: relationships.workspace.data.id,
              name: attrs['workspace-name'] || 'Unknown'
            },
            configurationVersion: relationships['configuration-version']?.data ? {
              id: relationships['configuration-version'].data.id,
              source: attrs['configuration-version-source'] || 'Unknown'
            } : undefined
          };
    
          return {
            content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
            structuredContent: output
          };
        } catch (error) {
          const errorMsg = error instanceof Error ? error.message : String(error);
          return {
            content: [{ type: 'text', text: `Error: ${errorMsg}` }],
            isError: true
          };
        }
      }
    );
    
    // Connect to stdio transport
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 of behavioral disclosure. It states this is a read operation ('Get'), implying it's likely safe and non-destructive, but doesn't specify authentication requirements, rate limits, error conditions, or what 'detailed information' entails (e.g., includes logs, configuration, or status). For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse quickly, and every part of the sentence contributes essential information.

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

Completeness4/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 (1 parameter, no nested objects) and the presence of an output schema (which handles return values), the description is reasonably complete for its purpose. However, it lacks context on behavioral aspects like authentication or error handling, which are important for a tool interacting with a cloud service like Terraform Cloud, slightly reducing completeness.

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 schema description coverage is 100%, with the single parameter 'runId' fully documented in the schema as 'Run ID (e.g., run-abc123)'. The description adds no additional parameter details beyond what the schema provides, such as format constraints or examples, so it meets the baseline score of 3 for high schema coverage.

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 action ('Get detailed information') and resource ('about a specific Terraform Cloud run by its ID'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_run_status' or 'get_workspace_details', which might offer overlapping or related information about runs or workspaces.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_run_status' (which might provide less detailed status info) or 'get_workspace_details' (which might include run info as part of workspace data), leaving the agent to infer usage context based on tool names alone.

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/matchs/tf-cloud-mcp-server'

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