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) <[email protected]>
@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) <[email protected]>
Preserve package-selection test imports alongside upstream tool failure
telemetry tests and the latest issue-details replay limits.

Co-Authored-By: GPT-6 (Codex) <[email protected]>
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) <[email protected]>
@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) <[email protected]>
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) <[email protected]>
@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?

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