Repository navigation
Conversation
…vailable The events validation endpoint (/events/validate/) was added to Sentry in mid-2026 and is absent on older deployments, including self-hosted instances. The search tools treated the resulting 404 as a fatal error and failed the whole search with a misleading message, even though the underlying /events/ endpoint works. Treat a 404 from the validation endpoint as 'validation unsupported' rather than a bad request: validateEvents now returns null, and callers (runSearchEvents, assertEventsSearchIsValid, and the agent validateSearch tool) skip the gate and run the search directly. Refs getsentry#1497
…alidation - Snapshot and restore globalThis.fetch around every test in client.test.ts so the direct fetch mocks used by several describes no longer leak into later tests that rely on MSW. Rewrite the 404 unit test to use MSW. - Record app.search_events.validation.unsupported on the active span when the validate endpoint is unavailable, so the skip is observable rather than silent.
This branch has not been 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.
Summary
Fixes #1497.
The search tools call the events validation endpoint (
GET /api/0/organizations/{org}/events/validate/) before every search and treat any non-400error as fatal. That endpoint was added to Sentry in mid-2026, so older deployments — including self-hosted instances — return404, and the whole search fails with a misleading "Input Error" even though the underlying/events/endpoint works fine.This change treats a
404from the validation endpoint as "validation is not supported on this deployment" rather than a bad request, and skips the validation gate so the search runs.Changes
SentryApiService.validateEventsnow opts404intoallowStatusesand returnsnullwhen the endpoint is unavailable (previously threwApiNotFoundError). Return type is nowEventsValidationResult | null.validateEventsSearchpropagates thenullresult.null:runSearchEvents(packages/mcp-core/src/tools/support/search-events/search.ts) — runs the search instead of throwing.assertEventsSearchIsValid— returns early.validateSearchtool (createValidateEventsSearchTool) — reports the candidate as valid with a note that validation was skipped.Why this is safe on newer Sentry
On deployments that expose the endpoint, behavior is unchanged:
400is still parsed as a validation result and200still validates normally.nullis only produced for a404, which on this endpoint means the route does not exist.Tests
client.test.ts:validateEventsreturnsnullon a404.search-events.test.ts:search_eventsstill executes and returns data when the validate endpoint returns404.pnpm --filter @sentry/mcp-core tsc✅pnpm exec oxlinton changed source ✅client.test.ts,search-events.test.ts,utils.test.ts) ✅ — 257 tests passing.Verification against a real self-hosted instance
Reproduced against a self-hosted Sentry 25.8.0 (
/events/validate/→ 404,/events/→ 200). With the published 0.42.0 the search tool failed with the404; with this build the same call returns data: