Back to cookbook

AI Prompt to Triage Production Errors Using Sentry's MCP Server

0 views Published

Make this prompt yours

Share

This AI prompt is for developers and on-call engineers who connect an AI assistant to Sentry's MCP server and want a fast, consistent first pass on a batch of error reports instead of clicking through each issue manually. Once MCP exposes issue details, stack traces, affected release, and event counts, the prompt tells the model how to group related errors, judge severity, and separate what needs an immediate fix from what can wait.

The prompt deliberately avoids asking the model to "just fix the bug." Stack traces from production often point to a symptom, not the root cause, so the prompt asks for a grounded read of what the trace actually shows, which function or file is implicated, and how confident that read is, rather than a guessed fix that sounds plausible but may be wrong for an issue the model hasn't fully traced through the codebase.

Because Sentry issue payloads can be long and repetitive across similar errors, especially when the same exception fires from multiple call sites, feeding every field into the model without pruning can get expensive fast on large error batches. Running the retrieved payload through Token Optimizer before triage, to strip redundant stack frames and duplicate context, keeps the prompt focused on what's actually needed to triage severity.

Prompt template

Make this prompt yours

prompt-template
342 tokens
ROLE: You are a software engineer triaging production error reports retrieved through Sentry's MCP integration. CONTEXT: - Project: [PROJECT NAME] - Time window: [E.G. LAST 24 HOURS] - Current release/deploy: [VERSION, DEPLOY TIME] - Known pre-existing low-priority issues to exclude: [LIST OR 'NONE'] TASK: 1. Retrieve open issues for the specified project and time window via the MCP connection, including stack trace, event count, affected users, and first-seen timestamp. 2. Group issues that share the same root exception type and call path as a single item. 3. For each grouped issue, state what the stack trace shows is happening, which file/function is implicated, and your confidence level in that read (high/medium/low). 4. Rank issues by severity using event count, affected user count, and whether first-seen falls after the stated deploy time. 5. Exclude any issue listed as a known pre-existing low-priority issue, but note it was excluded. CONSTRAINTS: - Do not propose a specific code fix; describe what the trace indicates and flag it for the responsible engineer. - Do not rank an issue as high severity solely because of the error message tone; use the stated metrics. - If stack trace data is incomplete or truncated, say so instead of inferring the missing frames. OUTPUT FORMAT: - Triage Summary (total issues reviewed, number flagged as new since deploy) - Ranked Issue List (issue title, severity, event count, affected users, confidence in root cause read) - Excluded Known Issues (if any) - Issues Needing Manual Trace Review (low-confidence reads)

Want it sharper? Optimize this prompt with Prompt Optimizer, check it with the Prompt Debugger or shorten it with the Token Optimizer.

Example input

example-input
64 tokens
Review open issues in the 'checkout-service' project from the last 24 hours. We deployed v2.14.0 at 2026-10-12 09:00 UTC. Exclude the known 'PaymentGatewayTimeout' issue, which is a pre-existing low-priority item we already track separately.

When to use it

  • You're starting a shift and need a quick severity-ranked view of overnight Sentry issues
  • A new release just shipped and you want new or spiking errors flagged before they pile up
  • You're deciding which of several open issues to assign first and need a reasoned priority order
  • You want a plain-language summary of a stack trace to share with a non-engineering stakeholder

Best practices

  • Give the model the actual release version and rollout time so it can tell newly introduced errors from pre-existing ones
  • Ask it to state its confidence in identifying the root cause separately from the severity ranking
  • List any known, already-tracked low-priority issues so the model excludes them instead of re-flagging them
  • Have it group duplicate errors from different call sites into one item instead of listing each occurrence separately

Common mistakes

  • Asking the model to propose a code fix directly from a stack trace without having it read the actual implicated file first
  • Not providing release or deploy timing, so the model can't tell a new regression from a long-standing low-priority error
  • Treating every error with a high event count as automatically high severity, even when it's a known, harmless edge case
  • Skipping a check of the top 2-3 flagged issues against the raw Sentry data before escalating them

FAQs

Can an AI assistant actually read my Sentry issues without me copying stack traces manually?

Only if it's connected through Sentry's MCP server or a similar integration. Without that connection, you'd still need to paste in the issue data yourself.

Should I let the model's severity ranking override my own on-call judgment?

No. Treat it as a fast first pass that uses the metrics you gave it, not a replacement for engineering judgment, especially for issues the model flagged as low-confidence on root cause.

Why does this prompt ask the model not to suggest a code fix?

A stack trace alone often shows a symptom, not the actual root cause in your codebase. Having the model guess a fix without reading the implicated file risks a plausible-sounding but wrong suggestion.

How can I check this prompt's quality before running it against a live Sentry project?

Intelligence Score — run your filled-in version through it to catch vague constraints or missing context before you point it at real production data.

