Repository navigation
feat(mcp): Add create, update, and delete dashboard tools - #2863
sentry-junior[bot] wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
📊 MCP Server Token Cost ReportSummary
Per-Tool Breakdown
Note: This measures the static overhead of tool definitions sent to LLM clients with every request. Lower is better. MCP Apps viewsEach
The budget applies to raw bytes, and the view's generator fails over it. |
Agents could read dashboards with find_dashboards and get_dashboard_details but had no way to change them, so they fell back to handing users raw API payloads and curl commands. create_dashboard creates a dashboard with widgets over error-events, spans, logs, tracemetrics, or issues. update_dashboard renames a dashboard and adds, edits, and removes widgets in one call. delete_dashboard deletes one. All three are in the project-management skill. The tools build Sentry's widget payload so agents don't have to: fields come from groupBy and aggregates, grouped charts get the largest limit Sentry accepts, and widgets without a layout are placed in rows below the existing ones. Group-by attributes are not checked against stored attributes, so widgets can use attributes that have no data yet. tracemetrics aggregates are checked for the metric format before any request. update_dashboard sends each untouched widget as its ID alone, which Sentry keeps as is, so saved settings the tool does not model, such as thresholds and transformations, survive the edit. Edited widgets keep their query ID. Each save is labeled as an agent edit in the revision history. Sentry's index-based widget errors are reported by widget title, and a 403 on a dashboard with restricted edit access says so. Co-Authored-By: Benjamin Coe <benjamin.coe@sentry.io>
The three dashboard write tools push the stdio bundle to 3,969,249 bytes, over the 3.78 MiB budget. Raise it to 3.79 MiB, which leaves about 5 KB of headroom. Co-Authored-By: Benjamin Coe <benjamin.coe@sentry.io>
94859e9 to
97fb458
Compare
Saved widget sorts often use Sentry's aggregate alias, such as `-count` for `count()`. update_dashboard compared the sort to the selected fields as written, so any aggregate or group-by edit dropped a `-count` sort even when `count()` stayed selected. Match the alias too, built the way Sentry's get_function_alias builds it.
|
Adding some context for this PR, missing dashboard update / creation endpoints is one of the main pieces of missing behaviour we see being flagged by agents:
|
|
Converted back to draft, because @DominikB2014 wanted to take this over. |
The MCP can read dashboards (
find_dashboards,get_dashboard_details) but can't change them. Without write tools, agents that need to add or edit widgets give up, or hand the user a rawPOST /dashboards/payload to run with curl.Refs #876.
This adds three tools in the
project-managementskill, modeled on the alert write tools:create_dashboard: title, optional projects, environments, and period, and a list of widgets.update_dashboard: rename a dashboard and add, edit (updateWidgetsby widget ID), and remove widgets, all in one call. Widgets the call doesn't name stay as they are.delete_dashboard: takes a numeric ID and checks the project constraint first.Use cases covered
groupByisn't checked against stored attributes, and Sentry doesn't validate span, log, or metric columns either.tracemetricsaggregates are checked against thesearch_metricsformat (p95(value,name,distribution,unit)) before any request. Grouped charts get the limit Sentry requires: 10 series divided by the number of aggregates.fields,conditions,orderby,limit, andlayout, so the agent never writes the API payload.Behavior worth reviewing
Checked against
getsentry/sentry(organization_dashboards.py,organization_dashboard_details.py,api/serializers/rest_framework/dashboard.py):update_dashboardsends each untouched widget as{ id }only. Settings these tools don't model (thresholds, transformations, legend, axis range) survive the edit. An edited widget keeps its query ID, so its saved transformations stay too.revisionSource: "edit-with-agent", so the revision history marks them as agent edits and the previous version can be restored.org:readfor dashboard POST, PUT, and DELETE, the same scopeget_dashboard_detailsuses.Open decisions
project-management, and its description now mentions dashboards. Feature Request: Dashboard & Widget Management Tools #876 suggests a separate dashboards skill instead, which would let people grant dashboard writes without project and alert management.search_metricsdoes, and reject unknown ones unless the caller overrides the check.update_dashboardcan't change a dashboard's projects, environments, or period. Sentry's PUT replaces the whole saved filter set (including release and global filters) whenever one of those keys is sent. Safe support means sending back every current filter, so it's left for a follow-up.create_dashboarddoes set them.assignDefaultLayoutinpackages/cli/src/types/dashboard.ts. Moving the grid logic intotoolkit-corewould let both use one copy.update_dashboardis about 2.1k tokens andcreate_dashboardabout 1.6k, perpnpm run measure-tokens. That's similar toupdate_alert_rule.via Benjamin Coe.
--
View Session [Sentry]