@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.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_chunk = require('./chunk-DoeelZqw.cjs');
|
|
3
3
|
const require_resolve = require('./resolve-CdTP9riu.cjs');
|
|
4
|
-
const require_stdio = require('./stdio-
|
|
4
|
+
const require_stdio = require('./stdio-DFfz0_Ua.cjs');
|
|
5
5
|
const require_config_BoFBjXRq = require('./config-BoFBjXRq-CGHqlnJ9.cjs');
|
|
6
6
|
const require_usage = require('./usage-DD58xBe3.cjs');
|
|
7
7
|
const require_parse = require('./parse-BjIH83SX.cjs');
|
|
@@ -2464,7 +2464,7 @@ function createApiError(message, status, detail, responseBody) {
|
|
|
2464
2464
|
}
|
|
2465
2465
|
|
|
2466
2466
|
//#endregion
|
|
2467
|
-
//#region ../mcp-core/dist/client-
|
|
2467
|
+
//#region ../mcp-core/dist/client-EbNZG3Z_.js
|
|
2468
2468
|
/**
|
|
2469
2469
|
* Mapping of common network error codes to user-friendly messages.
|
|
2470
2470
|
* These help users understand and resolve connection issues.
|
|
@@ -3295,6 +3295,26 @@ var SentryApiService = class {
|
|
|
3295
3295
|
eventId: "latest"
|
|
3296
3296
|
}, opts);
|
|
3297
3297
|
}
|
|
3298
|
+
/**
|
|
3299
|
+
* Lists events for a specific issue.
|
|
3300
|
+
* Uses the issue-specific endpoint which already filters by issue ID.
|
|
3301
|
+
*
|
|
3302
|
+
* @see https://docs.sentry.io/api/events/list-an-issues-events/
|
|
3303
|
+
*/
|
|
3304
|
+
async listEventsForIssue({ organizationSlug, issueId, query, limit = 50, sort, statsPeriod, start, end, full = false }, opts) {
|
|
3305
|
+
const params = new URLSearchParams();
|
|
3306
|
+
if (query) params.append("query", query);
|
|
3307
|
+
params.append("per_page", String(limit));
|
|
3308
|
+
if (sort) params.append("sort", sort);
|
|
3309
|
+
if (statsPeriod) params.append("statsPeriod", statsPeriod);
|
|
3310
|
+
else if (start && end) {
|
|
3311
|
+
params.append("start", start);
|
|
3312
|
+
params.append("end", end);
|
|
3313
|
+
}
|
|
3314
|
+
if (full) params.append("full", "true");
|
|
3315
|
+
const apiUrl = `/organizations/${organizationSlug}/issues/${issueId}/events/?${params.toString()}`;
|
|
3316
|
+
return await this.requestJSON(apiUrl, void 0, opts);
|
|
3317
|
+
}
|
|
3298
3318
|
async listEventAttachments({ organizationSlug, projectSlug, eventId }, opts) {
|
|
3299
3319
|
const body = await this.requestJSON(`/projects/${organizationSlug}/${projectSlug}/events/${eventId}/attachments/`, void 0, opts);
|
|
3300
3320
|
return EventAttachmentListSchema.parse(body);
|
|
@@ -3585,7 +3605,7 @@ function validateRegionUrl(regionUrl, baseHost) {
|
|
|
3585
3605
|
}
|
|
3586
3606
|
|
|
3587
3607
|
//#endregion
|
|
3588
|
-
//#region ../mcp-core/dist/api-
|
|
3608
|
+
//#region ../mcp-core/dist/api-C4iLorVN.js
|
|
3589
3609
|
/**
|
|
3590
3610
|
* Create a Sentry API service from server context with optional region override
|
|
3591
3611
|
* @param context - Server context containing host and access token
|
|
@@ -3606,7 +3626,7 @@ function apiServiceFromContext(context$1, opts = {}) {
|
|
|
3606
3626
|
}
|
|
3607
3627
|
|
|
3608
3628
|
//#endregion
|
|
3609
|
-
//#region ../mcp-core/dist/whoami-
|
|
3629
|
+
//#region ../mcp-core/dist/whoami-4TjhUF9I.js
|
|
3610
3630
|
var whoami_default = defineTool({
|
|
3611
3631
|
name: "whoami",
|
|
3612
3632
|
description: [
|
|
@@ -3639,7 +3659,7 @@ var whoami_default = defineTool({
|
|
|
3639
3659
|
});
|
|
3640
3660
|
|
|
3641
3661
|
//#endregion
|
|
3642
|
-
//#region ../mcp-core/dist/find-organizations-
|
|
3662
|
+
//#region ../mcp-core/dist/find-organizations-CY_CprTd.js
|
|
3643
3663
|
const RESULT_LIMIT$2 = 25;
|
|
3644
3664
|
var find_organizations_default = defineTool({
|
|
3645
3665
|
name: "find_organizations",
|
|
@@ -3691,7 +3711,7 @@ var find_organizations_default = defineTool({
|
|
|
3691
3711
|
});
|
|
3692
3712
|
|
|
3693
3713
|
//#endregion
|
|
3694
|
-
//#region ../mcp-core/dist/find-teams-
|
|
3714
|
+
//#region ../mcp-core/dist/find-teams-D20sronT.js
|
|
3695
3715
|
const RESULT_LIMIT$1 = 25;
|
|
3696
3716
|
var find_teams_default = defineTool({
|
|
3697
3717
|
name: "find_teams",
|
|
@@ -3739,7 +3759,7 @@ var find_teams_default = defineTool({
|
|
|
3739
3759
|
});
|
|
3740
3760
|
|
|
3741
3761
|
//#endregion
|
|
3742
|
-
//#region ../mcp-core/dist/find-projects-
|
|
3762
|
+
//#region ../mcp-core/dist/find-projects-BIbLskbP.js
|
|
3743
3763
|
const RESULT_LIMIT = 25;
|
|
3744
3764
|
var find_projects_default = defineTool({
|
|
3745
3765
|
name: "find_projects",
|
|
@@ -3783,7 +3803,7 @@ var find_projects_default = defineTool({
|
|
|
3783
3803
|
});
|
|
3784
3804
|
|
|
3785
3805
|
//#endregion
|
|
3786
|
-
//#region ../mcp-core/dist/find-releases-
|
|
3806
|
+
//#region ../mcp-core/dist/find-releases-DddLqSmt.js
|
|
3787
3807
|
var find_releases_default = defineTool({
|
|
3788
3808
|
name: "find_releases",
|
|
3789
3809
|
skills: ["inspect"],
|
|
@@ -3932,7 +3952,7 @@ function parseIssueId(issueId) {
|
|
|
3932
3952
|
* @returns Object containing the parsed organization slug and issue ID
|
|
3933
3953
|
* @throws Error if the input is invalid
|
|
3934
3954
|
*/
|
|
3935
|
-
function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
|
|
3955
|
+
function parseIssueParams$1({ issueUrl, issueId, organizationSlug }) {
|
|
3936
3956
|
if (issueUrl) {
|
|
3937
3957
|
const resolved = extractIssueId(issueUrl);
|
|
3938
3958
|
if (!resolved) throw new Error("Invalid Sentry issue URL. Path should contain '/issues/{issue_id}'");
|
|
@@ -4031,7 +4051,7 @@ function getOutputForAutofixStep(step) {
|
|
|
4031
4051
|
}
|
|
4032
4052
|
|
|
4033
4053
|
//#endregion
|
|
4034
|
-
//#region ../mcp-core/dist/formatting-
|
|
4054
|
+
//#region ../mcp-core/dist/formatting-BhgNMv3a.js
|
|
4035
4055
|
const LANGUAGE_EXTENSIONS = {
|
|
4036
4056
|
".java": "java",
|
|
4037
4057
|
".py": "python",
|
|
@@ -4995,6 +5015,7 @@ function formatIssueOutput({ organizationSlug, issue, event, apiService, autofix
|
|
|
4995
5015
|
output += "# Using this information\n\n";
|
|
4996
5016
|
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`;
|
|
4997
5017
|
output += "- The stacktrace includes both first-party application code as well as third-party code, its important to triage to first-party code.\n";
|
|
5018
|
+
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`;
|
|
4998
5019
|
return output;
|
|
4999
5020
|
}
|
|
5000
5021
|
|
|
@@ -5027,7 +5048,7 @@ function enhanceNotFoundError(error, params) {
|
|
|
5027
5048
|
}
|
|
5028
5049
|
|
|
5029
5050
|
//#endregion
|
|
5030
|
-
//#region ../mcp-core/dist/get-issue-details-
|
|
5051
|
+
//#region ../mcp-core/dist/get-issue-details-Dv2HsHlt.js
|
|
5031
5052
|
var get_issue_details_default = defineTool({
|
|
5032
5053
|
name: "get_issue_details",
|
|
5033
5054
|
skills: [
|
|
@@ -5138,7 +5159,7 @@ var get_issue_details_default = defineTool({
|
|
|
5138
5159
|
}
|
|
5139
5160
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
5140
5161
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
5141
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
5162
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
5142
5163
|
organizationSlug: params.organizationSlug,
|
|
5143
5164
|
issueId: params.issueId,
|
|
5144
5165
|
issueUrl: params.issueUrl
|
|
@@ -5208,7 +5229,7 @@ function shouldFetchTraceForEvent(event) {
|
|
|
5208
5229
|
}
|
|
5209
5230
|
|
|
5210
5231
|
//#endregion
|
|
5211
|
-
//#region ../mcp-core/dist/get-trace-details-
|
|
5232
|
+
//#region ../mcp-core/dist/get-trace-details-QaT2N9BA.js
|
|
5212
5233
|
const MAX_DEPTH = 2;
|
|
5213
5234
|
const MINIMUM_DURATION_THRESHOLD_MS = 10;
|
|
5214
5235
|
const MIN_MEANINGFUL_CHILD_DURATION = 5;
|
|
@@ -5507,7 +5528,7 @@ function formatTraceOutput({ organizationSlug, traceId, traceMeta, trace: trace$
|
|
|
5507
5528
|
}
|
|
5508
5529
|
|
|
5509
5530
|
//#endregion
|
|
5510
|
-
//#region ../mcp-core/dist/get-event-attachment-
|
|
5531
|
+
//#region ../mcp-core/dist/get-event-attachment-DdhoqwCO.js
|
|
5511
5532
|
var get_event_attachment_default = defineTool({
|
|
5512
5533
|
name: "get_event_attachment",
|
|
5513
5534
|
skills: ["inspect"],
|
|
@@ -5655,7 +5676,7 @@ function formatAssignedTo(assignedTo) {
|
|
|
5655
5676
|
}
|
|
5656
5677
|
|
|
5657
5678
|
//#endregion
|
|
5658
|
-
//#region ../mcp-core/dist/update-issue-
|
|
5679
|
+
//#region ../mcp-core/dist/update-issue-JybAx8DT.js
|
|
5659
5680
|
var update_issue_default = defineTool({
|
|
5660
5681
|
name: "update_issue",
|
|
5661
5682
|
skills: ["triage"],
|
|
@@ -5723,7 +5744,7 @@ var update_issue_default = defineTool({
|
|
|
5723
5744
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
5724
5745
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
5725
5746
|
if (!params.status && !params.assignedTo) throw new UserInputError("At least one of `status` or `assignedTo` must be provided to update the issue");
|
|
5726
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
5747
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
5727
5748
|
organizationSlug: params.organizationSlug,
|
|
5728
5749
|
issueId: params.issueId,
|
|
5729
5750
|
issueUrl: params.issueUrl
|
|
@@ -8928,7 +8949,7 @@ function createOpenAI(options = {}) {
|
|
|
8928
8949
|
var openai = createOpenAI({ compatibility: "strict" });
|
|
8929
8950
|
|
|
8930
8951
|
//#endregion
|
|
8931
|
-
//#region ../mcp-core/dist/openai-provider-
|
|
8952
|
+
//#region ../mcp-core/dist/openai-provider-BIuidJl6.js
|
|
8932
8953
|
const DEFAULT_OPENAI_MODEL = "gpt-5";
|
|
8933
8954
|
const VALID_REASONING_EFFORTS = [
|
|
8934
8955
|
"low",
|
|
@@ -14246,7 +14267,7 @@ function trimStartOfStream() {
|
|
|
14246
14267
|
var HANGING_STREAM_WARNING_TIME_MS = 15 * 1e3;
|
|
14247
14268
|
|
|
14248
14269
|
//#endregion
|
|
14249
|
-
//#region ../mcp-core/dist/callEmbeddedAgent-
|
|
14270
|
+
//#region ../mcp-core/dist/callEmbeddedAgent-wn0PIM50.js
|
|
14250
14271
|
/**
|
|
14251
14272
|
* Call an embedded agent with tool call capture
|
|
14252
14273
|
* This is the standard way to call embedded AI agents within MCP tools
|
|
@@ -19302,14 +19323,14 @@ function createDatasetAttributesTool(options) {
|
|
|
19302
19323
|
"logs"
|
|
19303
19324
|
]).describe("The dataset to query attributes for") }),
|
|
19304
19325
|
execute: async ({ dataset }) => {
|
|
19305
|
-
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$
|
|
19326
|
+
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await Promise.resolve().then(() => require("./config-rZ982IEm.cjs"));
|
|
19306
19327
|
const { attributes: customAttributes, fieldTypes } = await fetchCustomAttributes(apiService, organizationSlug, dataset, projectId);
|
|
19307
19328
|
const allFields = {
|
|
19308
19329
|
...BASE_COMMON_FIELDS,
|
|
19309
19330
|
...DATASET_FIELDS[dataset],
|
|
19310
19331
|
...customAttributes
|
|
19311
19332
|
};
|
|
19312
|
-
const recommendedFields = RECOMMENDED_FIELDS$
|
|
19333
|
+
const recommendedFields = RECOMMENDED_FIELDS$2[dataset];
|
|
19313
19334
|
const allFieldTypes = { ...fieldTypes };
|
|
19314
19335
|
const staticNumericFields = NUMERIC_FIELDS[dataset] || /* @__PURE__ */ new Set();
|
|
19315
19336
|
for (const field of staticNumericFields) allFieldTypes[field] = "number";
|
|
@@ -19337,7 +19358,7 @@ Use these examples as patterns for constructing your query.`;
|
|
|
19337
19358
|
}
|
|
19338
19359
|
|
|
19339
19360
|
//#endregion
|
|
19340
|
-
//#region ../mcp-core/dist/agent-
|
|
19361
|
+
//#region ../mcp-core/dist/agent-C_Z02GOk.js
|
|
19341
19362
|
const searchEventsAgentOutputSchema = zod.z.object({
|
|
19342
19363
|
dataset: zod.z.enum([
|
|
19343
19364
|
"spans",
|
|
@@ -19609,7 +19630,7 @@ function formatSpanResults(params) {
|
|
|
19609
19630
|
}
|
|
19610
19631
|
|
|
19611
19632
|
//#endregion
|
|
19612
|
-
//#region ../mcp-core/dist/handler-
|
|
19633
|
+
//#region ../mcp-core/dist/handler-DFWcpIpC.js
|
|
19613
19634
|
var handler_default = defineTool({
|
|
19614
19635
|
name: "search_events",
|
|
19615
19636
|
skills: [
|
|
@@ -19750,7 +19771,7 @@ var handler_default = defineTool({
|
|
|
19750
19771
|
});
|
|
19751
19772
|
|
|
19752
19773
|
//#endregion
|
|
19753
|
-
//#region ../mcp-core/dist/create-team-
|
|
19774
|
+
//#region ../mcp-core/dist/create-team-JXD-4yd1.js
|
|
19754
19775
|
var create_team_default = defineTool({
|
|
19755
19776
|
name: "create_team",
|
|
19756
19777
|
skills: ["project-management"],
|
|
@@ -19805,7 +19826,7 @@ var create_team_default = defineTool({
|
|
|
19805
19826
|
});
|
|
19806
19827
|
|
|
19807
19828
|
//#endregion
|
|
19808
|
-
//#region ../mcp-core/dist/create-project-
|
|
19829
|
+
//#region ../mcp-core/dist/create-project-B1g-3-yc.js
|
|
19809
19830
|
var create_project_default = defineTool({
|
|
19810
19831
|
name: "create_project",
|
|
19811
19832
|
skills: ["project-management"],
|
|
@@ -19882,7 +19903,7 @@ var create_project_default = defineTool({
|
|
|
19882
19903
|
});
|
|
19883
19904
|
|
|
19884
19905
|
//#endregion
|
|
19885
|
-
//#region ../mcp-core/dist/update-project-
|
|
19906
|
+
//#region ../mcp-core/dist/update-project-sPir9pn7.js
|
|
19886
19907
|
var update_project_default = defineTool({
|
|
19887
19908
|
name: "update_project",
|
|
19888
19909
|
skills: ["project-management"],
|
|
@@ -20000,7 +20021,7 @@ var update_project_default = defineTool({
|
|
|
20000
20021
|
});
|
|
20001
20022
|
|
|
20002
20023
|
//#endregion
|
|
20003
|
-
//#region ../mcp-core/dist/create-dsn-
|
|
20024
|
+
//#region ../mcp-core/dist/create-dsn-Co1eIXE3.js
|
|
20004
20025
|
var create_dsn_default = defineTool({
|
|
20005
20026
|
name: "create_dsn",
|
|
20006
20027
|
skills: ["project-management"],
|
|
@@ -20060,7 +20081,7 @@ var create_dsn_default = defineTool({
|
|
|
20060
20081
|
});
|
|
20061
20082
|
|
|
20062
20083
|
//#endregion
|
|
20063
|
-
//#region ../mcp-core/dist/find-dsns-
|
|
20084
|
+
//#region ../mcp-core/dist/find-dsns-o0QsNJv8.js
|
|
20064
20085
|
var find_dsns_default = defineTool({
|
|
20065
20086
|
name: "find_dsns",
|
|
20066
20087
|
skills: ["project-management"],
|
|
@@ -20161,7 +20182,7 @@ async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, should
|
|
|
20161
20182
|
}
|
|
20162
20183
|
|
|
20163
20184
|
//#endregion
|
|
20164
|
-
//#region ../mcp-core/dist/analyze-issue-with-seer-
|
|
20185
|
+
//#region ../mcp-core/dist/analyze-issue-with-seer-DLMG61CB.js
|
|
20165
20186
|
var analyze_issue_with_seer_default = defineTool({
|
|
20166
20187
|
name: "analyze_issue_with_seer",
|
|
20167
20188
|
skills: ["seer"],
|
|
@@ -20221,7 +20242,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20221
20242
|
},
|
|
20222
20243
|
async handler(params, context$1) {
|
|
20223
20244
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
20224
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
20245
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
20225
20246
|
organizationSlug: params.organizationSlug,
|
|
20226
20247
|
issueId: params.issueId,
|
|
20227
20248
|
issueUrl: params.issueUrl
|
|
@@ -20432,7 +20453,7 @@ var search_docs_default = defineTool({
|
|
|
20432
20453
|
});
|
|
20433
20454
|
|
|
20434
20455
|
//#endregion
|
|
20435
|
-
//#region ../mcp-core/dist/get-doc-
|
|
20456
|
+
//#region ../mcp-core/dist/get-doc-B2M_KGrK.js
|
|
20436
20457
|
var get_doc_default = defineTool({
|
|
20437
20458
|
name: "get_doc",
|
|
20438
20459
|
skills: ["docs"],
|
|
@@ -20663,7 +20684,7 @@ function getCommonPatterns(dataset) {
|
|
|
20663
20684
|
/**
|
|
20664
20685
|
* Configuration for the search-issues agent
|
|
20665
20686
|
*/
|
|
20666
|
-
const systemPrompt$
|
|
20687
|
+
const systemPrompt$3 = `You are a Sentry issue search query translator. Convert natural language queries to Sentry issue search syntax.
|
|
20667
20688
|
|
|
20668
20689
|
IMPORTANT RULES:
|
|
20669
20690
|
1. Use Sentry issue search syntax, NOT SQL
|
|
@@ -20731,7 +20752,7 @@ Always use the issueFields tool to discover available fields when needed.
|
|
|
20731
20752
|
Use the whoami tool when you need to resolve 'me' references.`;
|
|
20732
20753
|
|
|
20733
20754
|
//#endregion
|
|
20734
|
-
//#region ../mcp-core/dist/agent-
|
|
20755
|
+
//#region ../mcp-core/dist/agent-Jg5_CT7U.js
|
|
20735
20756
|
const searchIssuesAgentOutputSchema = zod.z.object({
|
|
20736
20757
|
query: zod.z.string().describe("The Sentry issue search query"),
|
|
20737
20758
|
sort: zod.z.enum([
|
|
@@ -20749,7 +20770,7 @@ const searchIssuesAgentOutputSchema = zod.z.object({
|
|
|
20749
20770
|
async function searchIssuesAgent(options) {
|
|
20750
20771
|
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for semantic search");
|
|
20751
20772
|
return await callEmbeddedAgent({
|
|
20752
|
-
system: systemPrompt$
|
|
20773
|
+
system: systemPrompt$3,
|
|
20753
20774
|
prompt: options.query,
|
|
20754
20775
|
tools: {
|
|
20755
20776
|
issueFields: createDatasetFieldsTool({
|
|
@@ -20846,7 +20867,7 @@ function formatDate(dateString) {
|
|
|
20846
20867
|
}
|
|
20847
20868
|
|
|
20848
20869
|
//#endregion
|
|
20849
|
-
//#region ../mcp-core/dist/handler-
|
|
20870
|
+
//#region ../mcp-core/dist/handler-rR_VkT5b.js
|
|
20850
20871
|
var handler_default$1 = defineTool({
|
|
20851
20872
|
name: "search_issues",
|
|
20852
20873
|
skills: [
|
|
@@ -20967,7 +20988,564 @@ var handler_default$1 = defineTool({
|
|
|
20967
20988
|
});
|
|
20968
20989
|
|
|
20969
20990
|
//#endregion
|
|
20970
|
-
//#region ../mcp-core/dist/config-
|
|
20991
|
+
//#region ../mcp-core/dist/config-DbfMHS7d.js
|
|
20992
|
+
const systemPrompt$2 = `You are a Sentry issue event filter translator. Your job is to:
|
|
20993
|
+
1. Translate natural language queries into Sentry tag filters for events within a SPECIFIC issue
|
|
20994
|
+
2. Select appropriate fields to return in the results
|
|
20995
|
+
3. Determine sort order and time ranges
|
|
20996
|
+
|
|
20997
|
+
IMPORTANT CONTEXT:
|
|
20998
|
+
- You are filtering events WITHIN a specific issue (the API endpoint is already scoped to that issue)
|
|
20999
|
+
- DO NOT include "issue:" in your query - the endpoint filters by issue automatically
|
|
21000
|
+
- Focus on tag-based filtering: release, environment, user, trace ID, URL, etc.
|
|
21001
|
+
- You are working with the "errors" dataset (issues are groups of error events)
|
|
21002
|
+
|
|
21003
|
+
CRITICAL - TAG FIELD VERIFICATION:
|
|
21004
|
+
Before using ANY tag or field, you should call the issueEventFields tool to verify it exists:
|
|
21005
|
+
1. Available tags vary by project and what data is being sent
|
|
21006
|
+
2. Using non-existent tags will cause query failures
|
|
21007
|
+
3. The issueEventFields tool returns ALL available tags for the issue's project
|
|
21008
|
+
4. Field names may not be what you expect (e.g., "user_agent.original" not "browser")
|
|
21009
|
+
|
|
21010
|
+
TOOL USAGE GUIDELINES:
|
|
21011
|
+
1. Use issueEventFields tool (no parameters) to discover available tags and fields
|
|
21012
|
+
2. Use whoami tool when queries reference "me", "my", or "myself" for user.id/user.email
|
|
21013
|
+
3. CRITICAL: All tools return {error?, result?} format - check for errors before using results
|
|
21014
|
+
|
|
21015
|
+
QUERY CONSTRUCTION:
|
|
21016
|
+
Your query should contain ONLY the filter expressions (tags, operators, values):
|
|
21017
|
+
- CORRECT: "environment:production release:v1.0.5"
|
|
21018
|
+
- CORRECT: "user.email:alice@example.com"
|
|
21019
|
+
- CORRECT: 'url:"*/checkout/*"'
|
|
21020
|
+
- WRONG: "issue:MCP-41 environment:production" ← DO NOT include issue: prefix
|
|
21021
|
+
|
|
21022
|
+
COMMON TAG PATTERNS:
|
|
21023
|
+
- release:VERSION - Filter by software release/version
|
|
21024
|
+
- environment:ENV - Filter by environment (production, staging, development)
|
|
21025
|
+
- user:USER_ID or user.email:EMAIL - Filter by user
|
|
21026
|
+
- trace:TRACE_ID - Filter by distributed trace ID
|
|
21027
|
+
- url:URL_PATTERN - Filter by request URL (use wildcards: "*/path/*")
|
|
21028
|
+
- transaction:NAME - Filter by transaction name
|
|
21029
|
+
- level:LEVEL - Filter by error level (error, warning, fatal, info)
|
|
21030
|
+
- device:DEVICE - Filter by device identifier
|
|
21031
|
+
- os:OS_NAME - Filter by operating system
|
|
21032
|
+
- browser:BROWSER - Filter by browser name
|
|
21033
|
+
- runtime:RUNTIME - Filter by runtime version (e.g., "python 3.11")
|
|
21034
|
+
|
|
21035
|
+
WILDCARD MATCHING:
|
|
21036
|
+
- Use "*" for wildcards in string values
|
|
21037
|
+
- Example: url:"*/checkout/*" matches any URL containing /checkout/
|
|
21038
|
+
- Example: release:"1.2.*" matches any 1.2.x release
|
|
21039
|
+
|
|
21040
|
+
TIME RANGE HANDLING:
|
|
21041
|
+
For time-based queries ("last hour", "yesterday", "from Dec 16"):
|
|
21042
|
+
- Relative: Use statsPeriod ("1h", "24h", "7d", "14d", "30d")
|
|
21043
|
+
- "last hour" → {"statsPeriod": "1h"}
|
|
21044
|
+
- "yesterday" → {"statsPeriod": "24h"}
|
|
21045
|
+
- "last week" → {"statsPeriod": "7d"}
|
|
21046
|
+
- Absolute: Use start/end (ISO 8601 format)
|
|
21047
|
+
- "from Dec 16 2025 17:50 UTC" → {"start": "2025-12-16T17:50:00Z", "end": "2025-12-17T23:59:59Z"}
|
|
21048
|
+
- Default: If no time mentioned, use {"statsPeriod": "14d"}
|
|
21049
|
+
|
|
21050
|
+
FIELD SELECTION:
|
|
21051
|
+
- Use recommended default fields unless user asks for specific data
|
|
21052
|
+
- For custom fields, verify availability with issueEventFields tool
|
|
21053
|
+
- Common useful fields:
|
|
21054
|
+
- id: Event ID
|
|
21055
|
+
- timestamp: When event occurred
|
|
21056
|
+
- title: Event title/message
|
|
21057
|
+
- message: Full error message
|
|
21058
|
+
- level: Error severity
|
|
21059
|
+
- environment: Deployment environment
|
|
21060
|
+
- release: Release version
|
|
21061
|
+
- user.display: User identifier
|
|
21062
|
+
- trace: Trace ID
|
|
21063
|
+
- url: Request URL
|
|
21064
|
+
- device: Device identifier
|
|
21065
|
+
- os: Operating system
|
|
21066
|
+
- runtime: Runtime environment
|
|
21067
|
+
|
|
21068
|
+
SORTING RULES (CRITICAL):
|
|
21069
|
+
1. ALWAYS specify a sort parameter
|
|
21070
|
+
2. Default: "-timestamp" (newest first) for time-based browsing
|
|
21071
|
+
3. Use "-" prefix for descending order
|
|
21072
|
+
4. CRITICAL: Sort field MUST be included in your fields array
|
|
21073
|
+
5. Examples:
|
|
21074
|
+
- sort: "-timestamp", fields: ["id", "timestamp", "message"] ✓ CORRECT
|
|
21075
|
+
- sort: "-level", fields: ["id", "timestamp"] ✗ WRONG (level not in fields)
|
|
21076
|
+
|
|
21077
|
+
DO NOT USE:
|
|
21078
|
+
- Aggregate functions (count, avg, sum) - this tool returns individual events, not statistics
|
|
21079
|
+
- SQL syntax (IS NULL, yesterday(), etc.) - use has: operator and timeRange instead
|
|
21080
|
+
- Field existence checks unless necessary (has:field_name, !has:field_name)
|
|
21081
|
+
|
|
21082
|
+
HANDLING "ME" REFERENCES:
|
|
21083
|
+
- If query contains "me", "my errors", "assigned to me", use whoami tool
|
|
21084
|
+
- Replace "me" with actual user.id or user.email value
|
|
21085
|
+
- Example: "my errors" + whoami returns user.email:"alice@example.com"
|
|
21086
|
+
→ query: "user.email:alice@example.com"
|
|
21087
|
+
|
|
21088
|
+
YOUR RESPONSE FORMAT:
|
|
21089
|
+
Return a JSON object with:
|
|
21090
|
+
- "query": Tag filter expressions (empty string "" for no filters)
|
|
21091
|
+
- "fields": Array of field names to return (use recommended defaults if not specified)
|
|
21092
|
+
- "sort": Sort parameter (REQUIRED - default to "-timestamp")
|
|
21093
|
+
- "timeRange": Optional time range
|
|
21094
|
+
- Relative: {"statsPeriod": "24h"}
|
|
21095
|
+
- Absolute: {"start": "2025-01-01T00:00:00Z", "end": "2025-01-02T00:00:00Z"}
|
|
21096
|
+
- Omit for default 14-day window
|
|
21097
|
+
- "explanation": Brief explanation of how you translated the query
|
|
21098
|
+
|
|
21099
|
+
CORRECT QUERY EXAMPLES:
|
|
21100
|
+
1. "events from last hour"
|
|
21101
|
+
→ {
|
|
21102
|
+
"query": "",
|
|
21103
|
+
"fields": ["id", "timestamp", "title", "message", "level"],
|
|
21104
|
+
"sort": "-timestamp",
|
|
21105
|
+
"timeRange": {"statsPeriod": "1h"},
|
|
21106
|
+
"explanation": "Filtering to events from last hour, sorted newest first"
|
|
21107
|
+
}
|
|
21108
|
+
|
|
21109
|
+
2. "production events with release v1.0.5"
|
|
21110
|
+
→ {
|
|
21111
|
+
"query": "environment:production release:v1.0.5",
|
|
21112
|
+
"fields": ["id", "timestamp", "title", "environment", "release"],
|
|
21113
|
+
"sort": "-timestamp",
|
|
21114
|
+
"timeRange": {"statsPeriod": "14d"},
|
|
21115
|
+
"explanation": "Filtering to production environment with specific release"
|
|
21116
|
+
}
|
|
21117
|
+
|
|
21118
|
+
3. "errors affecting user alice@example.com"
|
|
21119
|
+
→ {
|
|
21120
|
+
"query": "user.email:alice@example.com",
|
|
21121
|
+
"fields": ["id", "timestamp", "title", "user.display", "message"],
|
|
21122
|
+
"sort": "-timestamp",
|
|
21123
|
+
"timeRange": {"statsPeriod": "14d"},
|
|
21124
|
+
"explanation": "Filtering to events affecting specific user"
|
|
21125
|
+
}
|
|
21126
|
+
|
|
21127
|
+
4. "events with trace ID abc123"
|
|
21128
|
+
→ {
|
|
21129
|
+
"query": "trace:abc123",
|
|
21130
|
+
"fields": ["id", "timestamp", "title", "trace", "url", "transaction"],
|
|
21131
|
+
"sort": "-timestamp",
|
|
21132
|
+
"timeRange": {"statsPeriod": "14d"},
|
|
21133
|
+
"explanation": "Filtering to events with specific trace ID"
|
|
21134
|
+
}
|
|
21135
|
+
|
|
21136
|
+
PROCESS:
|
|
21137
|
+
1. Analyze the user's natural language query
|
|
21138
|
+
2. Call issueEventFields tool to discover available tags (if needed)
|
|
21139
|
+
3. Call whoami tool if query references "me" (if needed)
|
|
21140
|
+
4. Construct tag filters (WITHOUT "issue:" prefix)
|
|
21141
|
+
5. Select appropriate fields
|
|
21142
|
+
6. Determine sort order (default: "-timestamp")
|
|
21143
|
+
7. Determine time range (if applicable)
|
|
21144
|
+
8. Return JSON response with explanation
|
|
21145
|
+
|
|
21146
|
+
COMMON ERRORS TO AVOID:
|
|
21147
|
+
- Including "issue:" in query (handler adds this automatically)
|
|
21148
|
+
- Using aggregate functions like count() or avg()
|
|
21149
|
+
- Using non-existent field names (verify with issueEventFields tool)
|
|
21150
|
+
- Forgetting to include sort field in fields array
|
|
21151
|
+
- Using SQL syntax instead of Sentry query syntax`;
|
|
21152
|
+
const ISSUE_EVENT_TAGS = {
|
|
21153
|
+
release: "Software version/release identifier",
|
|
21154
|
+
environment: "Deployment environment (production, staging, development, etc.)",
|
|
21155
|
+
level: "Error severity level (error, warning, fatal, info, debug)",
|
|
21156
|
+
user: "User identifier",
|
|
21157
|
+
"user.id": "User ID",
|
|
21158
|
+
"user.email": "User email address",
|
|
21159
|
+
"user.username": "Username",
|
|
21160
|
+
"user.display": "User display name (formatted)",
|
|
21161
|
+
transaction: "Transaction name/route",
|
|
21162
|
+
url: "Request URL",
|
|
21163
|
+
trace: "Distributed trace ID",
|
|
21164
|
+
device: "Device identifier",
|
|
21165
|
+
"device.family": "Device family",
|
|
21166
|
+
os: "Operating system name",
|
|
21167
|
+
"os.name": "OS name",
|
|
21168
|
+
"os.version": "OS version",
|
|
21169
|
+
runtime: "Runtime environment",
|
|
21170
|
+
"runtime.name": "Runtime name (e.g., CPython)",
|
|
21171
|
+
"runtime.version": "Runtime version",
|
|
21172
|
+
browser: "Browser identifier",
|
|
21173
|
+
"browser.name": "Browser name",
|
|
21174
|
+
"browser.version": "Browser version",
|
|
21175
|
+
handled: "Whether error was handled (true/false)",
|
|
21176
|
+
mechanism: "Error mechanism type",
|
|
21177
|
+
"error.type": "Exception type/class name",
|
|
21178
|
+
"stack.filename": "Source file where error occurred",
|
|
21179
|
+
"stack.function": "Function where error occurred",
|
|
21180
|
+
"stack.module": "Module where error occurred",
|
|
21181
|
+
platform: "SDK platform (javascript, python, etc.)",
|
|
21182
|
+
"sdk.name": "SDK name",
|
|
21183
|
+
"sdk.version": "SDK version",
|
|
21184
|
+
"http.method": "HTTP request method",
|
|
21185
|
+
"http.status_code": "HTTP status code",
|
|
21186
|
+
"user_agent.original": "Original user agent string"
|
|
21187
|
+
};
|
|
21188
|
+
const RECOMMENDED_FIELDS$1 = [
|
|
21189
|
+
"id",
|
|
21190
|
+
"timestamp",
|
|
21191
|
+
"title",
|
|
21192
|
+
"message",
|
|
21193
|
+
"level",
|
|
21194
|
+
"environment",
|
|
21195
|
+
"release",
|
|
21196
|
+
"user.display",
|
|
21197
|
+
"trace",
|
|
21198
|
+
"url"
|
|
21199
|
+
];
|
|
21200
|
+
const EXAMPLE_QUERIES = [
|
|
21201
|
+
{
|
|
21202
|
+
description: "Events from last hour",
|
|
21203
|
+
output: {
|
|
21204
|
+
query: "",
|
|
21205
|
+
fields: RECOMMENDED_FIELDS$1,
|
|
21206
|
+
sort: "-timestamp",
|
|
21207
|
+
timeRange: { statsPeriod: "1h" }
|
|
21208
|
+
}
|
|
21209
|
+
},
|
|
21210
|
+
{
|
|
21211
|
+
description: "Production events with specific release",
|
|
21212
|
+
output: {
|
|
21213
|
+
query: "environment:production release:09f66121-a5a3-4947-8be1-1454c4cefa3d",
|
|
21214
|
+
fields: [
|
|
21215
|
+
"id",
|
|
21216
|
+
"timestamp",
|
|
21217
|
+
"title",
|
|
21218
|
+
"environment",
|
|
21219
|
+
"release",
|
|
21220
|
+
"user.display"
|
|
21221
|
+
],
|
|
21222
|
+
sort: "-timestamp",
|
|
21223
|
+
timeRange: { statsPeriod: "7d" }
|
|
21224
|
+
}
|
|
21225
|
+
},
|
|
21226
|
+
{
|
|
21227
|
+
description: "Events affecting specific user",
|
|
21228
|
+
output: {
|
|
21229
|
+
query: "user.email:alice@example.com",
|
|
21230
|
+
fields: [
|
|
21231
|
+
"id",
|
|
21232
|
+
"timestamp",
|
|
21233
|
+
"title",
|
|
21234
|
+
"user.display",
|
|
21235
|
+
"user.email",
|
|
21236
|
+
"message"
|
|
21237
|
+
],
|
|
21238
|
+
sort: "-timestamp",
|
|
21239
|
+
timeRange: { statsPeriod: "14d" }
|
|
21240
|
+
}
|
|
21241
|
+
},
|
|
21242
|
+
{
|
|
21243
|
+
description: "Events with specific trace ID",
|
|
21244
|
+
output: {
|
|
21245
|
+
query: "trace:abc123def456",
|
|
21246
|
+
fields: [
|
|
21247
|
+
"id",
|
|
21248
|
+
"timestamp",
|
|
21249
|
+
"title",
|
|
21250
|
+
"trace",
|
|
21251
|
+
"url",
|
|
21252
|
+
"transaction"
|
|
21253
|
+
],
|
|
21254
|
+
sort: "-timestamp",
|
|
21255
|
+
timeRange: { statsPeriod: "14d" }
|
|
21256
|
+
}
|
|
21257
|
+
},
|
|
21258
|
+
{
|
|
21259
|
+
description: "Events from checkout flow",
|
|
21260
|
+
output: {
|
|
21261
|
+
query: "url:\"*/checkout/*\"",
|
|
21262
|
+
fields: [
|
|
21263
|
+
"id",
|
|
21264
|
+
"timestamp",
|
|
21265
|
+
"title",
|
|
21266
|
+
"url",
|
|
21267
|
+
"transaction",
|
|
21268
|
+
"user.display"
|
|
21269
|
+
],
|
|
21270
|
+
sort: "-timestamp",
|
|
21271
|
+
timeRange: { statsPeriod: "7d" }
|
|
21272
|
+
}
|
|
21273
|
+
},
|
|
21274
|
+
{
|
|
21275
|
+
description: "Fatal errors only",
|
|
21276
|
+
output: {
|
|
21277
|
+
query: "level:fatal",
|
|
21278
|
+
fields: [
|
|
21279
|
+
"id",
|
|
21280
|
+
"timestamp",
|
|
21281
|
+
"title",
|
|
21282
|
+
"level",
|
|
21283
|
+
"message",
|
|
21284
|
+
"error.type"
|
|
21285
|
+
],
|
|
21286
|
+
sort: "-timestamp",
|
|
21287
|
+
timeRange: { statsPeriod: "30d" }
|
|
21288
|
+
}
|
|
21289
|
+
},
|
|
21290
|
+
{
|
|
21291
|
+
description: "Events on mobile devices",
|
|
21292
|
+
output: {
|
|
21293
|
+
query: "device:mobile OR device.family:mobile",
|
|
21294
|
+
fields: [
|
|
21295
|
+
"id",
|
|
21296
|
+
"timestamp",
|
|
21297
|
+
"title",
|
|
21298
|
+
"device",
|
|
21299
|
+
"device.family",
|
|
21300
|
+
"os",
|
|
21301
|
+
"browser"
|
|
21302
|
+
],
|
|
21303
|
+
sort: "-timestamp",
|
|
21304
|
+
timeRange: { statsPeriod: "7d" }
|
|
21305
|
+
}
|
|
21306
|
+
},
|
|
21307
|
+
{
|
|
21308
|
+
description: "Events from specific browser",
|
|
21309
|
+
output: {
|
|
21310
|
+
query: "browser.name:Chrome",
|
|
21311
|
+
fields: [
|
|
21312
|
+
"id",
|
|
21313
|
+
"timestamp",
|
|
21314
|
+
"title",
|
|
21315
|
+
"browser.name",
|
|
21316
|
+
"browser.version",
|
|
21317
|
+
"os"
|
|
21318
|
+
],
|
|
21319
|
+
sort: "-timestamp",
|
|
21320
|
+
timeRange: { statsPeriod: "7d" }
|
|
21321
|
+
}
|
|
21322
|
+
}
|
|
21323
|
+
];
|
|
21324
|
+
|
|
21325
|
+
//#endregion
|
|
21326
|
+
//#region ../mcp-core/dist/utils-jBgE1HtJ.js
|
|
21327
|
+
/**
|
|
21328
|
+
* Create a tool for the agent to query available tags and fields for issue events
|
|
21329
|
+
* The tool is pre-bound with the API service and organization configured for the appropriate region
|
|
21330
|
+
*/
|
|
21331
|
+
function createIssueEventFieldsTool(options) {
|
|
21332
|
+
const { apiService, organizationSlug, projectId } = options;
|
|
21333
|
+
return agentTool({
|
|
21334
|
+
description: "Get available tags and fields for issue events to understand what filters are available",
|
|
21335
|
+
parameters: zod.z.object({}),
|
|
21336
|
+
execute: async () => {
|
|
21337
|
+
const tagsResponse = await apiService.listTags({
|
|
21338
|
+
organizationSlug,
|
|
21339
|
+
dataset: "events",
|
|
21340
|
+
project: projectId,
|
|
21341
|
+
statsPeriod: "14d",
|
|
21342
|
+
useCache: true,
|
|
21343
|
+
useFlagsBackend: true
|
|
21344
|
+
});
|
|
21345
|
+
const availableTags = {};
|
|
21346
|
+
for (const tag of tagsResponse) if (tag.key) {
|
|
21347
|
+
const knownTagDescription = ISSUE_EVENT_TAGS[tag.key];
|
|
21348
|
+
availableTags[tag.key] = tag.name || knownTagDescription || tag.key;
|
|
21349
|
+
}
|
|
21350
|
+
const allTags = {
|
|
21351
|
+
...ISSUE_EVENT_TAGS,
|
|
21352
|
+
...availableTags
|
|
21353
|
+
};
|
|
21354
|
+
return `Available Tags and Fields (${Object.keys(allTags).length} total):
|
|
21355
|
+
|
|
21356
|
+
Common Tags:
|
|
21357
|
+
${Object.entries(ISSUE_EVENT_TAGS).slice(0, 30).map(([key, desc]) => `- ${key}: ${desc}`).join("\n")}
|
|
21358
|
+
${Object.keys(ISSUE_EVENT_TAGS).length > 30 ? `\n... and ${Object.keys(ISSUE_EVENT_TAGS).length - 30} more common tags` : ""}
|
|
21359
|
+
|
|
21360
|
+
Project-Specific Tags (from API):
|
|
21361
|
+
${Object.entries(availableTags).filter(([key]) => !ISSUE_EVENT_TAGS[key]).slice(0, 20).map(([key, desc]) => `- ${key}: ${desc}`).join("\n")}
|
|
21362
|
+
|
|
21363
|
+
Recommended Fields for Results:
|
|
21364
|
+
${RECOMMENDED_FIELDS$1.map((f) => `- ${f}`).join("\n")}
|
|
21365
|
+
|
|
21366
|
+
EXAMPLE QUERIES:
|
|
21367
|
+
${EXAMPLE_QUERIES.map((ex) => `- "${ex.description}" →\n ${JSON.stringify(ex.output, null, 2)}`).join("\n\n")}
|
|
21368
|
+
|
|
21369
|
+
IMPORTANT:
|
|
21370
|
+
- Use these tag names exactly as shown in your query
|
|
21371
|
+
- Tags are case-insensitive
|
|
21372
|
+
- Use wildcards with quotes: url:"*/checkout/*"
|
|
21373
|
+
- Your query should NOT include "issue:" prefix - the handler adds it automatically`;
|
|
21374
|
+
}
|
|
21375
|
+
});
|
|
21376
|
+
}
|
|
21377
|
+
/**
|
|
21378
|
+
* Parse issue parameters from various input formats
|
|
21379
|
+
* Supports both direct issueId/organizationSlug and issueUrl parsing
|
|
21380
|
+
*/
|
|
21381
|
+
function parseIssueParams(params) {
|
|
21382
|
+
if (params.issueUrl) {
|
|
21383
|
+
const orgMatch = params.issueUrl.match(/\/organizations\/([^/]+)\/issues\/([^/?]+)/) || params.issueUrl.match(/https?:\/\/([^.]+)\.sentry\.io\/issues\/([^/?]+)/);
|
|
21384
|
+
if (!orgMatch) throw new UserInputError(`Invalid issue URL format. Expected format like:
|
|
21385
|
+
- https://sentry.io/organizations/my-org/issues/123/
|
|
21386
|
+
- https://my-org.sentry.io/issues/123/
|
|
21387
|
+
|
|
21388
|
+
Received: ${params.issueUrl}`);
|
|
21389
|
+
return {
|
|
21390
|
+
organizationSlug: orgMatch[1],
|
|
21391
|
+
issueId: orgMatch[2]
|
|
21392
|
+
};
|
|
21393
|
+
}
|
|
21394
|
+
if (!params.issueId) throw new UserInputError("Must provide either issueUrl or issueId parameter. Use issueUrl for convenience, or provide both issueId and organizationSlug.");
|
|
21395
|
+
if (!params.organizationSlug) throw new UserInputError("When using issueId parameter, organizationSlug is required. Alternatively, provide issueUrl which includes both organization and issue ID.");
|
|
21396
|
+
return {
|
|
21397
|
+
organizationSlug: params.organizationSlug,
|
|
21398
|
+
issueId: params.issueId
|
|
21399
|
+
};
|
|
21400
|
+
}
|
|
21401
|
+
|
|
21402
|
+
//#endregion
|
|
21403
|
+
//#region ../mcp-core/dist/agent-CuQeP0Og.js
|
|
21404
|
+
const searchIssueEventsAgentOutputSchema = zod.z.object({
|
|
21405
|
+
query: zod.z.string().describe("Sentry query filters for tags/fields (NOT including issue: prefix - handler adds that)"),
|
|
21406
|
+
fields: zod.z.array(zod.z.string()).describe("Array of field names to return in results"),
|
|
21407
|
+
sort: zod.z.string().describe("Sort parameter for results (e.g., -timestamp)"),
|
|
21408
|
+
timeRange: zod.z.union([
|
|
21409
|
+
zod.z.object({ statsPeriod: zod.z.string().describe("Relative time period like '1h', '24h', '7d', '14d'") }),
|
|
21410
|
+
zod.z.object({
|
|
21411
|
+
start: zod.z.string().describe("ISO 8601 start time"),
|
|
21412
|
+
end: zod.z.string().describe("ISO 8601 end time")
|
|
21413
|
+
}),
|
|
21414
|
+
zod.z.null()
|
|
21415
|
+
]).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."),
|
|
21416
|
+
explanation: zod.z.string().describe("Brief explanation of how you translated this query")
|
|
21417
|
+
}).refine((data) => {
|
|
21418
|
+
if (!data.sort || !data.fields || data.fields.length === 0) return true;
|
|
21419
|
+
const sortField = data.sort.startsWith("-") ? data.sort.substring(1) : data.sort;
|
|
21420
|
+
return data.fields.includes(sortField);
|
|
21421
|
+
}, { 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." });
|
|
21422
|
+
/**
|
|
21423
|
+
* Search issue events agent - translates natural language queries to Sentry tag filters for events within a specific issue
|
|
21424
|
+
* Returns both the translated query result AND the tool calls made by the agent
|
|
21425
|
+
*/
|
|
21426
|
+
async function searchIssueEventsAgent(options) {
|
|
21427
|
+
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for natural language query translation");
|
|
21428
|
+
const issueEventFieldsTool = createIssueEventFieldsTool({
|
|
21429
|
+
apiService: options.apiService,
|
|
21430
|
+
organizationSlug: options.organizationSlug,
|
|
21431
|
+
projectId: options.projectId
|
|
21432
|
+
});
|
|
21433
|
+
const whoamiTool = createWhoamiTool({ apiService: options.apiService });
|
|
21434
|
+
return await callEmbeddedAgent({
|
|
21435
|
+
system: systemPrompt$2,
|
|
21436
|
+
prompt: options.query,
|
|
21437
|
+
tools: {
|
|
21438
|
+
issueEventFields: issueEventFieldsTool,
|
|
21439
|
+
whoami: whoamiTool
|
|
21440
|
+
},
|
|
21441
|
+
schema: searchIssueEventsAgentOutputSchema
|
|
21442
|
+
});
|
|
21443
|
+
}
|
|
21444
|
+
|
|
21445
|
+
//#endregion
|
|
21446
|
+
//#region ../mcp-core/dist/handler-Ca256WDv.js
|
|
21447
|
+
var handler_default$2 = defineTool({
|
|
21448
|
+
name: "search_issue_events",
|
|
21449
|
+
skills: ["inspect", "triage"],
|
|
21450
|
+
requiredScopes: ["event:read"],
|
|
21451
|
+
description: [
|
|
21452
|
+
"Search and filter events within a specific issue using natural language queries.",
|
|
21453
|
+
"",
|
|
21454
|
+
"Use this to filter events by time, environment, release, user, trace ID, or other tags. The tool automatically constrains results to the specified issue.",
|
|
21455
|
+
"",
|
|
21456
|
+
"For cross-issue searches use search_issues, for single event details use get_issue_details.",
|
|
21457
|
+
"",
|
|
21458
|
+
"<examples>",
|
|
21459
|
+
"search_issue_events(issueId='MCP-41', organizationSlug='my-org', naturalLanguageQuery='from last hour')",
|
|
21460
|
+
"search_issue_events(issueUrl='https://sentry.io/.../issues/123/', naturalLanguageQuery='production with release v1.0')",
|
|
21461
|
+
"</examples>"
|
|
21462
|
+
].join("\n"),
|
|
21463
|
+
inputSchema: {
|
|
21464
|
+
organizationSlug: ParamOrganizationSlug.nullable().default(null).describe("Organization slug. Required when using issueId. Not needed when using issueUrl."),
|
|
21465
|
+
issueId: zod.z.string().optional().describe("Issue ID (e.g., 'MCP-41', 'PROJECT-123'). Requires organizationSlug. Alternatively, use issueUrl."),
|
|
21466
|
+
issueUrl: zod.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."),
|
|
21467
|
+
naturalLanguageQuery: zod.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'"),
|
|
21468
|
+
projectSlug: ParamProjectSlug.nullable().default(null).describe("Project slug for better tag discovery. Optional - helps find project-specific tags."),
|
|
21469
|
+
regionUrl: ParamRegionUrl.nullable().default(null).describe("Sentry region URL. Optional - defaults to main region."),
|
|
21470
|
+
limit: zod.z.number().min(1).max(100).default(50).describe("Maximum number of events to return (1-100, default: 50)"),
|
|
21471
|
+
includeExplanation: zod.z.boolean().default(false).describe("Include explanation of how the natural language query was translated to Sentry syntax")
|
|
21472
|
+
},
|
|
21473
|
+
annotations: {
|
|
21474
|
+
readOnlyHint: true,
|
|
21475
|
+
openWorldHint: true
|
|
21476
|
+
},
|
|
21477
|
+
async handler(params, context$1) {
|
|
21478
|
+
const { organizationSlug, issueId } = parseIssueParams({
|
|
21479
|
+
organizationSlug: params.organizationSlug,
|
|
21480
|
+
issueId: params.issueId,
|
|
21481
|
+
issueUrl: params.issueUrl
|
|
21482
|
+
});
|
|
21483
|
+
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
21484
|
+
(0, __sentry_core.setTag)("organization.slug", organizationSlug);
|
|
21485
|
+
(0, __sentry_core.setTag)("issue.id", issueId);
|
|
21486
|
+
if (params.projectSlug) (0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
21487
|
+
let projectId;
|
|
21488
|
+
if (params.projectSlug) try {
|
|
21489
|
+
const project = await apiService.getProject({
|
|
21490
|
+
organizationSlug,
|
|
21491
|
+
projectSlugOrId: params.projectSlug
|
|
21492
|
+
});
|
|
21493
|
+
projectId = String(project.id);
|
|
21494
|
+
} catch (error) {
|
|
21495
|
+
console.warn(`Could not resolve project ${params.projectSlug}:`, error);
|
|
21496
|
+
}
|
|
21497
|
+
const agentResult = await searchIssueEventsAgent({
|
|
21498
|
+
query: params.naturalLanguageQuery,
|
|
21499
|
+
organizationSlug,
|
|
21500
|
+
apiService,
|
|
21501
|
+
projectId
|
|
21502
|
+
});
|
|
21503
|
+
const parsed = agentResult.result;
|
|
21504
|
+
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).`);
|
|
21505
|
+
const query = parsed.query || "";
|
|
21506
|
+
const requestedFields = parsed.fields || [];
|
|
21507
|
+
const fields = requestedFields.length > 0 ? requestedFields : RECOMMENDED_FIELDS$1;
|
|
21508
|
+
const sortParam = parsed.sort;
|
|
21509
|
+
const timeParams = {};
|
|
21510
|
+
if (parsed.timeRange) {
|
|
21511
|
+
if ("statsPeriod" in parsed.timeRange) timeParams.statsPeriod = parsed.timeRange.statsPeriod;
|
|
21512
|
+
else if ("start" in parsed.timeRange && "end" in parsed.timeRange) {
|
|
21513
|
+
timeParams.start = parsed.timeRange.start;
|
|
21514
|
+
timeParams.end = parsed.timeRange.end;
|
|
21515
|
+
}
|
|
21516
|
+
} else timeParams.statsPeriod = "14d";
|
|
21517
|
+
const eventsResponse = await apiService.listEventsForIssue({
|
|
21518
|
+
organizationSlug,
|
|
21519
|
+
issueId,
|
|
21520
|
+
query,
|
|
21521
|
+
limit: params.limit,
|
|
21522
|
+
sort: sortParam,
|
|
21523
|
+
...timeParams
|
|
21524
|
+
});
|
|
21525
|
+
const explorerQuery = query ? `issue:${issueId} ${query}` : `issue:${issueId}`;
|
|
21526
|
+
const explorerUrl = apiService.getEventsExplorerUrl(organizationSlug, explorerQuery, projectId, "errors", fields, sortParam, [], [], timeParams.statsPeriod, timeParams.start, timeParams.end);
|
|
21527
|
+
function isValidEventArray(data) {
|
|
21528
|
+
return Array.isArray(data) && data.every((item) => typeof item === "object" && item !== null);
|
|
21529
|
+
}
|
|
21530
|
+
if (!isValidEventArray(eventsResponse)) throw new Error("Invalid event data format from Sentry API: expected array of objects");
|
|
21531
|
+
const eventData = eventsResponse;
|
|
21532
|
+
const naturalLanguageContext = `Events in issue ${issueId}: ${params.naturalLanguageQuery}`;
|
|
21533
|
+
return formatErrorResults({
|
|
21534
|
+
eventData,
|
|
21535
|
+
naturalLanguageQuery: naturalLanguageContext,
|
|
21536
|
+
includeExplanation: params.includeExplanation,
|
|
21537
|
+
apiService,
|
|
21538
|
+
organizationSlug,
|
|
21539
|
+
explorerUrl,
|
|
21540
|
+
sentryQuery: explorerQuery,
|
|
21541
|
+
fields,
|
|
21542
|
+
explanation: parsed.explanation
|
|
21543
|
+
});
|
|
21544
|
+
}
|
|
21545
|
+
});
|
|
21546
|
+
|
|
21547
|
+
//#endregion
|
|
21548
|
+
//#region ../mcp-core/dist/config-eV2du5VJ.js
|
|
20971
21549
|
/**
|
|
20972
21550
|
* Configuration for the use_sentry embedded agent.
|
|
20973
21551
|
*
|
|
@@ -20986,7 +21564,7 @@ The user may include various parameters to pass to those tools in their prompt.
|
|
|
20986
21564
|
You MUST return tool results directly without interpreting them.`;
|
|
20987
21565
|
|
|
20988
21566
|
//#endregion
|
|
20989
|
-
//#region ../mcp-core/dist/agent-
|
|
21567
|
+
//#region ../mcp-core/dist/agent-DfZ797Yi.js
|
|
20990
21568
|
/**
|
|
20991
21569
|
* Output schema for the embedded agent.
|
|
20992
21570
|
* The agent returns the final result string directly from its tool calls.
|
|
@@ -21008,7 +21586,7 @@ async function useSentryAgent(options) {
|
|
|
21008
21586
|
}
|
|
21009
21587
|
|
|
21010
21588
|
//#endregion
|
|
21011
|
-
//#region ../mcp-core/dist/error-handling-
|
|
21589
|
+
//#region ../mcp-core/dist/error-handling-DrvyGci6.js
|
|
21012
21590
|
/**
|
|
21013
21591
|
* Type guard to identify user input validation errors.
|
|
21014
21592
|
*/
|
|
@@ -21099,7 +21677,7 @@ async function formatErrorForUser(error) {
|
|
|
21099
21677
|
}
|
|
21100
21678
|
|
|
21101
21679
|
//#endregion
|
|
21102
|
-
//#region ../mcp-core/dist/constraint-helpers-
|
|
21680
|
+
//#region ../mcp-core/dist/constraint-helpers-CCO6wSRb.js
|
|
21103
21681
|
/**
|
|
21104
21682
|
* Determines which tool parameter keys should be filtered out of the schema
|
|
21105
21683
|
* because they will be injected from constraints.
|
|
@@ -21161,7 +21739,7 @@ function getConstraintParametersToInject(constraints, toolInputSchema) {
|
|
|
21161
21739
|
}
|
|
21162
21740
|
|
|
21163
21741
|
//#endregion
|
|
21164
|
-
//#region ../mcp-core/dist/server-
|
|
21742
|
+
//#region ../mcp-core/dist/server-CAslpEs0.js
|
|
21165
21743
|
/**
|
|
21166
21744
|
* Format tool calls into a readable trace
|
|
21167
21745
|
*/
|
|
@@ -21180,7 +21758,7 @@ function formatToolCallTrace(toolCalls) {
|
|
|
21180
21758
|
}
|
|
21181
21759
|
return trace$1;
|
|
21182
21760
|
}
|
|
21183
|
-
var handler_default$
|
|
21761
|
+
var handler_default$3 = defineTool({
|
|
21184
21762
|
name: "use_sentry",
|
|
21185
21763
|
skills: [],
|
|
21186
21764
|
requiredScopes: [],
|
|
@@ -21271,7 +21849,8 @@ var tools_default = {
|
|
|
21271
21849
|
search_docs: search_docs_default,
|
|
21272
21850
|
get_doc: get_doc_default,
|
|
21273
21851
|
search_issues: handler_default$1,
|
|
21274
|
-
|
|
21852
|
+
search_issue_events: handler_default$2,
|
|
21853
|
+
use_sentry: handler_default$3
|
|
21275
21854
|
};
|
|
21276
21855
|
/**
|
|
21277
21856
|
* Creates and configures a complete MCP server with Sentry instrumentation.
|
|
@@ -21413,7 +21992,7 @@ function configureServer({ server: server$1, context: context$1, agentMode = fal
|
|
|
21413
21992
|
}
|
|
21414
21993
|
|
|
21415
21994
|
//#endregion
|
|
21416
|
-
//#region ../mcp-core/dist/sentry-
|
|
21995
|
+
//#region ../mcp-core/dist/sentry-Cfj4OGMQ.js
|
|
21417
21996
|
const SCRUB_PATTERNS = [
|
|
21418
21997
|
{
|
|
21419
21998
|
pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
|