Skip to content

feat(mcp): Tell the model about chart range changes and add fullscreen - #2456

Merged
dcramer merged 1 commit into
mainfrom
feat/chart-view-model-context-fullscreen
Nov 21, 2026
Merged

dcramer merged 1 commit into
mainfrom
feat/chart-view-model-context-fullscreen

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

The render_sentry_chart view now uses more of the MCP Apps protocol: ui/update-model-context and display modes. It also fixes a stale heading.

Model context after a range change. When the user picks a new range, the view redraws, but the model still only has the first tool result. If the user then asks about the chart, the model answers about a range they no longer see. After each successful range change, the view now sends ui/update-model-context with:

  • text: a short summary (new range, aggregate, query, total/peak or top groups) and the arguments that reproduce the chart
  • structuredContent: { tool, arguments, chart }

It sends only the parts the host advertises in hostCapabilities.updateModelContext, and nothing when the host advertises neither.

Fullscreen. The view declares appCapabilities.availableDisplayModes: ["inline", "fullscreen"]. A Fullscreen / Exit fullscreen button shows only when the host's availableDisplayModes includes fullscreen, and it calls ui/request-display-mode. In fullscreen, the chart fills the height left under the header instead of the fixed 220px. The view follows displayMode from host-context-changed, so it adjusts when the host leaves fullscreen on its own.

Title. The heading comes from the model's title argument, and the range picker keeps that argument. So a model-written title like "Errors in the last 24h" stayed after the user picked 7d. The title param description now tells the model to leave out the time range, because the subtitle shows it and the user can change it.

The view bumps to ui://sentry/chart/v4.html and is about 19 KB of its 24 KiB budget. #2455 also bumps to v4 and edits chart-app/main.ts. Whichever lands second needs a rebase and v5.

design/mcp-apps.md gains two rules: a view uses a host feature only when the host advertises it, and a view tells the model when the user changes what it shows. The verify-toolkit MCP Apps host now advertises these capabilities and checks model-context, fullscreen, and capability-gated (a host without either gets no Fullscreen button and no context update).

Drill-downs through ui/message are not included. They would put Sentry-sourced labels, such as transaction names and releases, into a user-role message, so they need their own design for quoting.

via @dcramer.

--

View Session [Sentry]

The chart view's range picker redraws the chart, but the model only ever
saw the first result, so it answered about a range the user no longer saw.
After a range change the view now sends ui/update-model-context with a short
summary, the chart, and the arguments that reproduce it.

Hosts that offer fullscreen get a Fullscreen button. In fullscreen the
chart fills the height the host gives it instead of a fixed 220px.

The view uses both only when the host advertises them in hostCapabilities
or availableDisplayModes, and declares the display modes it supports.

The title param now tells the model to leave out the time range, since a
model-written "last 24h" title stayed put after the user picked 7d.
@vercel

vercel Bot commented Nov 21, 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 Nov 21, 2026 2:54am UTC
sentry-local Ready Ready Preview Nov 21, 2026 2:54am UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📊 MCP Server Token Cost Report

Summary

  • Total Tokens: 65205 tokens
  • Tool Count: 74 tools
  • Average: 881 tokens/tool

Per-Tool Breakdown

Tool Tokens % of Total
get_issue_details 3938 6%
get_alert_rule 2245 3.4%
find_releases 1805 2.8%
get_issue_activity 1759 2.7%
update_alert_rule 1653 2.5%
get_replay_details 1602 2.5%
create_alert_rule 1506 2.3%
get_monitor_details 1501 2.3%
update_metric_monitor 1479 2.3%
create_metric_monitor 1458 2.2%
get_event_stacktrace 1381 2.1%
update_issue 1380 2.1%
get_snapshot 1308 2%
get_profile 1291 2%
get_agent_conversation_details 1278 2%
find_monitors 1261 1.9%
search_logs 1248 1.9%
search_traces 1246 1.9%
get_alert_options 1236 1.9%
search_profiles 1228 1.9%
search_metrics 1216 1.9%
search_errors 1214 1.9%
get_profile_details 1200 1.8%
get_uptime_monitor_details 1163 1.8%
create_monitor 1135 1.7%
onboarding_status_update 1109 1.7%
search_issue_events 1103 1.7%
search_replays 1095 1.7%
find_related_issues 1068 1.6%
get_release_details 1056 1.6%
get_dashboard_details 1052 1.6%
search_issues 977 1.5%
search_docs 973 1.5%
find_alert_rules 908 1.4%
update_uptime_monitor 873 1.3%
create_uptime_monitor 871 1.3%
search_agent_conversations 830 1.3%
find_dropped_events 819 1.3%
get_metric_monitor_details 797 1.2%
create_project 793 1.2%
update_dsn 765 1.2%
get_issue_user_reports 630 1%
get_latest_base_snapshot 623 1%
find_dashboards 553 0.8%
link_issue 545 0.8%
find_uptime_monitors 537 0.8%
get_issue_breadcrumbs 492 0.8%
unlink_issue 476 0.7%
find_metric_monitors 471 0.7%
get_issue_tag_values 469 0.7%
update_project 441 0.7%
get_sentry_resource 429 0.7%
submit_feedback_to_sentry_team 426 0.7%
add_issue_note 404 0.6%
delete_monitor_environment 363 0.6%
find_teams 351 0.5%
find_projects 346 0.5%
delete_alert_rule 345 0.5%
delete_uptime_monitor 333 0.5%
delete_metric_monitor 331 0.5%
create_dsn 326 0.5%
add_team_to_project 324 0.5%
remove_team_from_project 320 0.5%
find_dsns 319 0.5%
find_organizations 311 0.5%
get_snapshot_image 302 0.5%
analyze_issue_with_seer 300 0.5%
get_event_attachment 299 0.5%
get_trace_details 282 0.4%
create_team 266 0.4%
get_span_details 263 0.4%
whoami 261 0.4%
get_sentry_mcp_info 142 0.2%
get_doc 102 0.2%

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/v4.html text/html;profile=mcp-app 19,054 B 7,874 B 6,984 B 24,576 B 77.5%

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

