From 19ea101aae3f1589a17e54b8613aa20f9d0955fe Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 01:01:02 +0000 Subject: [PATCH 1/4] feat(mcp): List related issues in get_issue_details outside experimental mode get_issue_details, and get_sentry_resource for issue and event resources, now look up related issues for every session instead of only experimental ones. The lookup still fails soft: a rate-limited or failed /related/ call leaves relatedIssues out and the tool call succeeds. Co-Authored-By: Christina Long <60594860+Christinarlong@users.noreply.github.com> --- .../tools/catalog/get-issue-details.test.ts | 93 ++++++++++++++----- .../src/tools/catalog/get-issue-details.ts | 22 ++--- .../tools/catalog/get-sentry-resource.test.ts | 33 +++++++ 3 files changed, 112 insertions(+), 36 deletions(-) diff --git a/packages/mcp-core/src/tools/catalog/get-issue-details.test.ts b/packages/mcp-core/src/tools/catalog/get-issue-details.test.ts index b6d9efcef..8ebaa551a 100644 --- a/packages/mcp-core/src/tools/catalog/get-issue-details.test.ts +++ b/packages/mcp-core/src/tools/catalog/get-issue-details.test.ts @@ -364,6 +364,30 @@ describe("get_issue_details", () => { "url": "https://sentry-mcp-evals.sentry.io/issues/CLOUDFLARE-MCP-41", "usersImpacted": 1, }, + "relatedIssues": { + "issues": [ + { + "project": "CLOUDFLARE-MCP", + "relations": [ + "similar_stacktrace", + "same_trace", + ], + "shortId": "CLOUDFLARE-MCP-42", + "status": "resolved", + "title": "Error: Tool list_projects is already registered", + }, + { + "project": "web", + "relations": [ + "same_trace", + ], + "shortId": "WEB-1A2", + "status": "unresolved", + "title": "TypeError: Failed to fetch", + }, + ], + "unavailableTypes": [], + }, "replays": null, "seer": null, "sideQuests": [ @@ -384,25 +408,26 @@ describe("get_issue_details", () => { "issueId": "CLOUDFLARE-MCP-41", "organizationSlug": "sentry-mcp-evals", }, - "reason": "Chart this issue's events and affected users over time.", - "toolName": "render_issue_chart", + "reason": "List every related issue with its similarity score before resolving or ignoring this one.", + "toolName": "find_related_issues", "type": "tool_call", }, { "arguments": { + "issueId": "CLOUDFLARE-MCP-41", "organizationSlug": "sentry-mcp-evals", - "traceId": "3032af8bcdfe4423b937fc5c041d5d82", }, - "reason": "Inspect the distributed trace this event belongs to.", - "toolName": "get_trace_details", + "reason": "Chart this issue's events and affected users over time.", + "toolName": "render_issue_chart", "type": "tool_call", }, { "arguments": { - "issueUrl": "https://sentry-mcp-evals.sentry.io/issues/CLOUDFLARE-MCP-41", + "organizationSlug": "sentry-mcp-evals", + "traceId": "3032af8bcdfe4423b937fc5c041d5d82", }, - "reason": "Read the breadcrumb trail leading up to this event.", - "toolName": "get_issue_breadcrumbs", + "reason": "Inspect the distributed trace this event belongs to.", + "toolName": "get_trace_details", "type": "tool_call", }, ], @@ -2023,7 +2048,7 @@ describe("structuredContent", () => { expect(() => getIssueDetailsOutputSchema.parse(payload)).not.toThrow(); }); - it("returns the same structured payload outside experimental mode, apart from related issues", async () => { + it("returns the same structured payload outside experimental mode", async () => { mockLatestEvent(); const result = await getIssueDetails.handler(params, baseContext); @@ -2034,15 +2059,8 @@ describe("structuredContent", () => { experimentalContext, ); - // related issues are experimental only until the Seer load is checked - const { relatedIssues, ...rest } = parsePayload(experimental); - expect(relatedIssues).toBeDefined(); - expect(parsePayload(result)).toEqual({ - ...rest, - suggestedActions: rest.suggestedActions.filter( - (action) => action.toolName !== "find_related_issues", - ), - }); + expect(parsePayload(result).relatedIssues).toBeDefined(); + expect(parsePayload(result)).toEqual(parsePayload(experimental)); expect( parsePayload(result).suggestedActions.map((action) => action.toolName), ).toContain("render_issue_chart"); @@ -2112,15 +2130,15 @@ describe("structuredContent", () => { }); }); - it("doesn't look them up outside experimental mode", async () => { + it("looks them up outside experimental mode too", async () => { mockLatestEvent(); const requests = captureRelatedRequest(); const result = await getIssueDetails.handler(params, baseContext); const payload = parsePayload(result); - expect(requests).toHaveLength(0); - expect(payload).not.toHaveProperty("relatedIssues"); + expect(requests).toHaveLength(1); + expect(payload.relatedIssues?.issues).toHaveLength(2); }); it("keeps an empty list when nothing is related, without the suggestion", async () => { @@ -3022,6 +3040,30 @@ describe("selected event package versions", () => { "url": "https://sentry-mcp-evals.sentry.io/issues/CLOUDFLARE-MCP-41", "usersImpacted": 1, }, + "relatedIssues": { + "issues": [ + { + "project": "CLOUDFLARE-MCP", + "relations": [ + "similar_stacktrace", + "same_trace", + ], + "shortId": "CLOUDFLARE-MCP-42", + "status": "resolved", + "title": "Error: Tool list_projects is already registered", + }, + { + "project": "web", + "relations": [ + "same_trace", + ], + "shortId": "WEB-1A2", + "status": "unresolved", + "title": "TypeError: Failed to fetch", + }, + ], + "unavailableTypes": [], + }, "replays": null, "seer": null, "sideQuests": [ @@ -3037,6 +3079,15 @@ describe("selected event package versions", () => { }, ], "suggestedActions": [ + { + "arguments": { + "issueId": "CLOUDFLARE-MCP-41", + "organizationSlug": "sentry-mcp-evals", + }, + "reason": "List every related issue with its similarity score before resolving or ignoring this one.", + "toolName": "find_related_issues", + "type": "tool_call", + }, { "arguments": { "issueId": "CLOUDFLARE-MCP-41", diff --git a/packages/mcp-core/src/tools/catalog/get-issue-details.ts b/packages/mcp-core/src/tools/catalog/get-issue-details.ts index ac931aa5b..9a9416dc6 100644 --- a/packages/mcp-core/src/tools/catalog/get-issue-details.ts +++ b/packages/mcp-core/src/tools/catalog/get-issue-details.ts @@ -691,7 +691,6 @@ export default defineTool({ organizationSlug: orgSlug, issue, seerEnabled: isSeerGranted(context), - includeRelatedIssues: context.experimentalMode ?? false, // same_trace follows the event's trace, so it must be the event shown eventId, }), @@ -792,8 +791,6 @@ export default defineTool({ organizationSlug: orgSlug, issue, seerEnabled: isSeerGranted(context), - // experimental only until the Seer load and rate limits are checked - includeRelatedIssues: context.experimentalMode ?? false, }), ]); @@ -920,22 +917,19 @@ async function maybeFetchCommitters({ * Fetches supplementary data for an issue in parallel: Seer analysis, external links, replays * and related issues. All calls are non-blocking -- failures are caught so they never * prevent the primary issue details from being returned. Seer analysis is - * skipped entirely when the `seer` skill is not granted, and related issues unless - * `includeRelatedIssues` is set. + * skipped entirely when the `seer` skill is not granted. */ async function fetchIssueEnrichmentData({ apiService, organizationSlug, issue, seerEnabled, - includeRelatedIssues, eventId, }: { apiService: SentryApiService; organizationSlug: string; issue: Issue; seerEnabled: boolean; - includeRelatedIssues: boolean; /** The event the response shows; related issues come from the latest event when omitted. */ eventId?: string; }): Promise<{ @@ -963,14 +957,12 @@ async function fetchIssueEnrichmentData({ dataSource: getReplayDataSource(issue), }) .catch(() => undefined), - includeRelatedIssues - ? maybeFetchRelatedIssues({ - apiService, - organizationSlug, - issueId, - eventId, - }) - : undefined, + maybeFetchRelatedIssues({ + apiService, + organizationSlug, + issueId, + eventId, + }), ]); return { autofixState, externalIssues, relatedReplayIds, relatedIssues }; diff --git a/packages/mcp-core/src/tools/catalog/get-sentry-resource.test.ts b/packages/mcp-core/src/tools/catalog/get-sentry-resource.test.ts index 06dbf28a5..e0152285d 100644 --- a/packages/mcp-core/src/tools/catalog/get-sentry-resource.test.ts +++ b/packages/mcp-core/src/tools/catalog/get-sentry-resource.test.ts @@ -1335,6 +1335,30 @@ describe("event package selection", () => { "url": "https://sentry-mcp-evals.sentry.io/issues/CLOUDFLARE-MCP-41", "usersImpacted": 1, }, + "relatedIssues": { + "issues": [ + { + "project": "CLOUDFLARE-MCP", + "relations": [ + "similar_stacktrace", + "same_trace", + ], + "shortId": "CLOUDFLARE-MCP-42", + "status": "resolved", + "title": "Error: Tool list_projects is already registered", + }, + { + "project": "web", + "relations": [ + "same_trace", + ], + "shortId": "WEB-1A2", + "status": "unresolved", + "title": "TypeError: Failed to fetch", + }, + ], + "unavailableTypes": [], + }, "replays": null, "seer": null, "sideQuests": [ @@ -1350,6 +1374,15 @@ describe("event package selection", () => { }, ], "suggestedActions": [ + { + "arguments": { + "issueId": "CLOUDFLARE-MCP-41", + "organizationSlug": "sentry-mcp-evals", + }, + "reason": "List every related issue with its similarity score before resolving or ignoring this one.", + "toolName": "find_related_issues", + "type": "tool_call", + }, { "arguments": { "issueId": "CLOUDFLARE-MCP-41", From 74ff7fcf1be20d05379396ec1e1dc1b010b187ae Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 23:27:18 +0000 Subject: [PATCH 2/4] fix(mcp): Drop the resolve steering from get_issue_details related issues get_issue_details serves investigation and correlation as much as triage, so the related issues are surfaced as data only. Remove the find_related_issues suggestion and the resolve/ignore wording in the relatedIssues description. --- packages/mcp-core/src/toolDefinitions.json | 2 +- .../get-issue-details.structured.test.ts | 17 ++++--- .../tools/catalog/get-issue-details.test.ts | 44 +++++-------------- .../src/tools/catalog/get-issue-details.ts | 22 ++-------- .../tools/catalog/get-sentry-resource.test.ts | 9 ---- 5 files changed, 24 insertions(+), 70 deletions(-) diff --git a/packages/mcp-core/src/toolDefinitions.json b/packages/mcp-core/src/toolDefinitions.json index b2a1e2b96..b702c4c8d 100644 --- a/packages/mcp-core/src/toolDefinitions.json +++ b/packages/mcp-core/src/toolDefinitions.json @@ -7430,7 +7430,7 @@ "additionalProperties": false }, "relatedIssues": { - "description": "Up to 5 other issues related to this one, most relations first: similar_stacktrace (likely duplicate), same_trace (same request), contributing (behind a metric alert). Check them before resolving or ignoring this issue.", + "description": "Up to 5 other issues related to this one, most relations first: similar_stacktrace (likely duplicate), same_trace (same request), contributing (behind a metric alert).", "type": "object", "properties": { "issues": { diff --git a/packages/mcp-core/src/tools/catalog/get-issue-details.structured.test.ts b/packages/mcp-core/src/tools/catalog/get-issue-details.structured.test.ts index f3a58ddcd..378c8841c 100644 --- a/packages/mcp-core/src/tools/catalog/get-issue-details.structured.test.ts +++ b/packages/mcp-core/src/tools/catalog/get-issue-details.structured.test.ts @@ -643,15 +643,6 @@ describe("get_issue_details structuredContent for a realistic error", () => { "replays": null, "seer": null, "suggestedActions": [ - { - "arguments": { - "issueId": "SHOP-4F2", - "organizationSlug": "sentry-mcp-evals", - }, - "reason": "List every related issue with its similarity score before resolving or ignoring this one.", - "toolName": "find_related_issues", - "type": "tool_call", - }, { "arguments": { "issueId": "SHOP-4F2", @@ -670,6 +661,14 @@ describe("get_issue_details structuredContent for a realistic error", () => { "toolName": "get_trace_details", "type": "tool_call", }, + { + "arguments": { + "issueUrl": "https://sentry-mcp-evals.sentry.io/issues/SHOP-4F2", + }, + "reason": "Read the breadcrumb trail leading up to this event.", + "toolName": "get_issue_breadcrumbs", + "type": "tool_call", + }, ], "suspectCommit": null, } diff --git a/packages/mcp-core/src/tools/catalog/get-issue-details.test.ts b/packages/mcp-core/src/tools/catalog/get-issue-details.test.ts index 8ebaa551a..5e94c3806 100644 --- a/packages/mcp-core/src/tools/catalog/get-issue-details.test.ts +++ b/packages/mcp-core/src/tools/catalog/get-issue-details.test.ts @@ -403,15 +403,6 @@ describe("get_issue_details", () => { }, ], "suggestedActions": [ - { - "arguments": { - "issueId": "CLOUDFLARE-MCP-41", - "organizationSlug": "sentry-mcp-evals", - }, - "reason": "List every related issue with its similarity score before resolving or ignoring this one.", - "toolName": "find_related_issues", - "type": "tool_call", - }, { "arguments": { "issueId": "CLOUDFLARE-MCP-41", @@ -430,6 +421,14 @@ describe("get_issue_details", () => { "toolName": "get_trace_details", "type": "tool_call", }, + { + "arguments": { + "issueUrl": "https://sentry-mcp-evals.sentry.io/issues/CLOUDFLARE-MCP-41", + }, + "reason": "Read the breadcrumb trail leading up to this event.", + "toolName": "get_issue_breadcrumbs", + "type": "tool_call", + }, ], "suspectCommit": null, } @@ -2118,16 +2117,9 @@ describe("structuredContent", () => { ], unavailableTypes: [], }); - expect(payload.suggestedActions[0]).toEqual({ - type: "tool_call", - toolName: "find_related_issues", - arguments: { - organizationSlug: "sentry-mcp-evals", - issueId: "CLOUDFLARE-MCP-41", - }, - reason: - "List every related issue with its similarity score before resolving or ignoring this one.", - }); + expect( + payload.suggestedActions.map((action) => action.toolName), + ).not.toContain("find_related_issues"); }); it("looks them up outside experimental mode too", async () => { @@ -2141,7 +2133,7 @@ describe("structuredContent", () => { expect(payload.relatedIssues?.issues).toHaveLength(2); }); - it("keeps an empty list when nothing is related, without the suggestion", async () => { + it("keeps an empty list when nothing is related", async () => { mockLatestEvent(); captureRelatedRequest(() => HttpResponse.json({ @@ -2157,9 +2149,6 @@ describe("structuredContent", () => { issues: [], unavailableTypes: [], }); - expect( - payload.suggestedActions.map((action) => action.toolName), - ).not.toContain("find_related_issues"); }); it("names the relation types that failed", async () => { @@ -3079,15 +3068,6 @@ describe("selected event package versions", () => { }, ], "suggestedActions": [ - { - "arguments": { - "issueId": "CLOUDFLARE-MCP-41", - "organizationSlug": "sentry-mcp-evals", - }, - "reason": "List every related issue with its similarity score before resolving or ignoring this one.", - "toolName": "find_related_issues", - "type": "tool_call", - }, { "arguments": { "issueId": "CLOUDFLARE-MCP-41", diff --git a/packages/mcp-core/src/tools/catalog/get-issue-details.ts b/packages/mcp-core/src/tools/catalog/get-issue-details.ts index 9a9416dc6..0f5c4eb68 100644 --- a/packages/mcp-core/src/tools/catalog/get-issue-details.ts +++ b/packages/mcp-core/src/tools/catalog/get-issue-details.ts @@ -130,7 +130,7 @@ export const getIssueDetailsOutputSchema = z.object({ }) .optional() .describe( - `Up to ${MAX_RELATED_ISSUES} other issues related to this one, most relations first: similar_stacktrace (likely duplicate), same_trace (same request), contributing (behind a metric alert). Check them before resolving or ignoring this issue.`, + `Up to ${MAX_RELATED_ISSUES} other issues related to this one, most relations first: similar_stacktrace (likely duplicate), same_trace (same request), contributing (behind a metric alert).`, ), event: issueEventSchema, seer: z @@ -418,7 +418,6 @@ function buildIssueDetailsPayload({ event, apiService, aiConversations, - hasRelatedIssues: (related?.issues.length ?? 0) > 0, otherThread: findOtherThread(eventPayload.threads), session, }), @@ -450,8 +449,8 @@ function toCount(value: unknown): number | null { } /** - * Follow-up calls, most specific first: a metric issue's monitor and query, the related - * issues, the issue's chart, the agent conversations in the trace, the trace itself, + * Follow-up calls, most specific first: a metric issue's monitor and query, the issue's + * chart, the agent conversations in the trace, the trace itself, * another thread's stacktrace, and the breadcrumbs. */ function buildIssueSuggestedActions({ @@ -460,7 +459,6 @@ function buildIssueSuggestedActions({ event, apiService, aiConversations, - hasRelatedIssues, otherThread, session, }: { @@ -469,7 +467,6 @@ function buildIssueSuggestedActions({ event: Event; apiService: SentryApiService; aiConversations?: AIConversationReference[] | undefined; - hasRelatedIssues: boolean; otherThread: number | string | null; session: ToolSession; }): SuggestedToolAction[] { @@ -504,19 +501,6 @@ function buildIssueSuggestedActions({ } } - // the inline list is capped and has no scores; the tool has the full list - if (hasRelatedIssues) { - candidates.push( - buildSuggestedToolAction({ - toolName: "find_related_issues", - arguments: { organizationSlug, issueId: issue.shortId }, - reason: - "List every related issue with its similarity score before resolving or ignoring this one.", - ...session, - }), - ); - } - candidates.push( buildSuggestedToolAction({ toolName: "render_issue_chart", diff --git a/packages/mcp-core/src/tools/catalog/get-sentry-resource.test.ts b/packages/mcp-core/src/tools/catalog/get-sentry-resource.test.ts index e0152285d..6e64b0f35 100644 --- a/packages/mcp-core/src/tools/catalog/get-sentry-resource.test.ts +++ b/packages/mcp-core/src/tools/catalog/get-sentry-resource.test.ts @@ -1374,15 +1374,6 @@ describe("event package selection", () => { }, ], "suggestedActions": [ - { - "arguments": { - "issueId": "CLOUDFLARE-MCP-41", - "organizationSlug": "sentry-mcp-evals", - }, - "reason": "List every related issue with its similarity score before resolving or ignoring this one.", - "toolName": "find_related_issues", - "type": "tool_call", - }, { "arguments": { "issueId": "CLOUDFLARE-MCP-41", From 9a0854d8bb74dd38299f147fc1456d9d26e1a027 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 23:42:27 +0000 Subject: [PATCH 3/4] fix(mcp): Keep the existing relatedIssues schema description The description already ships in every session's tool definitions, so leave it as it was on main. --- packages/mcp-core/src/toolDefinitions.json | 2 +- packages/mcp-core/src/tools/catalog/get-issue-details.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/mcp-core/src/toolDefinitions.json b/packages/mcp-core/src/toolDefinitions.json index b702c4c8d..b2a1e2b96 100644 --- a/packages/mcp-core/src/toolDefinitions.json +++ b/packages/mcp-core/src/toolDefinitions.json @@ -7430,7 +7430,7 @@ "additionalProperties": false }, "relatedIssues": { - "description": "Up to 5 other issues related to this one, most relations first: similar_stacktrace (likely duplicate), same_trace (same request), contributing (behind a metric alert).", + "description": "Up to 5 other issues related to this one, most relations first: similar_stacktrace (likely duplicate), same_trace (same request), contributing (behind a metric alert). Check them before resolving or ignoring this issue.", "type": "object", "properties": { "issues": { diff --git a/packages/mcp-core/src/tools/catalog/get-issue-details.ts b/packages/mcp-core/src/tools/catalog/get-issue-details.ts index 0f5c4eb68..07c93329d 100644 --- a/packages/mcp-core/src/tools/catalog/get-issue-details.ts +++ b/packages/mcp-core/src/tools/catalog/get-issue-details.ts @@ -130,7 +130,7 @@ export const getIssueDetailsOutputSchema = z.object({ }) .optional() .describe( - `Up to ${MAX_RELATED_ISSUES} other issues related to this one, most relations first: similar_stacktrace (likely duplicate), same_trace (same request), contributing (behind a metric alert).`, + `Up to ${MAX_RELATED_ISSUES} other issues related to this one, most relations first: similar_stacktrace (likely duplicate), same_trace (same request), contributing (behind a metric alert). Check them before resolving or ignoring this issue.`, ), event: issueEventSchema, seer: z From 3384cf27305f249840d317dae9432a3e84bcf81f Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 23:53:10 +0000 Subject: [PATCH 4/4] fix(mcp): Restore the find_related_issues suggestion in get_issue_details The suggestion already existed on main, so keep its behavior as is. --- .../get-issue-details.structured.test.ts | 17 +++---- .../tools/catalog/get-issue-details.test.ts | 44 ++++++++++++++----- .../src/tools/catalog/get-issue-details.ts | 20 ++++++++- .../tools/catalog/get-sentry-resource.test.ts | 9 ++++ 4 files changed, 68 insertions(+), 22 deletions(-) diff --git a/packages/mcp-core/src/tools/catalog/get-issue-details.structured.test.ts b/packages/mcp-core/src/tools/catalog/get-issue-details.structured.test.ts index 378c8841c..f3a58ddcd 100644 --- a/packages/mcp-core/src/tools/catalog/get-issue-details.structured.test.ts +++ b/packages/mcp-core/src/tools/catalog/get-issue-details.structured.test.ts @@ -648,25 +648,26 @@ describe("get_issue_details structuredContent for a realistic error", () => { "issueId": "SHOP-4F2", "organizationSlug": "sentry-mcp-evals", }, - "reason": "Chart this issue's events and affected users over time.", - "toolName": "render_issue_chart", + "reason": "List every related issue with its similarity score before resolving or ignoring this one.", + "toolName": "find_related_issues", "type": "tool_call", }, { "arguments": { + "issueId": "SHOP-4F2", "organizationSlug": "sentry-mcp-evals", - "traceId": "4bf92f3577b34da6a3ce929d0e0e4736", }, - "reason": "Inspect the distributed trace this event belongs to.", - "toolName": "get_trace_details", + "reason": "Chart this issue's events and affected users over time.", + "toolName": "render_issue_chart", "type": "tool_call", }, { "arguments": { - "issueUrl": "https://sentry-mcp-evals.sentry.io/issues/SHOP-4F2", + "organizationSlug": "sentry-mcp-evals", + "traceId": "4bf92f3577b34da6a3ce929d0e0e4736", }, - "reason": "Read the breadcrumb trail leading up to this event.", - "toolName": "get_issue_breadcrumbs", + "reason": "Inspect the distributed trace this event belongs to.", + "toolName": "get_trace_details", "type": "tool_call", }, ], diff --git a/packages/mcp-core/src/tools/catalog/get-issue-details.test.ts b/packages/mcp-core/src/tools/catalog/get-issue-details.test.ts index 5e94c3806..8ebaa551a 100644 --- a/packages/mcp-core/src/tools/catalog/get-issue-details.test.ts +++ b/packages/mcp-core/src/tools/catalog/get-issue-details.test.ts @@ -408,25 +408,26 @@ describe("get_issue_details", () => { "issueId": "CLOUDFLARE-MCP-41", "organizationSlug": "sentry-mcp-evals", }, - "reason": "Chart this issue's events and affected users over time.", - "toolName": "render_issue_chart", + "reason": "List every related issue with its similarity score before resolving or ignoring this one.", + "toolName": "find_related_issues", "type": "tool_call", }, { "arguments": { + "issueId": "CLOUDFLARE-MCP-41", "organizationSlug": "sentry-mcp-evals", - "traceId": "3032af8bcdfe4423b937fc5c041d5d82", }, - "reason": "Inspect the distributed trace this event belongs to.", - "toolName": "get_trace_details", + "reason": "Chart this issue's events and affected users over time.", + "toolName": "render_issue_chart", "type": "tool_call", }, { "arguments": { - "issueUrl": "https://sentry-mcp-evals.sentry.io/issues/CLOUDFLARE-MCP-41", + "organizationSlug": "sentry-mcp-evals", + "traceId": "3032af8bcdfe4423b937fc5c041d5d82", }, - "reason": "Read the breadcrumb trail leading up to this event.", - "toolName": "get_issue_breadcrumbs", + "reason": "Inspect the distributed trace this event belongs to.", + "toolName": "get_trace_details", "type": "tool_call", }, ], @@ -2117,9 +2118,16 @@ describe("structuredContent", () => { ], unavailableTypes: [], }); - expect( - payload.suggestedActions.map((action) => action.toolName), - ).not.toContain("find_related_issues"); + expect(payload.suggestedActions[0]).toEqual({ + type: "tool_call", + toolName: "find_related_issues", + arguments: { + organizationSlug: "sentry-mcp-evals", + issueId: "CLOUDFLARE-MCP-41", + }, + reason: + "List every related issue with its similarity score before resolving or ignoring this one.", + }); }); it("looks them up outside experimental mode too", async () => { @@ -2133,7 +2141,7 @@ describe("structuredContent", () => { expect(payload.relatedIssues?.issues).toHaveLength(2); }); - it("keeps an empty list when nothing is related", async () => { + it("keeps an empty list when nothing is related, without the suggestion", async () => { mockLatestEvent(); captureRelatedRequest(() => HttpResponse.json({ @@ -2149,6 +2157,9 @@ describe("structuredContent", () => { issues: [], unavailableTypes: [], }); + expect( + payload.suggestedActions.map((action) => action.toolName), + ).not.toContain("find_related_issues"); }); it("names the relation types that failed", async () => { @@ -3068,6 +3079,15 @@ describe("selected event package versions", () => { }, ], "suggestedActions": [ + { + "arguments": { + "issueId": "CLOUDFLARE-MCP-41", + "organizationSlug": "sentry-mcp-evals", + }, + "reason": "List every related issue with its similarity score before resolving or ignoring this one.", + "toolName": "find_related_issues", + "type": "tool_call", + }, { "arguments": { "issueId": "CLOUDFLARE-MCP-41", diff --git a/packages/mcp-core/src/tools/catalog/get-issue-details.ts b/packages/mcp-core/src/tools/catalog/get-issue-details.ts index 07c93329d..9a9416dc6 100644 --- a/packages/mcp-core/src/tools/catalog/get-issue-details.ts +++ b/packages/mcp-core/src/tools/catalog/get-issue-details.ts @@ -418,6 +418,7 @@ function buildIssueDetailsPayload({ event, apiService, aiConversations, + hasRelatedIssues: (related?.issues.length ?? 0) > 0, otherThread: findOtherThread(eventPayload.threads), session, }), @@ -449,8 +450,8 @@ function toCount(value: unknown): number | null { } /** - * Follow-up calls, most specific first: a metric issue's monitor and query, the issue's - * chart, the agent conversations in the trace, the trace itself, + * Follow-up calls, most specific first: a metric issue's monitor and query, the related + * issues, the issue's chart, the agent conversations in the trace, the trace itself, * another thread's stacktrace, and the breadcrumbs. */ function buildIssueSuggestedActions({ @@ -459,6 +460,7 @@ function buildIssueSuggestedActions({ event, apiService, aiConversations, + hasRelatedIssues, otherThread, session, }: { @@ -467,6 +469,7 @@ function buildIssueSuggestedActions({ event: Event; apiService: SentryApiService; aiConversations?: AIConversationReference[] | undefined; + hasRelatedIssues: boolean; otherThread: number | string | null; session: ToolSession; }): SuggestedToolAction[] { @@ -501,6 +504,19 @@ function buildIssueSuggestedActions({ } } + // the inline list is capped and has no scores; the tool has the full list + if (hasRelatedIssues) { + candidates.push( + buildSuggestedToolAction({ + toolName: "find_related_issues", + arguments: { organizationSlug, issueId: issue.shortId }, + reason: + "List every related issue with its similarity score before resolving or ignoring this one.", + ...session, + }), + ); + } + candidates.push( buildSuggestedToolAction({ toolName: "render_issue_chart", diff --git a/packages/mcp-core/src/tools/catalog/get-sentry-resource.test.ts b/packages/mcp-core/src/tools/catalog/get-sentry-resource.test.ts index 6e64b0f35..e0152285d 100644 --- a/packages/mcp-core/src/tools/catalog/get-sentry-resource.test.ts +++ b/packages/mcp-core/src/tools/catalog/get-sentry-resource.test.ts @@ -1374,6 +1374,15 @@ describe("event package selection", () => { }, ], "suggestedActions": [ + { + "arguments": { + "issueId": "CLOUDFLARE-MCP-41", + "organizationSlug": "sentry-mcp-evals", + }, + "reason": "List every related issue with its similarity score before resolving or ignoring this one.", + "toolName": "find_related_issues", + "type": "tool_call", + }, { "arguments": { "issueId": "CLOUDFLARE-MCP-41",