Found this prompt useful? Share it.

Share

More in Code Generation & Software Engineering

Code Generation & Software Engineering

AI Prompt to Write a GitHub Actions CI/CD Workflow from Plain English

This is a prompt for turning a plain English description of your build, test, and deploy process into a working GitHub Actions workflow YAML…

Role: You are a DevOps engineer writing a GitHub Actions workflow file.

Context:
Project type: [LANGUAGE/FRAMEWORK, e.g. Node.js with npm, Python with Poetry]
Repository structure notes: [e.g. monorepo with /api and /web folders, single app at root]
Runner: [e.g. ubuntu-latest]

Task:
Write a GitHub Actions workflow (.github/workflows/[FILENAME].yml) that does the following, in this order:
1. Trigger on: [TRIGGER EVENTS, e.g. pull_request to main, push of tags matching v*]
2. Job 1 - [JOB NAME, e.g. lint]: [WHAT IT DOES]
3. Job 2 - [JOB NAME, e.g. test]: [WHAT IT DOES], must run only after Job 1 succeeds
4. Job 3 - [JOB NAME, e.g. deploy]: [WHAT IT DOES], must run only after Job 2 succeeds and only on [CONDITION, e.g. tag pushes to main]

Secrets/environment variables needed (reference by name only, do not invent values): [SECRET NAMES, e.g. DEPLOY_TOKEN, AWS_ACCESS_KEY_ID]

Constraints:
- Pin third-party actions to a specific major version (e.g. actions/checkout@v4)
- Use caching for dependencies where the ecosystem supports it
- Keep job names and step names descriptive enough to read clearly in the Actions UI

Output format:
Return the complete YAML file in a fenced code block, followed by a short bullet list explaining what each job does and when it runs.

Make this prompt yours

Code Generation & Software Engineering

AI Prompt to Debug a Failed Vercel Deployment Using Vercel's MCP Server

This Vercel MCP prompt helps developers and DevOps engineers figure out why a deployment failed without manually scrolling through build log…

ROLE: You are a deployment troubleshooting assistant with access to Vercel's MCP server.

CONTEXT:
- Project: [PROJECT_NAME]
- Framework: [FRAMEWORK, e.g. Next.js 14]
- Deployment ID or URL: [DEPLOYMENT_ID_OR_URL]
- Last known good deployment: [PREVIOUS_DEPLOYMENT_ID_OR_URL, or 'none']
- What changed since the last successful deploy: [RECENT_CHANGES_SUMMARY]

TASK:
1. Retrieve the build and runtime logs for the failing deployment.
2. Identify the failure category: build error, runtime error, environment/configuration issue, or dependency issue.
3. Quote the specific log lines that show the root cause.
4. If a last known good deployment is provided, compare configuration and environment variables between the two.
5. Propose a ranked list of likely fixes, most probable first.

CONSTRAINTS:
- Do not guess at a cause without quoting supporting log evidence.
- Flag if critical information (e.g. an environment variable value) is missing rather than assuming it.

OUTPUT FORMAT:
- Failure category
- Root cause (with quoted log evidence)
- Ranked fix recommendations
- Any missing information needed to confirm the diagnosis

Make this prompt yours

Code Generation & Software Engineering

ChatGPT Prompt to Generate a Production-Ready Dockerfile for Your App

This Dockerfile generator prompt gives ChatGPT, Claude, or Gemini everything needed to write a secure, production ready Dockerfile for your…

You are an expert DevOps engineer who writes secure, production-ready Dockerfiles.

Context:
- Application language and version: [LANGUAGE AND VERSION, e.g., Node.js 20]
- Framework: [FRAMEWORK, e.g., Express, Django, Spring Boot]
- Package manager: [PACKAGE MANAGER, e.g., npm, pip, Maven]
- Target deployment platform: [PLATFORM, e.g., AWS ECS, Kubernetes, linux/amd64]
- Special requirements: [e.g., private package registry, native dependencies, health checks]

Task:
Write a production-ready Dockerfile for this application. Use a multi-stage build that separates the build/dependency-install stage from the final runtime stage. The final image should:
1. Use the smallest reasonable base image for the runtime.
2. Run as a non-root user.
3. Only copy the files needed to run the application, not build tools or source maps.
4. Include a HEALTHCHECK instruction appropriate for this type of service.
5. Set any necessary environment variables and expose the correct port.

Constraints:
- Do not use the "latest" tag for any base image; pin a specific version.
- Keep the final image size as small as possible.
- Explain, in a short comment above each non-obvious instruction, why it's there.

Output format:
1. The complete Dockerfile in a single code block.
2. A short bullet list explaining the base image choice and any trade-offs.
3. One suggested .dockerignore entry list for this stack.

Make this prompt yours