Skip to content

feat(mcp): Add create, update, and delete dashboard tools - #2863

Draft
sentry-junior[bot] wants to merge 3 commits into
mainfrom
feat/mcp-dashboard-write-tools
Draft

sentry-junior[bot] wants to merge 3 commits into
mainfrom
feat/mcp-dashboard-write-tools

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

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 raw POST /dashboards/ payload to run with curl.

Refs #876.

This adds three tools in the project-management skill, 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 (updateWidgets by 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

  • Remove widgets and add new ones in one call. New widgets go in rows below the existing ones.
  • Group by attributes that have no stored data yet. groupBy isn't checked against stored attributes, and Sentry doesn't validate span, log, or metric columns either.
  • Metric widgets, such as count, avg, and p95 of a duration metric grouped by an attribute. tracemetrics aggregates are checked against the search_metrics format (p95(value,name,distribution,unit)) before any request. Grouped charts get the limit Sentry requires: 10 series divided by the number of aggregates.
  • Error-events, spans, logs, and issue widgets. The tool builds fields, conditions, orderby, limit, and layout, 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):

  • Sentry's PUT deletes widgets left out of the list, and keeps every field an existing widget omits. So update_dashboard sends 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.
  • Changing a widget's aggregates or group-by drops a sort that no longer names a selected field. Changing the display type raises the widget height when the new type needs it.
  • Updates send revisionSource: "edit-with-agent", so the revision history marks them as agent edits and the previous version can be restored.
  • Sentry reports widget errors by their position in the request. They're now reported by widget title. A bare 403 on a dashboard with restricted edit access explains that access is the problem.
  • Prebuilt dashboards are rejected before the write.
  • Display-type-per-dataset support, limit maximums, and query syntax are left to Sentry's own validation, which returns clear messages.
  • Sentry accepts org:read for dashboard POST, PUT, and DELETE, the same scope get_dashboard_details uses.

Open decisions

  • Skill: the tools are in 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.
  • Attributes with no data: widgets save with group-by attributes that have no stored data yet, so a dashboard can be set up before a launch ships its new attributes. The other option is to check attributes the way search_metrics does, and reject unknown ones unless the caller overrides the check.
  • Page filters on update: update_dashboard can'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_dashboard does set them.
  • Layout helper: the row placement is a smaller version of the CLI's assignDefaultLayout in packages/cli/src/types/dashboard.ts. Moving the grid logic into toolkit-core would let both use one copy.
  • Token cost: update_dashboard is about 2.1k tokens and create_dashboard about 1.6k, per pnpm run measure-tokens. That's similar to update_alert_rule.

via Benjamin Coe.

--

View Session [Sentry]

@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Dec 3, 2026 10:13pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Dec 3, 2026 10:13pm UTC

Request Review

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

📊 MCP Server Token Cost Report

Summary

  • Total Tokens: 75589 tokens
  • Tool Count: 82 tools
  • Average: 922 tokens/tool

Per-Tool Breakdown

