feat(search): Split search_events into dataset-specific tools - #1374
Merged
Merged
Conversation
Replace the multi-dataset search_events tool on the direct MCP surface with one tool per dataset: search_errors, search_logs, search_traces, search_metrics, search_profiles, and search_replays. Tool selection now picks the dataset, so agents can no longer omit or mis-pick a `dataset` argument (which silently fell back to errors and skipped Seer). All six tools share one handler, moved to tools/support/search-events/search.ts. Each tool fixes its dataset and passes lockDataset so the embedded agent cannot switch datasets. search_traces documents same-trace cross-event queries, since Seer only runs cross-event filters for the Traces strategy. search_events stays in the catalog as a deprecated alias for backward compatibility and is excluded from skill definitions. Co-Authored-By: Shaun Kaasten <shaun.kaasten@sentry.io>
dcramer
reviewed
Oct 2, 2026
Replace the six copy-pasted per-tool test files (each mocking the AI SDK and MSW endpoints) with one-test baselines that mock only runSearchEvents via a shared test-utils helper. The lockDataset behavior is tested once against the shared handler in search-events.test.ts, reusing its existing mocks. Also drop the "not search_replays or search_issues" clause from the get_latest_base_snapshot description to save tokens.
dcramer
approved these changes
Oct 2, 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.
Supersedes #1371. Instead of making
datasetrequired onsearch_events, this splits search into one tool per dataset, so the agent picks the dataset by picking the tool and has fewer ways to get it wrong.What changed
New direct tools, all backed by the same handler:
search_errors:errors, SeerErrorssearch_logs:logs, SeerLogssearch_traces:spans, SeerTracessearch_metrics:metrics, SeerMetricssearch_profiles:profiles, no Seersearch_replays:replays, no SeerThe handler moved from
tools/catalog/search-events.tstotools/support/search-events/search.ts(runSearchEvents). Each tool sets its own dataset and passeslockDataset: true. The embedded agent prompt says the dataset is fixed, and the handler ignores any dataset switch the agent suggests. This waysearch_logscan't return spans.Each tool has a shorter description that covers only its own dataset. The event tools have no
datasetparam, and environment filters go inquery.search_replayshas nofieldsand keeps its separateenvironmentparam.search_tracesdocuments same-trace cross-event queries ("checkout requests that also have an error log"). Seer only applies cross-event filters with theTracesstrategy.Compatibility:
search_eventsis still in the catalog as a deprecated alias (execute_sentry_toolcan still call it). It is off the direct surface and left out of skill definitions.Direct surface (
surfaces.ts) grows from 9 to 14 tools. That's still under the target of 20 and the hard limit of 25.Updated next-step hints that pointed at
search_events: trace details, profile formatter, Seer unsupported-issue message, search_issues formatters, get_sentry_resource.Updated the plugin agent prompts, evals (
search-events.eval.tsnow expects the specific tool), the Cloudflare stdio setup copy, and the docs (spec, testing, architecture, READMEs). Regenerated the tool/skill definitions.Tradeoffs
pnpm run measure-tokens. The six search tools total 4,238 tokens, compared with 1,130 forsearch_events, because each one repeats the shared params. Possible follow-ups: keepsearch_profiles/search_replayscatalog-only, or trim the shared param descriptions.search_logsinstead ofsearch_traces. The cross-event hint onsearch_tracesis meant to catch that.Testing
mcp-core: 1749 tests pass. That includes new tests for each tool, covering the locked dataset and the schema with nodatasetparam.search_tracesalso has a test that sends a natural-language query to Seer'sTracesstrategy.mcp-cloudflare: 430 tests pass.packages/clitypecheck fails in my sandbox with a Node loader error (ERR_INVALID_RETURN_PROPERTY_VALUE). The same failure happens on cleanmain.via shaun.kaasten.
--
View Junior Session [Sentry]