Skip to content

Commit 2f5996c

Browse files
feat(mcp): Support same-title and same-supergroup related issue types (#2475)
Sentry's `/organizations/{org}/issues/{id}/related/` endpoint now supports two more relation types (`RelationType` in `src/sentry/issues/related/types.py`): - `same_title`: error issues in the same project whose events in the last 14 days share this issue's event title. Grouping splits one cause reached from several places into several issues, and stack trace similarity misses those by design. - `same_supergroup`: the other issues in this issue's Seer supergroup, meaning issues in any project the user can read whose root cause describes the same failure. It's `not_applicable` unless the org has supergroups enabled. Both are in `RELATED_ISSUE_TYPES`, so every response and output schema accepts them. **What each caller asks for:** - `find_related_issues` asks for all types by default. Each `relationTypes` entry reports the title `same_title` searched and the supergroup's Seer summary (`meta.supergroup.title`). The supergroup ID is parsed but left out of the output, because no tool takes it. - `get_issue_details` (experimental mode) asks for every type except `same_title`, because that type's issue search would run on every call. - `update_issue`'s resolve side quest asks for every type. `RELATION_LABELS` has labels for the new ones. The project-scope filter already drops cross-project `same_supergroup` issues in a project-scoped session. **Deploy order:** the endpoint validates `type` against its choices and returns 400 for an unknown one. If the Sentry changes that added `same_title` and `same_supergroup` aren't deployed when this merges, `find_related_issues` fails by default. `get_issue_details` and the `update_issue` side quest quietly leave related issues out, since they treat client errors as expected. The new `investigations` type goes in a separate PR stacked on this one. <!-- junior-request-attribution:start --> via @Christinarlong. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Aca4aac603e2acab8493205b20f5ef64e --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Aca4aac603e2acab8493205b20f5ef64e) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Aca4aac603e2acab8493205b20f5ef64e/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Christina Long <60594860+Christinarlong@users.noreply.github.com>
1 parent 0c3ab8c commit 2f5996c

9 files changed

Lines changed: 208 additions & 19 deletions

File tree

‎packages/mcp-core/src/api-client/schema.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,8 @@ export const RELATED_ISSUE_TYPES = [
907907
"similar_stacktrace",
908908
"same_trace",
909909
"contributing",
910+
"same_title",
911+
"same_supergroup",
910912
] as const;
911913

912914
/** Outcome of each requested relation type (`RelationTypeStatus`). */
@@ -948,6 +950,10 @@ export const RelatedIssuesResponseSchema = z.object({
948950
status: z.enum(RELATED_ISSUE_TYPE_STATUSES),
949951
detail: z.string().optional(),
950952
traceId: z.string().optional(),
953+
title: z.string().optional(),
954+
supergroup: z
955+
.object({ id: z.string(), title: z.string() })
956+
.optional(),
951957
})
952958
.passthrough(),
953959
),

‎packages/mcp-core/src/internal/update-issue-side-quests.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ const RELATION_LABELS: Record<RelatedIssueType, string> = {
5555
similar_stacktrace: "similar stack trace",
5656
same_trace: "same trace",
5757
contributing: "contributing",
58+
same_title: "same title",
59+
same_supergroup: "same supergroup",
5860
};
5961

