Skip to content

feat: add diagnose_deployment_failure and add_release_notes prompts - #101

Open
egorpavlikhin wants to merge 1 commit into
mainfrom
egorp/basic-prompts
Open

feat: add diagnose_deployment_failure and add_release_notes prompts#101
egorpavlikhin wants to merge 1 commit into
mainfrom
egorp/basic-prompts

Conversation

@egorpavlikhin

Copy link
Copy Markdown
Contributor

Summary

Adds the first two MCP prompts to the server, registered alongside tools and resources:

  • diagnose_deployment_failure — walks the LLM through analyzing a failed deployment or runbook run: locate the failed task, extract the specific error, categorize it, suggest remediation. Points at the relevant tools (find_releases/find_runbooks, list_deployments, get_task_from_url, read_resource for the task activity tree, grep_task_log, find_events) and reminds about release snapshotting.
  • add_release_notes — guides the LLM through summarizing a change set into a Markdown changelog and writing it to an existing release via the PUT /releases/{id} round-trip (read full body → swap ReleaseNotes → PUT back), with a create_release fallback when no matching release exists. Flags Octostache non-re-evaluation and ReleaseEdit permission gotchas.

Both prompts require spaceName and projectName; release version / runbook name are optional and steer behavior. Wired into src/index.ts via a new registerPrompts barrel mirroring the tool/resource registration pattern.

Test plan

  • Build passes (npm run build)
  • Lint passes (npm run lint)
  • Connect a client (Claude Code / MCP Inspector) and confirm both prompts appear in prompts/list
  • Run diagnose_deployment_failure against a known failed deployment and confirm the LLM follows the prescribed tool path
  • Run add_release_notes end-to-end: draft notes, PUT round-trip, verify only ReleaseNotes changed on the release
  • Run add_release_notes against a non-existent release version and confirm the create_release fallback engages

@akirayamamoto akirayamamoto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments there, happy to discuss.

const qualifierClause =
qualifiers.length > 0 ? ` (${qualifiers.join(", ")})` : "";

const text = `Diagnose the most recent failed ${subject} for project **${projectName}** in space **${spaceName}**${qualifierClause}.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the one I want to diagnose is not the most recently failed? For example, not the lastest runbook run? It could be an intermittent one.

It could be possible for a release as well but less likely.

Follow this diagnostic approach, thinking step-by-step:
1. Identify the exact step/target where failure occurred.
2. Extract and quote the specific error message(s) from the task log.
3. Determine the error category (configuration, connectivity, permissions, resource availability, etc.).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving the range of category open (and not well defined) could lead to unpredictable results, therefore, I wonder if extracting a category here is useful. Maybe we are looking for a summary?


Remember: releases in Octopus snapshot the deployment process and variables at creation time. Changes made afterwards do not affect existing releases — fixes usually require creating a new release.

Follow the Octopus Deploy writing guide: be concise, direct, and use plain English. Bold step/project/entity names, quote log lines in code blocks, and avoid speculation about manually-cancelled tasks.`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Follow the Octopus Deploy writing guide" is this guide available in the MCP server? If not it could be dropped.


export function registerAddReleaseNotesPrompt(server: McpServer) {
server.registerPrompt(
"add_release_notes",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be more predictable if we split the workflow into draft_release_notes and set_release_notes.

draft_release_notes should be a non-mutating prompt: take explicit source material, like PRs, commits, tickets, or a user-provided changelog, and return a draft for review.

set_release_notes should probably be a tool, not a prompt. Updating ReleaseNotes is a concrete Octopus write operation, so it benefits from typed inputs, validation, confirmation, tests, and deterministic behavior. It should update an existing release only and not fall back to creating one.

For creating releases, I’d use the existing create_release tool and recommend passing releaseNotes there when needed. That tool already supports release notes, so a separate “create release with notes” prompt would duplicate behavior.

This keeps the boundaries clearer:

  • draft notes: prompt, no side effects
  • set notes on an existing release: tool, write operation
  • create a release with notes: existing create_release tool

The current add_release_notes prompt mixes drafting, release selection, updating, and fallback creation in one flow. That makes the outcome harder to predict, especially when releaseVersion is omitted or the release is not found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants