feat: add deployment history support#40
Open
ben-fowler-cloud wants to merge 4 commits into
Open
Conversation
…n logs and error analysis)
New tool:
- get-deployments: list deployments for an environment with optional
filters (limit, offset, statuses). Returns deployment IDs that can
be used with get-plan-logs and get-error-analysis.
Enhanced tools:
- get-plan-logs: optional deploymentId param. When provided, fetches
steps for that deployment and returns the plan step log. When omitted,
existing behavior (latest deployment) is preserved.
- get-error-analysis: optional deploymentId param. When provided,
attempts deployment-specific error analysis with fallback to
environment-level. When omitted, existing behavior is preserved.
New service methods:
- getDeployments: GET /environments/{envId}/deployments
- getDeploymentSteps: GET /deployments/{id}/steps
- getDeploymentStepLog: GET /deployments/{id}/steps/{name}/log
All changes are backward compatible — omitting deploymentId produces
identical behavior to the previous version.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two fixes for large plan output: 1. getDeploymentStepLog now paginates through all pages using hasMoreLogs/nextStartTime instead of returning only page 1. 2. getPlanLogs no longer falls back to the /mcp/ convenience endpoint (which truncates with "Plan is too long"). Instead, when no deploymentId is provided, it resolves the latest deployment from the environment's latestDeploymentLogId and uses the step log API directly. This returns the full untruncated output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add get-deployment-steps tool to list steps (init, plan, apply) for a deployment - Add get-deployment-step-log tool to fetch logs for any specific step - Add tail parameter to get-plan-logs (default 150 events) to reduce response size - get-deployment-step-log includes tail support with truncation metadata Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…leanup - Strip `variables` array from environment responses (50%+ of payload, includes sensitive hashes that aren't useful to agents) - Flatten `latestDeploymentLog` to 10 summary fields instead of full deployment record - Collapse `providerVersions` to count + short names, `moduleVersions` to count only - Strip ANSI escape codes from plan log messages (~15-20% noise reduction) - Lower default tail from 150 to 50, include planSummary in truncated metadata so agents can assess scope before fetching more Estimated ~40-50k token savings per environment+plan query. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the ability to query historical deployment data, not just the latest deployment per environment:
get-deployments— list deployments for an environment with optional filters (limit, offset, statuses). Returns deployment IDs usable with the other tools below.get-plan-logs— new optionaldeploymentIdparameter. When provided, fetches the plan step log for that specific deployment. When omitted, existing behavior (latest deployment) is preserved.get-error-analysis— new optionaldeploymentIdparameter. When provided, attempts deployment-specific error analysis with graceful fallback to environment-level. When omitted, existing behavior is preserved.Motivation
The current MCP tools only expose the latest deployment per environment. When multiple deployments happen in quick succession (e.g., a PR plan followed by a master deploy), agents can only see the most recent one. This makes it impossible to investigate a specific PR deployment that has since been superseded — a common workflow when debugging failed plans.
New service methods
getDeploymentsGET /environments/{envId}/deploymentsgetDeploymentStepsGET /deployments/{id}/stepsgetDeploymentStepLogGET /deployments/{id}/steps/{name}/logBackward compatibility
All changes are additive. Existing callers that omit
deploymentIdget identical behavior to the previous version. No breaking changes.Test plan
get-deploymentsreturns deployment history for an environmentget-deploymentswithlimitandstatusesfilters worksget-plan-logswithoutdeploymentIdreturns latest (unchanged behavior)get-plan-logswithdeploymentIdreturns plan step log for that specific deploymentget-error-analysiswithoutdeploymentIdreturns latest (unchanged behavior)get-error-analysiswithdeploymentIdattempts deployment-specific analysisnpm run build)npm run lint)