6062
/**

‎packages/mcp-core/src/skillDefinitions.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
{
4646
"name": "find_related_issues",
47-
"description": "Find Sentry issues related to an issue: likely duplicates with a similar stack trace in the same project, other errors in the same trace, and the error issues behind a metric alert. Returns each related issue with its status and why it's related. Use it before resolving or ignoring an issue. It doesn't compare titles or error messages.",
47+
"description": "Find Sentry issues related to an issue: likely duplicates with a similar stack trace or the same title in the same project, other errors in the same trace, issues Seer found to share a root cause, and the error issues behind a metric alert. Returns each related issue with its status and why it's related. Use it before resolving or ignoring an issue.",
4848
"requiredScopes": ["event:read"]
4949
},
5050
{
@@ -279,7 +279,7 @@
279279
},
280280
{
281281
"name": "find_related_issues",
282-
"description": "Find Sentry issues related to an issue: likely duplicates with a similar stack trace in the same project, other errors in the same trace, and the error issues behind a metric alert. Returns each related issue with its status and why it's related. Use it before resolving or ignoring an issue. It doesn't compare titles or error messages.",
282+
"description": "Find Sentry issues related to an issue: likely duplicates with a similar stack trace or the same title in the same project, other errors in the same trace, issues Seer found to share a root cause, and the error issues behind a metric alert. Returns each related issue with its status and why it's related. Use it before resolving or ignoring an issue.",
283283
"requiredScopes": ["event:read"]
284284
},
285285
{
@@ -430,7 +430,7 @@
430430
},
431431
{
432432
"name": "find_related_issues",
433-
"description": "Find Sentry issues related to an issue: likely duplicates with a similar stack trace in the same project, other errors in the same trace, and the error issues behind a metric alert. Returns each related issue with its status and why it's related. Use it before resolving or ignoring an issue. It doesn't compare titles or error messages.",
433+
"description": "Find Sentry issues related to an issue: likely duplicates with a similar stack trace or the same title in the same project, other errors in the same trace, issues Seer found to share a root cause, and the error issues behind a metric alert. Returns each related issue with its status and why it's related. Use it before resolving or ignoring an issue.",
434434
"requiredScopes": ["event:read"]
435435
},
436436
{

‎packages/mcp-core/src/toolDefinitions.json‎

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,7 +3116,7 @@
31163116
{
31173117
"name": "find_related_issues",
31183118
"title": "Find Related Issues",
3119-
"description": "Find Sentry issues related to an issue: likely duplicates with a similar stack trace in the same project, other errors in the same trace, and the error issues behind a metric alert. Returns each related issue with its status and why it's related. Use it before resolving or ignoring an issue. It doesn't compare titles or error messages.",
3119+
"description": "Find Sentry issues related to an issue: likely duplicates with a similar stack trace or the same title in the same project, other errors in the same trace, issues Seer found to share a root cause, and the error issues behind a metric alert. Returns each related issue with its status and why it's related. Use it before resolving or ignoring an issue.",
31203120
"inputSchema": {
31213121
"type": "object",
31223122
"properties": {
@@ -3147,13 +3147,19 @@
31473147
},
31483148
"types": {
31493149
"default": null,
3150-
"description": "Relation types to return; all when omitted. similar_stacktrace: likely duplicates. same_trace: errors in the same trace, often the other side of a request. contributing: for a metric issue, the error issues behind it.",
3150+
"description": "Relation types; all when omitted. similar_stacktrace: likely duplicates. same_trace: errors in the same trace. contributing: errors behind a metric issue. same_title: errors with the same title, last 14 days. same_supergroup: same root cause per Seer.",
31513151
"anyOf": [
31523152
{
31533153
"type": "array",
31543154
"items": {
31553155
"type": "string",
3156-
"enum": ["similar_stacktrace", "same_trace", "contributing"]
3156+
"enum": [
3157+
"similar_stacktrace",
3158+
"same_trace",
3159+
"contributing",
3160+
"same_title",
3161+
"same_supergroup"
3162+
]
31573163
}
31583164
},
31593165
{
@@ -3264,7 +3270,9 @@
32643270
"enum": [
32653271
"similar_stacktrace",
32663272
"same_trace",
3267-
"contributing"
3273+
"contributing",
3274+
"same_title",
3275+
"same_supergroup"
32683276
]
32693277
},
32703278
"score": {
@@ -3308,7 +3316,13 @@
33083316
"properties": {
33093317
"type": {
33103318
"type": "string",
3311-
"enum": ["similar_stacktrace", "same_trace", "contributing"]
3319+
"enum": [
3320+
"similar_stacktrace",
3321+
"same_trace",
3322+
"contributing",
3323+
"same_title",
3324+
"same_supergroup"
3325+
]
33123326
},
33133327
"status": {
33143328
"type": "string",
@@ -3321,9 +3335,24 @@
33213335
"traceId": {
33223336
"description": "same_trace only: the trace that was searched.",
33233337
"type": ["string", "null"]
3338+
},
3339+
"title": {
3340+
"description": "same_title only: the title that was searched.",
3341+
"type": ["string", "null"]
3342+
},
3343+
"supergroup": {
3344+
"description": "same_supergroup only: what the issues in this issue's supergroup have in common, from Seer.",
3345+
"type": ["string", "null"]
33243346
}
33253347
},
3326-
"required": ["type", "status", "detail", "traceId"],
3348+
"required": [
3349+
"type",
3350+
"status",
3351+
"detail",
3352+
"traceId",
3353+
"title",
3354+
"supergroup"
3355+
],
33273356
"additionalProperties": false
33283357
},
33293358
"description": "Whether each requested relation type ran."
@@ -7430,7 +7459,7 @@
74307459
"additionalProperties": false
74317460
},
74327461
"relatedIssues": {
7433-
"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.",
7462+
"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), same_supergroup (same root cause per Seer). Check them before resolving or ignoring this issue.",
74347463
"type": "object",
74357464
"properties": {
74367465
"issues": {
@@ -7472,7 +7501,9 @@
74727501
"enum": [
74737502
"similar_stacktrace",
74747503
"same_trace",
7475-
"contributing"
7504+
"contributing",
7505+
"same_title",
7506+
"same_supergroup"
74767507
]
74777508
}
74787509
}
@@ -7491,7 +7522,13 @@
74917522
"type": "array",
74927523
"items": {
74937524
"type": "string",
7494-
"enum": ["similar_stacktrace", "same_trace", "contributing"]
7525+
"enum": [
7526+
"similar_stacktrace",
7527+
"same_trace",
7528+
"contributing",
7529+
"same_title",
7530+
"same_supergroup"
7531+
]
74957532
},
74967533
"description": "Relation types that failed, so some may be missing."
74977534
}

‎packages/mcp-core/src/tools/catalog/find-related-issues.test.ts‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,24 @@ describe("find_related_issues", () => {
121121
{
122122
"detail": null,
123123
"status": "ok",
124+
"supergroup": null,
125+
"title": null,
124126
"traceId": null,
125127
"type": "similar_stacktrace",
126128
},
127129
{
128130
"detail": null,
129131
"status": "ok",
132+
"supergroup": null,
133+
"title": null,
130134
"traceId": "3032af8bcdfe4423b937fc5c041d5d82",
131135
"type": "same_trace",
132136
},
133137
{
134138
"detail": "Only metric issues have contributing issues.",
135139
"status": "not_applicable",
140+
"supergroup": null,
141+
"title": null,
136142
"traceId": null,
137143
"type": "contributing",
138144
},
@@ -188,6 +194,83 @@ describe("find_related_issues", () => {
188194
"similar_stacktrace",
189195
"same_trace",
190196
"contributing",
197+
"same_title",
198+
"same_supergroup",
199+
]);
200+
});
201+
202+
it("returns same-title and same-supergroup issues with what was matched", async () => {
203+
mswServer.use(
204+
http.get(RELATED_URL, () =>
205+
HttpResponse.json({
206+
data: [
207+
{
208+
issue: issueFixture,
209+
relations: [{ type: "same_title" }, { type: "same_supergroup" }],
210+
},
211+
],
212+
meta: {
213+
types: [
214+
{
215+
type: "same_title",
216+
status: "ok",
217+
eventId: "7ca573c0f4814912aaa9bdc77d1a7d51",
218+
title: "Error: Tool list_organizations is already registered",
219+
},
220+
{
221+
type: "same_supergroup",
222+
status: "ok",
223+
supergroup: {
224+
id: "17",
225+
title: "Tools are registered twice when the server restarts",
226+
},
227+
},
228+
],
229+
},
230+
}),
231+
),
232+
);
233+
234+
const result = await findRelatedIssues.handler(
235+
{ ...params, types: ["same_title", "same_supergroup"] },
236+
context,
237+
);
238+
const structuredContent = getStructuredContent<Output>(result);
239+
240+
expect(findRelatedIssuesOutputSchema.parse(structuredContent)).toEqual(
241+
structuredContent,
242+
);
243+
expect(
244+
structuredContent.relatedIssues.map(({ shortId, relations }) => ({
245+
shortId,
246+
relations,
247+
})),
248+
).toEqual([
249+
{
250+
shortId: "CLOUDFLARE-MCP-41",
251+
relations: [
252+
{ type: "same_title", score: null },
253+
{ type: "same_supergroup", score: null },
254+
],
255+
},
256+
]);
257+
expect(structuredContent.relationTypes).toEqual([
258+
{
259+
type: "same_title",
260+
status: "ok",
261+
detail: null,
262+
traceId: null,
263+
title: "Error: Tool list_organizations is already registered",
264+
supergroup: null,
265+
},
266+
{
267+
type: "same_supergroup",
268+
status: "ok",
269+
detail: null,
270+
traceId: null,
271+
title: null,
272+
supergroup: "Tools are registered twice when the server restarts",
273+
},
191274
]);
192275
});
193276

@@ -328,6 +411,8 @@ describe("find_related_issues through the MCP server", () => {
328411
"similar_stacktrace",
329412
"same_trace",
330413
"contributing",
414+
"same_title",
415+
"same_supergroup",
331416
]);
332417
expect(relatedRequest?.searchParams.get("limit")).toBe("10");
333418

‎packages/mcp-core/src/tools/catalog/find-related-issues.ts‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ export const findRelatedIssuesOutputSchema = z.object({
6565
.string()
6666
.nullable()
6767
.describe("same_trace only: the trace that was searched."),
68+
title: z
69+
.string()
70+
.nullable()
71+
.describe("same_title only: the title that was searched."),
72+
supergroup: z
73+
.string()
74+
.nullable()
75+
.describe(
76+
"same_supergroup only: what the issues in this issue's supergroup have in common, from Seer.",
77+
),
6878
}),
6979
)
7080
.describe("Whether each requested relation type ran."),
@@ -93,7 +103,7 @@ export default defineTool({
93103
skills: ["inspect", "triage", "seer"],
94104
requiredScopes: ["event:read"],
95105
description:
96-
"Find Sentry issues related to an issue: likely duplicates with a similar stack trace in the same project, other errors in the same trace, and the error issues behind a metric alert. Returns each related issue with its status and why it's related. Use it before resolving or ignoring an issue. It doesn't compare titles or error messages.",
106+
"Find Sentry issues related to an issue: likely duplicates with a similar stack trace or the same title in the same project, other errors in the same trace, issues Seer found to share a root cause, and the error issues behind a metric alert. Returns each related issue with its status and why it's related. Use it before resolving or ignoring an issue.",
97107
inputSchema: {
98108
organizationSlug: ParamOrganizationSlug.optional(),
99109
regionUrl: ParamRegionUrl.nullable().default(null),
@@ -104,7 +114,7 @@ export default defineTool({
104114
.nullable()
105115
.default(null)
106116
.describe(
107-
"Relation types to return; all when omitted. similar_stacktrace: likely duplicates. same_trace: errors in the same trace, often the other side of a request. contributing: for a metric issue, the error issues behind it.",
117+
"Relation types; all when omitted. similar_stacktrace: likely duplicates. same_trace: errors in the same trace. contributing: errors behind a metric issue. same_title: errors with the same title, last 14 days. same_supergroup: same root cause per Seer.",
108118
),
109119
limit: z
110120
.number()
@@ -151,8 +161,8 @@ export default defineTool({
151161
limit: params.limit,
152162
});
153163

154-
// Same-trace issues can be in any project, so a project-scoped session
155-
// drops the ones outside its project.
164+
// Same-trace and same-supergroup issues can be in any project, so a
165+
// project-scoped session drops the ones outside its project.
156166
const inScope = projectSlug
157167
? related.data.filter(({ issue }) => issue.project.slug === projectSlug)
158168
: related.data;
@@ -205,6 +215,8 @@ export default defineTool({
205215
status: meta.status,
206216
detail: meta.detail ?? null,
207217
traceId: meta.traceId ?? null,
218+
title: meta.title ?? null,
219+
supergroup: meta.supergroup?.title ?? null,
208220
})),
209221
notes,
210222
suggestedActions: inspectFirst ? [inspectFirst] : [],

‎packages/mcp-core/src/tools/catalog/get-issue-details.test.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,10 +2073,12 @@ describe("structuredContent", () => {
20732073
const payload = parsePayload(result);
20742074

20752075
expect(requests).toHaveLength(1);
2076+
// Not same_title: its issue search would add to every call.
20762077
expect(requests[0]?.searchParams.getAll("type")).toEqual([
20772078
"similar_stacktrace",
20782079
"same_trace",
20792080
"contributing",
2081+
"same_supergroup",
20802082
]);
20812083
expect(requests[0]?.searchParams.get("limit")).toBe("5");
20822084
// the latest event is the endpoint's default
@@ -2249,6 +2251,36 @@ describe("structuredContent", () => {
22492251
"similar_stacktrace",
22502252
"same_trace",
22512253
"contributing",
2254+
"same_supergroup",
2255+
]);
2256+
});
2257+
2258+
it("lists same-supergroup issues", async () => {
2259+
mockLatestEvent();
2260+
captureRelatedRequest(() =>
2261+
HttpResponse.json({
2262+
data: [
2263+
{
2264+
issue: relatedIssuesFixture.data[0]?.issue,
2265+
relations: [{ type: "same_supergroup" }],
2266+
},
2267+
],
2268+
meta: {
2269+
types: [
2270+
{
2271+
type: "same_supergroup",
2272+
status: "ok",
2273+
supergroup: { id: "17", title: "Payment client times out" },
2274+
},
2275+
],
2276+
},
2277+
}),
2278+
);
2279+
2280+
const result = await getIssueDetails.handler(params, experimentalContext);
2281+
2282+
expect(parsePayload(result).relatedIssues?.issues).toMatchObject([
2283+
{ shortId: "CLOUDFLARE-MCP-42", relations: ["same_supergroup"] },
22522284
]);
22532285
});
22542286
});

0 commit comments

Comments
 (0)