Repository navigation
fix(mcp): Accept 1h and minute periods; guide models to find_organizations on missing org - #1678
Merged
Merged
Conversation
`search_issues` limits `period` to an enum without `1h`, and the shared `ParamPeriod` regex rejects minute windows such as `30m`. The MCP SDK rejects these before the handler runs. In `sentry/mcp-server` over the 7 days to 2026-10-26, about 26K `search_issues` calls failed on `period: "1h"`. A single user sent about 25K of those; the other ~50 users sent about 500. Minute periods (`30m`, `15m`, `10m`, ...) failed about 1.5K times for ~300 users on `search_errors`, `search_logs`, and `search_traces`. Sentry's `statsPeriod` already treats `m` as minutes: a read-only check returned 28 errors for `30m` against 1,269 for `24h`, and the issues endpoint accepts `statsPeriod=1h`. Add `1h` to the `search_issues` enum and accept `m` in `ParamPeriod`. The other `search_issues` windows stay bounded. Co-Authored-By: Burak Yigit Kaya <126780+BYK@users.noreply.github.com>
Sessions without an organization constraint need `organizationSlug` on most tools. When a call omits it, the MCP SDK rejects the arguments before the handler runs and returns zod's generic message, such as `organizationSlug: Invalid input: expected string, received undefined`. In `sentry/mcp-server` over the 7 days to 2026-10-26, about 24K tool calls failed this way. A single user sent about 17.7K of them. The rest came from about 860 users, mostly on `search_issues`, `search_errors`, and `find_projects`. The SDK validates before the handler, so the zod issue message is the only place to add guidance. A missing or null slug now returns `Required. Call find_organizations() to list your organizations, then retry with organizationSlug set to one of their slugs.` Other invalid values keep their current messages. The JSON schema and token count do not change. Co-Authored-By: Burak Yigit Kaya <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
BYK
approved these changes
Oct 27, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Telemetry from
sentry/mcp-server(spans over 7 days, extrapolated from 0.3 sampling, so user counts are lower bounds):organizationSlug: about 23.8K failures from 861+ users. One user sent ~17.7K of them, allsearch_issueswithperiod:"1h". Without them it's ~6.1K failures across ~860 users. All of these came in on the unscoped/mcpURL. They fail in the MCP SDK's input validation before any handler runs, so the zod error message is the only place to add guidance without changing the schema.period: "1h"onsearch_issues: about 25.6K failures from ~50 users, mostly that same user.30m,15mand10monsearch_errors,search_logsandsearch_traceswere never accepted. That's about 1.5K failures from ~300 users. Sentry readsmas minutes (read-only GET check:30mreturned 28 errors, against 1,269 for24h), and the issues endpoint acceptsstatsPeriod=1h.Changes
SEARCH_ISSUES_PERIOD_VALUESnow includes1h.ParamPeriodnow accepts minutes (/^\d+[mhdw]$/), and the rejection message says "(minutes)".organizationSlugnow returns:Required. Call find_organizations() to list your organizations, then retry with organizationSlug set to one of their slugs.This works on SDK v1 and v2 and doesn't change the JSON schema.Held back
organizationSlugoptional on ~50 tools, and fetching the org list plus a region lookup on every call that has no org. That's the org endpoint, cache and region-routing code that docs(openspec): Propose a shared Sentry API layer for the CLI and MCP #1669 reworks, so it's left for that work.Checks
pnpm run tscandpnpm run lintpass.Risk
A model that means months by
3mwould get 3 minutes of data. Telemetry shows callers mean minutes; there are only a handful of6m/12m. None of this fixes the stuck script.via BYK.
--
View Junior Session [Sentry]