Repository navigation
fix(mcp): Add dataset-specific hints for common rejected event fields - #1679
Merged
Merged
Conversation
The search tools pass Sentry's diagnostic through when it rejects a field or sort, but the diagnostic does not say what to use instead. These are the top dataset-specific field failures in `sentry/mcp-server` over the 7 days to 2026-10-26: - `search_logs` with `min(timestamp)` or `max(timestamp)`: about 2.6K failures from ~470 users. Log timestamps are strings. - `search_errors` with `first_seen()`: about 2.3K failures from ~590 users. The errors dataset has `last_seen()` but no `first_seen()`. - `search_errors` sorted by `issue`: about 1K failures from ~270 users. Sentry rejects that sort even when `issue` is selected. Add a fixed hint when the request sent the rejected expression and Sentry's diagnostic matches it, as the CLI's Explore field hints do. Read-only checks confirmed each replacement: `min(timestamp)` and `last_seen()` on errors, `min/max(timestamp_precise)` on logs and metrics, and sorting by `issue.id`. The backend diagnostic stays in the message, and other failures are unchanged. The validate endpoint accepts `first_seen()` and the `issue` sort, so the final Events API error is checked too. The hints never include caller input. The embedded agent's errors field list now includes `min(timestamp)`, because about 700 of the `first_seen()` failures came from agent-generated fields. 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
These are the most common field and sort errors in
sentry/mcp-servertelemetry (7 days, extrapolated from 0.3 sampling, so user counts are lower bounds). Each fix was checked against the live API.search_logswithmin/max(timestamp): ~2.6K failures from ~470 users. Log timestamps are strings, so the fix ismin/max(timestamp_precise)(nanoseconds). Metrics behaves the same way (43 failures).search_errorswithfirst_seen(): ~2.3K failures from ~590 users. That function doesn't exist; usemin(timestamp), plusmax(timestamp)orlast_seen(). About 700 of these came from fields the embedded agent picked.search_errorssorted byissue: ~1K failures from ~270 users. Sentry rejects this sort even whenissueis selected; use-count()orissue.id.Changes
tools/support/search-events/field-hints.ts. It adds a hint only when the request actually sent the rejected expression and Sentry's error message matches it.ApiValidationError.first_seen()andissue-sort cases.min(timestamp)is added to the embedded agent's errors field list.Not covered
timestamp.to_day/to_houron spans and logs (~600 failures): there's no clear one-line replacement.count()arity (~350),p10/p25(~150), andcount(span)(0).Checks
Relation to #1669
Task 7.3 moves the explore, traces and logs endpoints onto
@sentry/api. These hints only depend on the error being anApiValidationErrorand on its message, so they should carry over as long as 400s still map to that class.via BYK.
--
View Junior Session [Sentry]