@sentry/mcp-server 0.24.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/cli/parse.cjs +1 -1
- package/dist/cli/parse.d.cts +1 -1
- package/dist/cli/parse.d.cts.map +1 -1
- package/dist/cli/parse.d.ts +1 -1
- package/dist/cli/parse.d.ts.map +1 -1
- package/dist/cli/parse.js +1 -1
- package/dist/cli/resolve.cjs +1 -2
- package/dist/cli/resolve.d.cts +2 -3
- package/dist/cli/resolve.d.cts.map +1 -1
- package/dist/cli/resolve.d.ts +2 -3
- package/dist/cli/resolve.d.ts.map +1 -1
- package/dist/cli/resolve.js +2 -2
- package/dist/cli/types.d.cts +1 -1
- package/dist/cli/types.d.ts +1 -1
- package/dist/cli/usage.cjs +1 -1
- package/dist/cli/usage.d.cts +1 -2
- package/dist/cli/usage.d.cts.map +1 -1
- package/dist/cli/usage.d.ts +1 -2
- package/dist/cli/usage.d.ts.map +1 -1
- package/dist/cli/usage.js +1 -1
- package/dist/config-BEgU9ylR.js +3 -0
- package/dist/{config-DtimzxvV-D3ccpxhQ.cjs → config-BoFBjXRq-CGHqlnJ9.cjs} +296 -4
- package/dist/config-BoFBjXRq-CGHqlnJ9.cjs.map +1 -0
- package/dist/{config-DtimzxvV-BItTrGiz.js → config-BoFBjXRq-CMdBQOkQ.js} +291 -5
- package/dist/config-BoFBjXRq-CMdBQOkQ.js.map +1 -0
- package/dist/config-rZ982IEm.cjs +7 -0
- package/dist/index.cjs +921 -173
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +917 -169
- package/dist/index.js.map +1 -1
- package/dist/{parse-Dn9XeQSj.js → parse-46t_fITC.js} +2 -26
- package/dist/parse-46t_fITC.js.map +1 -0
- package/dist/{parse-By6nDBNs.cjs → parse-BjIH83SX.cjs} +2 -26
- package/dist/parse-BjIH83SX.cjs.map +1 -0
- package/dist/resolve-CdTP9riu.cjs +286 -0
- package/dist/resolve-CdTP9riu.cjs.map +1 -0
- package/dist/resolve-Cg3SH2zt.js +232 -0
- package/dist/resolve-Cg3SH2zt.js.map +1 -0
- package/dist/{stdio-Cp-EJZB9.js → stdio-C47PFfCl.js} +4 -4
- package/dist/{stdio-Cp-EJZB9.js.map → stdio-C47PFfCl.js.map} +1 -1
- package/dist/{stdio-iRuX-anh.cjs → stdio-DFfz0_Ua.cjs} +4 -4
- package/dist/{stdio-iRuX-anh.cjs.map → stdio-DFfz0_Ua.cjs.map} +1 -1
- package/dist/transports/stdio.cjs +1 -1
- package/dist/transports/stdio.js +1 -1
- package/dist/{types-CM88pHH_.d.ts → types-D5f00mg9.d.ts} +2 -11
- package/dist/types-D5f00mg9.d.ts.map +1 -0
- package/dist/{types-CnLRMjvf.d.cts → types-DpmAC3S8.d.cts} +2 -11
- package/dist/types-DpmAC3S8.d.cts.map +1 -0
- package/dist/{usage-DMGbIpV-.js → usage-BzYvqaru.js} +3 -11
- package/dist/usage-BzYvqaru.js.map +1 -0
- package/dist/{usage-iwGZsu3a.cjs → usage-DD58xBe3.cjs} +3 -11
- package/dist/usage-DD58xBe3.cjs.map +1 -0
- package/package.json +7 -6
- package/dist/config-Bs1p6XwV.js +0 -3
- package/dist/config-DFewJLVx.cjs +0 -6
- package/dist/config-DtimzxvV-BItTrGiz.js.map +0 -1
- package/dist/config-DtimzxvV-D3ccpxhQ.cjs.map +0 -1
- package/dist/parse-By6nDBNs.cjs.map +0 -1
- package/dist/parse-Dn9XeQSj.js.map +0 -1
- package/dist/resolve-BCdS4js5.js +0 -590
- package/dist/resolve-BCdS4js5.js.map +0 -1
- package/dist/resolve-BMmRdCFJ.cjs +0 -692
- package/dist/resolve-BMmRdCFJ.cjs.map +0 -1
- package/dist/types-CM88pHH_.d.ts.map +0 -1
- package/dist/types-CnLRMjvf.d.cts.map +0 -1
- package/dist/usage-DMGbIpV-.js.map +0 -1
- package/dist/usage-iwGZsu3a.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,18 +1,194 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_chunk = require('./chunk-DoeelZqw.cjs');
|
|
3
|
-
const require_resolve = require('./resolve-
|
|
4
|
-
const require_stdio = require('./stdio-
|
|
5
|
-
const
|
|
6
|
-
const require_usage = require('./usage-
|
|
7
|
-
const require_parse = require('./parse-
|
|
3
|
+
const require_resolve = require('./resolve-CdTP9riu.cjs');
|
|
4
|
+
const require_stdio = require('./stdio-DFfz0_Ua.cjs');
|
|
5
|
+
const require_config_BoFBjXRq = require('./config-BoFBjXRq-CGHqlnJ9.cjs');
|
|
6
|
+
const require_usage = require('./usage-DD58xBe3.cjs');
|
|
7
|
+
const require_parse = require('./parse-BjIH83SX.cjs');
|
|
8
8
|
const zod = require_chunk.__toESM(require("zod"));
|
|
9
9
|
const node_util = require_chunk.__toESM(require("node:util"));
|
|
10
10
|
const __sentry_core = require_chunk.__toESM(require("@sentry/core"));
|
|
11
|
-
const __sentry_node = require_chunk.__toESM(require("@sentry/node"));
|
|
12
11
|
const zod_v3 = require_chunk.__toESM(require("zod/v3"));
|
|
13
12
|
const __modelcontextprotocol_sdk_server_mcp_js = require_chunk.__toESM(require("@modelcontextprotocol/sdk/server/mcp.js"));
|
|
14
13
|
const __modelcontextprotocol_sdk_inMemory_js = require_chunk.__toESM(require("@modelcontextprotocol/sdk/inMemory.js"));
|
|
14
|
+
const __sentry_node = require_chunk.__toESM(require("@sentry/node"));
|
|
15
15
|
|
|
16
|
+
//#region ../mcp-core/dist/constants-D8axTonA.js
|
|
17
|
+
/**
|
|
18
|
+
* Constants for Sentry MCP server.
|
|
19
|
+
*
|
|
20
|
+
* Defines platform and framework combinations available in Sentry documentation.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* MCP Server identification
|
|
24
|
+
*/
|
|
25
|
+
const MCP_SERVER_NAME = "Sentry MCP";
|
|
26
|
+
/**
|
|
27
|
+
* Allowed region domains for sentry.io
|
|
28
|
+
* Only these specific domains are permitted when using Sentry's cloud service
|
|
29
|
+
* This is used to prevent SSRF attacks by restricting regionUrl to known domains
|
|
30
|
+
*/
|
|
31
|
+
const SENTRY_ALLOWED_REGION_DOMAINS = new Set([
|
|
32
|
+
"sentry.io",
|
|
33
|
+
"us.sentry.io",
|
|
34
|
+
"de.sentry.io"
|
|
35
|
+
]);
|
|
36
|
+
/**
|
|
37
|
+
* Common Sentry platforms that have documentation available
|
|
38
|
+
*/
|
|
39
|
+
const SENTRY_PLATFORMS_BASE = [
|
|
40
|
+
"javascript",
|
|
41
|
+
"python",
|
|
42
|
+
"java",
|
|
43
|
+
"dotnet",
|
|
44
|
+
"go",
|
|
45
|
+
"php",
|
|
46
|
+
"ruby",
|
|
47
|
+
"android",
|
|
48
|
+
"apple",
|
|
49
|
+
"unity",
|
|
50
|
+
"unreal",
|
|
51
|
+
"rust",
|
|
52
|
+
"elixir",
|
|
53
|
+
"kotlin",
|
|
54
|
+
"native",
|
|
55
|
+
"dart",
|
|
56
|
+
"godot",
|
|
57
|
+
"nintendo-switch",
|
|
58
|
+
"playstation",
|
|
59
|
+
"powershell",
|
|
60
|
+
"react-native",
|
|
61
|
+
"xbox"
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* Platform-specific frameworks that have Sentry guides
|
|
65
|
+
*/
|
|
66
|
+
const SENTRY_FRAMEWORKS = {
|
|
67
|
+
javascript: [
|
|
68
|
+
"nextjs",
|
|
69
|
+
"react",
|
|
70
|
+
"gatsby",
|
|
71
|
+
"remix",
|
|
72
|
+
"vue",
|
|
73
|
+
"angular",
|
|
74
|
+
"hono",
|
|
75
|
+
"svelte",
|
|
76
|
+
"express",
|
|
77
|
+
"fastify",
|
|
78
|
+
"astro",
|
|
79
|
+
"bun",
|
|
80
|
+
"capacitor",
|
|
81
|
+
"cloudflare",
|
|
82
|
+
"connect",
|
|
83
|
+
"cordova",
|
|
84
|
+
"deno",
|
|
85
|
+
"electron",
|
|
86
|
+
"ember",
|
|
87
|
+
"nuxt",
|
|
88
|
+
"solid",
|
|
89
|
+
"solidstart",
|
|
90
|
+
"sveltekit",
|
|
91
|
+
"tanstack-react",
|
|
92
|
+
"wasm",
|
|
93
|
+
"node",
|
|
94
|
+
"koa",
|
|
95
|
+
"nestjs",
|
|
96
|
+
"hapi"
|
|
97
|
+
],
|
|
98
|
+
python: [
|
|
99
|
+
"django",
|
|
100
|
+
"flask",
|
|
101
|
+
"fastapi",
|
|
102
|
+
"celery",
|
|
103
|
+
"tornado",
|
|
104
|
+
"pyramid",
|
|
105
|
+
"aiohttp",
|
|
106
|
+
"anthropic",
|
|
107
|
+
"airflow",
|
|
108
|
+
"aws-lambda",
|
|
109
|
+
"boto3",
|
|
110
|
+
"bottle",
|
|
111
|
+
"chalice",
|
|
112
|
+
"dramatiq",
|
|
113
|
+
"falcon",
|
|
114
|
+
"langchain",
|
|
115
|
+
"litestar",
|
|
116
|
+
"logging",
|
|
117
|
+
"loguru",
|
|
118
|
+
"openai",
|
|
119
|
+
"quart",
|
|
120
|
+
"ray",
|
|
121
|
+
"redis",
|
|
122
|
+
"rq",
|
|
123
|
+
"sanic",
|
|
124
|
+
"sqlalchemy",
|
|
125
|
+
"starlette"
|
|
126
|
+
],
|
|
127
|
+
dart: ["flutter"],
|
|
128
|
+
dotnet: [
|
|
129
|
+
"aspnetcore",
|
|
130
|
+
"maui",
|
|
131
|
+
"wpf",
|
|
132
|
+
"winforms",
|
|
133
|
+
"aspnet",
|
|
134
|
+
"aws-lambda",
|
|
135
|
+
"azure-functions",
|
|
136
|
+
"blazor-webassembly",
|
|
137
|
+
"entityframework",
|
|
138
|
+
"google-cloud-functions",
|
|
139
|
+
"extensions-logging",
|
|
140
|
+
"log4net",
|
|
141
|
+
"nlog",
|
|
142
|
+
"serilog",
|
|
143
|
+
"uwp",
|
|
144
|
+
"xamarin"
|
|
145
|
+
],
|
|
146
|
+
java: [
|
|
147
|
+
"spring",
|
|
148
|
+
"spring-boot",
|
|
149
|
+
"android",
|
|
150
|
+
"jul",
|
|
151
|
+
"log4j2",
|
|
152
|
+
"logback",
|
|
153
|
+
"servlet"
|
|
154
|
+
],
|
|
155
|
+
go: [
|
|
156
|
+
"echo",
|
|
157
|
+
"fasthttp",
|
|
158
|
+
"fiber",
|
|
159
|
+
"gin",
|
|
160
|
+
"http",
|
|
161
|
+
"iris",
|
|
162
|
+
"logrus",
|
|
163
|
+
"negroni",
|
|
164
|
+
"slog",
|
|
165
|
+
"zerolog"
|
|
166
|
+
],
|
|
167
|
+
php: ["laravel", "symfony"],
|
|
168
|
+
ruby: [
|
|
169
|
+
"delayed_job",
|
|
170
|
+
"rack",
|
|
171
|
+
"rails",
|
|
172
|
+
"resque",
|
|
173
|
+
"sidekiq"
|
|
174
|
+
],
|
|
175
|
+
android: ["kotlin"],
|
|
176
|
+
apple: [
|
|
177
|
+
"ios",
|
|
178
|
+
"macos",
|
|
179
|
+
"watchos",
|
|
180
|
+
"tvos",
|
|
181
|
+
"visionos"
|
|
182
|
+
],
|
|
183
|
+
kotlin: ["multiplatform"]
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* All valid guides for Sentry docs search filtering.
|
|
187
|
+
* A guide can be either a platform (e.g., 'javascript') or a platform/framework combination (e.g., 'javascript/nextjs').
|
|
188
|
+
*/
|
|
189
|
+
const SENTRY_GUIDES = [...SENTRY_PLATFORMS_BASE, ...Object.entries(SENTRY_FRAMEWORKS).flatMap(([platform, guides]) => guides.map((guide) => `${platform}/${guide}`))];
|
|
190
|
+
|
|
191
|
+
//#endregion
|
|
16
192
|
//#region ../mcp-core/dist/errors-BXmNwD2K.js
|
|
17
193
|
/**
|
|
18
194
|
* Error thrown when user input validation fails.
|
|
@@ -37,7 +213,7 @@ var ConfigurationError = class extends Error {
|
|
|
37
213
|
};
|
|
38
214
|
|
|
39
215
|
//#endregion
|
|
40
|
-
//#region ../mcp-core/dist/slug-validation-
|
|
216
|
+
//#region ../mcp-core/dist/slug-validation-BdDL1fV5.js
|
|
41
217
|
/**
|
|
42
218
|
* Maximum reasonable length for a slug.
|
|
43
219
|
*/
|
|
@@ -126,7 +302,7 @@ function validateSlugOrId(val, ctx) {
|
|
|
126
302
|
}
|
|
127
303
|
|
|
128
304
|
//#endregion
|
|
129
|
-
//#region ../mcp-core/dist/schema-
|
|
305
|
+
//#region ../mcp-core/dist/schema-Bl7AGsln.js
|
|
130
306
|
const ParamOrganizationSlug = zod.z.string().toLowerCase().trim().superRefine(validateSlug).describe("The organization's slug. You can find a existing list of organizations you have access to using the `find_organizations()` tool.");
|
|
131
307
|
const ParamTeamSlug = zod.z.string().toLowerCase().trim().superRefine(validateSlug).describe("The team's slug. You can find a list of existing teams in an organization using the `find_teams()` tool.");
|
|
132
308
|
const ParamProjectSlug = zod.z.string().toLowerCase().trim().superRefine(validateSlug).describe("The project's slug. You can find a list of existing projects in an organization using the `find_projects()` tool.");
|
|
@@ -154,12 +330,12 @@ const ParamIssueStatus = zod.z.enum([
|
|
|
154
330
|
"ignored"
|
|
155
331
|
]).describe("The new status for the issue. Valid values are 'resolved', 'resolvedInNextRelease', 'unresolved', and 'ignored'.");
|
|
156
332
|
const ParamAssignedTo = zod.z.string().trim().describe("The assignee in format 'user:ID' or 'team:ID' where ID is numeric. Example: 'user:123456' or 'team:789'. Use the whoami tool to find your user ID.");
|
|
157
|
-
const ParamSentryGuide = zod.z.enum(
|
|
333
|
+
const ParamSentryGuide = zod.z.enum(SENTRY_GUIDES).describe("Optional guide filter to limit search results to specific documentation sections. Use either a platform (e.g., 'javascript', 'python') or platform/guide combination (e.g., 'javascript/nextjs', 'python/django').");
|
|
158
334
|
const ParamEventId = zod.z.string().trim().describe("The ID of the event.");
|
|
159
335
|
const ParamAttachmentId = zod.z.string().trim().describe("The ID of the attachment to download.");
|
|
160
336
|
|
|
161
337
|
//#endregion
|
|
162
|
-
//#region ../mcp-core/dist/define-
|
|
338
|
+
//#region ../mcp-core/dist/define-vgYYpneQ.js
|
|
163
339
|
function defineTool(config) {
|
|
164
340
|
return config;
|
|
165
341
|
}
|
|
@@ -316,8 +492,8 @@ var LoggerImpl = class LoggerImpl$1 {
|
|
|
316
492
|
*/
|
|
317
493
|
resetDescendants() {
|
|
318
494
|
for (const child of Object.values(this.children)) {
|
|
319
|
-
const logger$
|
|
320
|
-
if (logger$
|
|
495
|
+
const logger$2 = child instanceof LoggerImpl$1 ? child : child.deref();
|
|
496
|
+
if (logger$2 != null) logger$2.resetDescendants();
|
|
321
497
|
}
|
|
322
498
|
this.reset();
|
|
323
499
|
}
|
|
@@ -481,8 +657,8 @@ var LoggerImpl = class LoggerImpl$1 {
|
|
|
481
657
|
var LoggerCtx = class LoggerCtx$1 {
|
|
482
658
|
logger;
|
|
483
659
|
properties;
|
|
484
|
-
constructor(logger$
|
|
485
|
-
this.logger = logger$
|
|
660
|
+
constructor(logger$2, properties) {
|
|
661
|
+
this.logger = logger$2;
|
|
486
662
|
this.properties = properties;
|
|
487
663
|
}
|
|
488
664
|
get category() {
|
|
@@ -1232,20 +1408,20 @@ function configureInternal(config, allowAsync) {
|
|
|
1232
1408
|
const categoryKey = Array.isArray(cfg$1.category) ? JSON.stringify(cfg$1.category) : JSON.stringify([cfg$1.category]);
|
|
1233
1409
|
if (configuredCategories.has(categoryKey)) throw new ConfigError(`Duplicate logger configuration for category: ${categoryKey}. Each category can only be configured once.`);
|
|
1234
1410
|
configuredCategories.add(categoryKey);
|
|
1235
|
-
const logger$
|
|
1411
|
+
const logger$2 = LoggerImpl.getLogger(cfg$1.category);
|
|
1236
1412
|
for (const sinkId of cfg$1.sinks ?? []) {
|
|
1237
1413
|
const sink = config.sinks[sinkId];
|
|
1238
1414
|
if (!sink) throw new ConfigError(`Sink not found: ${sinkId}.`);
|
|
1239
|
-
logger$
|
|
1415
|
+
logger$2.sinks.push(sink);
|
|
1240
1416
|
}
|
|
1241
|
-
logger$
|
|
1242
|
-
if (cfg$1.lowestLevel !== void 0) logger$
|
|
1417
|
+
logger$2.parentSinks = cfg$1.parentSinks ?? "inherit";
|
|
1418
|
+
if (cfg$1.lowestLevel !== void 0) logger$2.lowestLevel = cfg$1.lowestLevel;
|
|
1243
1419
|
for (const filterId of cfg$1.filters ?? []) {
|
|
1244
1420
|
const filter$1 = config.filters?.[filterId];
|
|
1245
1421
|
if (filter$1 === void 0) throw new ConfigError(`Filter not found: ${filterId}.`);
|
|
1246
|
-
logger$
|
|
1422
|
+
logger$2.filters.push(toFilter(filter$1));
|
|
1247
1423
|
}
|
|
1248
|
-
strongRefs.add(logger$
|
|
1424
|
+
strongRefs.add(logger$2);
|
|
1249
1425
|
}
|
|
1250
1426
|
LoggerImpl.getLogger().contextLocalStorage = config.contextLocalStorage;
|
|
1251
1427
|
for (const sink of Object.values(config.sinks)) {
|
|
@@ -1329,7 +1505,7 @@ var ConfigError = class extends Error {
|
|
|
1329
1505
|
};
|
|
1330
1506
|
|
|
1331
1507
|
//#endregion
|
|
1332
|
-
//#region ../mcp-core/dist/logging-
|
|
1508
|
+
//#region ../mcp-core/dist/logging-BK_g0p3a.js
|
|
1333
1509
|
const ROOT_LOG_CATEGORY = ["sentry", "mcp"];
|
|
1334
1510
|
let loggingConfigured = false;
|
|
1335
1511
|
function resolveLowestLevel() {
|
|
@@ -1346,12 +1522,12 @@ function resolveLowestLevel() {
|
|
|
1346
1522
|
* (creating Issues), this sink uses Sentry.logger.* methods to send data to the
|
|
1347
1523
|
* Logs product.
|
|
1348
1524
|
*
|
|
1349
|
-
*
|
|
1350
|
-
*
|
|
1525
|
+
* This uses @sentry/core logger API which works across all platforms (Node.js,
|
|
1526
|
+
* Cloudflare Workers, etc.) as long as Sentry is initialized with the appropriate SDK.
|
|
1351
1527
|
*/
|
|
1352
1528
|
function createSentryLogsSink() {
|
|
1353
1529
|
return (record) => {
|
|
1354
|
-
if (!
|
|
1530
|
+
if (!__sentry_core.logger) return;
|
|
1355
1531
|
let message = "";
|
|
1356
1532
|
for (let i = 0; i < record.message.length; i++) if (i % 2 === 0) message += record.message[i];
|
|
1357
1533
|
else {
|
|
@@ -1361,24 +1537,24 @@ function createSentryLogsSink() {
|
|
|
1361
1537
|
const attributes$73 = record.properties;
|
|
1362
1538
|
switch (record.level) {
|
|
1363
1539
|
case "trace":
|
|
1364
|
-
|
|
1540
|
+
__sentry_core.logger.trace(message, attributes$73);
|
|
1365
1541
|
break;
|
|
1366
1542
|
case "debug":
|
|
1367
|
-
|
|
1543
|
+
__sentry_core.logger.debug(message, attributes$73);
|
|
1368
1544
|
break;
|
|
1369
1545
|
case "info":
|
|
1370
|
-
|
|
1546
|
+
__sentry_core.logger.info(message, attributes$73);
|
|
1371
1547
|
break;
|
|
1372
1548
|
case "warning":
|
|
1373
|
-
|
|
1549
|
+
__sentry_core.logger.warn(message, attributes$73);
|
|
1374
1550
|
break;
|
|
1375
1551
|
case "error":
|
|
1376
|
-
|
|
1552
|
+
__sentry_core.logger.error(message, attributes$73);
|
|
1377
1553
|
break;
|
|
1378
1554
|
case "fatal":
|
|
1379
|
-
|
|
1555
|
+
__sentry_core.logger.fatal(message, attributes$73);
|
|
1380
1556
|
break;
|
|
1381
|
-
default:
|
|
1557
|
+
default: __sentry_core.logger.info(message, attributes$73);
|
|
1382
1558
|
}
|
|
1383
1559
|
};
|
|
1384
1560
|
}
|
|
@@ -1415,8 +1591,8 @@ function ensureLoggingConfigured() {
|
|
|
1415
1591
|
function getLogger$1(scope, defaults) {
|
|
1416
1592
|
ensureLoggingConfigured();
|
|
1417
1593
|
const category = Array.isArray(scope) ? scope : [scope];
|
|
1418
|
-
const logger$
|
|
1419
|
-
return defaults ? logger$
|
|
1594
|
+
const logger$2 = getLogger([...ROOT_LOG_CATEGORY, ...category]);
|
|
1595
|
+
return defaults ? logger$2.with(defaults) : logger$2;
|
|
1420
1596
|
}
|
|
1421
1597
|
const ISSUE_LOGGER_SCOPE = ["runtime", "issues"];
|
|
1422
1598
|
function isRecord(value) {
|
|
@@ -1494,7 +1670,7 @@ function serializeError(value, depth = 0) {
|
|
|
1494
1670
|
}
|
|
1495
1671
|
return { message: coerceMessage(value) };
|
|
1496
1672
|
}
|
|
1497
|
-
const logger = getLogger$1([]);
|
|
1673
|
+
const logger$1 = getLogger$1([]);
|
|
1498
1674
|
const DEFAULT_LOGGER_SCOPE = [];
|
|
1499
1675
|
function buildLogProperties(level, options, serializedError) {
|
|
1500
1676
|
const properties = { severity: level };
|
|
@@ -1533,6 +1709,9 @@ function logWithLevel(level, value, contextsOrOptions) {
|
|
|
1533
1709
|
default: scopedLogger.info(message, () => properties);
|
|
1534
1710
|
}
|
|
1535
1711
|
}
|
|
1712
|
+
function logInfo(value, contextsOrOptions) {
|
|
1713
|
+
logWithLevel("info", value, contextsOrOptions);
|
|
1714
|
+
}
|
|
1536
1715
|
function logWarn(value, contextsOrOptions) {
|
|
1537
1716
|
logWithLevel("warning", value, contextsOrOptions);
|
|
1538
1717
|
}
|
|
@@ -1573,7 +1752,7 @@ function logIssue(error, contextsOrOptions, attachmentsArg) {
|
|
|
1573
1752
|
}
|
|
1574
1753
|
|
|
1575
1754
|
//#endregion
|
|
1576
|
-
//#region ../mcp-core/dist/schema-
|
|
1755
|
+
//#region ../mcp-core/dist/schema-BO1YtJIJ.js
|
|
1577
1756
|
/**
|
|
1578
1757
|
* Schema for Sentry API error responses.
|
|
1579
1758
|
*
|
|
@@ -2070,7 +2249,7 @@ const TraceIssueSchema = zod.z.object({
|
|
|
2070
2249
|
const TraceSchema = zod.z.array(zod.z.union([TraceSpanSchema, TraceIssueSchema]));
|
|
2071
2250
|
|
|
2072
2251
|
//#endregion
|
|
2073
|
-
//#region ../mcp-core/dist/errors-
|
|
2252
|
+
//#region ../mcp-core/dist/errors-ZBQnDL3L.js
|
|
2074
2253
|
/**
|
|
2075
2254
|
* API Error Class Hierarchy
|
|
2076
2255
|
*
|
|
@@ -2285,7 +2464,7 @@ function createApiError(message, status, detail, responseBody) {
|
|
|
2285
2464
|
}
|
|
2286
2465
|
|
|
2287
2466
|
//#endregion
|
|
2288
|
-
//#region ../mcp-core/dist/client-
|
|
2467
|
+
//#region ../mcp-core/dist/client-EbNZG3Z_.js
|
|
2289
2468
|
/**
|
|
2290
2469
|
* Mapping of common network error codes to user-friendly messages.
|
|
2291
2470
|
* These help users understand and resolve connection issues.
|
|
@@ -3116,6 +3295,26 @@ var SentryApiService = class {
|
|
|
3116
3295
|
eventId: "latest"
|
|
3117
3296
|
}, opts);
|
|
3118
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
|
+
}
|
|
3119
3318
|
async listEventAttachments({ organizationSlug, projectSlug, eventId }, opts) {
|
|
3120
3319
|
const body = await this.requestJSON(`/projects/${organizationSlug}/${projectSlug}/events/${eventId}/attachments/`, void 0, opts);
|
|
3121
3320
|
return EventAttachmentListSchema.parse(body);
|
|
@@ -3374,7 +3573,7 @@ var SentryApiService = class {
|
|
|
3374
3573
|
};
|
|
3375
3574
|
|
|
3376
3575
|
//#endregion
|
|
3377
|
-
//#region ../mcp-core/dist/validate-region-url-
|
|
3576
|
+
//#region ../mcp-core/dist/validate-region-url-BL1kR9T7.js
|
|
3378
3577
|
/**
|
|
3379
3578
|
* Validates that a regionUrl is valid.
|
|
3380
3579
|
* Prevents SSRF attacks by only allowing the base host itself or domains from an allowlist.
|
|
@@ -3401,12 +3600,12 @@ function validateRegionUrl(regionUrl, baseHost) {
|
|
|
3401
3600
|
const regionHost = parsedUrl.host.toLowerCase();
|
|
3402
3601
|
const baseLower = baseHost.toLowerCase();
|
|
3403
3602
|
if (regionHost === baseLower) return regionHost;
|
|
3404
|
-
if (!
|
|
3603
|
+
if (!SENTRY_ALLOWED_REGION_DOMAINS.has(regionHost)) throw new UserInputError(`Invalid regionUrl: ${regionUrl}. The domain '${regionHost}' is not allowed. Allowed domains are: ${Array.from(SENTRY_ALLOWED_REGION_DOMAINS).join(", ")}`);
|
|
3405
3604
|
return regionHost;
|
|
3406
3605
|
}
|
|
3407
3606
|
|
|
3408
3607
|
//#endregion
|
|
3409
|
-
//#region ../mcp-core/dist/api-
|
|
3608
|
+
//#region ../mcp-core/dist/api-C4iLorVN.js
|
|
3410
3609
|
/**
|
|
3411
3610
|
* Create a Sentry API service from server context with optional region override
|
|
3412
3611
|
* @param context - Server context containing host and access token
|
|
@@ -3427,7 +3626,7 @@ function apiServiceFromContext(context$1, opts = {}) {
|
|
|
3427
3626
|
}
|
|
3428
3627
|
|
|
3429
3628
|
//#endregion
|
|
3430
|
-
//#region ../mcp-core/dist/whoami-
|
|
3629
|
+
//#region ../mcp-core/dist/whoami-4TjhUF9I.js
|
|
3431
3630
|
var whoami_default = defineTool({
|
|
3432
3631
|
name: "whoami",
|
|
3433
3632
|
description: [
|
|
@@ -3437,7 +3636,7 @@ var whoami_default = defineTool({
|
|
|
3437
3636
|
"- Get the user's name and email address."
|
|
3438
3637
|
].join("\n"),
|
|
3439
3638
|
inputSchema: {},
|
|
3440
|
-
|
|
3639
|
+
skills: require_resolve.ALL_SKILLS,
|
|
3441
3640
|
requiredScopes: [],
|
|
3442
3641
|
annotations: {
|
|
3443
3642
|
readOnlyHint: true,
|
|
@@ -3460,11 +3659,11 @@ var whoami_default = defineTool({
|
|
|
3460
3659
|
});
|
|
3461
3660
|
|
|
3462
3661
|
//#endregion
|
|
3463
|
-
//#region ../mcp-core/dist/find-organizations-
|
|
3662
|
+
//#region ../mcp-core/dist/find-organizations-CY_CprTd.js
|
|
3464
3663
|
const RESULT_LIMIT$2 = 25;
|
|
3465
3664
|
var find_organizations_default = defineTool({
|
|
3466
3665
|
name: "find_organizations",
|
|
3467
|
-
|
|
3666
|
+
skills: require_resolve.ALL_SKILLS,
|
|
3468
3667
|
requiredScopes: ["org:read"],
|
|
3469
3668
|
description: [
|
|
3470
3669
|
"Find organizations that the user has access to in Sentry.",
|
|
@@ -3512,11 +3711,11 @@ var find_organizations_default = defineTool({
|
|
|
3512
3711
|
});
|
|
3513
3712
|
|
|
3514
3713
|
//#endregion
|
|
3515
|
-
//#region ../mcp-core/dist/find-teams-
|
|
3714
|
+
//#region ../mcp-core/dist/find-teams-D20sronT.js
|
|
3516
3715
|
const RESULT_LIMIT$1 = 25;
|
|
3517
3716
|
var find_teams_default = defineTool({
|
|
3518
3717
|
name: "find_teams",
|
|
3519
|
-
|
|
3718
|
+
skills: [
|
|
3520
3719
|
"inspect",
|
|
3521
3720
|
"triage",
|
|
3522
3721
|
"project-management"
|
|
@@ -3560,11 +3759,11 @@ var find_teams_default = defineTool({
|
|
|
3560
3759
|
});
|
|
3561
3760
|
|
|
3562
3761
|
//#endregion
|
|
3563
|
-
//#region ../mcp-core/dist/find-projects-
|
|
3762
|
+
//#region ../mcp-core/dist/find-projects-BIbLskbP.js
|
|
3564
3763
|
const RESULT_LIMIT = 25;
|
|
3565
3764
|
var find_projects_default = defineTool({
|
|
3566
3765
|
name: "find_projects",
|
|
3567
|
-
|
|
3766
|
+
skills: require_resolve.ALL_SKILLS,
|
|
3568
3767
|
requiredScopes: ["project:read"],
|
|
3569
3768
|
description: [
|
|
3570
3769
|
"Find projects in Sentry.",
|
|
@@ -3604,10 +3803,10 @@ var find_projects_default = defineTool({
|
|
|
3604
3803
|
});
|
|
3605
3804
|
|
|
3606
3805
|
//#endregion
|
|
3607
|
-
//#region ../mcp-core/dist/find-releases-
|
|
3806
|
+
//#region ../mcp-core/dist/find-releases-DddLqSmt.js
|
|
3608
3807
|
var find_releases_default = defineTool({
|
|
3609
3808
|
name: "find_releases",
|
|
3610
|
-
|
|
3809
|
+
skills: ["inspect"],
|
|
3611
3810
|
requiredScopes: ["project:read"],
|
|
3612
3811
|
description: [
|
|
3613
3812
|
"Find releases in Sentry.",
|
|
@@ -3695,7 +3894,7 @@ var find_releases_default = defineTool({
|
|
|
3695
3894
|
});
|
|
3696
3895
|
|
|
3697
3896
|
//#endregion
|
|
3698
|
-
//#region ../mcp-core/dist/issue-helpers-
|
|
3897
|
+
//#region ../mcp-core/dist/issue-helpers-DtCbXiRZ.js
|
|
3699
3898
|
/**
|
|
3700
3899
|
* Extracts the Sentry issue ID and organization slug from a full URL
|
|
3701
3900
|
*
|
|
@@ -3753,7 +3952,7 @@ function parseIssueId(issueId) {
|
|
|
3753
3952
|
* @returns Object containing the parsed organization slug and issue ID
|
|
3754
3953
|
* @throws Error if the input is invalid
|
|
3755
3954
|
*/
|
|
3756
|
-
function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
|
|
3955
|
+
function parseIssueParams$1({ issueUrl, issueId, organizationSlug }) {
|
|
3757
3956
|
if (issueUrl) {
|
|
3758
3957
|
const resolved = extractIssueId(issueUrl);
|
|
3759
3958
|
if (!resolved) throw new Error("Invalid Sentry issue URL. Path should contain '/issues/{issue_id}'");
|
|
@@ -3771,7 +3970,7 @@ function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
|
|
|
3771
3970
|
}
|
|
3772
3971
|
|
|
3773
3972
|
//#endregion
|
|
3774
|
-
//#region ../mcp-core/dist/seer-
|
|
3973
|
+
//#region ../mcp-core/dist/seer-CSFgx4AP.js
|
|
3775
3974
|
const SEER_POLLING_INTERVAL = 5e3;
|
|
3776
3975
|
const SEER_TIMEOUT = 5 * 60 * 1e3;
|
|
3777
3976
|
const SEER_MAX_RETRIES = 3;
|
|
@@ -3852,7 +4051,7 @@ function getOutputForAutofixStep(step) {
|
|
|
3852
4051
|
}
|
|
3853
4052
|
|
|
3854
4053
|
//#endregion
|
|
3855
|
-
//#region ../mcp-core/dist/formatting-
|
|
4054
|
+
//#region ../mcp-core/dist/formatting-BhgNMv3a.js
|
|
3856
4055
|
const LANGUAGE_EXTENSIONS = {
|
|
3857
4056
|
".java": "java",
|
|
3858
4057
|
".py": "python",
|
|
@@ -4816,11 +5015,12 @@ function formatIssueOutput({ organizationSlug, issue, event, apiService, autofix
|
|
|
4816
5015
|
output += "# Using this information\n\n";
|
|
4817
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`;
|
|
4818
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`;
|
|
4819
5019
|
return output;
|
|
4820
5020
|
}
|
|
4821
5021
|
|
|
4822
5022
|
//#endregion
|
|
4823
|
-
//#region ../mcp-core/dist/enhance-error-
|
|
5023
|
+
//#region ../mcp-core/dist/enhance-error-BzwoJ7V0.js
|
|
4824
5024
|
/**
|
|
4825
5025
|
* Enhances a 404 error with parameter context to help users understand what went wrong.
|
|
4826
5026
|
* This is optional - tools can use this when they want to provide extra context.
|
|
@@ -4848,10 +5048,10 @@ function enhanceNotFoundError(error, params) {
|
|
|
4848
5048
|
}
|
|
4849
5049
|
|
|
4850
5050
|
//#endregion
|
|
4851
|
-
//#region ../mcp-core/dist/get-issue-details-
|
|
5051
|
+
//#region ../mcp-core/dist/get-issue-details-Dv2HsHlt.js
|
|
4852
5052
|
var get_issue_details_default = defineTool({
|
|
4853
5053
|
name: "get_issue_details",
|
|
4854
|
-
|
|
5054
|
+
skills: [
|
|
4855
5055
|
"inspect",
|
|
4856
5056
|
"triage",
|
|
4857
5057
|
"seer"
|
|
@@ -4959,7 +5159,7 @@ var get_issue_details_default = defineTool({
|
|
|
4959
5159
|
}
|
|
4960
5160
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
4961
5161
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
4962
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
5162
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
4963
5163
|
organizationSlug: params.organizationSlug,
|
|
4964
5164
|
issueId: params.issueId,
|
|
4965
5165
|
issueUrl: params.issueUrl
|
|
@@ -5029,14 +5229,14 @@ function shouldFetchTraceForEvent(event) {
|
|
|
5029
5229
|
}
|
|
5030
5230
|
|
|
5031
5231
|
//#endregion
|
|
5032
|
-
//#region ../mcp-core/dist/get-trace-details-
|
|
5232
|
+
//#region ../mcp-core/dist/get-trace-details-QaT2N9BA.js
|
|
5033
5233
|
const MAX_DEPTH = 2;
|
|
5034
5234
|
const MINIMUM_DURATION_THRESHOLD_MS = 10;
|
|
5035
5235
|
const MIN_MEANINGFUL_CHILD_DURATION = 5;
|
|
5036
5236
|
const MIN_AVG_DURATION_MS = 5;
|
|
5037
5237
|
var get_trace_details_default = defineTool({
|
|
5038
5238
|
name: "get_trace_details",
|
|
5039
|
-
|
|
5239
|
+
skills: ["inspect"],
|
|
5040
5240
|
requiredScopes: ["event:read"],
|
|
5041
5241
|
description: [
|
|
5042
5242
|
"Get detailed information about a specific Sentry trace by ID.",
|
|
@@ -5328,10 +5528,10 @@ function formatTraceOutput({ organizationSlug, traceId, traceMeta, trace: trace$
|
|
|
5328
5528
|
}
|
|
5329
5529
|
|
|
5330
5530
|
//#endregion
|
|
5331
|
-
//#region ../mcp-core/dist/get-event-attachment-
|
|
5531
|
+
//#region ../mcp-core/dist/get-event-attachment-DdhoqwCO.js
|
|
5332
5532
|
var get_event_attachment_default = defineTool({
|
|
5333
5533
|
name: "get_event_attachment",
|
|
5334
|
-
|
|
5534
|
+
skills: ["inspect"],
|
|
5335
5535
|
requiredScopes: ["event:read"],
|
|
5336
5536
|
description: [
|
|
5337
5537
|
"Download attachments from a Sentry event.",
|
|
@@ -5464,7 +5664,7 @@ var get_event_attachment_default = defineTool({
|
|
|
5464
5664
|
});
|
|
5465
5665
|
|
|
5466
5666
|
//#endregion
|
|
5467
|
-
//#region ../mcp-core/dist/formatting-
|
|
5667
|
+
//#region ../mcp-core/dist/formatting-DJFcfTJG.js
|
|
5468
5668
|
/**
|
|
5469
5669
|
* Helper function to format assignedTo field for display
|
|
5470
5670
|
*/
|
|
@@ -5476,10 +5676,10 @@ function formatAssignedTo(assignedTo) {
|
|
|
5476
5676
|
}
|
|
5477
5677
|
|
|
5478
5678
|
//#endregion
|
|
5479
|
-
//#region ../mcp-core/dist/update-issue-
|
|
5679
|
+
//#region ../mcp-core/dist/update-issue-JybAx8DT.js
|
|
5480
5680
|
var update_issue_default = defineTool({
|
|
5481
5681
|
name: "update_issue",
|
|
5482
|
-
|
|
5682
|
+
skills: ["triage"],
|
|
5483
5683
|
requiredScopes: ["event:write"],
|
|
5484
5684
|
description: [
|
|
5485
5685
|
"Update an issue's status or assignment in Sentry. This allows you to resolve, ignore, or reassign issues.",
|
|
@@ -5544,7 +5744,7 @@ var update_issue_default = defineTool({
|
|
|
5544
5744
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
5545
5745
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
5546
5746
|
if (!params.status && !params.assignedTo) throw new UserInputError("At least one of `status` or `assignedTo` must be provided to update the issue");
|
|
5547
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
5747
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
5548
5748
|
organizationSlug: params.organizationSlug,
|
|
5549
5749
|
issueId: params.issueId,
|
|
5550
5750
|
issueUrl: params.issueUrl
|
|
@@ -8749,7 +8949,7 @@ function createOpenAI(options = {}) {
|
|
|
8749
8949
|
var openai = createOpenAI({ compatibility: "strict" });
|
|
8750
8950
|
|
|
8751
8951
|
//#endregion
|
|
8752
|
-
//#region ../mcp-core/dist/openai-provider-
|
|
8952
|
+
//#region ../mcp-core/dist/openai-provider-BIuidJl6.js
|
|
8753
8953
|
const DEFAULT_OPENAI_MODEL = "gpt-5";
|
|
8754
8954
|
const VALID_REASONING_EFFORTS = [
|
|
8755
8955
|
"low",
|
|
@@ -10753,10 +10953,10 @@ var DiagComponentLogger = function() {
|
|
|
10753
10953
|
return DiagComponentLogger$1;
|
|
10754
10954
|
}();
|
|
10755
10955
|
function logProxy(funcName, namespace$73, args) {
|
|
10756
|
-
var logger$
|
|
10757
|
-
if (!logger$
|
|
10956
|
+
var logger$2 = getGlobal("diag");
|
|
10957
|
+
if (!logger$2) return;
|
|
10758
10958
|
args.unshift(namespace$73);
|
|
10759
|
-
return logger$
|
|
10959
|
+
return logger$2[funcName].apply(logger$2, __spreadArray$3([], __read$3(args), false));
|
|
10760
10960
|
}
|
|
10761
10961
|
|
|
10762
10962
|
//#endregion
|
|
@@ -10789,13 +10989,13 @@ var DiagLogLevel;
|
|
|
10789
10989
|
|
|
10790
10990
|
//#endregion
|
|
10791
10991
|
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
|
|
10792
|
-
function createLogLevelDiagLogger(maxLevel, logger$
|
|
10992
|
+
function createLogLevelDiagLogger(maxLevel, logger$2) {
|
|
10793
10993
|
if (maxLevel < DiagLogLevel.NONE) maxLevel = DiagLogLevel.NONE;
|
|
10794
10994
|
else if (maxLevel > DiagLogLevel.ALL) maxLevel = DiagLogLevel.ALL;
|
|
10795
|
-
logger$
|
|
10995
|
+
logger$2 = logger$2 || {};
|
|
10796
10996
|
function _filterFunc(funcName, theLevel) {
|
|
10797
|
-
var theFunc = logger$
|
|
10798
|
-
if (typeof theFunc === "function" && maxLevel >= theLevel) return theFunc.bind(logger$
|
|
10997
|
+
var theFunc = logger$2[funcName];
|
|
10998
|
+
if (typeof theFunc === "function" && maxLevel >= theLevel) return theFunc.bind(logger$2);
|
|
10799
10999
|
return function() {};
|
|
10800
11000
|
}
|
|
10801
11001
|
return {
|
|
@@ -10850,23 +11050,23 @@ var DiagAPI = function() {
|
|
|
10850
11050
|
return function() {
|
|
10851
11051
|
var args = [];
|
|
10852
11052
|
for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
|
|
10853
|
-
var logger$
|
|
10854
|
-
if (!logger$
|
|
10855
|
-
return logger$
|
|
11053
|
+
var logger$2 = getGlobal("diag");
|
|
11054
|
+
if (!logger$2) return;
|
|
11055
|
+
return logger$2[funcName].apply(logger$2, __spreadArray$2([], __read$2(args), false));
|
|
10856
11056
|
};
|
|
10857
11057
|
}
|
|
10858
11058
|
var self = this;
|
|
10859
|
-
var setLogger = function(logger$
|
|
11059
|
+
var setLogger = function(logger$2, optionsOrLogLevel) {
|
|
10860
11060
|
var _a$2, _b, _c;
|
|
10861
11061
|
if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
|
|
10862
|
-
if (logger$
|
|
11062
|
+
if (logger$2 === self) {
|
|
10863
11063
|
var err = /* @__PURE__ */ new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
10864
11064
|
self.error((_a$2 = err.stack) !== null && _a$2 !== void 0 ? _a$2 : err.message);
|
|
10865
11065
|
return false;
|
|
10866
11066
|
}
|
|
10867
11067
|
if (typeof optionsOrLogLevel === "number") optionsOrLogLevel = { logLevel: optionsOrLogLevel };
|
|
10868
11068
|
var oldLogger = getGlobal("diag");
|
|
10869
|
-
var newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger$
|
|
11069
|
+
var newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger$2);
|
|
10870
11070
|
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
10871
11071
|
var stack = (_c = (/* @__PURE__ */ new Error()).stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
10872
11072
|
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
@@ -14067,7 +14267,7 @@ function trimStartOfStream() {
|
|
|
14067
14267
|
var HANGING_STREAM_WARNING_TIME_MS = 15 * 1e3;
|
|
14068
14268
|
|
|
14069
14269
|
//#endregion
|
|
14070
|
-
//#region ../mcp-core/dist/callEmbeddedAgent-
|
|
14270
|
+
//#region ../mcp-core/dist/callEmbeddedAgent-wn0PIM50.js
|
|
14071
14271
|
/**
|
|
14072
14272
|
* Call an embedded agent with tool call capture
|
|
14073
14273
|
* This is the standard way to call embedded AI agents within MCP tools
|
|
@@ -14086,6 +14286,10 @@ async function callEmbeddedAgent({ system, prompt, tools, schema }) {
|
|
|
14086
14286
|
maxSteps: 5,
|
|
14087
14287
|
temperature: 1,
|
|
14088
14288
|
experimental_output: output_exports.object({ schema }),
|
|
14289
|
+
experimental_telemetry: {
|
|
14290
|
+
isEnabled: true,
|
|
14291
|
+
functionId: "callEmbeddedAgent"
|
|
14292
|
+
},
|
|
14089
14293
|
providerOptions: { openai: {
|
|
14090
14294
|
structuredOutputs: false,
|
|
14091
14295
|
strictJsonSchema: false
|
|
@@ -14109,7 +14313,7 @@ async function callEmbeddedAgent({ system, prompt, tools, schema }) {
|
|
|
14109
14313
|
}
|
|
14110
14314
|
|
|
14111
14315
|
//#endregion
|
|
14112
|
-
//#region ../mcp-core/dist/utils-
|
|
14316
|
+
//#region ../mcp-core/dist/utils-wepw5Cmn.js
|
|
14113
14317
|
/**
|
|
14114
14318
|
* Standard response schema for all embedded agent tools.
|
|
14115
14319
|
* Tools return either an error message or the result data, never both.
|
|
@@ -14191,7 +14395,7 @@ function agentTool(config) {
|
|
|
14191
14395
|
}
|
|
14192
14396
|
|
|
14193
14397
|
//#endregion
|
|
14194
|
-
//#region ../mcp-core/dist/otel-semantics-
|
|
14398
|
+
//#region ../mcp-core/dist/otel-semantics-ji8CZiqz.js
|
|
14195
14399
|
var namespace$72 = "android";
|
|
14196
14400
|
var description$72 = "The Android platform on which the Android application is running.\n";
|
|
14197
14401
|
var attributes$72 = {
|
|
@@ -19037,7 +19241,7 @@ function createOtelLookupTool(options) {
|
|
|
19037
19241
|
}
|
|
19038
19242
|
|
|
19039
19243
|
//#endregion
|
|
19040
|
-
//#region ../mcp-core/dist/whoami-
|
|
19244
|
+
//#region ../mcp-core/dist/whoami-B-N3_K3B.js
|
|
19041
19245
|
/**
|
|
19042
19246
|
* Get the current authenticated user's information from Sentry API
|
|
19043
19247
|
*/
|
|
@@ -19066,7 +19270,7 @@ function createWhoamiTool(options) {
|
|
|
19066
19270
|
}
|
|
19067
19271
|
|
|
19068
19272
|
//#endregion
|
|
19069
|
-
//#region ../mcp-core/dist/utils-
|
|
19273
|
+
//#region ../mcp-core/dist/utils-Dehfm_qW.js
|
|
19070
19274
|
function getStringValue(event, key, defaultValue = "") {
|
|
19071
19275
|
const value = event[key];
|
|
19072
19276
|
return typeof value === "string" ? value : defaultValue;
|
|
@@ -19119,14 +19323,14 @@ function createDatasetAttributesTool(options) {
|
|
|
19119
19323
|
"logs"
|
|
19120
19324
|
]).describe("The dataset to query attributes for") }),
|
|
19121
19325
|
execute: async ({ dataset }) => {
|
|
19122
|
-
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"));
|
|
19123
19327
|
const { attributes: customAttributes, fieldTypes } = await fetchCustomAttributes(apiService, organizationSlug, dataset, projectId);
|
|
19124
19328
|
const allFields = {
|
|
19125
19329
|
...BASE_COMMON_FIELDS,
|
|
19126
19330
|
...DATASET_FIELDS[dataset],
|
|
19127
19331
|
...customAttributes
|
|
19128
19332
|
};
|
|
19129
|
-
const recommendedFields = RECOMMENDED_FIELDS$
|
|
19333
|
+
const recommendedFields = RECOMMENDED_FIELDS$2[dataset];
|
|
19130
19334
|
const allFieldTypes = { ...fieldTypes };
|
|
19131
19335
|
const staticNumericFields = NUMERIC_FIELDS[dataset] || /* @__PURE__ */ new Set();
|
|
19132
19336
|
for (const field of staticNumericFields) allFieldTypes[field] = "number";
|
|
@@ -19145,13 +19349,16 @@ ${Object.keys(allFieldTypes).length > 30 ? `\n... and ${Object.keys(allFieldType
|
|
|
19145
19349
|
|
|
19146
19350
|
IMPORTANT: Only use numeric aggregate functions (avg, sum, min, max, percentiles) with numeric fields. Use count() or count_unique() for non-numeric fields.
|
|
19147
19351
|
|
|
19148
|
-
|
|
19352
|
+
EXAMPLE QUERIES FOR ${dataset.toUpperCase()}:
|
|
19353
|
+
${DATASET_EXAMPLES[dataset].map((ex) => `- "${ex.description}" →\n ${JSON.stringify(ex.output)}`).join("\n\n")}
|
|
19354
|
+
|
|
19355
|
+
Use these examples as patterns for constructing your query.`;
|
|
19149
19356
|
}
|
|
19150
19357
|
});
|
|
19151
19358
|
}
|
|
19152
19359
|
|
|
19153
19360
|
//#endregion
|
|
19154
|
-
//#region ../mcp-core/dist/agent-
|
|
19361
|
+
//#region ../mcp-core/dist/agent-C_Z02GOk.js
|
|
19155
19362
|
const searchEventsAgentOutputSchema = zod.z.object({
|
|
19156
19363
|
dataset: zod.z.enum([
|
|
19157
19364
|
"spans",
|
|
@@ -19193,7 +19400,7 @@ async function searchEventsAgent(options) {
|
|
|
19193
19400
|
});
|
|
19194
19401
|
const whoamiTool = createWhoamiTool({ apiService: options.apiService });
|
|
19195
19402
|
return await callEmbeddedAgent({
|
|
19196
|
-
system:
|
|
19403
|
+
system: require_config_BoFBjXRq.systemPrompt,
|
|
19197
19404
|
prompt: options.query,
|
|
19198
19405
|
tools: {
|
|
19199
19406
|
datasetAttributes: datasetAttributesTool,
|
|
@@ -19205,7 +19412,7 @@ async function searchEventsAgent(options) {
|
|
|
19205
19412
|
}
|
|
19206
19413
|
|
|
19207
19414
|
//#endregion
|
|
19208
|
-
//#region ../mcp-core/dist/formatters-
|
|
19415
|
+
//#region ../mcp-core/dist/formatters-CBiThZnb.js
|
|
19209
19416
|
/**
|
|
19210
19417
|
* Format an explanation for how a natural language query was translated
|
|
19211
19418
|
*/
|
|
@@ -19227,12 +19434,12 @@ function formatErrorResults(params) {
|
|
|
19227
19434
|
output += `**View these results in Sentry**:\n${explorerUrl}\n`;
|
|
19228
19435
|
output += `_Please share this link with the user to view the search results in their Sentry dashboard._\n\n`;
|
|
19229
19436
|
if (eventData.length === 0) {
|
|
19230
|
-
|
|
19437
|
+
logInfo(`No error events found for query: ${naturalLanguageQuery}`, { extra: {
|
|
19231
19438
|
query: sentryQuery,
|
|
19232
19439
|
fields,
|
|
19233
19440
|
organizationSlug,
|
|
19234
19441
|
dataset: "errors"
|
|
19235
|
-
});
|
|
19442
|
+
} });
|
|
19236
19443
|
output += `No results found.\n\n`;
|
|
19237
19444
|
output += `Try being more specific or using different terms in your search.\n`;
|
|
19238
19445
|
return output;
|
|
@@ -19291,12 +19498,12 @@ function formatLogResults(params) {
|
|
|
19291
19498
|
output += `**View these results in Sentry**:\n${explorerUrl}\n`;
|
|
19292
19499
|
output += `_Please share this link with the user to view the search results in their Sentry dashboard._\n\n`;
|
|
19293
19500
|
if (eventData.length === 0) {
|
|
19294
|
-
|
|
19501
|
+
logInfo(`No log events found for query: ${naturalLanguageQuery}`, { extra: {
|
|
19295
19502
|
query: sentryQuery,
|
|
19296
19503
|
fields,
|
|
19297
19504
|
organizationSlug,
|
|
19298
19505
|
dataset: "logs"
|
|
19299
|
-
});
|
|
19506
|
+
} });
|
|
19300
19507
|
output += `No results found.\n\n`;
|
|
19301
19508
|
output += `Try being more specific or using different terms in your search.\n`;
|
|
19302
19509
|
return output;
|
|
@@ -19372,12 +19579,12 @@ function formatSpanResults(params) {
|
|
|
19372
19579
|
output += `**View these results in Sentry**:\n${explorerUrl}\n`;
|
|
19373
19580
|
output += `_Please share this link with the user to view the search results in their Sentry dashboard._\n\n`;
|
|
19374
19581
|
if (eventData.length === 0) {
|
|
19375
|
-
|
|
19582
|
+
logInfo(`No span events found for query: ${naturalLanguageQuery}`, { extra: {
|
|
19376
19583
|
query: sentryQuery,
|
|
19377
19584
|
fields,
|
|
19378
19585
|
organizationSlug,
|
|
19379
19586
|
dataset: "spans"
|
|
19380
|
-
});
|
|
19587
|
+
} });
|
|
19381
19588
|
output += `No results found.\n\n`;
|
|
19382
19589
|
output += `Try being more specific or using different terms in your search.\n`;
|
|
19383
19590
|
return output;
|
|
@@ -19423,10 +19630,10 @@ function formatSpanResults(params) {
|
|
|
19423
19630
|
}
|
|
19424
19631
|
|
|
19425
19632
|
//#endregion
|
|
19426
|
-
//#region ../mcp-core/dist/handler-
|
|
19633
|
+
//#region ../mcp-core/dist/handler-DFWcpIpC.js
|
|
19427
19634
|
var handler_default = defineTool({
|
|
19428
19635
|
name: "search_events",
|
|
19429
|
-
|
|
19636
|
+
skills: [
|
|
19430
19637
|
"inspect",
|
|
19431
19638
|
"triage",
|
|
19432
19639
|
"seer"
|
|
@@ -19503,7 +19710,7 @@ var handler_default = defineTool({
|
|
|
19503
19710
|
});
|
|
19504
19711
|
const parsed = agentResult.result;
|
|
19505
19712
|
const dataset = parsed.dataset;
|
|
19506
|
-
const recommendedFields =
|
|
19713
|
+
const recommendedFields = require_config_BoFBjXRq.RECOMMENDED_FIELDS[dataset];
|
|
19507
19714
|
if (!parsed.sort) throw new UserInputError(`Search 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, '-count()' for highest count).`);
|
|
19508
19715
|
const sentryQuery = parsed.query || "";
|
|
19509
19716
|
const requestedFields = parsed.fields || [];
|
|
@@ -19564,10 +19771,10 @@ var handler_default = defineTool({
|
|
|
19564
19771
|
});
|
|
19565
19772
|
|
|
19566
19773
|
//#endregion
|
|
19567
|
-
//#region ../mcp-core/dist/create-team-
|
|
19774
|
+
//#region ../mcp-core/dist/create-team-JXD-4yd1.js
|
|
19568
19775
|
var create_team_default = defineTool({
|
|
19569
19776
|
name: "create_team",
|
|
19570
|
-
|
|
19777
|
+
skills: ["project-management"],
|
|
19571
19778
|
requiredScopes: ["team:write"],
|
|
19572
19779
|
description: [
|
|
19573
19780
|
"Create a new team in Sentry.",
|
|
@@ -19619,10 +19826,10 @@ var create_team_default = defineTool({
|
|
|
19619
19826
|
});
|
|
19620
19827
|
|
|
19621
19828
|
//#endregion
|
|
19622
|
-
//#region ../mcp-core/dist/create-project-
|
|
19829
|
+
//#region ../mcp-core/dist/create-project-B1g-3-yc.js
|
|
19623
19830
|
var create_project_default = defineTool({
|
|
19624
19831
|
name: "create_project",
|
|
19625
|
-
|
|
19832
|
+
skills: ["project-management"],
|
|
19626
19833
|
requiredScopes: ["project:write", "team:read"],
|
|
19627
19834
|
description: [
|
|
19628
19835
|
"Create a new project in Sentry (includes DSN automatically).",
|
|
@@ -19696,10 +19903,10 @@ var create_project_default = defineTool({
|
|
|
19696
19903
|
});
|
|
19697
19904
|
|
|
19698
19905
|
//#endregion
|
|
19699
|
-
//#region ../mcp-core/dist/update-project-
|
|
19906
|
+
//#region ../mcp-core/dist/update-project-sPir9pn7.js
|
|
19700
19907
|
var update_project_default = defineTool({
|
|
19701
19908
|
name: "update_project",
|
|
19702
|
-
|
|
19909
|
+
skills: ["project-management"],
|
|
19703
19910
|
requiredScopes: ["project:write"],
|
|
19704
19911
|
description: [
|
|
19705
19912
|
"Update project settings in Sentry, such as name, slug, platform, and team assignment.",
|
|
@@ -19814,10 +20021,10 @@ var update_project_default = defineTool({
|
|
|
19814
20021
|
});
|
|
19815
20022
|
|
|
19816
20023
|
//#endregion
|
|
19817
|
-
//#region ../mcp-core/dist/create-dsn-
|
|
20024
|
+
//#region ../mcp-core/dist/create-dsn-Co1eIXE3.js
|
|
19818
20025
|
var create_dsn_default = defineTool({
|
|
19819
20026
|
name: "create_dsn",
|
|
19820
|
-
|
|
20027
|
+
skills: ["project-management"],
|
|
19821
20028
|
requiredScopes: ["project:write"],
|
|
19822
20029
|
description: [
|
|
19823
20030
|
"Create an additional DSN for an EXISTING project.",
|
|
@@ -19874,10 +20081,10 @@ var create_dsn_default = defineTool({
|
|
|
19874
20081
|
});
|
|
19875
20082
|
|
|
19876
20083
|
//#endregion
|
|
19877
|
-
//#region ../mcp-core/dist/find-dsns-
|
|
20084
|
+
//#region ../mcp-core/dist/find-dsns-o0QsNJv8.js
|
|
19878
20085
|
var find_dsns_default = defineTool({
|
|
19879
20086
|
name: "find_dsns",
|
|
19880
|
-
|
|
20087
|
+
skills: ["project-management"],
|
|
19881
20088
|
requiredScopes: ["project:read"],
|
|
19882
20089
|
description: [
|
|
19883
20090
|
"List all Sentry DSNs for a specific project.",
|
|
@@ -19925,7 +20132,7 @@ var find_dsns_default = defineTool({
|
|
|
19925
20132
|
});
|
|
19926
20133
|
|
|
19927
20134
|
//#endregion
|
|
19928
|
-
//#region ../mcp-core/dist/fetch-utils-
|
|
20135
|
+
//#region ../mcp-core/dist/fetch-utils-C6qSgZai.js
|
|
19929
20136
|
/**
|
|
19930
20137
|
* Fetch with timeout using AbortController
|
|
19931
20138
|
* @param url - The URL to fetch
|
|
@@ -19975,10 +20182,10 @@ async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, should
|
|
|
19975
20182
|
}
|
|
19976
20183
|
|
|
19977
20184
|
//#endregion
|
|
19978
|
-
//#region ../mcp-core/dist/analyze-issue-with-seer-
|
|
20185
|
+
//#region ../mcp-core/dist/analyze-issue-with-seer-DLMG61CB.js
|
|
19979
20186
|
var analyze_issue_with_seer_default = defineTool({
|
|
19980
20187
|
name: "analyze_issue_with_seer",
|
|
19981
|
-
|
|
20188
|
+
skills: ["seer"],
|
|
19982
20189
|
requiredScopes: [],
|
|
19983
20190
|
description: [
|
|
19984
20191
|
"Use Seer to analyze production errors and get detailed root cause analysis with specific code fixes.",
|
|
@@ -20035,7 +20242,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20035
20242
|
},
|
|
20036
20243
|
async handler(params, context$1) {
|
|
20037
20244
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
20038
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
20245
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
20039
20246
|
organizationSlug: params.organizationSlug,
|
|
20040
20247
|
issueId: params.issueId,
|
|
20041
20248
|
issueUrl: params.issueUrl
|
|
@@ -20163,10 +20370,10 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20163
20370
|
});
|
|
20164
20371
|
|
|
20165
20372
|
//#endregion
|
|
20166
|
-
//#region ../mcp-core/dist/search-docs-
|
|
20373
|
+
//#region ../mcp-core/dist/search-docs-BzvTE9Na.js
|
|
20167
20374
|
var search_docs_default = defineTool({
|
|
20168
20375
|
name: "search_docs",
|
|
20169
|
-
|
|
20376
|
+
skills: ["docs"],
|
|
20170
20377
|
requiredScopes: [],
|
|
20171
20378
|
description: [
|
|
20172
20379
|
"Search Sentry documentation for SDK setup, instrumentation, and configuration guidance.",
|
|
@@ -20246,10 +20453,10 @@ var search_docs_default = defineTool({
|
|
|
20246
20453
|
});
|
|
20247
20454
|
|
|
20248
20455
|
//#endregion
|
|
20249
|
-
//#region ../mcp-core/dist/get-doc-
|
|
20456
|
+
//#region ../mcp-core/dist/get-doc-B2M_KGrK.js
|
|
20250
20457
|
var get_doc_default = defineTool({
|
|
20251
20458
|
name: "get_doc",
|
|
20252
|
-
|
|
20459
|
+
skills: ["docs"],
|
|
20253
20460
|
requiredScopes: [],
|
|
20254
20461
|
description: [
|
|
20255
20462
|
"Fetch the full markdown content of a Sentry documentation page.",
|
|
@@ -20323,7 +20530,7 @@ var get_doc_default = defineTool({
|
|
|
20323
20530
|
});
|
|
20324
20531
|
|
|
20325
20532
|
//#endregion
|
|
20326
|
-
//#region ../mcp-core/dist/dataset-fields-
|
|
20533
|
+
//#region ../mcp-core/dist/dataset-fields-nvbboMpe.js
|
|
20327
20534
|
/**
|
|
20328
20535
|
* Discover available fields for a dataset by querying Sentry's tags API
|
|
20329
20536
|
*/
|
|
@@ -20473,11 +20680,11 @@ function getCommonPatterns(dataset) {
|
|
|
20473
20680
|
}
|
|
20474
20681
|
|
|
20475
20682
|
//#endregion
|
|
20476
|
-
//#region ../mcp-core/dist/config-
|
|
20683
|
+
//#region ../mcp-core/dist/config-BFaJp4hW.js
|
|
20477
20684
|
/**
|
|
20478
20685
|
* Configuration for the search-issues agent
|
|
20479
20686
|
*/
|
|
20480
|
-
const systemPrompt$
|
|
20687
|
+
const systemPrompt$3 = `You are a Sentry issue search query translator. Convert natural language queries to Sentry issue search syntax.
|
|
20481
20688
|
|
|
20482
20689
|
IMPORTANT RULES:
|
|
20483
20690
|
1. Use Sentry issue search syntax, NOT SQL
|
|
@@ -20545,7 +20752,7 @@ Always use the issueFields tool to discover available fields when needed.
|
|
|
20545
20752
|
Use the whoami tool when you need to resolve 'me' references.`;
|
|
20546
20753
|
|
|
20547
20754
|
//#endregion
|
|
20548
|
-
//#region ../mcp-core/dist/agent-
|
|
20755
|
+
//#region ../mcp-core/dist/agent-Jg5_CT7U.js
|
|
20549
20756
|
const searchIssuesAgentOutputSchema = zod.z.object({
|
|
20550
20757
|
query: zod.z.string().describe("The Sentry issue search query"),
|
|
20551
20758
|
sort: zod.z.enum([
|
|
@@ -20563,7 +20770,7 @@ const searchIssuesAgentOutputSchema = zod.z.object({
|
|
|
20563
20770
|
async function searchIssuesAgent(options) {
|
|
20564
20771
|
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for semantic search");
|
|
20565
20772
|
return await callEmbeddedAgent({
|
|
20566
|
-
system: systemPrompt$
|
|
20773
|
+
system: systemPrompt$3,
|
|
20567
20774
|
prompt: options.query,
|
|
20568
20775
|
tools: {
|
|
20569
20776
|
issueFields: createDatasetFieldsTool({
|
|
@@ -20579,7 +20786,7 @@ async function searchIssuesAgent(options) {
|
|
|
20579
20786
|
}
|
|
20580
20787
|
|
|
20581
20788
|
//#endregion
|
|
20582
|
-
//#region ../mcp-core/dist/formatters-
|
|
20789
|
+
//#region ../mcp-core/dist/formatters-W4LF85x9.js
|
|
20583
20790
|
/**
|
|
20584
20791
|
* Format an explanation for how a natural language query was translated
|
|
20585
20792
|
*/
|
|
@@ -20603,12 +20810,12 @@ function formatIssueResults(params) {
|
|
|
20603
20810
|
output += `⚠️ **IMPORTANT**: Display these issues as highlighted cards with status indicators, assignee info, and clickable Issue IDs.\n\n`;
|
|
20604
20811
|
}
|
|
20605
20812
|
if (issues.length === 0) {
|
|
20606
|
-
|
|
20813
|
+
logInfo(`No issues found for query: ${naturalLanguageQuery || query}`, { extra: {
|
|
20607
20814
|
query,
|
|
20608
20815
|
organizationSlug,
|
|
20609
20816
|
projectSlug: projectSlugOrId,
|
|
20610
20817
|
naturalLanguageQuery
|
|
20611
|
-
});
|
|
20818
|
+
} });
|
|
20612
20819
|
output += "No issues found matching your search criteria.\n\n";
|
|
20613
20820
|
output += "Try adjusting your search criteria or time range.";
|
|
20614
20821
|
return output;
|
|
@@ -20660,10 +20867,10 @@ function formatDate(dateString) {
|
|
|
20660
20867
|
}
|
|
20661
20868
|
|
|
20662
20869
|
//#endregion
|
|
20663
|
-
//#region ../mcp-core/dist/handler-
|
|
20870
|
+
//#region ../mcp-core/dist/handler-rR_VkT5b.js
|
|
20664
20871
|
var handler_default$1 = defineTool({
|
|
20665
20872
|
name: "search_issues",
|
|
20666
|
-
|
|
20873
|
+
skills: [
|
|
20667
20874
|
"inspect",
|
|
20668
20875
|
"triage",
|
|
20669
20876
|
"seer"
|
|
@@ -20781,7 +20988,564 @@ var handler_default$1 = defineTool({
|
|
|
20781
20988
|
});
|
|
20782
20989
|
|
|
20783
20990
|
//#endregion
|
|
20784
|
-
//#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
|
|
20785
21549
|
/**
|
|
20786
21550
|
* Configuration for the use_sentry embedded agent.
|
|
20787
21551
|
*
|
|
@@ -20800,7 +21564,7 @@ The user may include various parameters to pass to those tools in their prompt.
|
|
|
20800
21564
|
You MUST return tool results directly without interpreting them.`;
|
|
20801
21565
|
|
|
20802
21566
|
//#endregion
|
|
20803
|
-
//#region ../mcp-core/dist/agent-
|
|
21567
|
+
//#region ../mcp-core/dist/agent-DfZ797Yi.js
|
|
20804
21568
|
/**
|
|
20805
21569
|
* Output schema for the embedded agent.
|
|
20806
21570
|
* The agent returns the final result string directly from its tool calls.
|
|
@@ -20822,7 +21586,7 @@ async function useSentryAgent(options) {
|
|
|
20822
21586
|
}
|
|
20823
21587
|
|
|
20824
21588
|
//#endregion
|
|
20825
|
-
//#region ../mcp-core/dist/error-handling-
|
|
21589
|
+
//#region ../mcp-core/dist/error-handling-DrvyGci6.js
|
|
20826
21590
|
/**
|
|
20827
21591
|
* Type guard to identify user input validation errors.
|
|
20828
21592
|
*/
|
|
@@ -20913,7 +21677,7 @@ async function formatErrorForUser(error) {
|
|
|
20913
21677
|
}
|
|
20914
21678
|
|
|
20915
21679
|
//#endregion
|
|
20916
|
-
//#region ../mcp-core/dist/constraint-helpers-
|
|
21680
|
+
//#region ../mcp-core/dist/constraint-helpers-CCO6wSRb.js
|
|
20917
21681
|
/**
|
|
20918
21682
|
* Determines which tool parameter keys should be filtered out of the schema
|
|
20919
21683
|
* because they will be injected from constraints.
|
|
@@ -20975,7 +21739,7 @@ function getConstraintParametersToInject(constraints, toolInputSchema) {
|
|
|
20975
21739
|
}
|
|
20976
21740
|
|
|
20977
21741
|
//#endregion
|
|
20978
|
-
//#region ../mcp-core/dist/server-
|
|
21742
|
+
//#region ../mcp-core/dist/server-CAslpEs0.js
|
|
20979
21743
|
/**
|
|
20980
21744
|
* Format tool calls into a readable trace
|
|
20981
21745
|
*/
|
|
@@ -20994,9 +21758,9 @@ function formatToolCallTrace(toolCalls) {
|
|
|
20994
21758
|
}
|
|
20995
21759
|
return trace$1;
|
|
20996
21760
|
}
|
|
20997
|
-
var handler_default$
|
|
21761
|
+
var handler_default$3 = defineTool({
|
|
20998
21762
|
name: "use_sentry",
|
|
20999
|
-
|
|
21763
|
+
skills: [],
|
|
21000
21764
|
requiredScopes: [],
|
|
21001
21765
|
description: [
|
|
21002
21766
|
"Natural language interface to Sentry via an embedded AI agent.",
|
|
@@ -21085,12 +21849,13 @@ var tools_default = {
|
|
|
21085
21849
|
search_docs: search_docs_default,
|
|
21086
21850
|
get_doc: get_doc_default,
|
|
21087
21851
|
search_issues: handler_default$1,
|
|
21088
|
-
|
|
21852
|
+
search_issue_events: handler_default$2,
|
|
21853
|
+
use_sentry: handler_default$3
|
|
21089
21854
|
};
|
|
21090
21855
|
/**
|
|
21091
21856
|
* Creates and configures a complete MCP server with Sentry instrumentation.
|
|
21092
21857
|
*
|
|
21093
|
-
* The server is built with tools filtered based on the granted
|
|
21858
|
+
* The server is built with tools filtered based on the granted skills in the context.
|
|
21094
21859
|
* Context is captured in tool handler closures and passed directly to handlers.
|
|
21095
21860
|
*
|
|
21096
21861
|
* @example Usage with stdio transport
|
|
@@ -21125,7 +21890,7 @@ var tools_default = {
|
|
|
21125
21890
|
*/
|
|
21126
21891
|
function buildServer({ context: context$1, agentMode = false, tools: customTools }) {
|
|
21127
21892
|
const server$1 = new __modelcontextprotocol_sdk_server_mcp_js.McpServer({
|
|
21128
|
-
name:
|
|
21893
|
+
name: MCP_SERVER_NAME,
|
|
21129
21894
|
version: require_stdio.LIB_VERSION
|
|
21130
21895
|
});
|
|
21131
21896
|
configureServer({
|
|
@@ -21137,18 +21902,17 @@ function buildServer({ context: context$1, agentMode = false, tools: customTools
|
|
|
21137
21902
|
return (0, __sentry_core.wrapMcpServerWithSentry)(server$1);
|
|
21138
21903
|
}
|
|
21139
21904
|
/**
|
|
21140
|
-
* Configures an MCP server with tools filtered by granted skills
|
|
21905
|
+
* Configures an MCP server with tools filtered by granted skills.
|
|
21141
21906
|
*
|
|
21142
21907
|
* Internal function used by buildServer(). Use buildServer() instead for most cases.
|
|
21143
|
-
* Tools are filtered at registration time based on grantedSkills
|
|
21144
|
-
*
|
|
21908
|
+
* Tools are filtered at registration time based on grantedSkills, and context is
|
|
21909
|
+
* captured in closures for tool handler execution.
|
|
21145
21910
|
*
|
|
21146
21911
|
* In agent mode, only the use_sentry tool is registered, bypassing authorization checks.
|
|
21147
21912
|
*/
|
|
21148
21913
|
function configureServer({ server: server$1, context: context$1, agentMode = false, tools: customTools }) {
|
|
21149
21914
|
const toolsToRegister = agentMode ? { use_sentry: tools_default.use_sentry } : customTools ?? tools_default;
|
|
21150
21915
|
const grantedSkills = context$1.grantedSkills ? new Set(context$1.grantedSkills) : void 0;
|
|
21151
|
-
const grantedScopes = context$1.grantedScopes ? new Set(context$1.grantedScopes) : void 0;
|
|
21152
21916
|
server$1.server.onerror = (error) => {
|
|
21153
21917
|
const transportLogOptions = {
|
|
21154
21918
|
loggerScope: ["server", "transport"],
|
|
@@ -21158,47 +21922,32 @@ function configureServer({ server: server$1, context: context$1, agentMode = fal
|
|
|
21158
21922
|
};
|
|
21159
21923
|
for (const [toolKey, tool$1] of Object.entries(toolsToRegister)) {
|
|
21160
21924
|
/**
|
|
21161
|
-
* Authorization
|
|
21162
|
-
*
|
|
21163
|
-
*
|
|
21164
|
-
* The server supports two authorization systems:
|
|
21165
|
-
* 1. **Skills System (NEW)** - User-facing permission groups (inspect, triage, etc.)
|
|
21166
|
-
* 2. **Scopes System (LEGACY)** - Low-level API permissions (event:read, project:write, etc.)
|
|
21925
|
+
* Skills-Based Authorization
|
|
21926
|
+
* ==========================
|
|
21167
21927
|
*
|
|
21168
|
-
*
|
|
21928
|
+
* Tools are filtered at registration time based on grantedSkills.
|
|
21929
|
+
* Tool must have non-empty `skills` array to be exposed.
|
|
21930
|
+
* Empty `skills: []` means intentionally excluded from skills system.
|
|
21169
21931
|
*
|
|
21170
|
-
*
|
|
21171
|
-
* - ONLY skills are checked (scopes are ignored)
|
|
21172
|
-
* - Tool must have non-empty `requiredSkills` array to be exposed
|
|
21173
|
-
* - Empty `requiredSkills: []` means intentionally excluded from skills system
|
|
21174
|
-
* - Authorization: `allowed = hasRequiredSkills(grantedSkills, tool.requiredSkills)`
|
|
21175
|
-
*
|
|
21176
|
-
* ## Scopes Mode (when grantedSkills is NOT set, but grantedScopes is set):
|
|
21177
|
-
* - Falls back to legacy scope checking
|
|
21178
|
-
* - Empty `requiredScopes: []` means no scopes required (always allowed)
|
|
21179
|
-
* - Authorization: `allowed = isToolAllowed(tool.requiredScopes, grantedScopes)`
|
|
21180
|
-
*
|
|
21181
|
-
* ## Tool Visibility:
|
|
21182
|
-
* - If not allowed by active authorization system: tool is NOT registered
|
|
21183
|
-
* - Only registered tools are visible to MCP clients
|
|
21932
|
+
* In agent mode, authorization is skipped - use_sentry handles it internally.
|
|
21184
21933
|
*
|
|
21185
21934
|
* ## Examples:
|
|
21186
21935
|
* ```typescript
|
|
21187
|
-
* // Tool
|
|
21188
|
-
* {
|
|
21936
|
+
* // Tool belongs to "triage" skill only:
|
|
21937
|
+
* { skills: ["triage"] }
|
|
21189
21938
|
*
|
|
21190
|
-
* // Tool
|
|
21191
|
-
* {
|
|
21939
|
+
* // Tool belongs to ALL skills (foundational tool like whoami):
|
|
21940
|
+
* { skills: ALL_SKILLS }
|
|
21192
21941
|
*
|
|
21193
21942
|
* // Tool excluded from skills system (like use_sentry in agent mode):
|
|
21194
|
-
* {
|
|
21943
|
+
* { skills: [] }
|
|
21195
21944
|
* ```
|
|
21196
21945
|
*/
|
|
21197
21946
|
let allowed = false;
|
|
21198
21947
|
if (agentMode) allowed = true;
|
|
21199
21948
|
else if (grantedSkills) {
|
|
21200
|
-
if (tool$1.
|
|
21201
|
-
}
|
|
21949
|
+
if (tool$1.skills && tool$1.skills.length > 0) allowed = require_resolve.isEnabledBySkills(grantedSkills, tool$1.skills);
|
|
21950
|
+
}
|
|
21202
21951
|
if (!allowed) continue;
|
|
21203
21952
|
if (toolKey === "find_organizations" && context$1.constraints.organizationSlug || toolKey === "find_projects" && context$1.constraints.projectSlug) continue;
|
|
21204
21953
|
const constraintKeysToFilter = new Set(getConstraintKeysToFilter(context$1.constraints, tool$1.inputSchema));
|
|
@@ -21243,7 +21992,7 @@ function configureServer({ server: server$1, context: context$1, agentMode = fal
|
|
|
21243
21992
|
}
|
|
21244
21993
|
|
|
21245
21994
|
//#endregion
|
|
21246
|
-
//#region ../mcp-core/dist/sentry-
|
|
21995
|
+
//#region ../mcp-core/dist/sentry-Cfj4OGMQ.js
|
|
21247
21996
|
const SCRUB_PATTERNS = [
|
|
21248
21997
|
{
|
|
21249
21998
|
pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
|
|
@@ -21348,7 +22097,7 @@ function sentryBeforeSend(event, hint) {
|
|
|
21348
22097
|
//#region src/index.ts
|
|
21349
22098
|
const packageName = "@sentry/mcp-server";
|
|
21350
22099
|
const allSkills = Object.keys(require_resolve.SKILLS);
|
|
21351
|
-
const usageText = require_usage.buildUsage(packageName,
|
|
22100
|
+
const usageText = require_usage.buildUsage(packageName, allSkills);
|
|
21352
22101
|
function die(message) {
|
|
21353
22102
|
console.error(message);
|
|
21354
22103
|
console.error(usageText);
|
|
@@ -21417,7 +22166,6 @@ if (cli.agent) {
|
|
|
21417
22166
|
const SENTRY_TIMEOUT = 5e3;
|
|
21418
22167
|
const context = {
|
|
21419
22168
|
accessToken: cfg.accessToken,
|
|
21420
|
-
grantedScopes: cfg.finalScopes,
|
|
21421
22169
|
grantedSkills: cfg.finalSkills,
|
|
21422
22170
|
constraints: {
|
|
21423
22171
|
organizationSlug: cfg.organizationSlug ?? null,
|