Skip to main content
Glama
env0

env0

Official
by env0

Get Deployment Context

get-deployment-context

Debug a failed deployment by fetching its metadata, step statuses, and the log of the first failed step. Optionally target a specific step for inspection.

Instructions

Fetch debug context for one specific deployment: metadata, all step statuses, and the log of the first failed step (auto-picked: status FAIL or TIMEOUT). Returns log:null on clean success — pass an explicit stepName to inspect a successful step.

Use when: user asks why a past deployment failed, names a deploymentLogId, or wants to inspect a specific step (apply, destroy, custom flow) of a historical deployment.

Do NOT use for the latest deployment's plan log — use get-plan-logs (no deploymentLogId needed, cheaper). For an error summary use get-error-analysis.

deploymentLogId is REQUIRED. Use search-deployments first to find one.

Returns { deployment, steps, log }. log is { stepName, events, truncated } or null when no failed step exists and no stepName was given. Step names look like 'tf:plan', 'tf:apply', 'opentofu:plan', 'terragrunt:plan', 'pulumi:preview', 'helm:diff', 'k8s:apply', 'git:clone', 'spec:load'. Targeting a NOT_STARTED step returns 400.

Example chain: search-deployments(envId, statuses="FAILURE") → get-deployment-context(deploymentLogId=)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deploymentLogIdYesRequired. The deployment to inspect. If you don't have one, call search-deployments first. For the latest deployment's plan log, prefer get-plan-logs — it doesn't require an ID.
stepNameNoOmit to auto-pick the first failed step (status FAIL or TIMEOUT); returns log:null if no failure. Common values: 'tf:plan', 'tf:apply', 'opentofu:plan', 'terragrunt:plan', 'pulumi:preview', 'helm:diff', 'k8s:apply', 'cf:change-set', 'ansible:playbook', 'git:clone', 'spec:load'. Cannot target a NOT_STARTED step.
Behavior4/5

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

Discloses auto-picking of first failed step, return format ({deployment, steps, log}), log structure, error condition (400 for NOT_STARTED step). No annotations provided, so description carries burden; it does well but could explicitly state read-only.

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?

Concise yet comprehensive: purpose, usage guidelines, parameter details, return format, error note, and example chain. No extra words.

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 no output schema and no annotations, the description covers all necessary aspects: purpose, usage, parameters, return structure, error scenario, and common step names. No gaps.

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 covers both parameters (100%). Description adds context: stepName omitted auto-picks failure, lists common values, cannot target NOT_STARTED; deploymentLogId is required and suggests search-deployments. Adds value beyond 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?

Description clearly states the tool fetches debug context for a deployment: metadata, step statuses, log from first failed step (or specified step). It distinguishes from siblings like get-plan-logs and get-error-analysis.

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?

Explicitly says when to use (user asks why deployment failed, has deploymentLogId, inspects specific step) and when not to use (latest plan log, error summary). Recommends search-deployments first and gives alternatives.

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/env0/mcp-server'

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