Tool Tokens % of Total
get_issue_details 4049 5.4%
get_alert_rule 2245 3%
update_dashboard 2088 2.8%
search_logs 1837 2.4%
search_metrics 1836 2.4%
search_traces 1835 2.4%
find_releases 1805 2.4%
get_issue_activity 1759 2.3%
update_alert_rule 1653 2.2%
create_dashboard 1635 2.2%
get_replay_details 1602 2.1%
create_alert_rule 1506 2%
get_monitor_details 1501 2%
update_metric_monitor 1479 2%
create_metric_monitor 1458 1.9%
update_issue 1394 1.8%
get_event_stacktrace 1381 1.8%
get_snapshot 1370 1.8%
render_sentry_chart 1362 1.8%
get_profile 1291 1.7%
get_agent_conversation_details 1278 1.7%
find_monitors 1261 1.7%
get_alert_options 1236 1.6%
search_profiles 1228 1.6%
search_errors 1214 1.6%
get_profile_details 1203 1.6%
find_related_issues 1171 1.5%
get_uptime_monitor_details 1163 1.5%
render_issue_chart 1141 1.5%
create_monitor 1135 1.5%
onboarding_status_update 1109 1.5%
search_issue_events 1103 1.5%
search_replays 1095 1.4%
get_release_details 1056 1.4%
get_dashboard_details 1052 1.4%
search_attributes 1012 1.3%
search_issues 977 1.3%
search_docs 973 1.3%
find_alert_rules 908 1.2%
update_uptime_monitor 889 1.2%
create_uptime_monitor 883 1.2%
search_agent_conversations 830 1.1%
find_dropped_events 819 1.1%
get_metric_monitor_details 797 1.1%
create_project 793 1%
update_dsn 765 1%
get_issue_user_reports 630 0.8%
get_latest_base_snapshot 623 0.8%
find_dashboards 553 0.7%
link_issue 545 0.7%
find_uptime_monitors 537 0.7%
get_issue_breadcrumbs 492 0.7%
unlink_issue 476 0.6%
find_metric_monitors 471 0.6%
get_issue_tag_values 469 0.6%
find_project_members 448 0.6%
update_project 441 0.6%
get_sentry_resource 429 0.6%
submit_feedback_to_sentry_team 426 0.6%
add_issue_note 404 0.5%
delete_monitor_environment 363 0.5%
find_teams 351 0.5%
find_projects 346 0.5%
delete_alert_rule 345 0.5%
delete_uptime_monitor 333 0.4%
delete_metric_monitor 331 0.4%
create_dsn 326 0.4%
add_team_to_project 324 0.4%
remove_team_from_project 320 0.4%
find_dsns 319 0.4%
find_organizations 311 0.4%
get_snapshot_image 302 0.4%
analyze_issue_with_seer 300 0.4%
approve_snapshot 300 0.4%
get_event_attachment 299 0.4%
get_trace_details 282 0.4%
delete_dashboard 279 0.4%
create_team 266 0.4%
get_span_details 263 0.3%
whoami 261 0.3%
get_sentry_mcp_info 142 0.2%
get_doc 102 0.1%

Note: This measures the static overhead of tool definitions sent to LLM clients with every request. Lower is better.

MCP Apps views

Each ui:// view as a host receives it from resources/read.

View MIME type Raw Gzip Brotli Budget % of budget
ui://sentry/chart/v6.html text/html;profile=mcp-app 19,249 B 7,913 B 7,014 B 24,576 B 78.3%

The budget applies to raw bytes, and the view's generator fails over it.

sentry-junior Bot and others added 2 commits December 3, 2026 21:34
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>
@sentry-junior
sentry-junior Bot force-pushed the feat/mcp-dashboard-write-tools branch from 94859e9 to 97fb458 Compare December 3, 2026 21:51
@bcoe
bcoe marked this pull request as ready for review December 3, 2026 21:56
@bcoe
bcoe requested a review from a team as a code owner December 3, 2026 21:56
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Dec 3, 2026
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.
@bcoe

bcoe commented Dec 4, 2026

Copy link
Copy Markdown
Member

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:

Add missing write tools, starting with dashboards. 18 reports from 14 users, nearly all marked "blocked". The asks: creating dashboards and adding widgets (the most-repeated ask), webhook actions on alerts, updating and deleting cron monitors, editing code mappings, and inviting members.

@bcoe
bcoe marked this pull request as draft December 4, 2026 16:28
@bcoe
bcoe requested a review from DominikB2014 December 4, 2026 16:28
@bcoe

bcoe commented Dec 4, 2026

Copy link
Copy Markdown
Member

Converted back to draft, because @DominikB2014 wanted to take this over.

This branch was successfully deployed

2 active and 1 inactive deployments
Preview – cli — e65c88cd Deployed Dec 3, 2026 by vercel[bot]
Actions — e65c88cd Deployed Dec 3, 2026 by sentry-junior[bot] via eval #2253
Preview – sentry-local — e65c88cd Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant