Skip to content

feat(tools): expose selected package versions for exact events - #1293

Open
mr-danya wants to merge 6 commits into
getsentry:mainfrom
mr-danya:trusst/sentry-mcp-pr-handoff
Open

mr-danya wants to merge 6 commits into
getsentry:mainfrom
mr-danya:trusst/sentry-mcp-pr-handoff

Conversation

@mr-danya

@mr-danya mr-danya commented Sep 8, 2026 •

Copy link
Copy Markdown

Summary

Adds optional packageNames selection to exact-event reads through get_sentry_resource and get_issue_details, so dependency compatibility diagnosis can use versions recorded with the event. Returns up to 10 selected packages in structuredContent when Sentry supplies JSON, and in Markdown fallback responses, with distinct states for unavailable metadata and unlisted packages and bounded version lengths. Calls without a selection retain their existing output, with no additional API requests.

Fixes #1292.

Before / After

Before: event packages → discarded during parsing → versions unavailable
After:  event packages → exact-name selection → structured or Markdown response

Retain event package metadata and support bounded exact-name selection
through the existing resource and issue readers. Include selected versions
with supplied Markdown and local formatting without extra API requests.

Fixes getsentry#1292

Co-Authored-By: GPT-6 (Codex) <noreply@openai.com>
@mr-danya
mr-danya marked this pull request as ready for review September 8, 2026 01:46
mr-danya and others added 3 commits September 10, 2026 12:03
Merge upstream/main and retain package selection in the new structured
issue responses as well as Markdown fallback. Share selection logic and
cover both response formats through the tool and MCP boundaries.

Co-Authored-By: GPT-6 (Codex) <noreply@openai.com>
Preserve package-selection test imports alongside upstream tool failure
telemetry tests and the latest issue-details replay limits.

Co-Authored-By: GPT-6 (Codex) <noreply@openai.com>
Preserve selected event package versions alongside suspect commit output
and adapt package-selection fixtures to numeric issue event endpoints.

Co-Authored-By: GPT-6 (Codex) <noreply@openai.com>
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Sep 29, 2026
mr-danya and others added 2 commits October 6, 2026 13:30
Preserve package selection alongside updated resource telemetry and nullable
event context documentation.

Co-Authored-By: GPT-6 (Codex) <noreply@openai.com>
Preserve selected package versions with experimental structured issue details
and locally formatted event bodies. Regenerate definitions and update response
snapshots for the upstream formatting contract.

Co-Authored-By: GPT-6 (Codex) <noreply@openai.com>
@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown

@mr-danya is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.


return {
metadataAvailable: true,
packages: [...new Set(packageNames)].map((name) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
packages: [...new Set(packageNames)].map((name) => {
packages: Array.from(new Set(packageNames), (name) => {

return {
metadataAvailable: true,
packages: [...new Set(packageNames)].map((name) => {
const version = Object.hasOwn(packages, name)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages should be a Map I guess if we are doing this?

const version = Object.hasOwn(packages, name)
? packages[name]
: undefined;
if (version === undefined || !version?.trim()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First check is redundant.

Suggested change
if (version === undefined || !version?.trim()) {
if (!version?.trim()) {

if (version === undefined || !version?.trim()) {
return {
name,
status: version === undefined ? "not_listed" : "version_not_recorded",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, do version === undefined early on and record it? Then you can probably reduce this to a single return {...} statement with 2 ternary statements in it.

Comment on lines +1985 to +1993
const value =
entry.status === "recorded"
? entry.truncated
? `${entry.version}… (truncated)`
: entry.version
: entry.status === "not_listed"
? "Not listed in this event's package metadata"
: "Version not recorded";
output += `- ${formatPackageText(entry.name)}: ${formatPackageText(value)}\n`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These nested ternaries are blowing my mind. I feel like this calls for a switch block to be clear?

Comment on lines +1998 to +2004
function formatPackageText(value: string): string {
return value
.replace(/[\r\n\t]/g, " ")
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/([\\`*_[\]|>])/g, "\\$1");
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this doing? Don't we already have proper markdown/HTML escaping and building blocks in the repo?

BYK added a commit that referenced this pull request Oct 23, 2026
…me (#1607)

Two places where what the library SDK accepts doesn't match what
commands actually get:

- **Scalar values for variadic flags.** Stricli always passes variadic
flags to a handler as arrays, but the SDK forwards the caller's flags
as-is. An untyped caller passing `{ field: "title" }` to `explore`
crashed with `e.find is not a function`
([CLI-28C](https://sentry.sentry.io/issues/7602736942/),
[CLI-2B4](https://sentry.sentry.io/issues/7630797537/)).
getsentry/cli#1648 fixed the generated types. `applyFlagDefaults` now
also wraps scalar values in an array at runtime, so plain JS callers
work.
- **Streaming overloads.** The `AsyncIterable` overload for `log list
--follow` and `dashboard view --refresh` didn't accept trailing
positionals, so `sdk.log.list({ follow: "5" }, "org/project")` failed to
type-check even though the runtime accepts it.

This replaces three getsentry/cli PRs that patched `explore` directly.
#1293's `parse: (v: string[]) => v` was wrong because Stricli calls
`parse` once per value. #1218 and #1294 coerced the arrays inside
`explore`. The variadic fix here is at the SDK boundary, which is the
only path that can pass a scalar.

Ported from getsentry/cli#1218, getsentry/cli#1293, getsentry/cli#1294,
and the SDK part of getsentry/cli#1655. All are being closed with the
repo archive.

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

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

--

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

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

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <burak.kaya@sentry.io>

This branch has not been deployed

No deployments
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.

Expose installed package versions in exact-event MCP responses

2 participants