Skip to main content
Glama

Fetch Deploy Logs

tflogs
Read-only

MONITORING: Fetch Terraform deployment logs with pagination Fetches logs from a running or completed Terraform deployment job. For completed jobs: uses REST endpoint for instant retrieval (supports tail for server-side filtering). For running jobs: streams via SSE with timeout-based pagination.

PAGINATION (running jobs only): Use last_event_id from the response to fetch more:

  1. First call: tflogs(session_id='...') → get logs + last_event_id

  2. Next call: tflogs(session_id='...', last_event_id='...') → get NEW logs only

  3. Repeat until complete: true in response

RESPONSE FIELDS:

  • logs: Array of log messages collected

  • last_event_id: Pass this back to get more logs (pagination cursor, SSE only)

  • complete: true if job finished, false if more logs may be available

  • total_logs: total log entries before tail truncation

REQUIRES: session_id from convoopen response (format: sess_v2_...). OPTIONAL: job_id to target a specific deployment (use tfruns to discover IDs), timeout (default 50s, max 55s), last_event_id (for pagination), tail (return only last N entries) ⚠️ CONTEXT WARNING: Deploy logs can be hundreds of lines. Use tail: 50 for completed jobs to avoid blowing up the context window.

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": "tflogs"
  }
}

Input Schema

NameRequiredDescriptionDefault
tailNoReturn only the last N log entries. Use 0 (or omit) for all available entries.
job_idNoOptional. Target a specific job. Use tfruns to discover job IDs. When omitted, streams the latest job for the session.
timeoutNoMax seconds to collect logs. Default 50, max 55.
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.
last_event_idNoResume cursor for pagination. Pass back the last_event_id from a previous tflogs response to fetch only newer entries.

Output Schema

NameRequiredDescriptionDefault
logsNoLog lines, oldest first.
hintsNoGuidance for the calling agent: what to do next and which tools relate to this result.
completeNoTrue when the job has finished and no more logs will come.
logs_countNoNumber of log lines in this result.
session_idNoSession ID these logs belong to.
last_event_idNoLog cursor. Pass it back as last_event_id to fetch only newer entries.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "complete": {
      +      "description": "True when the job has finished and no more logs will come.",
      +      "type": "boolean"
      +    },
      +    "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"
      +      ]
      +    },
      +    "last_event_id": {
      +      "description": "Log cursor. Pass it back as last_event_id to fetch only newer entries.",
      +      "type": "string"
      +    },
      +    "logs": {
      +      "description": "Log lines, oldest first.",
      +      "items": {
      +        "description": "One log line.",
      +        "type": "string"
      +      },
      +      "type": [
      +        "null",
      +        "array"
      +      ]
      +    },
      +    "logs_count": {
      +      "description": "Number of log lines in this result.",
      +      "type": "integer"
      +    },
      +    "session_id": {
      +      "description": "Session ID these logs belong to.",
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed10 schema fields changed
    • addedInput schema / properties / job_id / description
      Added value: +"Optional. Target a specific job. Use tfruns to discover job IDs. When omitted, streams the latest job for the session."
    • addedInput schema / properties / last_event_id / description
      Added value: +"Resume cursor for pagination. Pass back the last_event_id from a previous tflogs response to fetch only newer entries."
    • 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]+$"
    • addedInput schema / properties / tail / description
      Added value: +"Return only the last N log entries. Use 0 (or omit) for all available entries."
    • addedInput schema / properties / tail / maximum
      Added value: +10000
    • addedInput schema / properties / tail / minimum
      Added value: +0
    • addedInput schema / properties / timeout / description
      Added value: +"Max seconds to collect logs. Default 50, max 55."
    • addedInput schema / properties / timeout / maximum
      Added value: +55
    • addedInput schema / properties / timeout / minimum
      Added value: +1
  3. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the readOnly/openWorld annotations by disclosing the dual REST/SSE execution path, the 50s default/55s max timeout ceiling, and the context-window warning about hundreds of log lines. The pagination cursor lifecycle (last_event_id returning only new logs) is a genuinely non-obvious behavioral trait.

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?

Bold headers and a numbered pagination flow make it scannable and front-loaded with purpose before mechanics. The RESPONSE FIELDS block partially duplicates the existing output schema, which is the only wasted space.

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?

With an output schema present, the description needn't re-explain return values, yet it still supplies the operational context an agent needs: prerequisites (session_id from convoopen), pagination termination condition, and the context-blowup risk. Nothing material is missing for correct invocation.

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 already 100%, so the baseline is 3; the description earns above that by adding selection guidance the schema lacks — tail:50 for completed jobs, timeout defaults, job_id discovery via tfruns — though it doesn't add much on the session_id token format beyond what the schema states.

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 ('Fetch Terraform deployment logs') and immediately distinguishes the two operating modes (completed jobs via REST vs running jobs via SSE). An agent can tell exactly what this tool returns and how it differs from tfstatus or tfruns.

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 concrete routing advice: use tfruns to discover job_id, use tail for completed jobs, and a three-step pagination recipe until complete:true. It lacks explicit when-not-to-use guidance against near siblings like tfstatus or tfoutputs, which keeps it from a 5.

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