Skip to content

fix(server): stop advertising tool list change notifications - #1317

Merged
betegon merged 1 commit into
mainfrom
bt/fix-mcp-tool-list-capability
Oct 14, 2026
Merged

betegon merged 1 commit into
mainfrom
bt/fix-mcp-tool-list-capability

Conversation

@betegon

@betegon betegon commented Sep 18, 2026

Copy link
Copy Markdown
Member

The SDK defaults to advertising tools.listChanged, but Sentry fixes its tool catalog when each server is created and does not publish catalog-change notifications. Clients could therefore subscribe to a notification stream that never reports those changes.

Set listChanged: false after registering tools in both SDK versions. Legacy initialization and modern discovery now describe that behavior accurately, and modern subscription acknowledgments omit toolsListChanged. Tool listing and calls remain available; empty catalogs keep their existing capabilities.

Regressions exercise a real legacy client and modern HTTP discovery, listing, and subscription acknowledgment. Both fail before the change and pass afterward. Full typecheck, lint, tests, and documentation checks pass.

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Sep 22, 2026
@betegon
betegon marked this pull request as ready for review October 14, 2026 12:09
Each server instance has a fixed tool catalog and the hosted factory has
no shared catalog notification channel. Override the SDK registration
default so clients do not subscribe to notifications we cannot emit.

Co-Authored-By: GPT-6 (Codex) <[email protected]>
@betegon
betegon force-pushed the bt/fix-mcp-tool-list-capability branch from e6f30f7 to ce99b07 Compare October 14, 2026 12:14
@betegon
betegon merged commit c31fe16 into main Oct 14, 2026
31 checks passed
@betegon
betegon deleted the bt/fix-mcp-tool-list-capability branch October 14, 2026 12:25
sentry-junior Bot added a commit that referenced this pull request Nov 2, 2026
`sentry event view` now takes the issue selectors `@latest` and
`@most_frequent` (also as `<org>/@sel`, `<org>/<project>/@sel`, or after a
separate target) and shows the selected issue's latest event. Without an
event ID it defaults to `@latest`, so `sentry event view`,
`sentry event view <org>/`, and `sentry event view <org>/<project>` all
work instead of failing with "Event ID is required".

Project-scoped selectors pick the project by numeric ID, so projects
that are not actively selected still match (#1317). This replaces the
errors-dataset lookup for `<org>/<project>`, which is no longer needed.

Co-Authored-By: BYK <[email protected]>
Co-Authored-By: Claude <[email protected]>
BYK added a commit that referenced this pull request Nov 2, 2026
… (#1793)

`sentry event view` without an event ID used to fail with `ContextError:
Event ID is required`. AI agents hit this a lot. Now `event view`
accepts the issue selectors the other commands already take, and with no
event ID it falls back to `@latest`.

- `@latest` and `@most_frequent` (and the existing aliases such as
`@most-frequent`) show the selected issue's latest event.
- Scopes: bare (the auto-detected org, as `issue view @latest` uses),
`<org>/@sel`, `<org>/<project>/@sel`, or a bare selector before or after
a separate target (`my-org/my-project @latest`).
- With no event ID it defaults to `@latest`: `sentry event view`,
`sentry event view <org>/`, and `sentry event view <org>/<project>` all
work. `<org>/<project>/` (an empty ID typed after the slash) and `""`
still raise the missing-event-ID error.
- A selector combined with event or issue IDs is rejected with a
`ValidationError`.

Project-scoped selectors go through a new `findSelectorIssue` helper in
`issue/utils.ts`, which `resolveSelector` now uses too. It picks the
project by numeric ID (`resolveProjectIdsInOrg`), so projects that are
not actively selected still match (#1317).

The selectors are now described once, in `ISSUE_SELECTORS` next to
`parseSelector`. `issueSelectorHelp()` renders the `--help` lines for
`event view`, `event list`, and the issue commands from it, and their
existing help text is unchanged. Shell completion now suggests the
selectors for a word that starts with `@`, bare or after `org/`, in
every issue argument. `event view` now completes as an issue argument,
so it also suggests cached issue short IDs.

This PR first added a separate `errors`-dataset lookup for
`<org>/<project>`. That lookup is gone, along with the `project` param
it added to `explore.ts`. One behavior difference: the old lookup
returned the project's newest error event of any kind, while `@latest`
returns the latest event of the most recently seen *unresolved* issue.
That matches what `@latest` means everywhere else.

When no target is given, the selector searches the auto-detected *org*
(the same scope `issue view @latest` uses). It is not narrowed to a
DSN-detected project. If a project-scoped default would be better there,
that's a small follow-up.

<!-- SEER_FIXES_SENTRY_ISSUE -->
Fixes
[CLI-CG](https://sentry.sentry.io/issues/7322504022/?seerDrawer=true)
<!-- /SEER_FIXES_SENTRY_ISSUE -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:local%3Aweb%3Acb8a9f3a3fdbf5f94427bcff -->

--

[View Session in
Sentry](https://sentry.sentry.io/explore/conversations/local%3Aweb%3Acb8a9f3a3fdbf5f94427bcff/?project=4510944073809921)

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

---------

Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <[email protected]>
Co-authored-by: Claude <[email protected]>
BYK pushed a commit that referenced this pull request Nov 4, 2026
`sentry explore <org>/<project>` scoped the Events request with a
`project:<slug>` query term and sent no `project` param. The API checks
that term against the requester's member projects only. So if you query
a valid project you aren't a member of, the request 400s. This is one of
the root causes grouped under
[CLI-10](https://sentry.sentry.io/issues/7238595083/) ("API request
failed: 400"), hitting several orgs on 0.47.0.

The fix copies trace/span/log list (#1317). Explore now resolves the
numeric project ID with `resolveLogProjectId` and sends `project=<id>`
for table queries, `--time-series`, and `--metric` discovery. It still
falls back to `project:<slug>` when the ID can't be resolved. Replays
already scope with `projectSlugs` and are unchanged. A slug that doesn't
exist now gets the existing "Project not found" resolution error with
suggestions, not a raw 400.

### Before

```
$ sentry explore my-org/my-proj -F title -F "count()"
Error: API request failed: 400 Bad Request
  Endpoint: /organizations/my-org/events/
  Invalid query. Project(s) my-proj do not exist or are not actively selected.
```

```
GET /api/0/organizations/my-org/events/?dataset=errors&field=title&field=count()&query=project:my-proj&sort=-count()&per_page=25&statsPeriod=24h
```

### After

```
$ sentry explore my-org/my-proj -F title -F "count()"
Querying errors in my-org/my-proj:

╭────────────────────────────────────────────────┬─────────╮
│ TITLE                                          │ COUNT() │
├────────────────────────────────────────────────┼─────────┤
│ TypeError: Cannot read properties of undefined │     128 │
│ ReferenceError: foo is not defined             │      12 │
╰────────────────────────────────────────────────┴─────────╯

Showing 2 results.
```

```
GET /api/0/projects/my-org/my-proj/?collapse=organization
GET /api/0/organizations/my-org/events/?dataset=errors&field=title&field=count()&project=42&sort=-count()&per_page=25&statsPeriod=24h
```

The output above came from a local fake Sentry server that rejects
`project:<slug>` without a `project` param, which matches the production
error.

<!-- junior-request-attribution:start -->
via **bete**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3Aeb1d9c83d99dc5af67281777a0b4315a -->

--

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

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

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Miguel Betegon <[email protected]>
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