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",