grafana/mcp-grafana

Feature Request: Expose last_alert payload in get_alert_group response

Open

#814 aberto em 29 de abr. de 2026

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)Go (368 forks)auto 404
good first issue

Métricas do repositório

Stars
 (3.078 stars)
Métricas de merge de PR
 (Mesclagem média 2d 3h) (37 fundiu PRs em 30d)

Description

Summary

The Grafana OnCall API already returns a last_alert object (including full payload) inside the alert group response, but the Go client's AlertGroup struct doesn't map it — so get_alert_group silently drops it today.

The Fix

  1. Add last_alert to the AlertGroup struct in amixr-api-go-client:
type AlertGroup struct {
    // existing fields ...
    LastAlert *Alert `json:"last_alert,omitempty"`
}
  1. Expose it in get_alert_group as opt-in to avoid polluting MCP context by default:
type GetAlertGroupParams struct {
    AlertGroupID           string `json:"alertGroupId" jsonschema:"required,description=The ID of the alert group to retrieve"`
    IncludeLastAlertPayload bool  `json:"includeLastAlertPayload,omitempty" jsonschema:"description=If true, includes the full payload of the last alert in the group"`
}

Motivation

Alert payloads contain stable fingerprints that an AI agent can use to correlate recurring alerts across different alert group IDs:

Source Field Example
Sentry payload.data.event.hashes[0] "66b46acbdeae7d18599d803d44d7c10f"
groundcover / Grafana Alertmanager payload.alerts[0].fingerprint "912a47a2bcc2c22e"

Today the agent sees only alerts_count: 1 with no way to reach the payload in a single call. With this fix, one get_alert_group call returns the fingerprint needed for correlation — no additional tool required.

The includeLastAlertPayload flag is intentional: a Sentry alert payload can exceed 10KB (full stacktrace, 50+ module versions, request headers). Opt-in avoids polluting the MCP context when the payload isn't needed.

Related

  • #748 — update_incident
  • #813 — update_alert_group
  • Follow-up: a list_alerts tool (with field selection) will be proposed separately for cases where the full alert history of a group is needed

Guia do colaborador