@dcramer dcramer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Visual qa this one

@sentry-junior

sentry-junior Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

Visual QA on fba68ba: pass. The view was rendered from the PR's built ui://sentry/chart/v4.html with the mock stdio server, in the verify-toolkit ext-apps AppBridge host under headless Chromium. All data is mock fixtures.

Inline, dark, host offers fullscreen (720px). The Fullscreen button sits next to Open in Sentry and matches its style.
inline dark

Fullscreen, dark (host gives 720×560). The chart grows from 220px to fill the height under the header. The button reads Exit fullscreen, and the axes, hatched band and note stay in place.
fullscreen dark

Fullscreen, grouped, light (p95 by release, 7d). The legend wraps under the taller chart, and nothing overlaps.
fullscreen grouped light

Narrow inline (420px), light. The controls wrap under the heading, and the Fullscreen button still fits on one row.
narrow light

Narrow inline, host without fullscreen. There is no Fullscreen button, and the layout matches the previous view.
narrow no fullscreen

The view logged no console errors under the spec's default CSP. Exit fullscreen returns the chart to exactly 220px. The ui/update-model-context payload after a range change is checked in the host log (mcp-apps#model-context), not shown in a screenshot.

Limitations:

  • These screenshots come only from the reference host, not Claude, VS Code or ChatGPT, so real fullscreen sizes and chrome are unverified.
  • The dots at 30s in the grouped chart are the sparse mock releases. They predate this PR.

@dcramer
dcramer marked this pull request as ready for review November 21, 2026 03:21
@dcramer
dcramer requested a review from a team as a code owner November 21, 2026 03:21
@sentry-junior
sentry-junior Bot requested a review from dcramer November 21, 2026 03:21
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 21, 2026
@dcramer
dcramer merged commit e692073 into main Nov 21, 2026
45 checks passed
@dcramer
dcramer deleted the feat/chart-view-model-context-fullscreen branch November 21, 2026 03:22
dcramer added a commit that referenced this pull request Nov 22, 2026
…2455)

Adds an experimental `render_issue_chart` tool. It charts one issue's
events and affected users over time, like the graph on the issue page,
and renders in the same MCP Apps chart view as `render_sentry_chart`.

**Issue charts**
- Input is the issue, given as a short ID, numeric ID, or URL, the same
way `get_issue_details` takes it. A period or start/end is optional and
defaults to 14d, which is what the issue page uses.
- The server picks everything else:
- Dataset: `errors` for error issues and `issuePlatform` for every other
issue type. This is the issue page's `usesIssuePlatform` split, now in a
shared `isErrorIssue` helper.
  - Aggregates: `count()` and `count_unique(user)`.
- Bucket size: from the issue page's fidelity ladder. At 14d that's 4h
buckets, about 85, instead of the 337 one-hour buckets the API picks by
default.
- The result has an Events series, a Users series (no total, because
unique counts can't be summed), the Events peak, and a link to the issue
page for the same range.
- In experimental sessions, `get_issue_details` suggests a pre-filled
`render_issue_chart` call.

**Fake-zero guard**
On the `errors` dataset, an `issue.id:` filter for an issue-platform
issue returns HTTP 200 with every bucket 0, and an agent reads that as a
real answer. `render_sentry_chart` now rejects any positive `issue:` or
`issue.id:` filter, lists included, with a repairable error that points
to `render_issue_chart`. Negated filters (`!issue:`) still work.
`search_events` no longer suggests a `render_sentry_chart` call for
issue-filtered queries.

**Shared view**
- Series building, time ranges, and interval formatting moved into
`tools/support/chart/series.ts`, which both tools use.
- The chart output schema has a new `tool` field, and the view's range
picker calls whichever tool drew the chart. The view accepts only the
two chart tool names, so a result can't point it at a tool that changes
data. A result without the field is treated as `render_sentry_chart`'s.
- The view now ships as `ui://sentry/chart/v5.html`, on top of
#2456's v4. The model context that view sends after a
range change names the tool that drew the chart too.
- `getEventsTimeSeries` accepts several yAxes and
`dataset=issuePlatform`. `PUBLIC_EVENTS_DATASETS` is unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>

<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC08J1NSPU6S%3A1795226206.866739 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC08J1NSPU6S%3A1795226206.866739)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC08J1NSPU6S%3A1795226206.866739/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: David Cramer <23610+dcramer@users.noreply.github.com>

This branch was successfully deployed

3 active deployments
Actions — fba68ba1 Deployed Nov 21, 2026 by sentry-junior[bot] via eval #2018
Preview – sentry-local — fba68ba1 Deployed Nov 21, 2026 by vercel[bot]
Preview – cli — fba68ba1 Deployed Nov 21, 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