@sentry/mcp-server 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +621 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +621 -42
- package/dist/index.js.map +1 -1
- package/dist/{stdio-CwqdTAhY.js → stdio-C47PFfCl.js} +3 -3
- package/dist/{stdio-CwqdTAhY.js.map → stdio-C47PFfCl.js.map} +1 -1
- package/dist/{stdio-Cl-Ib8bu.cjs → stdio-DFfz0_Ua.cjs} +3 -3
- package/dist/{stdio-Cl-Ib8bu.cjs.map → stdio-DFfz0_Ua.cjs.map} +1 -1
- package/dist/transports/stdio.cjs +1 -1
- package/dist/transports/stdio.js +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { ALL_SKILLS, SKILLS, finalize, getIssueUrl, getIssuesSearchUrl, getTraceUrl, isEnabledBySkills, isSentryHost } from "./resolve-Cg3SH2zt.js";
|
|
3
|
-
import { LIB_VERSION, USER_AGENT, startStdio } from "./stdio-
|
|
3
|
+
import { LIB_VERSION, USER_AGENT, startStdio } from "./stdio-C47PFfCl.js";
|
|
4
4
|
import { RECOMMENDED_FIELDS, systemPrompt } from "./config-BoFBjXRq-CMdBQOkQ.js";
|
|
5
5
|
import { buildUsage } from "./usage-BzYvqaru.js";
|
|
6
6
|
import { merge, parseArgv, parseEnv } from "./parse-46t_fITC.js";
|
|
@@ -2495,7 +2495,7 @@ function createApiError(message, status, detail, responseBody) {
|
|
|
2495
2495
|
}
|
|
2496
2496
|
|
|
2497
2497
|
//#endregion
|
|
2498
|
-
//#region ../mcp-core/dist/client-
|
|
2498
|
+
//#region ../mcp-core/dist/client-EbNZG3Z_.js
|
|
2499
2499
|
/**
|
|
2500
2500
|
* Mapping of common network error codes to user-friendly messages.
|
|
2501
2501
|
* These help users understand and resolve connection issues.
|
|
@@ -3326,6 +3326,26 @@ var SentryApiService = class {
|
|
|
3326
3326
|
eventId: "latest"
|
|
3327
3327
|
}, opts);
|
|
3328
3328
|
}
|
|
3329
|
+
/**
|
|
3330
|
+
* Lists events for a specific issue.
|
|
3331
|
+
* Uses the issue-specific endpoint which already filters by issue ID.
|
|
3332
|
+
*
|
|
3333
|
+
* @see https://docs.sentry.io/api/events/list-an-issues-events/
|
|
3334
|
+
*/
|
|
3335
|
+
async listEventsForIssue({ organizationSlug, issueId, query, limit = 50, sort, statsPeriod, start, end, full = false }, opts) {
|
|
3336
|
+
const params = new URLSearchParams();
|
|
3337
|
+
if (query) params.append("query", query);
|
|
3338
|
+
params.append("per_page", String(limit));
|
|
3339
|
+
if (sort) params.append("sort", sort);
|
|
3340
|
+
if (statsPeriod) params.append("statsPeriod", statsPeriod);
|
|
3341
|
+
else if (start && end) {
|
|
3342
|
+
params.append("start", start);
|
|
3343
|
+
params.append("end", end);
|
|
3344
|
+
}
|
|
3345
|
+
if (full) params.append("full", "true");
|
|
3346
|
+
const apiUrl = `/organizations/${organizationSlug}/issues/${issueId}/events/?${params.toString()}`;
|
|
3347
|
+
return await this.requestJSON(apiUrl, void 0, opts);
|
|
3348
|
+
}
|
|
3329
3349
|
async listEventAttachments({ organizationSlug, projectSlug, eventId }, opts) {
|
|
3330
3350
|
const body = await this.requestJSON(`/projects/${organizationSlug}/${projectSlug}/events/${eventId}/attachments/`, void 0, opts);
|
|
3331
3351
|
return EventAttachmentListSchema.parse(body);
|
|
@@ -3616,7 +3636,7 @@ function validateRegionUrl(regionUrl, baseHost) {
|
|
|
3616
3636
|
}
|
|
3617
3637
|
|
|
3618
3638
|
//#endregion
|
|
3619
|
-
//#region ../mcp-core/dist/api-
|
|
3639
|
+
//#region ../mcp-core/dist/api-C4iLorVN.js
|
|
3620
3640
|
/**
|
|
3621
3641
|
* Create a Sentry API service from server context with optional region override
|
|
3622
3642
|
* @param context - Server context containing host and access token
|
|
@@ -3637,7 +3657,7 @@ function apiServiceFromContext(context$1, opts = {}) {
|
|
|
3637
3657
|
}
|
|
3638
3658
|
|
|
3639
3659
|
//#endregion
|
|
3640
|
-
//#region ../mcp-core/dist/whoami-
|
|
3660
|
+
//#region ../mcp-core/dist/whoami-4TjhUF9I.js
|
|
3641
3661
|
var whoami_default = defineTool({
|
|
3642
3662
|
name: "whoami",
|
|
3643
3663
|
description: [
|
|
@@ -3670,7 +3690,7 @@ var whoami_default = defineTool({
|
|
|
3670
3690
|
});
|
|
3671
3691
|
|
|
3672
3692
|
//#endregion
|
|
3673
|
-
//#region ../mcp-core/dist/find-organizations-
|
|
3693
|
+
//#region ../mcp-core/dist/find-organizations-CY_CprTd.js
|
|
3674
3694
|
const RESULT_LIMIT$2 = 25;
|
|
3675
3695
|
var find_organizations_default = defineTool({
|
|
3676
3696
|
name: "find_organizations",
|
|
@@ -3722,7 +3742,7 @@ var find_organizations_default = defineTool({
|
|
|
3722
3742
|
});
|
|
3723
3743
|
|
|
3724
3744
|
//#endregion
|
|
3725
|
-
//#region ../mcp-core/dist/find-teams-
|
|
3745
|
+
//#region ../mcp-core/dist/find-teams-D20sronT.js
|
|
3726
3746
|
const RESULT_LIMIT$1 = 25;
|
|
3727
3747
|
var find_teams_default = defineTool({
|
|
3728
3748
|
name: "find_teams",
|
|
@@ -3770,7 +3790,7 @@ var find_teams_default = defineTool({
|
|
|
3770
3790
|
});
|
|
3771
3791
|
|
|
3772
3792
|
//#endregion
|
|
3773
|
-
//#region ../mcp-core/dist/find-projects-
|
|
3793
|
+
//#region ../mcp-core/dist/find-projects-BIbLskbP.js
|
|
3774
3794
|
const RESULT_LIMIT = 25;
|
|
3775
3795
|
var find_projects_default = defineTool({
|
|
3776
3796
|
name: "find_projects",
|
|
@@ -3814,7 +3834,7 @@ var find_projects_default = defineTool({
|
|
|
3814
3834
|
});
|
|
3815
3835
|
|
|
3816
3836
|
//#endregion
|
|
3817
|
-
//#region ../mcp-core/dist/find-releases-
|
|
3837
|
+
//#region ../mcp-core/dist/find-releases-DddLqSmt.js
|
|
3818
3838
|
var find_releases_default = defineTool({
|
|
3819
3839
|
name: "find_releases",
|
|
3820
3840
|
skills: ["inspect"],
|
|
@@ -3963,7 +3983,7 @@ function parseIssueId(issueId) {
|
|
|
3963
3983
|
* @returns Object containing the parsed organization slug and issue ID
|
|
3964
3984
|
* @throws Error if the input is invalid
|
|
3965
3985
|
*/
|
|
3966
|
-
function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
|
|
3986
|
+
function parseIssueParams$1({ issueUrl, issueId, organizationSlug }) {
|
|
3967
3987
|
if (issueUrl) {
|
|
3968
3988
|
const resolved = extractIssueId(issueUrl);
|
|
3969
3989
|
if (!resolved) throw new Error("Invalid Sentry issue URL. Path should contain '/issues/{issue_id}'");
|
|
@@ -4062,7 +4082,7 @@ function getOutputForAutofixStep(step) {
|
|
|
4062
4082
|
}
|
|
4063
4083
|
|
|
4064
4084
|
//#endregion
|
|
4065
|
-
//#region ../mcp-core/dist/formatting-
|
|
4085
|
+
//#region ../mcp-core/dist/formatting-BhgNMv3a.js
|
|
4066
4086
|
const LANGUAGE_EXTENSIONS = {
|
|
4067
4087
|
".java": "java",
|
|
4068
4088
|
".py": "python",
|
|
@@ -5026,6 +5046,7 @@ function formatIssueOutput({ organizationSlug, issue, event, apiService, autofix
|
|
|
5026
5046
|
output += "# Using this information\n\n";
|
|
5027
5047
|
output += `- You can reference the IssueID in commit messages (e.g. \`Fixes ${issue.shortId}\`) to automatically close the issue when the commit is merged.\n`;
|
|
5028
5048
|
output += "- The stacktrace includes both first-party application code as well as third-party code, its important to triage to first-party code.\n";
|
|
5049
|
+
output += `- To search for specific occurrences or filter events within this issue, use \`search_issue_events(organizationSlug='${organizationSlug}', issueId='${issue.shortId}', naturalLanguageQuery='your query')\`\n`;
|
|
5029
5050
|
return output;
|
|
5030
5051
|
}
|
|
5031
5052
|
|
|
@@ -5058,7 +5079,7 @@ function enhanceNotFoundError(error, params) {
|
|
|
5058
5079
|
}
|
|
5059
5080
|
|
|
5060
5081
|
//#endregion
|
|
5061
|
-
//#region ../mcp-core/dist/get-issue-details-
|
|
5082
|
+
//#region ../mcp-core/dist/get-issue-details-Dv2HsHlt.js
|
|
5062
5083
|
var get_issue_details_default = defineTool({
|
|
5063
5084
|
name: "get_issue_details",
|
|
5064
5085
|
skills: [
|
|
@@ -5169,7 +5190,7 @@ var get_issue_details_default = defineTool({
|
|
|
5169
5190
|
}
|
|
5170
5191
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
5171
5192
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
5172
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
5193
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
5173
5194
|
organizationSlug: params.organizationSlug,
|
|
5174
5195
|
issueId: params.issueId,
|
|
5175
5196
|
issueUrl: params.issueUrl
|
|
@@ -5239,7 +5260,7 @@ function shouldFetchTraceForEvent(event) {
|
|
|
5239
5260
|
}
|
|
5240
5261
|
|
|
5241
5262
|
//#endregion
|
|
5242
|
-
//#region ../mcp-core/dist/get-trace-details-
|
|
5263
|
+
//#region ../mcp-core/dist/get-trace-details-QaT2N9BA.js
|
|
5243
5264
|
const MAX_DEPTH = 2;
|
|
5244
5265
|
const MINIMUM_DURATION_THRESHOLD_MS = 10;
|
|
5245
5266
|
const MIN_MEANINGFUL_CHILD_DURATION = 5;
|
|
@@ -5538,7 +5559,7 @@ function formatTraceOutput({ organizationSlug, traceId, traceMeta, trace: trace$
|
|
|
5538
5559
|
}
|
|
5539
5560
|
|
|
5540
5561
|
//#endregion
|
|
5541
|
-
//#region ../mcp-core/dist/get-event-attachment-
|
|
5562
|
+
//#region ../mcp-core/dist/get-event-attachment-DdhoqwCO.js
|
|
5542
5563
|
var get_event_attachment_default = defineTool({
|
|
5543
5564
|
name: "get_event_attachment",
|
|
5544
5565
|
skills: ["inspect"],
|
|
@@ -5686,7 +5707,7 @@ function formatAssignedTo(assignedTo) {
|
|
|
5686
5707
|
}
|
|
5687
5708
|
|
|
5688
5709
|
//#endregion
|
|
5689
|
-
//#region ../mcp-core/dist/update-issue-
|
|
5710
|
+
//#region ../mcp-core/dist/update-issue-JybAx8DT.js
|
|
5690
5711
|
var update_issue_default = defineTool({
|
|
5691
5712
|
name: "update_issue",
|
|
5692
5713
|
skills: ["triage"],
|
|
@@ -5754,7 +5775,7 @@ var update_issue_default = defineTool({
|
|
|
5754
5775
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
5755
5776
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
5756
5777
|
if (!params.status && !params.assignedTo) throw new UserInputError("At least one of `status` or `assignedTo` must be provided to update the issue");
|
|
5757
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
5778
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
5758
5779
|
organizationSlug: params.organizationSlug,
|
|
5759
5780
|
issueId: params.issueId,
|
|
5760
5781
|
issueUrl: params.issueUrl
|
|
@@ -8959,7 +8980,7 @@ function createOpenAI(options = {}) {
|
|
|
8959
8980
|
var openai = createOpenAI({ compatibility: "strict" });
|
|
8960
8981
|
|
|
8961
8982
|
//#endregion
|
|
8962
|
-
//#region ../mcp-core/dist/openai-provider-
|
|
8983
|
+
//#region ../mcp-core/dist/openai-provider-BIuidJl6.js
|
|
8963
8984
|
const DEFAULT_OPENAI_MODEL = "gpt-5";
|
|
8964
8985
|
const VALID_REASONING_EFFORTS = [
|
|
8965
8986
|
"low",
|
|
@@ -14277,7 +14298,7 @@ function trimStartOfStream() {
|
|
|
14277
14298
|
var HANGING_STREAM_WARNING_TIME_MS = 15 * 1e3;
|
|
14278
14299
|
|
|
14279
14300
|
//#endregion
|
|
14280
|
-
//#region ../mcp-core/dist/callEmbeddedAgent-
|
|
14301
|
+
//#region ../mcp-core/dist/callEmbeddedAgent-wn0PIM50.js
|
|
14281
14302
|
/**
|
|
14282
14303
|
* Call an embedded agent with tool call capture
|
|
14283
14304
|
* This is the standard way to call embedded AI agents within MCP tools
|
|
@@ -19333,14 +19354,14 @@ function createDatasetAttributesTool(options) {
|
|
|
19333
19354
|
"logs"
|
|
19334
19355
|
]).describe("The dataset to query attributes for") }),
|
|
19335
19356
|
execute: async ({ dataset }) => {
|
|
19336
|
-
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$
|
|
19357
|
+
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await import("./config-BEgU9ylR.js");
|
|
19337
19358
|
const { attributes: customAttributes, fieldTypes } = await fetchCustomAttributes(apiService, organizationSlug, dataset, projectId);
|
|
19338
19359
|
const allFields = {
|
|
19339
19360
|
...BASE_COMMON_FIELDS,
|
|
19340
19361
|
...DATASET_FIELDS[dataset],
|
|
19341
19362
|
...customAttributes
|
|
19342
19363
|
};
|
|
19343
|
-
const recommendedFields = RECOMMENDED_FIELDS$
|
|
19364
|
+
const recommendedFields = RECOMMENDED_FIELDS$2[dataset];
|
|
19344
19365
|
const allFieldTypes = { ...fieldTypes };
|
|
19345
19366
|
const staticNumericFields = NUMERIC_FIELDS[dataset] || /* @__PURE__ */ new Set();
|
|
19346
19367
|
for (const field of staticNumericFields) allFieldTypes[field] = "number";
|
|
@@ -19368,7 +19389,7 @@ Use these examples as patterns for constructing your query.`;
|
|
|
19368
19389
|
}
|
|
19369
19390
|
|
|
19370
19391
|
//#endregion
|
|
19371
|
-
//#region ../mcp-core/dist/agent-
|
|
19392
|
+
//#region ../mcp-core/dist/agent-C_Z02GOk.js
|
|
19372
19393
|
const searchEventsAgentOutputSchema = z.object({
|
|
19373
19394
|
dataset: z.enum([
|
|
19374
19395
|
"spans",
|
|
@@ -19640,7 +19661,7 @@ function formatSpanResults(params) {
|
|
|
19640
19661
|
}
|
|
19641
19662
|
|
|
19642
19663
|
//#endregion
|
|
19643
|
-
//#region ../mcp-core/dist/handler-
|
|
19664
|
+
//#region ../mcp-core/dist/handler-DFWcpIpC.js
|
|
19644
19665
|
var handler_default = defineTool({
|
|
19645
19666
|
name: "search_events",
|
|
19646
19667
|
skills: [
|
|
@@ -19781,7 +19802,7 @@ var handler_default = defineTool({
|
|
|
19781
19802
|
});
|
|
19782
19803
|
|
|
19783
19804
|
//#endregion
|
|
19784
|
-
//#region ../mcp-core/dist/create-team-
|
|
19805
|
+
//#region ../mcp-core/dist/create-team-JXD-4yd1.js
|
|
19785
19806
|
var create_team_default = defineTool({
|
|
19786
19807
|
name: "create_team",
|
|
19787
19808
|
skills: ["project-management"],
|
|
@@ -19836,7 +19857,7 @@ var create_team_default = defineTool({
|
|
|
19836
19857
|
});
|
|
19837
19858
|
|
|
19838
19859
|
//#endregion
|
|
19839
|
-
//#region ../mcp-core/dist/create-project-
|
|
19860
|
+
//#region ../mcp-core/dist/create-project-B1g-3-yc.js
|
|
19840
19861
|
var create_project_default = defineTool({
|
|
19841
19862
|
name: "create_project",
|
|
19842
19863
|
skills: ["project-management"],
|
|
@@ -19913,7 +19934,7 @@ var create_project_default = defineTool({
|
|
|
19913
19934
|
});
|
|
19914
19935
|
|
|
19915
19936
|
//#endregion
|
|
19916
|
-
//#region ../mcp-core/dist/update-project-
|
|
19937
|
+
//#region ../mcp-core/dist/update-project-sPir9pn7.js
|
|
19917
19938
|
var update_project_default = defineTool({
|
|
19918
19939
|
name: "update_project",
|
|
19919
19940
|
skills: ["project-management"],
|
|
@@ -20031,7 +20052,7 @@ var update_project_default = defineTool({
|
|
|
20031
20052
|
});
|
|
20032
20053
|
|
|
20033
20054
|
//#endregion
|
|
20034
|
-
//#region ../mcp-core/dist/create-dsn-
|
|
20055
|
+
//#region ../mcp-core/dist/create-dsn-Co1eIXE3.js
|
|
20035
20056
|
var create_dsn_default = defineTool({
|
|
20036
20057
|
name: "create_dsn",
|
|
20037
20058
|
skills: ["project-management"],
|
|
@@ -20091,7 +20112,7 @@ var create_dsn_default = defineTool({
|
|
|
20091
20112
|
});
|
|
20092
20113
|
|
|
20093
20114
|
//#endregion
|
|
20094
|
-
//#region ../mcp-core/dist/find-dsns-
|
|
20115
|
+
//#region ../mcp-core/dist/find-dsns-o0QsNJv8.js
|
|
20095
20116
|
var find_dsns_default = defineTool({
|
|
20096
20117
|
name: "find_dsns",
|
|
20097
20118
|
skills: ["project-management"],
|
|
@@ -20192,7 +20213,7 @@ async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, should
|
|
|
20192
20213
|
}
|
|
20193
20214
|
|
|
20194
20215
|
//#endregion
|
|
20195
|
-
//#region ../mcp-core/dist/analyze-issue-with-seer-
|
|
20216
|
+
//#region ../mcp-core/dist/analyze-issue-with-seer-DLMG61CB.js
|
|
20196
20217
|
var analyze_issue_with_seer_default = defineTool({
|
|
20197
20218
|
name: "analyze_issue_with_seer",
|
|
20198
20219
|
skills: ["seer"],
|
|
@@ -20252,7 +20273,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20252
20273
|
},
|
|
20253
20274
|
async handler(params, context$1) {
|
|
20254
20275
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
20255
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
20276
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
20256
20277
|
organizationSlug: params.organizationSlug,
|
|
20257
20278
|
issueId: params.issueId,
|
|
20258
20279
|
issueUrl: params.issueUrl
|
|
@@ -20463,7 +20484,7 @@ var search_docs_default = defineTool({
|
|
|
20463
20484
|
});
|
|
20464
20485
|
|
|
20465
20486
|
//#endregion
|
|
20466
|
-
//#region ../mcp-core/dist/get-doc-
|
|
20487
|
+
//#region ../mcp-core/dist/get-doc-B2M_KGrK.js
|
|
20467
20488
|
var get_doc_default = defineTool({
|
|
20468
20489
|
name: "get_doc",
|
|
20469
20490
|
skills: ["docs"],
|
|
@@ -20694,7 +20715,7 @@ function getCommonPatterns(dataset) {
|
|
|
20694
20715
|
/**
|
|
20695
20716
|
* Configuration for the search-issues agent
|
|
20696
20717
|
*/
|
|
20697
|
-
const systemPrompt$
|
|
20718
|
+
const systemPrompt$3 = `You are a Sentry issue search query translator. Convert natural language queries to Sentry issue search syntax.
|
|
20698
20719
|
|
|
20699
20720
|
IMPORTANT RULES:
|
|
20700
20721
|
1. Use Sentry issue search syntax, NOT SQL
|
|
@@ -20762,7 +20783,7 @@ Always use the issueFields tool to discover available fields when needed.
|
|
|
20762
20783
|
Use the whoami tool when you need to resolve 'me' references.`;
|
|
20763
20784
|
|
|
20764
20785
|
//#endregion
|
|
20765
|
-
//#region ../mcp-core/dist/agent-
|
|
20786
|
+
//#region ../mcp-core/dist/agent-Jg5_CT7U.js
|
|
20766
20787
|
const searchIssuesAgentOutputSchema = z.object({
|
|
20767
20788
|
query: z.string().describe("The Sentry issue search query"),
|
|
20768
20789
|
sort: z.enum([
|
|
@@ -20780,7 +20801,7 @@ const searchIssuesAgentOutputSchema = z.object({
|
|
|
20780
20801
|
async function searchIssuesAgent(options) {
|
|
20781
20802
|
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for semantic search");
|
|
20782
20803
|
return await callEmbeddedAgent({
|
|
20783
|
-
system: systemPrompt$
|
|
20804
|
+
system: systemPrompt$3,
|
|
20784
20805
|
prompt: options.query,
|
|
20785
20806
|
tools: {
|
|
20786
20807
|
issueFields: createDatasetFieldsTool({
|
|
@@ -20877,7 +20898,7 @@ function formatDate(dateString) {
|
|
|
20877
20898
|
}
|
|
20878
20899
|
|
|
20879
20900
|
//#endregion
|
|
20880
|
-
//#region ../mcp-core/dist/handler-
|
|
20901
|
+
//#region ../mcp-core/dist/handler-rR_VkT5b.js
|
|
20881
20902
|
var handler_default$1 = defineTool({
|
|
20882
20903
|
name: "search_issues",
|
|
20883
20904
|
skills: [
|
|
@@ -20998,7 +21019,564 @@ var handler_default$1 = defineTool({
|
|
|
20998
21019
|
});
|
|
20999
21020
|
|
|
21000
21021
|
//#endregion
|
|
21001
|
-
//#region ../mcp-core/dist/config-
|
|
21022
|
+
//#region ../mcp-core/dist/config-DbfMHS7d.js
|
|
21023
|
+
const systemPrompt$2 = `You are a Sentry issue event filter translator. Your job is to:
|
|
21024
|
+
1. Translate natural language queries into Sentry tag filters for events within a SPECIFIC issue
|
|
21025
|
+
2. Select appropriate fields to return in the results
|
|
21026
|
+
3. Determine sort order and time ranges
|
|
21027
|
+
|
|
21028
|
+
IMPORTANT CONTEXT:
|
|
21029
|
+
- You are filtering events WITHIN a specific issue (the API endpoint is already scoped to that issue)
|
|
21030
|
+
- DO NOT include "issue:" in your query - the endpoint filters by issue automatically
|
|
21031
|
+
- Focus on tag-based filtering: release, environment, user, trace ID, URL, etc.
|
|
21032
|
+
- You are working with the "errors" dataset (issues are groups of error events)
|
|
21033
|
+
|
|
21034
|
+
CRITICAL - TAG FIELD VERIFICATION:
|
|
21035
|
+
Before using ANY tag or field, you should call the issueEventFields tool to verify it exists:
|
|
21036
|
+
1. Available tags vary by project and what data is being sent
|
|
21037
|
+
2. Using non-existent tags will cause query failures
|
|
21038
|
+
3. The issueEventFields tool returns ALL available tags for the issue's project
|
|
21039
|
+
4. Field names may not be what you expect (e.g., "user_agent.original" not "browser")
|
|
21040
|
+
|
|
21041
|
+
TOOL USAGE GUIDELINES:
|
|
21042
|
+
1. Use issueEventFields tool (no parameters) to discover available tags and fields
|
|
21043
|
+
2. Use whoami tool when queries reference "me", "my", or "myself" for user.id/user.email
|
|
21044
|
+
3. CRITICAL: All tools return {error?, result?} format - check for errors before using results
|
|
21045
|
+
|
|
21046
|
+
QUERY CONSTRUCTION:
|
|
21047
|
+
Your query should contain ONLY the filter expressions (tags, operators, values):
|
|
21048
|
+
- CORRECT: "environment:production release:v1.0.5"
|
|
21049
|
+
- CORRECT: "user.email:alice@example.com"
|
|
21050
|
+
- CORRECT: 'url:"*/checkout/*"'
|
|
21051
|
+
- WRONG: "issue:MCP-41 environment:production" ← DO NOT include issue: prefix
|
|
21052
|
+
|
|
21053
|
+
COMMON TAG PATTERNS:
|
|
21054
|
+
- release:VERSION - Filter by software release/version
|
|
21055
|
+
- environment:ENV - Filter by environment (production, staging, development)
|
|
21056
|
+
- user:USER_ID or user.email:EMAIL - Filter by user
|
|
21057
|
+
- trace:TRACE_ID - Filter by distributed trace ID
|
|
21058
|
+
- url:URL_PATTERN - Filter by request URL (use wildcards: "*/path/*")
|
|
21059
|
+
- transaction:NAME - Filter by transaction name
|
|
21060
|
+
- level:LEVEL - Filter by error level (error, warning, fatal, info)
|
|
21061
|
+
- device:DEVICE - Filter by device identifier
|
|
21062
|
+
- os:OS_NAME - Filter by operating system
|
|
21063
|
+
- browser:BROWSER - Filter by browser name
|
|
21064
|
+
- runtime:RUNTIME - Filter by runtime version (e.g., "python 3.11")
|
|
21065
|
+
|
|
21066
|
+
WILDCARD MATCHING:
|
|
21067
|
+
- Use "*" for wildcards in string values
|
|
21068
|
+
- Example: url:"*/checkout/*" matches any URL containing /checkout/
|
|
21069
|
+
- Example: release:"1.2.*" matches any 1.2.x release
|
|
21070
|
+
|
|
21071
|
+
TIME RANGE HANDLING:
|
|
21072
|
+
For time-based queries ("last hour", "yesterday", "from Dec 16"):
|
|
21073
|
+
- Relative: Use statsPeriod ("1h", "24h", "7d", "14d", "30d")
|
|
21074
|
+
- "last hour" → {"statsPeriod": "1h"}
|
|
21075
|
+
- "yesterday" → {"statsPeriod": "24h"}
|
|
21076
|
+
- "last week" → {"statsPeriod": "7d"}
|
|
21077
|
+
- Absolute: Use start/end (ISO 8601 format)
|
|
21078
|
+
- "from Dec 16 2025 17:50 UTC" → {"start": "2025-12-16T17:50:00Z", "end": "2025-12-17T23:59:59Z"}
|
|
21079
|
+
- Default: If no time mentioned, use {"statsPeriod": "14d"}
|
|
21080
|
+
|
|
21081
|
+
FIELD SELECTION:
|
|
21082
|
+
- Use recommended default fields unless user asks for specific data
|
|
21083
|
+
- For custom fields, verify availability with issueEventFields tool
|
|
21084
|
+
- Common useful fields:
|
|
21085
|
+
- id: Event ID
|
|
21086
|
+
- timestamp: When event occurred
|
|
21087
|
+
- title: Event title/message
|
|
21088
|
+
- message: Full error message
|
|
21089
|
+
- level: Error severity
|
|
21090
|
+
- environment: Deployment environment
|
|
21091
|
+
- release: Release version
|
|
21092
|
+
- user.display: User identifier
|
|
21093
|
+
- trace: Trace ID
|
|
21094
|
+
- url: Request URL
|
|
21095
|
+
- device: Device identifier
|
|
21096
|
+
- os: Operating system
|
|
21097
|
+
- runtime: Runtime environment
|
|
21098
|
+
|
|
21099
|
+
SORTING RULES (CRITICAL):
|
|
21100
|
+
1. ALWAYS specify a sort parameter
|
|
21101
|
+
2. Default: "-timestamp" (newest first) for time-based browsing
|
|
21102
|
+
3. Use "-" prefix for descending order
|
|
21103
|
+
4. CRITICAL: Sort field MUST be included in your fields array
|
|
21104
|
+
5. Examples:
|
|
21105
|
+
- sort: "-timestamp", fields: ["id", "timestamp", "message"] ✓ CORRECT
|
|
21106
|
+
- sort: "-level", fields: ["id", "timestamp"] ✗ WRONG (level not in fields)
|
|
21107
|
+
|
|
21108
|
+
DO NOT USE:
|
|
21109
|
+
- Aggregate functions (count, avg, sum) - this tool returns individual events, not statistics
|
|
21110
|
+
- SQL syntax (IS NULL, yesterday(), etc.) - use has: operator and timeRange instead
|
|
21111
|
+
- Field existence checks unless necessary (has:field_name, !has:field_name)
|
|
21112
|
+
|
|
21113
|
+
HANDLING "ME" REFERENCES:
|
|
21114
|
+
- If query contains "me", "my errors", "assigned to me", use whoami tool
|
|
21115
|
+
- Replace "me" with actual user.id or user.email value
|
|
21116
|
+
- Example: "my errors" + whoami returns user.email:"alice@example.com"
|
|
21117
|
+
→ query: "user.email:alice@example.com"
|
|
21118
|
+
|
|
21119
|
+
YOUR RESPONSE FORMAT:
|
|
21120
|
+
Return a JSON object with:
|
|
21121
|
+
- "query": Tag filter expressions (empty string "" for no filters)
|
|
21122
|
+
- "fields": Array of field names to return (use recommended defaults if not specified)
|
|
21123
|
+
- "sort": Sort parameter (REQUIRED - default to "-timestamp")
|
|
21124
|
+
- "timeRange": Optional time range
|
|
21125
|
+
- Relative: {"statsPeriod": "24h"}
|
|
21126
|
+
- Absolute: {"start": "2025-01-01T00:00:00Z", "end": "2025-01-02T00:00:00Z"}
|
|
21127
|
+
- Omit for default 14-day window
|
|
21128
|
+
- "explanation": Brief explanation of how you translated the query
|
|
21129
|
+
|
|
21130
|
+
CORRECT QUERY EXAMPLES:
|
|
21131
|
+
1. "events from last hour"
|
|
21132
|
+
→ {
|
|
21133
|
+
"query": "",
|
|
21134
|
+
"fields": ["id", "timestamp", "title", "message", "level"],
|
|
21135
|
+
"sort": "-timestamp",
|
|
21136
|
+
"timeRange": {"statsPeriod": "1h"},
|
|
21137
|
+
"explanation": "Filtering to events from last hour, sorted newest first"
|
|
21138
|
+
}
|
|
21139
|
+
|
|
21140
|
+
2. "production events with release v1.0.5"
|
|
21141
|
+
→ {
|
|
21142
|
+
"query": "environment:production release:v1.0.5",
|
|
21143
|
+
"fields": ["id", "timestamp", "title", "environment", "release"],
|
|
21144
|
+
"sort": "-timestamp",
|
|
21145
|
+
"timeRange": {"statsPeriod": "14d"},
|
|
21146
|
+
"explanation": "Filtering to production environment with specific release"
|
|
21147
|
+
}
|
|
21148
|
+
|
|
21149
|
+
3. "errors affecting user alice@example.com"
|
|
21150
|
+
→ {
|
|
21151
|
+
"query": "user.email:alice@example.com",
|
|
21152
|
+
"fields": ["id", "timestamp", "title", "user.display", "message"],
|
|
21153
|
+
"sort": "-timestamp",
|
|
21154
|
+
"timeRange": {"statsPeriod": "14d"},
|
|
21155
|
+
"explanation": "Filtering to events affecting specific user"
|
|
21156
|
+
}
|
|
21157
|
+
|
|
21158
|
+
4. "events with trace ID abc123"
|
|
21159
|
+
→ {
|
|
21160
|
+
"query": "trace:abc123",
|
|
21161
|
+
"fields": ["id", "timestamp", "title", "trace", "url", "transaction"],
|
|
21162
|
+
"sort": "-timestamp",
|
|
21163
|
+
"timeRange": {"statsPeriod": "14d"},
|
|
21164
|
+
"explanation": "Filtering to events with specific trace ID"
|
|
21165
|
+
}
|
|
21166
|
+
|
|
21167
|
+
PROCESS:
|
|
21168
|
+
1. Analyze the user's natural language query
|
|
21169
|
+
2. Call issueEventFields tool to discover available tags (if needed)
|
|
21170
|
+
3. Call whoami tool if query references "me" (if needed)
|
|
21171
|
+
4. Construct tag filters (WITHOUT "issue:" prefix)
|
|
21172
|
+
5. Select appropriate fields
|
|
21173
|
+
6. Determine sort order (default: "-timestamp")
|
|
21174
|
+
7. Determine time range (if applicable)
|
|
21175
|
+
8. Return JSON response with explanation
|
|
21176
|
+
|
|
21177
|
+
COMMON ERRORS TO AVOID:
|
|
21178
|
+
- Including "issue:" in query (handler adds this automatically)
|
|
21179
|
+
- Using aggregate functions like count() or avg()
|
|
21180
|
+
- Using non-existent field names (verify with issueEventFields tool)
|
|
21181
|
+
- Forgetting to include sort field in fields array
|
|
21182
|
+
- Using SQL syntax instead of Sentry query syntax`;
|
|
21183
|
+
const ISSUE_EVENT_TAGS = {
|
|
21184
|
+
release: "Software version/release identifier",
|
|
21185
|
+
environment: "Deployment environment (production, staging, development, etc.)",
|
|
21186
|
+
level: "Error severity level (error, warning, fatal, info, debug)",
|
|
21187
|
+
user: "User identifier",
|
|
21188
|
+
"user.id": "User ID",
|
|
21189
|
+
"user.email": "User email address",
|
|
21190
|
+
"user.username": "Username",
|
|
21191
|
+
"user.display": "User display name (formatted)",
|
|
21192
|
+
transaction: "Transaction name/route",
|
|
21193
|
+
url: "Request URL",
|
|
21194
|
+
trace: "Distributed trace ID",
|
|
21195
|
+
device: "Device identifier",
|
|
21196
|
+
"device.family": "Device family",
|
|
21197
|
+
os: "Operating system name",
|
|
21198
|
+
"os.name": "OS name",
|
|
21199
|
+
"os.version": "OS version",
|
|
21200
|
+
runtime: "Runtime environment",
|
|
21201
|
+
"runtime.name": "Runtime name (e.g., CPython)",
|
|
21202
|
+
"runtime.version": "Runtime version",
|
|
21203
|
+
browser: "Browser identifier",
|
|
21204
|
+
"browser.name": "Browser name",
|
|
21205
|
+
"browser.version": "Browser version",
|
|
21206
|
+
handled: "Whether error was handled (true/false)",
|
|
21207
|
+
mechanism: "Error mechanism type",
|
|
21208
|
+
"error.type": "Exception type/class name",
|
|
21209
|
+
"stack.filename": "Source file where error occurred",
|
|
21210
|
+
"stack.function": "Function where error occurred",
|
|
21211
|
+
"stack.module": "Module where error occurred",
|
|
21212
|
+
platform: "SDK platform (javascript, python, etc.)",
|
|
21213
|
+
"sdk.name": "SDK name",
|
|
21214
|
+
"sdk.version": "SDK version",
|
|
21215
|
+
"http.method": "HTTP request method",
|
|
21216
|
+
"http.status_code": "HTTP status code",
|
|
21217
|
+
"user_agent.original": "Original user agent string"
|
|
21218
|
+
};
|
|
21219
|
+
const RECOMMENDED_FIELDS$1 = [
|
|
21220
|
+
"id",
|
|
21221
|
+
"timestamp",
|
|
21222
|
+
"title",
|
|
21223
|
+
"message",
|
|
21224
|
+
"level",
|
|
21225
|
+
"environment",
|
|
21226
|
+
"release",
|
|
21227
|
+
"user.display",
|
|
21228
|
+
"trace",
|
|
21229
|
+
"url"
|
|
21230
|
+
];
|
|
21231
|
+
const EXAMPLE_QUERIES = [
|
|
21232
|
+
{
|
|
21233
|
+
description: "Events from last hour",
|
|
21234
|
+
output: {
|
|
21235
|
+
query: "",
|
|
21236
|
+
fields: RECOMMENDED_FIELDS$1,
|
|
21237
|
+
sort: "-timestamp",
|
|
21238
|
+
timeRange: { statsPeriod: "1h" }
|
|
21239
|
+
}
|
|
21240
|
+
},
|
|
21241
|
+
{
|
|
21242
|
+
description: "Production events with specific release",
|
|
21243
|
+
output: {
|
|
21244
|
+
query: "environment:production release:09f66121-a5a3-4947-8be1-1454c4cefa3d",
|
|
21245
|
+
fields: [
|
|
21246
|
+
"id",
|
|
21247
|
+
"timestamp",
|
|
21248
|
+
"title",
|
|
21249
|
+
"environment",
|
|
21250
|
+
"release",
|
|
21251
|
+
"user.display"
|
|
21252
|
+
],
|
|
21253
|
+
sort: "-timestamp",
|
|
21254
|
+
timeRange: { statsPeriod: "7d" }
|
|
21255
|
+
}
|
|
21256
|
+
},
|
|
21257
|
+
{
|
|
21258
|
+
description: "Events affecting specific user",
|
|
21259
|
+
output: {
|
|
21260
|
+
query: "user.email:alice@example.com",
|
|
21261
|
+
fields: [
|
|
21262
|
+
"id",
|
|
21263
|
+
"timestamp",
|
|
21264
|
+
"title",
|
|
21265
|
+
"user.display",
|
|
21266
|
+
"user.email",
|
|
21267
|
+
"message"
|
|
21268
|
+
],
|
|
21269
|
+
sort: "-timestamp",
|
|
21270
|
+
timeRange: { statsPeriod: "14d" }
|
|
21271
|
+
}
|
|
21272
|
+
},
|
|
21273
|
+
{
|
|
21274
|
+
description: "Events with specific trace ID",
|
|
21275
|
+
output: {
|
|
21276
|
+
query: "trace:abc123def456",
|
|
21277
|
+
fields: [
|
|
21278
|
+
"id",
|
|
21279
|
+
"timestamp",
|
|
21280
|
+
"title",
|
|
21281
|
+
"trace",
|
|
21282
|
+
"url",
|
|
21283
|
+
"transaction"
|
|
21284
|
+
],
|
|
21285
|
+
sort: "-timestamp",
|
|
21286
|
+
timeRange: { statsPeriod: "14d" }
|
|
21287
|
+
}
|
|
21288
|
+
},
|
|
21289
|
+
{
|
|
21290
|
+
description: "Events from checkout flow",
|
|
21291
|
+
output: {
|
|
21292
|
+
query: "url:\"*/checkout/*\"",
|
|
21293
|
+
fields: [
|
|
21294
|
+
"id",
|
|
21295
|
+
"timestamp",
|
|
21296
|
+
"title",
|
|
21297
|
+
"url",
|
|
21298
|
+
"transaction",
|
|
21299
|
+
"user.display"
|
|
21300
|
+
],
|
|
21301
|
+
sort: "-timestamp",
|
|
21302
|
+
timeRange: { statsPeriod: "7d" }
|
|
21303
|
+
}
|
|
21304
|
+
},
|
|
21305
|
+
{
|
|
21306
|
+
description: "Fatal errors only",
|
|
21307
|
+
output: {
|
|
21308
|
+
query: "level:fatal",
|
|
21309
|
+
fields: [
|
|
21310
|
+
"id",
|
|
21311
|
+
"timestamp",
|
|
21312
|
+
"title",
|
|
21313
|
+
"level",
|
|
21314
|
+
"message",
|
|
21315
|
+
"error.type"
|
|
21316
|
+
],
|
|
21317
|
+
sort: "-timestamp",
|
|
21318
|
+
timeRange: { statsPeriod: "30d" }
|
|
21319
|
+
}
|
|
21320
|
+
},
|
|
21321
|
+
{
|
|
21322
|
+
description: "Events on mobile devices",
|
|
21323
|
+
output: {
|
|
21324
|
+
query: "device:mobile OR device.family:mobile",
|
|
21325
|
+
fields: [
|
|
21326
|
+
"id",
|
|
21327
|
+
"timestamp",
|
|
21328
|
+
"title",
|
|
21329
|
+
"device",
|
|
21330
|
+
"device.family",
|
|
21331
|
+
"os",
|
|
21332
|
+
"browser"
|
|
21333
|
+
],
|
|
21334
|
+
sort: "-timestamp",
|
|
21335
|
+
timeRange: { statsPeriod: "7d" }
|
|
21336
|
+
}
|
|
21337
|
+
},
|
|
21338
|
+
{
|
|
21339
|
+
description: "Events from specific browser",
|
|
21340
|
+
output: {
|
|
21341
|
+
query: "browser.name:Chrome",
|
|
21342
|
+
fields: [
|
|
21343
|
+
"id",
|
|
21344
|
+
"timestamp",
|
|
21345
|
+
"title",
|
|
21346
|
+
"browser.name",
|
|
21347
|
+
"browser.version",
|
|
21348
|
+
"os"
|
|
21349
|
+
],
|
|
21350
|
+
sort: "-timestamp",
|
|
21351
|
+
timeRange: { statsPeriod: "7d" }
|
|
21352
|
+
}
|
|
21353
|
+
}
|
|
21354
|
+
];
|
|
21355
|
+
|
|
21356
|
+
//#endregion
|
|
21357
|
+
//#region ../mcp-core/dist/utils-jBgE1HtJ.js
|
|
21358
|
+
/**
|
|
21359
|
+
* Create a tool for the agent to query available tags and fields for issue events
|
|
21360
|
+
* The tool is pre-bound with the API service and organization configured for the appropriate region
|
|
21361
|
+
*/
|
|
21362
|
+
function createIssueEventFieldsTool(options) {
|
|
21363
|
+
const { apiService, organizationSlug, projectId } = options;
|
|
21364
|
+
return agentTool({
|
|
21365
|
+
description: "Get available tags and fields for issue events to understand what filters are available",
|
|
21366
|
+
parameters: z.object({}),
|
|
21367
|
+
execute: async () => {
|
|
21368
|
+
const tagsResponse = await apiService.listTags({
|
|
21369
|
+
organizationSlug,
|
|
21370
|
+
dataset: "events",
|
|
21371
|
+
project: projectId,
|
|
21372
|
+
statsPeriod: "14d",
|
|
21373
|
+
useCache: true,
|
|
21374
|
+
useFlagsBackend: true
|
|
21375
|
+
});
|
|
21376
|
+
const availableTags = {};
|
|
21377
|
+
for (const tag of tagsResponse) if (tag.key) {
|
|
21378
|
+
const knownTagDescription = ISSUE_EVENT_TAGS[tag.key];
|
|
21379
|
+
availableTags[tag.key] = tag.name || knownTagDescription || tag.key;
|
|
21380
|
+
}
|
|
21381
|
+
const allTags = {
|
|
21382
|
+
...ISSUE_EVENT_TAGS,
|
|
21383
|
+
...availableTags
|
|
21384
|
+
};
|
|
21385
|
+
return `Available Tags and Fields (${Object.keys(allTags).length} total):
|
|
21386
|
+
|
|
21387
|
+
Common Tags:
|
|
21388
|
+
${Object.entries(ISSUE_EVENT_TAGS).slice(0, 30).map(([key, desc]) => `- ${key}: ${desc}`).join("\n")}
|
|
21389
|
+
${Object.keys(ISSUE_EVENT_TAGS).length > 30 ? `\n... and ${Object.keys(ISSUE_EVENT_TAGS).length - 30} more common tags` : ""}
|
|
21390
|
+
|
|
21391
|
+
Project-Specific Tags (from API):
|
|
21392
|
+
${Object.entries(availableTags).filter(([key]) => !ISSUE_EVENT_TAGS[key]).slice(0, 20).map(([key, desc]) => `- ${key}: ${desc}`).join("\n")}
|
|
21393
|
+
|
|
21394
|
+
Recommended Fields for Results:
|
|
21395
|
+
${RECOMMENDED_FIELDS$1.map((f) => `- ${f}`).join("\n")}
|
|
21396
|
+
|
|
21397
|
+
EXAMPLE QUERIES:
|
|
21398
|
+
${EXAMPLE_QUERIES.map((ex) => `- "${ex.description}" →\n ${JSON.stringify(ex.output, null, 2)}`).join("\n\n")}
|
|
21399
|
+
|
|
21400
|
+
IMPORTANT:
|
|
21401
|
+
- Use these tag names exactly as shown in your query
|
|
21402
|
+
- Tags are case-insensitive
|
|
21403
|
+
- Use wildcards with quotes: url:"*/checkout/*"
|
|
21404
|
+
- Your query should NOT include "issue:" prefix - the handler adds it automatically`;
|
|
21405
|
+
}
|
|
21406
|
+
});
|
|
21407
|
+
}
|
|
21408
|
+
/**
|
|
21409
|
+
* Parse issue parameters from various input formats
|
|
21410
|
+
* Supports both direct issueId/organizationSlug and issueUrl parsing
|
|
21411
|
+
*/
|
|
21412
|
+
function parseIssueParams(params) {
|
|
21413
|
+
if (params.issueUrl) {
|
|
21414
|
+
const orgMatch = params.issueUrl.match(/\/organizations\/([^/]+)\/issues\/([^/?]+)/) || params.issueUrl.match(/https?:\/\/([^.]+)\.sentry\.io\/issues\/([^/?]+)/);
|
|
21415
|
+
if (!orgMatch) throw new UserInputError(`Invalid issue URL format. Expected format like:
|
|
21416
|
+
- https://sentry.io/organizations/my-org/issues/123/
|
|
21417
|
+
- https://my-org.sentry.io/issues/123/
|
|
21418
|
+
|
|
21419
|
+
Received: ${params.issueUrl}`);
|
|
21420
|
+
return {
|
|
21421
|
+
organizationSlug: orgMatch[1],
|
|
21422
|
+
issueId: orgMatch[2]
|
|
21423
|
+
};
|
|
21424
|
+
}
|
|
21425
|
+
if (!params.issueId) throw new UserInputError("Must provide either issueUrl or issueId parameter. Use issueUrl for convenience, or provide both issueId and organizationSlug.");
|
|
21426
|
+
if (!params.organizationSlug) throw new UserInputError("When using issueId parameter, organizationSlug is required. Alternatively, provide issueUrl which includes both organization and issue ID.");
|
|
21427
|
+
return {
|
|
21428
|
+
organizationSlug: params.organizationSlug,
|
|
21429
|
+
issueId: params.issueId
|
|
21430
|
+
};
|
|
21431
|
+
}
|
|
21432
|
+
|
|
21433
|
+
//#endregion
|
|
21434
|
+
//#region ../mcp-core/dist/agent-CuQeP0Og.js
|
|
21435
|
+
const searchIssueEventsAgentOutputSchema = z.object({
|
|
21436
|
+
query: z.string().describe("Sentry query filters for tags/fields (NOT including issue: prefix - handler adds that)"),
|
|
21437
|
+
fields: z.array(z.string()).describe("Array of field names to return in results"),
|
|
21438
|
+
sort: z.string().describe("Sort parameter for results (e.g., -timestamp)"),
|
|
21439
|
+
timeRange: z.union([
|
|
21440
|
+
z.object({ statsPeriod: z.string().describe("Relative time period like '1h', '24h', '7d', '14d'") }),
|
|
21441
|
+
z.object({
|
|
21442
|
+
start: z.string().describe("ISO 8601 start time"),
|
|
21443
|
+
end: z.string().describe("ISO 8601 end time")
|
|
21444
|
+
}),
|
|
21445
|
+
z.null()
|
|
21446
|
+
]).describe("Time range for filtering events. Use either statsPeriod for relative time or start/end for absolute time. Use null for default 14-day window."),
|
|
21447
|
+
explanation: z.string().describe("Brief explanation of how you translated this query")
|
|
21448
|
+
}).refine((data) => {
|
|
21449
|
+
if (!data.sort || !data.fields || data.fields.length === 0) return true;
|
|
21450
|
+
const sortField = data.sort.startsWith("-") ? data.sort.substring(1) : data.sort;
|
|
21451
|
+
return data.fields.includes(sortField);
|
|
21452
|
+
}, { message: "Sort field must be included in the fields array. Sentry requires that any field used for sorting must also be explicitly selected. Add the sort field to the fields array or choose a different sort field that's already included." });
|
|
21453
|
+
/**
|
|
21454
|
+
* Search issue events agent - translates natural language queries to Sentry tag filters for events within a specific issue
|
|
21455
|
+
* Returns both the translated query result AND the tool calls made by the agent
|
|
21456
|
+
*/
|
|
21457
|
+
async function searchIssueEventsAgent(options) {
|
|
21458
|
+
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for natural language query translation");
|
|
21459
|
+
const issueEventFieldsTool = createIssueEventFieldsTool({
|
|
21460
|
+
apiService: options.apiService,
|
|
21461
|
+
organizationSlug: options.organizationSlug,
|
|
21462
|
+
projectId: options.projectId
|
|
21463
|
+
});
|
|
21464
|
+
const whoamiTool = createWhoamiTool({ apiService: options.apiService });
|
|
21465
|
+
return await callEmbeddedAgent({
|
|
21466
|
+
system: systemPrompt$2,
|
|
21467
|
+
prompt: options.query,
|
|
21468
|
+
tools: {
|
|
21469
|
+
issueEventFields: issueEventFieldsTool,
|
|
21470
|
+
whoami: whoamiTool
|
|
21471
|
+
},
|
|
21472
|
+
schema: searchIssueEventsAgentOutputSchema
|
|
21473
|
+
});
|
|
21474
|
+
}
|
|
21475
|
+
|
|
21476
|
+
//#endregion
|
|
21477
|
+
//#region ../mcp-core/dist/handler-Ca256WDv.js
|
|
21478
|
+
var handler_default$2 = defineTool({
|
|
21479
|
+
name: "search_issue_events",
|
|
21480
|
+
skills: ["inspect", "triage"],
|
|
21481
|
+
requiredScopes: ["event:read"],
|
|
21482
|
+
description: [
|
|
21483
|
+
"Search and filter events within a specific issue using natural language queries.",
|
|
21484
|
+
"",
|
|
21485
|
+
"Use this to filter events by time, environment, release, user, trace ID, or other tags. The tool automatically constrains results to the specified issue.",
|
|
21486
|
+
"",
|
|
21487
|
+
"For cross-issue searches use search_issues, for single event details use get_issue_details.",
|
|
21488
|
+
"",
|
|
21489
|
+
"<examples>",
|
|
21490
|
+
"search_issue_events(issueId='MCP-41', organizationSlug='my-org', naturalLanguageQuery='from last hour')",
|
|
21491
|
+
"search_issue_events(issueUrl='https://sentry.io/.../issues/123/', naturalLanguageQuery='production with release v1.0')",
|
|
21492
|
+
"</examples>"
|
|
21493
|
+
].join("\n"),
|
|
21494
|
+
inputSchema: {
|
|
21495
|
+
organizationSlug: ParamOrganizationSlug.nullable().default(null).describe("Organization slug. Required when using issueId. Not needed when using issueUrl."),
|
|
21496
|
+
issueId: z.string().optional().describe("Issue ID (e.g., 'MCP-41', 'PROJECT-123'). Requires organizationSlug. Alternatively, use issueUrl."),
|
|
21497
|
+
issueUrl: z.string().url().optional().describe("Full Sentry issue URL (e.g., 'https://sentry.io/organizations/my-org/issues/123/'). Includes both organization and issue ID."),
|
|
21498
|
+
naturalLanguageQuery: z.string().trim().min(1).describe("Natural language description of what events you want to find within this issue. Examples: 'from last hour', 'production with release v1.0', 'affecting user alice@example.com', 'with trace ID abc123'"),
|
|
21499
|
+
projectSlug: ParamProjectSlug.nullable().default(null).describe("Project slug for better tag discovery. Optional - helps find project-specific tags."),
|
|
21500
|
+
regionUrl: ParamRegionUrl.nullable().default(null).describe("Sentry region URL. Optional - defaults to main region."),
|
|
21501
|
+
limit: z.number().min(1).max(100).default(50).describe("Maximum number of events to return (1-100, default: 50)"),
|
|
21502
|
+
includeExplanation: z.boolean().default(false).describe("Include explanation of how the natural language query was translated to Sentry syntax")
|
|
21503
|
+
},
|
|
21504
|
+
annotations: {
|
|
21505
|
+
readOnlyHint: true,
|
|
21506
|
+
openWorldHint: true
|
|
21507
|
+
},
|
|
21508
|
+
async handler(params, context$1) {
|
|
21509
|
+
const { organizationSlug, issueId } = parseIssueParams({
|
|
21510
|
+
organizationSlug: params.organizationSlug,
|
|
21511
|
+
issueId: params.issueId,
|
|
21512
|
+
issueUrl: params.issueUrl
|
|
21513
|
+
});
|
|
21514
|
+
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
21515
|
+
setTag("organization.slug", organizationSlug);
|
|
21516
|
+
setTag("issue.id", issueId);
|
|
21517
|
+
if (params.projectSlug) setTag("project.slug", params.projectSlug);
|
|
21518
|
+
let projectId;
|
|
21519
|
+
if (params.projectSlug) try {
|
|
21520
|
+
const project = await apiService.getProject({
|
|
21521
|
+
organizationSlug,
|
|
21522
|
+
projectSlugOrId: params.projectSlug
|
|
21523
|
+
});
|
|
21524
|
+
projectId = String(project.id);
|
|
21525
|
+
} catch (error) {
|
|
21526
|
+
console.warn(`Could not resolve project ${params.projectSlug}:`, error);
|
|
21527
|
+
}
|
|
21528
|
+
const agentResult = await searchIssueEventsAgent({
|
|
21529
|
+
query: params.naturalLanguageQuery,
|
|
21530
|
+
organizationSlug,
|
|
21531
|
+
apiService,
|
|
21532
|
+
projectId
|
|
21533
|
+
});
|
|
21534
|
+
const parsed = agentResult.result;
|
|
21535
|
+
if (!parsed.sort) throw new UserInputError(`Search Issue Events Agent response missing required 'sort' parameter. Received: ${JSON.stringify(parsed, null, 2)}. The agent must specify how to sort results (e.g., '-timestamp' for newest first).`);
|
|
21536
|
+
const query = parsed.query || "";
|
|
21537
|
+
const requestedFields = parsed.fields || [];
|
|
21538
|
+
const fields = requestedFields.length > 0 ? requestedFields : RECOMMENDED_FIELDS$1;
|
|
21539
|
+
const sortParam = parsed.sort;
|
|
21540
|
+
const timeParams = {};
|
|
21541
|
+
if (parsed.timeRange) {
|
|
21542
|
+
if ("statsPeriod" in parsed.timeRange) timeParams.statsPeriod = parsed.timeRange.statsPeriod;
|
|
21543
|
+
else if ("start" in parsed.timeRange && "end" in parsed.timeRange) {
|
|
21544
|
+
timeParams.start = parsed.timeRange.start;
|
|
21545
|
+
timeParams.end = parsed.timeRange.end;
|
|
21546
|
+
}
|
|
21547
|
+
} else timeParams.statsPeriod = "14d";
|
|
21548
|
+
const eventsResponse = await apiService.listEventsForIssue({
|
|
21549
|
+
organizationSlug,
|
|
21550
|
+
issueId,
|
|
21551
|
+
query,
|
|
21552
|
+
limit: params.limit,
|
|
21553
|
+
sort: sortParam,
|
|
21554
|
+
...timeParams
|
|
21555
|
+
});
|
|
21556
|
+
const explorerQuery = query ? `issue:${issueId} ${query}` : `issue:${issueId}`;
|
|
21557
|
+
const explorerUrl = apiService.getEventsExplorerUrl(organizationSlug, explorerQuery, projectId, "errors", fields, sortParam, [], [], timeParams.statsPeriod, timeParams.start, timeParams.end);
|
|
21558
|
+
function isValidEventArray(data) {
|
|
21559
|
+
return Array.isArray(data) && data.every((item) => typeof item === "object" && item !== null);
|
|
21560
|
+
}
|
|
21561
|
+
if (!isValidEventArray(eventsResponse)) throw new Error("Invalid event data format from Sentry API: expected array of objects");
|
|
21562
|
+
const eventData = eventsResponse;
|
|
21563
|
+
const naturalLanguageContext = `Events in issue ${issueId}: ${params.naturalLanguageQuery}`;
|
|
21564
|
+
return formatErrorResults({
|
|
21565
|
+
eventData,
|
|
21566
|
+
naturalLanguageQuery: naturalLanguageContext,
|
|
21567
|
+
includeExplanation: params.includeExplanation,
|
|
21568
|
+
apiService,
|
|
21569
|
+
organizationSlug,
|
|
21570
|
+
explorerUrl,
|
|
21571
|
+
sentryQuery: explorerQuery,
|
|
21572
|
+
fields,
|
|
21573
|
+
explanation: parsed.explanation
|
|
21574
|
+
});
|
|
21575
|
+
}
|
|
21576
|
+
});
|
|
21577
|
+
|
|
21578
|
+
//#endregion
|
|
21579
|
+
//#region ../mcp-core/dist/config-eV2du5VJ.js
|
|
21002
21580
|
/**
|
|
21003
21581
|
* Configuration for the use_sentry embedded agent.
|
|
21004
21582
|
*
|
|
@@ -21017,7 +21595,7 @@ The user may include various parameters to pass to those tools in their prompt.
|
|
|
21017
21595
|
You MUST return tool results directly without interpreting them.`;
|
|
21018
21596
|
|
|
21019
21597
|
//#endregion
|
|
21020
|
-
//#region ../mcp-core/dist/agent-
|
|
21598
|
+
//#region ../mcp-core/dist/agent-DfZ797Yi.js
|
|
21021
21599
|
/**
|
|
21022
21600
|
* Output schema for the embedded agent.
|
|
21023
21601
|
* The agent returns the final result string directly from its tool calls.
|
|
@@ -21039,7 +21617,7 @@ async function useSentryAgent(options) {
|
|
|
21039
21617
|
}
|
|
21040
21618
|
|
|
21041
21619
|
//#endregion
|
|
21042
|
-
//#region ../mcp-core/dist/error-handling-
|
|
21620
|
+
//#region ../mcp-core/dist/error-handling-DrvyGci6.js
|
|
21043
21621
|
/**
|
|
21044
21622
|
* Type guard to identify user input validation errors.
|
|
21045
21623
|
*/
|
|
@@ -21130,7 +21708,7 @@ async function formatErrorForUser(error) {
|
|
|
21130
21708
|
}
|
|
21131
21709
|
|
|
21132
21710
|
//#endregion
|
|
21133
|
-
//#region ../mcp-core/dist/constraint-helpers-
|
|
21711
|
+
//#region ../mcp-core/dist/constraint-helpers-CCO6wSRb.js
|
|
21134
21712
|
/**
|
|
21135
21713
|
* Determines which tool parameter keys should be filtered out of the schema
|
|
21136
21714
|
* because they will be injected from constraints.
|
|
@@ -21192,7 +21770,7 @@ function getConstraintParametersToInject(constraints, toolInputSchema) {
|
|
|
21192
21770
|
}
|
|
21193
21771
|
|
|
21194
21772
|
//#endregion
|
|
21195
|
-
//#region ../mcp-core/dist/server-
|
|
21773
|
+
//#region ../mcp-core/dist/server-CAslpEs0.js
|
|
21196
21774
|
/**
|
|
21197
21775
|
* Format tool calls into a readable trace
|
|
21198
21776
|
*/
|
|
@@ -21211,7 +21789,7 @@ function formatToolCallTrace(toolCalls) {
|
|
|
21211
21789
|
}
|
|
21212
21790
|
return trace$1;
|
|
21213
21791
|
}
|
|
21214
|
-
var handler_default$
|
|
21792
|
+
var handler_default$3 = defineTool({
|
|
21215
21793
|
name: "use_sentry",
|
|
21216
21794
|
skills: [],
|
|
21217
21795
|
requiredScopes: [],
|
|
@@ -21302,7 +21880,8 @@ var tools_default = {
|
|
|
21302
21880
|
search_docs: search_docs_default,
|
|
21303
21881
|
get_doc: get_doc_default,
|
|
21304
21882
|
search_issues: handler_default$1,
|
|
21305
|
-
|
|
21883
|
+
search_issue_events: handler_default$2,
|
|
21884
|
+
use_sentry: handler_default$3
|
|
21306
21885
|
};
|
|
21307
21886
|
/**
|
|
21308
21887
|
* Creates and configures a complete MCP server with Sentry instrumentation.
|
|
@@ -21444,7 +22023,7 @@ function configureServer({ server: server$1, context: context$1, agentMode = fal
|
|
|
21444
22023
|
}
|
|
21445
22024
|
|
|
21446
22025
|
//#endregion
|
|
21447
|
-
//#region ../mcp-core/dist/sentry-
|
|
22026
|
+
//#region ../mcp-core/dist/sentry-Cfj4OGMQ.js
|
|
21448
22027
|
const SCRUB_PATTERNS = [
|
|
21449
22028
|
{
|
|
21450
22029
|
pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
|