@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.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { LIB_VERSION, USER_AGENT, startStdio } from "./stdio-
|
|
4
|
-
import { RECOMMENDED_FIELDS, systemPrompt } from "./config-
|
|
5
|
-
import { buildUsage } from "./usage-
|
|
6
|
-
import { merge, parseArgv, parseEnv } from "./parse-
|
|
2
|
+
import { ALL_SKILLS, SKILLS, finalize, getIssueUrl, getIssuesSearchUrl, getTraceUrl, isEnabledBySkills, isSentryHost } from "./resolve-Cg3SH2zt.js";
|
|
3
|
+
import { LIB_VERSION, USER_AGENT, startStdio } from "./stdio-C47PFfCl.js";
|
|
4
|
+
import { RECOMMENDED_FIELDS, systemPrompt } from "./config-BoFBjXRq-CMdBQOkQ.js";
|
|
5
|
+
import { buildUsage } from "./usage-BzYvqaru.js";
|
|
6
|
+
import { merge, parseArgv, parseEnv } from "./parse-46t_fITC.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import util from "node:util";
|
|
9
|
-
import { captureException, captureMessage, getActiveSpan, setTag, setUser, withScope, wrapMcpServerWithSentry } from "@sentry/core";
|
|
10
|
-
import * as Sentry from "@sentry/node";
|
|
9
|
+
import { captureException, captureMessage, getActiveSpan, logger, setTag, setUser, withScope, wrapMcpServerWithSentry } from "@sentry/core";
|
|
11
10
|
import { ZodFirstPartyTypeKind } from "zod/v3";
|
|
12
11
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
12
|
import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
|
|
13
|
+
import * as Sentry from "@sentry/node";
|
|
14
14
|
|
|
15
15
|
//#region rolldown:runtime
|
|
16
16
|
var __create = Object.create;
|
|
@@ -43,6 +43,182 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
43
43
|
enumerable: true
|
|
44
44
|
}) : target, mod));
|
|
45
45
|
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region ../mcp-core/dist/constants-D8axTonA.js
|
|
48
|
+
/**
|
|
49
|
+
* Constants for Sentry MCP server.
|
|
50
|
+
*
|
|
51
|
+
* Defines platform and framework combinations available in Sentry documentation.
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* MCP Server identification
|
|
55
|
+
*/
|
|
56
|
+
const MCP_SERVER_NAME = "Sentry MCP";
|
|
57
|
+
/**
|
|
58
|
+
* Allowed region domains for sentry.io
|
|
59
|
+
* Only these specific domains are permitted when using Sentry's cloud service
|
|
60
|
+
* This is used to prevent SSRF attacks by restricting regionUrl to known domains
|
|
61
|
+
*/
|
|
62
|
+
const SENTRY_ALLOWED_REGION_DOMAINS = new Set([
|
|
63
|
+
"sentry.io",
|
|
64
|
+
"us.sentry.io",
|
|
65
|
+
"de.sentry.io"
|
|
66
|
+
]);
|
|
67
|
+
/**
|
|
68
|
+
* Common Sentry platforms that have documentation available
|
|
69
|
+
*/
|
|
70
|
+
const SENTRY_PLATFORMS_BASE = [
|
|
71
|
+
"javascript",
|
|
72
|
+
"python",
|
|
73
|
+
"java",
|
|
74
|
+
"dotnet",
|
|
75
|
+
"go",
|
|
76
|
+
"php",
|
|
77
|
+
"ruby",
|
|
78
|
+
"android",
|
|
79
|
+
"apple",
|
|
80
|
+
"unity",
|
|
81
|
+
"unreal",
|
|
82
|
+
"rust",
|
|
83
|
+
"elixir",
|
|
84
|
+
"kotlin",
|
|
85
|
+
"native",
|
|
86
|
+
"dart",
|
|
87
|
+
"godot",
|
|
88
|
+
"nintendo-switch",
|
|
89
|
+
"playstation",
|
|
90
|
+
"powershell",
|
|
91
|
+
"react-native",
|
|
92
|
+
"xbox"
|
|
93
|
+
];
|
|
94
|
+
/**
|
|
95
|
+
* Platform-specific frameworks that have Sentry guides
|
|
96
|
+
*/
|
|
97
|
+
const SENTRY_FRAMEWORKS = {
|
|
98
|
+
javascript: [
|
|
99
|
+
"nextjs",
|
|
100
|
+
"react",
|
|
101
|
+
"gatsby",
|
|
102
|
+
"remix",
|
|
103
|
+
"vue",
|
|
104
|
+
"angular",
|
|
105
|
+
"hono",
|
|
106
|
+
"svelte",
|
|
107
|
+
"express",
|
|
108
|
+
"fastify",
|
|
109
|
+
"astro",
|
|
110
|
+
"bun",
|
|
111
|
+
"capacitor",
|
|
112
|
+
"cloudflare",
|
|
113
|
+
"connect",
|
|
114
|
+
"cordova",
|
|
115
|
+
"deno",
|
|
116
|
+
"electron",
|
|
117
|
+
"ember",
|
|
118
|
+
"nuxt",
|
|
119
|
+
"solid",
|
|
120
|
+
"solidstart",
|
|
121
|
+
"sveltekit",
|
|
122
|
+
"tanstack-react",
|
|
123
|
+
"wasm",
|
|
124
|
+
"node",
|
|
125
|
+
"koa",
|
|
126
|
+
"nestjs",
|
|
127
|
+
"hapi"
|
|
128
|
+
],
|
|
129
|
+
python: [
|
|
130
|
+
"django",
|
|
131
|
+
"flask",
|
|
132
|
+
"fastapi",
|
|
133
|
+
"celery",
|
|
134
|
+
"tornado",
|
|
135
|
+
"pyramid",
|
|
136
|
+
"aiohttp",
|
|
137
|
+
"anthropic",
|
|
138
|
+
"airflow",
|
|
139
|
+
"aws-lambda",
|
|
140
|
+
"boto3",
|
|
141
|
+
"bottle",
|
|
142
|
+
"chalice",
|
|
143
|
+
"dramatiq",
|
|
144
|
+
"falcon",
|
|
145
|
+
"langchain",
|
|
146
|
+
"litestar",
|
|
147
|
+
"logging",
|
|
148
|
+
"loguru",
|
|
149
|
+
"openai",
|
|
150
|
+
"quart",
|
|
151
|
+
"ray",
|
|
152
|
+
"redis",
|
|
153
|
+
"rq",
|
|
154
|
+
"sanic",
|
|
155
|
+
"sqlalchemy",
|
|
156
|
+
"starlette"
|
|
157
|
+
],
|
|
158
|
+
dart: ["flutter"],
|
|
159
|
+
dotnet: [
|
|
160
|
+
"aspnetcore",
|
|
161
|
+
"maui",
|
|
162
|
+
"wpf",
|
|
163
|
+
"winforms",
|
|
164
|
+
"aspnet",
|
|
165
|
+
"aws-lambda",
|
|
166
|
+
"azure-functions",
|
|
167
|
+
"blazor-webassembly",
|
|
168
|
+
"entityframework",
|
|
169
|
+
"google-cloud-functions",
|
|
170
|
+
"extensions-logging",
|
|
171
|
+
"log4net",
|
|
172
|
+
"nlog",
|
|
173
|
+
"serilog",
|
|
174
|
+
"uwp",
|
|
175
|
+
"xamarin"
|
|
176
|
+
],
|
|
177
|
+
java: [
|
|
178
|
+
"spring",
|
|
179
|
+
"spring-boot",
|
|
180
|
+
"android",
|
|
181
|
+
"jul",
|
|
182
|
+
"log4j2",
|
|
183
|
+
"logback",
|
|
184
|
+
"servlet"
|
|
185
|
+
],
|
|
186
|
+
go: [
|
|
187
|
+
"echo",
|
|
188
|
+
"fasthttp",
|
|
189
|
+
"fiber",
|
|
190
|
+
"gin",
|
|
191
|
+
"http",
|
|
192
|
+
"iris",
|
|
193
|
+
"logrus",
|
|
194
|
+
"negroni",
|
|
195
|
+
"slog",
|
|
196
|
+
"zerolog"
|
|
197
|
+
],
|
|
198
|
+
php: ["laravel", "symfony"],
|
|
199
|
+
ruby: [
|
|
200
|
+
"delayed_job",
|
|
201
|
+
"rack",
|
|
202
|
+
"rails",
|
|
203
|
+
"resque",
|
|
204
|
+
"sidekiq"
|
|
205
|
+
],
|
|
206
|
+
android: ["kotlin"],
|
|
207
|
+
apple: [
|
|
208
|
+
"ios",
|
|
209
|
+
"macos",
|
|
210
|
+
"watchos",
|
|
211
|
+
"tvos",
|
|
212
|
+
"visionos"
|
|
213
|
+
],
|
|
214
|
+
kotlin: ["multiplatform"]
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* All valid guides for Sentry docs search filtering.
|
|
218
|
+
* A guide can be either a platform (e.g., 'javascript') or a platform/framework combination (e.g., 'javascript/nextjs').
|
|
219
|
+
*/
|
|
220
|
+
const SENTRY_GUIDES = [...SENTRY_PLATFORMS_BASE, ...Object.entries(SENTRY_FRAMEWORKS).flatMap(([platform, guides]) => guides.map((guide) => `${platform}/${guide}`))];
|
|
221
|
+
|
|
46
222
|
//#endregion
|
|
47
223
|
//#region ../mcp-core/dist/errors-BXmNwD2K.js
|
|
48
224
|
/**
|
|
@@ -68,7 +244,7 @@ var ConfigurationError = class extends Error {
|
|
|
68
244
|
};
|
|
69
245
|
|
|
70
246
|
//#endregion
|
|
71
|
-
//#region ../mcp-core/dist/slug-validation-
|
|
247
|
+
//#region ../mcp-core/dist/slug-validation-BdDL1fV5.js
|
|
72
248
|
/**
|
|
73
249
|
* Maximum reasonable length for a slug.
|
|
74
250
|
*/
|
|
@@ -157,7 +333,7 @@ function validateSlugOrId(val, ctx) {
|
|
|
157
333
|
}
|
|
158
334
|
|
|
159
335
|
//#endregion
|
|
160
|
-
//#region ../mcp-core/dist/schema-
|
|
336
|
+
//#region ../mcp-core/dist/schema-Bl7AGsln.js
|
|
161
337
|
const ParamOrganizationSlug = 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.");
|
|
162
338
|
const ParamTeamSlug = 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.");
|
|
163
339
|
const ParamProjectSlug = 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.");
|
|
@@ -190,7 +366,7 @@ const ParamEventId = z.string().trim().describe("The ID of the event.");
|
|
|
190
366
|
const ParamAttachmentId = z.string().trim().describe("The ID of the attachment to download.");
|
|
191
367
|
|
|
192
368
|
//#endregion
|
|
193
|
-
//#region ../mcp-core/dist/define-
|
|
369
|
+
//#region ../mcp-core/dist/define-vgYYpneQ.js
|
|
194
370
|
function defineTool(config) {
|
|
195
371
|
return config;
|
|
196
372
|
}
|
|
@@ -347,8 +523,8 @@ var LoggerImpl = class LoggerImpl$1 {
|
|
|
347
523
|
*/
|
|
348
524
|
resetDescendants() {
|
|
349
525
|
for (const child of Object.values(this.children)) {
|
|
350
|
-
const logger$
|
|
351
|
-
if (logger$
|
|
526
|
+
const logger$2 = child instanceof LoggerImpl$1 ? child : child.deref();
|
|
527
|
+
if (logger$2 != null) logger$2.resetDescendants();
|
|
352
528
|
}
|
|
353
529
|
this.reset();
|
|
354
530
|
}
|
|
@@ -512,8 +688,8 @@ var LoggerImpl = class LoggerImpl$1 {
|
|
|
512
688
|
var LoggerCtx = class LoggerCtx$1 {
|
|
513
689
|
logger;
|
|
514
690
|
properties;
|
|
515
|
-
constructor(logger$
|
|
516
|
-
this.logger = logger$
|
|
691
|
+
constructor(logger$2, properties) {
|
|
692
|
+
this.logger = logger$2;
|
|
517
693
|
this.properties = properties;
|
|
518
694
|
}
|
|
519
695
|
get category() {
|
|
@@ -1263,20 +1439,20 @@ function configureInternal(config, allowAsync) {
|
|
|
1263
1439
|
const categoryKey = Array.isArray(cfg$1.category) ? JSON.stringify(cfg$1.category) : JSON.stringify([cfg$1.category]);
|
|
1264
1440
|
if (configuredCategories.has(categoryKey)) throw new ConfigError(`Duplicate logger configuration for category: ${categoryKey}. Each category can only be configured once.`);
|
|
1265
1441
|
configuredCategories.add(categoryKey);
|
|
1266
|
-
const logger$
|
|
1442
|
+
const logger$2 = LoggerImpl.getLogger(cfg$1.category);
|
|
1267
1443
|
for (const sinkId of cfg$1.sinks ?? []) {
|
|
1268
1444
|
const sink = config.sinks[sinkId];
|
|
1269
1445
|
if (!sink) throw new ConfigError(`Sink not found: ${sinkId}.`);
|
|
1270
|
-
logger$
|
|
1446
|
+
logger$2.sinks.push(sink);
|
|
1271
1447
|
}
|
|
1272
|
-
logger$
|
|
1273
|
-
if (cfg$1.lowestLevel !== void 0) logger$
|
|
1448
|
+
logger$2.parentSinks = cfg$1.parentSinks ?? "inherit";
|
|
1449
|
+
if (cfg$1.lowestLevel !== void 0) logger$2.lowestLevel = cfg$1.lowestLevel;
|
|
1274
1450
|
for (const filterId of cfg$1.filters ?? []) {
|
|
1275
1451
|
const filter$1 = config.filters?.[filterId];
|
|
1276
1452
|
if (filter$1 === void 0) throw new ConfigError(`Filter not found: ${filterId}.`);
|
|
1277
|
-
logger$
|
|
1453
|
+
logger$2.filters.push(toFilter(filter$1));
|
|
1278
1454
|
}
|
|
1279
|
-
strongRefs.add(logger$
|
|
1455
|
+
strongRefs.add(logger$2);
|
|
1280
1456
|
}
|
|
1281
1457
|
LoggerImpl.getLogger().contextLocalStorage = config.contextLocalStorage;
|
|
1282
1458
|
for (const sink of Object.values(config.sinks)) {
|
|
@@ -1360,7 +1536,7 @@ var ConfigError = class extends Error {
|
|
|
1360
1536
|
};
|
|
1361
1537
|
|
|
1362
1538
|
//#endregion
|
|
1363
|
-
//#region ../mcp-core/dist/logging-
|
|
1539
|
+
//#region ../mcp-core/dist/logging-BK_g0p3a.js
|
|
1364
1540
|
const ROOT_LOG_CATEGORY = ["sentry", "mcp"];
|
|
1365
1541
|
let loggingConfigured = false;
|
|
1366
1542
|
function resolveLowestLevel() {
|
|
@@ -1377,12 +1553,12 @@ function resolveLowestLevel() {
|
|
|
1377
1553
|
* (creating Issues), this sink uses Sentry.logger.* methods to send data to the
|
|
1378
1554
|
* Logs product.
|
|
1379
1555
|
*
|
|
1380
|
-
*
|
|
1381
|
-
*
|
|
1556
|
+
* This uses @sentry/core logger API which works across all platforms (Node.js,
|
|
1557
|
+
* Cloudflare Workers, etc.) as long as Sentry is initialized with the appropriate SDK.
|
|
1382
1558
|
*/
|
|
1383
1559
|
function createSentryLogsSink() {
|
|
1384
1560
|
return (record) => {
|
|
1385
|
-
if (!
|
|
1561
|
+
if (!logger) return;
|
|
1386
1562
|
let message = "";
|
|
1387
1563
|
for (let i = 0; i < record.message.length; i++) if (i % 2 === 0) message += record.message[i];
|
|
1388
1564
|
else {
|
|
@@ -1392,24 +1568,24 @@ function createSentryLogsSink() {
|
|
|
1392
1568
|
const attributes$73 = record.properties;
|
|
1393
1569
|
switch (record.level) {
|
|
1394
1570
|
case "trace":
|
|
1395
|
-
|
|
1571
|
+
logger.trace(message, attributes$73);
|
|
1396
1572
|
break;
|
|
1397
1573
|
case "debug":
|
|
1398
|
-
|
|
1574
|
+
logger.debug(message, attributes$73);
|
|
1399
1575
|
break;
|
|
1400
1576
|
case "info":
|
|
1401
|
-
|
|
1577
|
+
logger.info(message, attributes$73);
|
|
1402
1578
|
break;
|
|
1403
1579
|
case "warning":
|
|
1404
|
-
|
|
1580
|
+
logger.warn(message, attributes$73);
|
|
1405
1581
|
break;
|
|
1406
1582
|
case "error":
|
|
1407
|
-
|
|
1583
|
+
logger.error(message, attributes$73);
|
|
1408
1584
|
break;
|
|
1409
1585
|
case "fatal":
|
|
1410
|
-
|
|
1586
|
+
logger.fatal(message, attributes$73);
|
|
1411
1587
|
break;
|
|
1412
|
-
default:
|
|
1588
|
+
default: logger.info(message, attributes$73);
|
|
1413
1589
|
}
|
|
1414
1590
|
};
|
|
1415
1591
|
}
|
|
@@ -1446,8 +1622,8 @@ function ensureLoggingConfigured() {
|
|
|
1446
1622
|
function getLogger$1(scope, defaults) {
|
|
1447
1623
|
ensureLoggingConfigured();
|
|
1448
1624
|
const category = Array.isArray(scope) ? scope : [scope];
|
|
1449
|
-
const logger$
|
|
1450
|
-
return defaults ? logger$
|
|
1625
|
+
const logger$2 = getLogger([...ROOT_LOG_CATEGORY, ...category]);
|
|
1626
|
+
return defaults ? logger$2.with(defaults) : logger$2;
|
|
1451
1627
|
}
|
|
1452
1628
|
const ISSUE_LOGGER_SCOPE = ["runtime", "issues"];
|
|
1453
1629
|
function isRecord(value) {
|
|
@@ -1525,7 +1701,7 @@ function serializeError(value, depth = 0) {
|
|
|
1525
1701
|
}
|
|
1526
1702
|
return { message: coerceMessage(value) };
|
|
1527
1703
|
}
|
|
1528
|
-
const logger = getLogger$1([]);
|
|
1704
|
+
const logger$1 = getLogger$1([]);
|
|
1529
1705
|
const DEFAULT_LOGGER_SCOPE = [];
|
|
1530
1706
|
function buildLogProperties(level, options, serializedError) {
|
|
1531
1707
|
const properties = { severity: level };
|
|
@@ -1564,6 +1740,9 @@ function logWithLevel(level, value, contextsOrOptions) {
|
|
|
1564
1740
|
default: scopedLogger.info(message, () => properties);
|
|
1565
1741
|
}
|
|
1566
1742
|
}
|
|
1743
|
+
function logInfo(value, contextsOrOptions) {
|
|
1744
|
+
logWithLevel("info", value, contextsOrOptions);
|
|
1745
|
+
}
|
|
1567
1746
|
function logWarn(value, contextsOrOptions) {
|
|
1568
1747
|
logWithLevel("warning", value, contextsOrOptions);
|
|
1569
1748
|
}
|
|
@@ -1604,7 +1783,7 @@ function logIssue(error, contextsOrOptions, attachmentsArg) {
|
|
|
1604
1783
|
}
|
|
1605
1784
|
|
|
1606
1785
|
//#endregion
|
|
1607
|
-
//#region ../mcp-core/dist/schema-
|
|
1786
|
+
//#region ../mcp-core/dist/schema-BO1YtJIJ.js
|
|
1608
1787
|
/**
|
|
1609
1788
|
* Schema for Sentry API error responses.
|
|
1610
1789
|
*
|
|
@@ -2101,7 +2280,7 @@ const TraceIssueSchema = z.object({
|
|
|
2101
2280
|
const TraceSchema = z.array(z.union([TraceSpanSchema, TraceIssueSchema]));
|
|
2102
2281
|
|
|
2103
2282
|
//#endregion
|
|
2104
|
-
//#region ../mcp-core/dist/errors-
|
|
2283
|
+
//#region ../mcp-core/dist/errors-ZBQnDL3L.js
|
|
2105
2284
|
/**
|
|
2106
2285
|
* API Error Class Hierarchy
|
|
2107
2286
|
*
|
|
@@ -2316,7 +2495,7 @@ function createApiError(message, status, detail, responseBody) {
|
|
|
2316
2495
|
}
|
|
2317
2496
|
|
|
2318
2497
|
//#endregion
|
|
2319
|
-
//#region ../mcp-core/dist/client-
|
|
2498
|
+
//#region ../mcp-core/dist/client-EbNZG3Z_.js
|
|
2320
2499
|
/**
|
|
2321
2500
|
* Mapping of common network error codes to user-friendly messages.
|
|
2322
2501
|
* These help users understand and resolve connection issues.
|
|
@@ -3147,6 +3326,26 @@ var SentryApiService = class {
|
|
|
3147
3326
|
eventId: "latest"
|
|
3148
3327
|
}, opts);
|
|
3149
3328
|
}
|
|
3329
|
+
/**
|
|
3330
|
+
* Lists events for a specific issue.
|
|
3331
|
+
* Uses the issue-specific endpoint which already filters by issue ID.
|
|
3332
|
+
*
|
|
3333
|
+
* @see https://docs.sentry.io/api/events/list-an-issues-events/
|
|
3334
|
+
*/
|
|
3335
|
+
async listEventsForIssue({ organizationSlug, issueId, query, limit = 50, sort, statsPeriod, start, end, full = false }, opts) {
|
|
3336
|
+
const params = new URLSearchParams();
|
|
3337
|
+
if (query) params.append("query", query);
|
|
3338
|
+
params.append("per_page", String(limit));
|
|
3339
|
+
if (sort) params.append("sort", sort);
|
|
3340
|
+
if (statsPeriod) params.append("statsPeriod", statsPeriod);
|
|
3341
|
+
else if (start && end) {
|
|
3342
|
+
params.append("start", start);
|
|
3343
|
+
params.append("end", end);
|
|
3344
|
+
}
|
|
3345
|
+
if (full) params.append("full", "true");
|
|
3346
|
+
const apiUrl = `/organizations/${organizationSlug}/issues/${issueId}/events/?${params.toString()}`;
|
|
3347
|
+
return await this.requestJSON(apiUrl, void 0, opts);
|
|
3348
|
+
}
|
|
3150
3349
|
async listEventAttachments({ organizationSlug, projectSlug, eventId }, opts) {
|
|
3151
3350
|
const body = await this.requestJSON(`/projects/${organizationSlug}/${projectSlug}/events/${eventId}/attachments/`, void 0, opts);
|
|
3152
3351
|
return EventAttachmentListSchema.parse(body);
|
|
@@ -3405,7 +3604,7 @@ var SentryApiService = class {
|
|
|
3405
3604
|
};
|
|
3406
3605
|
|
|
3407
3606
|
//#endregion
|
|
3408
|
-
//#region ../mcp-core/dist/validate-region-url-
|
|
3607
|
+
//#region ../mcp-core/dist/validate-region-url-BL1kR9T7.js
|
|
3409
3608
|
/**
|
|
3410
3609
|
* Validates that a regionUrl is valid.
|
|
3411
3610
|
* Prevents SSRF attacks by only allowing the base host itself or domains from an allowlist.
|
|
@@ -3437,7 +3636,7 @@ function validateRegionUrl(regionUrl, baseHost) {
|
|
|
3437
3636
|
}
|
|
3438
3637
|
|
|
3439
3638
|
//#endregion
|
|
3440
|
-
//#region ../mcp-core/dist/api-
|
|
3639
|
+
//#region ../mcp-core/dist/api-C4iLorVN.js
|
|
3441
3640
|
/**
|
|
3442
3641
|
* Create a Sentry API service from server context with optional region override
|
|
3443
3642
|
* @param context - Server context containing host and access token
|
|
@@ -3458,7 +3657,7 @@ function apiServiceFromContext(context$1, opts = {}) {
|
|
|
3458
3657
|
}
|
|
3459
3658
|
|
|
3460
3659
|
//#endregion
|
|
3461
|
-
//#region ../mcp-core/dist/whoami-
|
|
3660
|
+
//#region ../mcp-core/dist/whoami-4TjhUF9I.js
|
|
3462
3661
|
var whoami_default = defineTool({
|
|
3463
3662
|
name: "whoami",
|
|
3464
3663
|
description: [
|
|
@@ -3468,7 +3667,7 @@ var whoami_default = defineTool({
|
|
|
3468
3667
|
"- Get the user's name and email address."
|
|
3469
3668
|
].join("\n"),
|
|
3470
3669
|
inputSchema: {},
|
|
3471
|
-
|
|
3670
|
+
skills: ALL_SKILLS,
|
|
3472
3671
|
requiredScopes: [],
|
|
3473
3672
|
annotations: {
|
|
3474
3673
|
readOnlyHint: true,
|
|
@@ -3491,11 +3690,11 @@ var whoami_default = defineTool({
|
|
|
3491
3690
|
});
|
|
3492
3691
|
|
|
3493
3692
|
//#endregion
|
|
3494
|
-
//#region ../mcp-core/dist/find-organizations-
|
|
3693
|
+
//#region ../mcp-core/dist/find-organizations-CY_CprTd.js
|
|
3495
3694
|
const RESULT_LIMIT$2 = 25;
|
|
3496
3695
|
var find_organizations_default = defineTool({
|
|
3497
3696
|
name: "find_organizations",
|
|
3498
|
-
|
|
3697
|
+
skills: ALL_SKILLS,
|
|
3499
3698
|
requiredScopes: ["org:read"],
|
|
3500
3699
|
description: [
|
|
3501
3700
|
"Find organizations that the user has access to in Sentry.",
|
|
@@ -3543,11 +3742,11 @@ var find_organizations_default = defineTool({
|
|
|
3543
3742
|
});
|
|
3544
3743
|
|
|
3545
3744
|
//#endregion
|
|
3546
|
-
//#region ../mcp-core/dist/find-teams-
|
|
3745
|
+
//#region ../mcp-core/dist/find-teams-D20sronT.js
|
|
3547
3746
|
const RESULT_LIMIT$1 = 25;
|
|
3548
3747
|
var find_teams_default = defineTool({
|
|
3549
3748
|
name: "find_teams",
|
|
3550
|
-
|
|
3749
|
+
skills: [
|
|
3551
3750
|
"inspect",
|
|
3552
3751
|
"triage",
|
|
3553
3752
|
"project-management"
|
|
@@ -3591,11 +3790,11 @@ var find_teams_default = defineTool({
|
|
|
3591
3790
|
});
|
|
3592
3791
|
|
|
3593
3792
|
//#endregion
|
|
3594
|
-
//#region ../mcp-core/dist/find-projects-
|
|
3793
|
+
//#region ../mcp-core/dist/find-projects-BIbLskbP.js
|
|
3595
3794
|
const RESULT_LIMIT = 25;
|
|
3596
3795
|
var find_projects_default = defineTool({
|
|
3597
3796
|
name: "find_projects",
|
|
3598
|
-
|
|
3797
|
+
skills: ALL_SKILLS,
|
|
3599
3798
|
requiredScopes: ["project:read"],
|
|
3600
3799
|
description: [
|
|
3601
3800
|
"Find projects in Sentry.",
|
|
@@ -3635,10 +3834,10 @@ var find_projects_default = defineTool({
|
|
|
3635
3834
|
});
|
|
3636
3835
|
|
|
3637
3836
|
//#endregion
|
|
3638
|
-
//#region ../mcp-core/dist/find-releases-
|
|
3837
|
+
//#region ../mcp-core/dist/find-releases-DddLqSmt.js
|
|
3639
3838
|
var find_releases_default = defineTool({
|
|
3640
3839
|
name: "find_releases",
|
|
3641
|
-
|
|
3840
|
+
skills: ["inspect"],
|
|
3642
3841
|
requiredScopes: ["project:read"],
|
|
3643
3842
|
description: [
|
|
3644
3843
|
"Find releases in Sentry.",
|
|
@@ -3726,7 +3925,7 @@ var find_releases_default = defineTool({
|
|
|
3726
3925
|
});
|
|
3727
3926
|
|
|
3728
3927
|
//#endregion
|
|
3729
|
-
//#region ../mcp-core/dist/issue-helpers-
|
|
3928
|
+
//#region ../mcp-core/dist/issue-helpers-DtCbXiRZ.js
|
|
3730
3929
|
/**
|
|
3731
3930
|
* Extracts the Sentry issue ID and organization slug from a full URL
|
|
3732
3931
|
*
|
|
@@ -3784,7 +3983,7 @@ function parseIssueId(issueId) {
|
|
|
3784
3983
|
* @returns Object containing the parsed organization slug and issue ID
|
|
3785
3984
|
* @throws Error if the input is invalid
|
|
3786
3985
|
*/
|
|
3787
|
-
function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
|
|
3986
|
+
function parseIssueParams$1({ issueUrl, issueId, organizationSlug }) {
|
|
3788
3987
|
if (issueUrl) {
|
|
3789
3988
|
const resolved = extractIssueId(issueUrl);
|
|
3790
3989
|
if (!resolved) throw new Error("Invalid Sentry issue URL. Path should contain '/issues/{issue_id}'");
|
|
@@ -3802,7 +4001,7 @@ function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
|
|
|
3802
4001
|
}
|
|
3803
4002
|
|
|
3804
4003
|
//#endregion
|
|
3805
|
-
//#region ../mcp-core/dist/seer-
|
|
4004
|
+
//#region ../mcp-core/dist/seer-CSFgx4AP.js
|
|
3806
4005
|
const SEER_POLLING_INTERVAL = 5e3;
|
|
3807
4006
|
const SEER_TIMEOUT = 5 * 60 * 1e3;
|
|
3808
4007
|
const SEER_MAX_RETRIES = 3;
|
|
@@ -3883,7 +4082,7 @@ function getOutputForAutofixStep(step) {
|
|
|
3883
4082
|
}
|
|
3884
4083
|
|
|
3885
4084
|
//#endregion
|
|
3886
|
-
//#region ../mcp-core/dist/formatting-
|
|
4085
|
+
//#region ../mcp-core/dist/formatting-BhgNMv3a.js
|
|
3887
4086
|
const LANGUAGE_EXTENSIONS = {
|
|
3888
4087
|
".java": "java",
|
|
3889
4088
|
".py": "python",
|
|
@@ -4847,11 +5046,12 @@ function formatIssueOutput({ organizationSlug, issue, event, apiService, autofix
|
|
|
4847
5046
|
output += "# Using this information\n\n";
|
|
4848
5047
|
output += `- You can reference the IssueID in commit messages (e.g. \`Fixes ${issue.shortId}\`) to automatically close the issue when the commit is merged.\n`;
|
|
4849
5048
|
output += "- The stacktrace includes both first-party application code as well as third-party code, its important to triage to first-party code.\n";
|
|
5049
|
+
output += `- To search for specific occurrences or filter events within this issue, use \`search_issue_events(organizationSlug='${organizationSlug}', issueId='${issue.shortId}', naturalLanguageQuery='your query')\`\n`;
|
|
4850
5050
|
return output;
|
|
4851
5051
|
}
|
|
4852
5052
|
|
|
4853
5053
|
//#endregion
|
|
4854
|
-
//#region ../mcp-core/dist/enhance-error-
|
|
5054
|
+
//#region ../mcp-core/dist/enhance-error-BzwoJ7V0.js
|
|
4855
5055
|
/**
|
|
4856
5056
|
* Enhances a 404 error with parameter context to help users understand what went wrong.
|
|
4857
5057
|
* This is optional - tools can use this when they want to provide extra context.
|
|
@@ -4879,10 +5079,10 @@ function enhanceNotFoundError(error, params) {
|
|
|
4879
5079
|
}
|
|
4880
5080
|
|
|
4881
5081
|
//#endregion
|
|
4882
|
-
//#region ../mcp-core/dist/get-issue-details-
|
|
5082
|
+
//#region ../mcp-core/dist/get-issue-details-Dv2HsHlt.js
|
|
4883
5083
|
var get_issue_details_default = defineTool({
|
|
4884
5084
|
name: "get_issue_details",
|
|
4885
|
-
|
|
5085
|
+
skills: [
|
|
4886
5086
|
"inspect",
|
|
4887
5087
|
"triage",
|
|
4888
5088
|
"seer"
|
|
@@ -4990,7 +5190,7 @@ var get_issue_details_default = defineTool({
|
|
|
4990
5190
|
}
|
|
4991
5191
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
4992
5192
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
4993
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
5193
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
4994
5194
|
organizationSlug: params.organizationSlug,
|
|
4995
5195
|
issueId: params.issueId,
|
|
4996
5196
|
issueUrl: params.issueUrl
|
|
@@ -5060,14 +5260,14 @@ function shouldFetchTraceForEvent(event) {
|
|
|
5060
5260
|
}
|
|
5061
5261
|
|
|
5062
5262
|
//#endregion
|
|
5063
|
-
//#region ../mcp-core/dist/get-trace-details-
|
|
5263
|
+
//#region ../mcp-core/dist/get-trace-details-QaT2N9BA.js
|
|
5064
5264
|
const MAX_DEPTH = 2;
|
|
5065
5265
|
const MINIMUM_DURATION_THRESHOLD_MS = 10;
|
|
5066
5266
|
const MIN_MEANINGFUL_CHILD_DURATION = 5;
|
|
5067
5267
|
const MIN_AVG_DURATION_MS = 5;
|
|
5068
5268
|
var get_trace_details_default = defineTool({
|
|
5069
5269
|
name: "get_trace_details",
|
|
5070
|
-
|
|
5270
|
+
skills: ["inspect"],
|
|
5071
5271
|
requiredScopes: ["event:read"],
|
|
5072
5272
|
description: [
|
|
5073
5273
|
"Get detailed information about a specific Sentry trace by ID.",
|
|
@@ -5359,10 +5559,10 @@ function formatTraceOutput({ organizationSlug, traceId, traceMeta, trace: trace$
|
|
|
5359
5559
|
}
|
|
5360
5560
|
|
|
5361
5561
|
//#endregion
|
|
5362
|
-
//#region ../mcp-core/dist/get-event-attachment-
|
|
5562
|
+
//#region ../mcp-core/dist/get-event-attachment-DdhoqwCO.js
|
|
5363
5563
|
var get_event_attachment_default = defineTool({
|
|
5364
5564
|
name: "get_event_attachment",
|
|
5365
|
-
|
|
5565
|
+
skills: ["inspect"],
|
|
5366
5566
|
requiredScopes: ["event:read"],
|
|
5367
5567
|
description: [
|
|
5368
5568
|
"Download attachments from a Sentry event.",
|
|
@@ -5495,7 +5695,7 @@ var get_event_attachment_default = defineTool({
|
|
|
5495
5695
|
});
|
|
5496
5696
|
|
|
5497
5697
|
//#endregion
|
|
5498
|
-
//#region ../mcp-core/dist/formatting-
|
|
5698
|
+
//#region ../mcp-core/dist/formatting-DJFcfTJG.js
|
|
5499
5699
|
/**
|
|
5500
5700
|
* Helper function to format assignedTo field for display
|
|
5501
5701
|
*/
|
|
@@ -5507,10 +5707,10 @@ function formatAssignedTo(assignedTo) {
|
|
|
5507
5707
|
}
|
|
5508
5708
|
|
|
5509
5709
|
//#endregion
|
|
5510
|
-
//#region ../mcp-core/dist/update-issue-
|
|
5710
|
+
//#region ../mcp-core/dist/update-issue-JybAx8DT.js
|
|
5511
5711
|
var update_issue_default = defineTool({
|
|
5512
5712
|
name: "update_issue",
|
|
5513
|
-
|
|
5713
|
+
skills: ["triage"],
|
|
5514
5714
|
requiredScopes: ["event:write"],
|
|
5515
5715
|
description: [
|
|
5516
5716
|
"Update an issue's status or assignment in Sentry. This allows you to resolve, ignore, or reassign issues.",
|
|
@@ -5575,7 +5775,7 @@ var update_issue_default = defineTool({
|
|
|
5575
5775
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
5576
5776
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
5577
5777
|
if (!params.status && !params.assignedTo) throw new UserInputError("At least one of `status` or `assignedTo` must be provided to update the issue");
|
|
5578
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
5778
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
5579
5779
|
organizationSlug: params.organizationSlug,
|
|
5580
5780
|
issueId: params.issueId,
|
|
5581
5781
|
issueUrl: params.issueUrl
|
|
@@ -8780,7 +8980,7 @@ function createOpenAI(options = {}) {
|
|
|
8780
8980
|
var openai = createOpenAI({ compatibility: "strict" });
|
|
8781
8981
|
|
|
8782
8982
|
//#endregion
|
|
8783
|
-
//#region ../mcp-core/dist/openai-provider-
|
|
8983
|
+
//#region ../mcp-core/dist/openai-provider-BIuidJl6.js
|
|
8784
8984
|
const DEFAULT_OPENAI_MODEL = "gpt-5";
|
|
8785
8985
|
const VALID_REASONING_EFFORTS = [
|
|
8786
8986
|
"low",
|
|
@@ -10784,10 +10984,10 @@ var DiagComponentLogger = function() {
|
|
|
10784
10984
|
return DiagComponentLogger$1;
|
|
10785
10985
|
}();
|
|
10786
10986
|
function logProxy(funcName, namespace$73, args) {
|
|
10787
|
-
var logger$
|
|
10788
|
-
if (!logger$
|
|
10987
|
+
var logger$2 = getGlobal("diag");
|
|
10988
|
+
if (!logger$2) return;
|
|
10789
10989
|
args.unshift(namespace$73);
|
|
10790
|
-
return logger$
|
|
10990
|
+
return logger$2[funcName].apply(logger$2, __spreadArray$3([], __read$3(args), false));
|
|
10791
10991
|
}
|
|
10792
10992
|
|
|
10793
10993
|
//#endregion
|
|
@@ -10820,13 +11020,13 @@ var DiagLogLevel;
|
|
|
10820
11020
|
|
|
10821
11021
|
//#endregion
|
|
10822
11022
|
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
|
|
10823
|
-
function createLogLevelDiagLogger(maxLevel, logger$
|
|
11023
|
+
function createLogLevelDiagLogger(maxLevel, logger$2) {
|
|
10824
11024
|
if (maxLevel < DiagLogLevel.NONE) maxLevel = DiagLogLevel.NONE;
|
|
10825
11025
|
else if (maxLevel > DiagLogLevel.ALL) maxLevel = DiagLogLevel.ALL;
|
|
10826
|
-
logger$
|
|
11026
|
+
logger$2 = logger$2 || {};
|
|
10827
11027
|
function _filterFunc(funcName, theLevel) {
|
|
10828
|
-
var theFunc = logger$
|
|
10829
|
-
if (typeof theFunc === "function" && maxLevel >= theLevel) return theFunc.bind(logger$
|
|
11028
|
+
var theFunc = logger$2[funcName];
|
|
11029
|
+
if (typeof theFunc === "function" && maxLevel >= theLevel) return theFunc.bind(logger$2);
|
|
10830
11030
|
return function() {};
|
|
10831
11031
|
}
|
|
10832
11032
|
return {
|
|
@@ -10881,23 +11081,23 @@ var DiagAPI = function() {
|
|
|
10881
11081
|
return function() {
|
|
10882
11082
|
var args = [];
|
|
10883
11083
|
for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
|
|
10884
|
-
var logger$
|
|
10885
|
-
if (!logger$
|
|
10886
|
-
return logger$
|
|
11084
|
+
var logger$2 = getGlobal("diag");
|
|
11085
|
+
if (!logger$2) return;
|
|
11086
|
+
return logger$2[funcName].apply(logger$2, __spreadArray$2([], __read$2(args), false));
|
|
10887
11087
|
};
|
|
10888
11088
|
}
|
|
10889
11089
|
var self = this;
|
|
10890
|
-
var setLogger = function(logger$
|
|
11090
|
+
var setLogger = function(logger$2, optionsOrLogLevel) {
|
|
10891
11091
|
var _a$2, _b, _c;
|
|
10892
11092
|
if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
|
|
10893
|
-
if (logger$
|
|
11093
|
+
if (logger$2 === self) {
|
|
10894
11094
|
var err = /* @__PURE__ */ new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
10895
11095
|
self.error((_a$2 = err.stack) !== null && _a$2 !== void 0 ? _a$2 : err.message);
|
|
10896
11096
|
return false;
|
|
10897
11097
|
}
|
|
10898
11098
|
if (typeof optionsOrLogLevel === "number") optionsOrLogLevel = { logLevel: optionsOrLogLevel };
|
|
10899
11099
|
var oldLogger = getGlobal("diag");
|
|
10900
|
-
var newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger$
|
|
11100
|
+
var newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger$2);
|
|
10901
11101
|
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
10902
11102
|
var stack = (_c = (/* @__PURE__ */ new Error()).stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
10903
11103
|
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
@@ -14098,7 +14298,7 @@ function trimStartOfStream() {
|
|
|
14098
14298
|
var HANGING_STREAM_WARNING_TIME_MS = 15 * 1e3;
|
|
14099
14299
|
|
|
14100
14300
|
//#endregion
|
|
14101
|
-
//#region ../mcp-core/dist/callEmbeddedAgent-
|
|
14301
|
+
//#region ../mcp-core/dist/callEmbeddedAgent-wn0PIM50.js
|
|
14102
14302
|
/**
|
|
14103
14303
|
* Call an embedded agent with tool call capture
|
|
14104
14304
|
* This is the standard way to call embedded AI agents within MCP tools
|
|
@@ -14117,6 +14317,10 @@ async function callEmbeddedAgent({ system, prompt, tools, schema }) {
|
|
|
14117
14317
|
maxSteps: 5,
|
|
14118
14318
|
temperature: 1,
|
|
14119
14319
|
experimental_output: output_exports.object({ schema }),
|
|
14320
|
+
experimental_telemetry: {
|
|
14321
|
+
isEnabled: true,
|
|
14322
|
+
functionId: "callEmbeddedAgent"
|
|
14323
|
+
},
|
|
14120
14324
|
providerOptions: { openai: {
|
|
14121
14325
|
structuredOutputs: false,
|
|
14122
14326
|
strictJsonSchema: false
|
|
@@ -14140,7 +14344,7 @@ async function callEmbeddedAgent({ system, prompt, tools, schema }) {
|
|
|
14140
14344
|
}
|
|
14141
14345
|
|
|
14142
14346
|
//#endregion
|
|
14143
|
-
//#region ../mcp-core/dist/utils-
|
|
14347
|
+
//#region ../mcp-core/dist/utils-wepw5Cmn.js
|
|
14144
14348
|
/**
|
|
14145
14349
|
* Standard response schema for all embedded agent tools.
|
|
14146
14350
|
* Tools return either an error message or the result data, never both.
|
|
@@ -14222,7 +14426,7 @@ function agentTool(config) {
|
|
|
14222
14426
|
}
|
|
14223
14427
|
|
|
14224
14428
|
//#endregion
|
|
14225
|
-
//#region ../mcp-core/dist/otel-semantics-
|
|
14429
|
+
//#region ../mcp-core/dist/otel-semantics-ji8CZiqz.js
|
|
14226
14430
|
var namespace$72 = "android";
|
|
14227
14431
|
var description$72 = "The Android platform on which the Android application is running.\n";
|
|
14228
14432
|
var attributes$72 = {
|
|
@@ -19068,7 +19272,7 @@ function createOtelLookupTool(options) {
|
|
|
19068
19272
|
}
|
|
19069
19273
|
|
|
19070
19274
|
//#endregion
|
|
19071
|
-
//#region ../mcp-core/dist/whoami-
|
|
19275
|
+
//#region ../mcp-core/dist/whoami-B-N3_K3B.js
|
|
19072
19276
|
/**
|
|
19073
19277
|
* Get the current authenticated user's information from Sentry API
|
|
19074
19278
|
*/
|
|
@@ -19097,7 +19301,7 @@ function createWhoamiTool(options) {
|
|
|
19097
19301
|
}
|
|
19098
19302
|
|
|
19099
19303
|
//#endregion
|
|
19100
|
-
//#region ../mcp-core/dist/utils-
|
|
19304
|
+
//#region ../mcp-core/dist/utils-Dehfm_qW.js
|
|
19101
19305
|
function getStringValue(event, key, defaultValue = "") {
|
|
19102
19306
|
const value = event[key];
|
|
19103
19307
|
return typeof value === "string" ? value : defaultValue;
|
|
@@ -19150,14 +19354,14 @@ function createDatasetAttributesTool(options) {
|
|
|
19150
19354
|
"logs"
|
|
19151
19355
|
]).describe("The dataset to query attributes for") }),
|
|
19152
19356
|
execute: async ({ dataset }) => {
|
|
19153
|
-
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$
|
|
19357
|
+
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await import("./config-BEgU9ylR.js");
|
|
19154
19358
|
const { attributes: customAttributes, fieldTypes } = await fetchCustomAttributes(apiService, organizationSlug, dataset, projectId);
|
|
19155
19359
|
const allFields = {
|
|
19156
19360
|
...BASE_COMMON_FIELDS,
|
|
19157
19361
|
...DATASET_FIELDS[dataset],
|
|
19158
19362
|
...customAttributes
|
|
19159
19363
|
};
|
|
19160
|
-
const recommendedFields = RECOMMENDED_FIELDS$
|
|
19364
|
+
const recommendedFields = RECOMMENDED_FIELDS$2[dataset];
|
|
19161
19365
|
const allFieldTypes = { ...fieldTypes };
|
|
19162
19366
|
const staticNumericFields = NUMERIC_FIELDS[dataset] || /* @__PURE__ */ new Set();
|
|
19163
19367
|
for (const field of staticNumericFields) allFieldTypes[field] = "number";
|
|
@@ -19176,13 +19380,16 @@ ${Object.keys(allFieldTypes).length > 30 ? `\n... and ${Object.keys(allFieldType
|
|
|
19176
19380
|
|
|
19177
19381
|
IMPORTANT: Only use numeric aggregate functions (avg, sum, min, max, percentiles) with numeric fields. Use count() or count_unique() for non-numeric fields.
|
|
19178
19382
|
|
|
19179
|
-
|
|
19383
|
+
EXAMPLE QUERIES FOR ${dataset.toUpperCase()}:
|
|
19384
|
+
${DATASET_EXAMPLES[dataset].map((ex) => `- "${ex.description}" →\n ${JSON.stringify(ex.output)}`).join("\n\n")}
|
|
19385
|
+
|
|
19386
|
+
Use these examples as patterns for constructing your query.`;
|
|
19180
19387
|
}
|
|
19181
19388
|
});
|
|
19182
19389
|
}
|
|
19183
19390
|
|
|
19184
19391
|
//#endregion
|
|
19185
|
-
//#region ../mcp-core/dist/agent-
|
|
19392
|
+
//#region ../mcp-core/dist/agent-C_Z02GOk.js
|
|
19186
19393
|
const searchEventsAgentOutputSchema = z.object({
|
|
19187
19394
|
dataset: z.enum([
|
|
19188
19395
|
"spans",
|
|
@@ -19236,7 +19443,7 @@ async function searchEventsAgent(options) {
|
|
|
19236
19443
|
}
|
|
19237
19444
|
|
|
19238
19445
|
//#endregion
|
|
19239
|
-
//#region ../mcp-core/dist/formatters-
|
|
19446
|
+
//#region ../mcp-core/dist/formatters-CBiThZnb.js
|
|
19240
19447
|
/**
|
|
19241
19448
|
* Format an explanation for how a natural language query was translated
|
|
19242
19449
|
*/
|
|
@@ -19258,12 +19465,12 @@ function formatErrorResults(params) {
|
|
|
19258
19465
|
output += `**View these results in Sentry**:\n${explorerUrl}\n`;
|
|
19259
19466
|
output += `_Please share this link with the user to view the search results in their Sentry dashboard._\n\n`;
|
|
19260
19467
|
if (eventData.length === 0) {
|
|
19261
|
-
|
|
19468
|
+
logInfo(`No error events found for query: ${naturalLanguageQuery}`, { extra: {
|
|
19262
19469
|
query: sentryQuery,
|
|
19263
19470
|
fields,
|
|
19264
19471
|
organizationSlug,
|
|
19265
19472
|
dataset: "errors"
|
|
19266
|
-
});
|
|
19473
|
+
} });
|
|
19267
19474
|
output += `No results found.\n\n`;
|
|
19268
19475
|
output += `Try being more specific or using different terms in your search.\n`;
|
|
19269
19476
|
return output;
|
|
@@ -19322,12 +19529,12 @@ function formatLogResults(params) {
|
|
|
19322
19529
|
output += `**View these results in Sentry**:\n${explorerUrl}\n`;
|
|
19323
19530
|
output += `_Please share this link with the user to view the search results in their Sentry dashboard._\n\n`;
|
|
19324
19531
|
if (eventData.length === 0) {
|
|
19325
|
-
|
|
19532
|
+
logInfo(`No log events found for query: ${naturalLanguageQuery}`, { extra: {
|
|
19326
19533
|
query: sentryQuery,
|
|
19327
19534
|
fields,
|
|
19328
19535
|
organizationSlug,
|
|
19329
19536
|
dataset: "logs"
|
|
19330
|
-
});
|
|
19537
|
+
} });
|
|
19331
19538
|
output += `No results found.\n\n`;
|
|
19332
19539
|
output += `Try being more specific or using different terms in your search.\n`;
|
|
19333
19540
|
return output;
|
|
@@ -19403,12 +19610,12 @@ function formatSpanResults(params) {
|
|
|
19403
19610
|
output += `**View these results in Sentry**:\n${explorerUrl}\n`;
|
|
19404
19611
|
output += `_Please share this link with the user to view the search results in their Sentry dashboard._\n\n`;
|
|
19405
19612
|
if (eventData.length === 0) {
|
|
19406
|
-
|
|
19613
|
+
logInfo(`No span events found for query: ${naturalLanguageQuery}`, { extra: {
|
|
19407
19614
|
query: sentryQuery,
|
|
19408
19615
|
fields,
|
|
19409
19616
|
organizationSlug,
|
|
19410
19617
|
dataset: "spans"
|
|
19411
|
-
});
|
|
19618
|
+
} });
|
|
19412
19619
|
output += `No results found.\n\n`;
|
|
19413
19620
|
output += `Try being more specific or using different terms in your search.\n`;
|
|
19414
19621
|
return output;
|
|
@@ -19454,10 +19661,10 @@ function formatSpanResults(params) {
|
|
|
19454
19661
|
}
|
|
19455
19662
|
|
|
19456
19663
|
//#endregion
|
|
19457
|
-
//#region ../mcp-core/dist/handler-
|
|
19664
|
+
//#region ../mcp-core/dist/handler-DFWcpIpC.js
|
|
19458
19665
|
var handler_default = defineTool({
|
|
19459
19666
|
name: "search_events",
|
|
19460
|
-
|
|
19667
|
+
skills: [
|
|
19461
19668
|
"inspect",
|
|
19462
19669
|
"triage",
|
|
19463
19670
|
"seer"
|
|
@@ -19595,10 +19802,10 @@ var handler_default = defineTool({
|
|
|
19595
19802
|
});
|
|
19596
19803
|
|
|
19597
19804
|
//#endregion
|
|
19598
|
-
//#region ../mcp-core/dist/create-team-
|
|
19805
|
+
//#region ../mcp-core/dist/create-team-JXD-4yd1.js
|
|
19599
19806
|
var create_team_default = defineTool({
|
|
19600
19807
|
name: "create_team",
|
|
19601
|
-
|
|
19808
|
+
skills: ["project-management"],
|
|
19602
19809
|
requiredScopes: ["team:write"],
|
|
19603
19810
|
description: [
|
|
19604
19811
|
"Create a new team in Sentry.",
|
|
@@ -19650,10 +19857,10 @@ var create_team_default = defineTool({
|
|
|
19650
19857
|
});
|
|
19651
19858
|
|
|
19652
19859
|
//#endregion
|
|
19653
|
-
//#region ../mcp-core/dist/create-project-
|
|
19860
|
+
//#region ../mcp-core/dist/create-project-B1g-3-yc.js
|
|
19654
19861
|
var create_project_default = defineTool({
|
|
19655
19862
|
name: "create_project",
|
|
19656
|
-
|
|
19863
|
+
skills: ["project-management"],
|
|
19657
19864
|
requiredScopes: ["project:write", "team:read"],
|
|
19658
19865
|
description: [
|
|
19659
19866
|
"Create a new project in Sentry (includes DSN automatically).",
|
|
@@ -19727,10 +19934,10 @@ var create_project_default = defineTool({
|
|
|
19727
19934
|
});
|
|
19728
19935
|
|
|
19729
19936
|
//#endregion
|
|
19730
|
-
//#region ../mcp-core/dist/update-project-
|
|
19937
|
+
//#region ../mcp-core/dist/update-project-sPir9pn7.js
|
|
19731
19938
|
var update_project_default = defineTool({
|
|
19732
19939
|
name: "update_project",
|
|
19733
|
-
|
|
19940
|
+
skills: ["project-management"],
|
|
19734
19941
|
requiredScopes: ["project:write"],
|
|
19735
19942
|
description: [
|
|
19736
19943
|
"Update project settings in Sentry, such as name, slug, platform, and team assignment.",
|
|
@@ -19845,10 +20052,10 @@ var update_project_default = defineTool({
|
|
|
19845
20052
|
});
|
|
19846
20053
|
|
|
19847
20054
|
//#endregion
|
|
19848
|
-
//#region ../mcp-core/dist/create-dsn-
|
|
20055
|
+
//#region ../mcp-core/dist/create-dsn-Co1eIXE3.js
|
|
19849
20056
|
var create_dsn_default = defineTool({
|
|
19850
20057
|
name: "create_dsn",
|
|
19851
|
-
|
|
20058
|
+
skills: ["project-management"],
|
|
19852
20059
|
requiredScopes: ["project:write"],
|
|
19853
20060
|
description: [
|
|
19854
20061
|
"Create an additional DSN for an EXISTING project.",
|
|
@@ -19905,10 +20112,10 @@ var create_dsn_default = defineTool({
|
|
|
19905
20112
|
});
|
|
19906
20113
|
|
|
19907
20114
|
//#endregion
|
|
19908
|
-
//#region ../mcp-core/dist/find-dsns-
|
|
20115
|
+
//#region ../mcp-core/dist/find-dsns-o0QsNJv8.js
|
|
19909
20116
|
var find_dsns_default = defineTool({
|
|
19910
20117
|
name: "find_dsns",
|
|
19911
|
-
|
|
20118
|
+
skills: ["project-management"],
|
|
19912
20119
|
requiredScopes: ["project:read"],
|
|
19913
20120
|
description: [
|
|
19914
20121
|
"List all Sentry DSNs for a specific project.",
|
|
@@ -19956,7 +20163,7 @@ var find_dsns_default = defineTool({
|
|
|
19956
20163
|
});
|
|
19957
20164
|
|
|
19958
20165
|
//#endregion
|
|
19959
|
-
//#region ../mcp-core/dist/fetch-utils-
|
|
20166
|
+
//#region ../mcp-core/dist/fetch-utils-C6qSgZai.js
|
|
19960
20167
|
/**
|
|
19961
20168
|
* Fetch with timeout using AbortController
|
|
19962
20169
|
* @param url - The URL to fetch
|
|
@@ -20006,10 +20213,10 @@ async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, should
|
|
|
20006
20213
|
}
|
|
20007
20214
|
|
|
20008
20215
|
//#endregion
|
|
20009
|
-
//#region ../mcp-core/dist/analyze-issue-with-seer-
|
|
20216
|
+
//#region ../mcp-core/dist/analyze-issue-with-seer-DLMG61CB.js
|
|
20010
20217
|
var analyze_issue_with_seer_default = defineTool({
|
|
20011
20218
|
name: "analyze_issue_with_seer",
|
|
20012
|
-
|
|
20219
|
+
skills: ["seer"],
|
|
20013
20220
|
requiredScopes: [],
|
|
20014
20221
|
description: [
|
|
20015
20222
|
"Use Seer to analyze production errors and get detailed root cause analysis with specific code fixes.",
|
|
@@ -20066,7 +20273,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20066
20273
|
},
|
|
20067
20274
|
async handler(params, context$1) {
|
|
20068
20275
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
20069
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
20276
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
20070
20277
|
organizationSlug: params.organizationSlug,
|
|
20071
20278
|
issueId: params.issueId,
|
|
20072
20279
|
issueUrl: params.issueUrl
|
|
@@ -20194,10 +20401,10 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20194
20401
|
});
|
|
20195
20402
|
|
|
20196
20403
|
//#endregion
|
|
20197
|
-
//#region ../mcp-core/dist/search-docs-
|
|
20404
|
+
//#region ../mcp-core/dist/search-docs-BzvTE9Na.js
|
|
20198
20405
|
var search_docs_default = defineTool({
|
|
20199
20406
|
name: "search_docs",
|
|
20200
|
-
|
|
20407
|
+
skills: ["docs"],
|
|
20201
20408
|
requiredScopes: [],
|
|
20202
20409
|
description: [
|
|
20203
20410
|
"Search Sentry documentation for SDK setup, instrumentation, and configuration guidance.",
|
|
@@ -20277,10 +20484,10 @@ var search_docs_default = defineTool({
|
|
|
20277
20484
|
});
|
|
20278
20485
|
|
|
20279
20486
|
//#endregion
|
|
20280
|
-
//#region ../mcp-core/dist/get-doc-
|
|
20487
|
+
//#region ../mcp-core/dist/get-doc-B2M_KGrK.js
|
|
20281
20488
|
var get_doc_default = defineTool({
|
|
20282
20489
|
name: "get_doc",
|
|
20283
|
-
|
|
20490
|
+
skills: ["docs"],
|
|
20284
20491
|
requiredScopes: [],
|
|
20285
20492
|
description: [
|
|
20286
20493
|
"Fetch the full markdown content of a Sentry documentation page.",
|
|
@@ -20354,7 +20561,7 @@ var get_doc_default = defineTool({
|
|
|
20354
20561
|
});
|
|
20355
20562
|
|
|
20356
20563
|
//#endregion
|
|
20357
|
-
//#region ../mcp-core/dist/dataset-fields-
|
|
20564
|
+
//#region ../mcp-core/dist/dataset-fields-nvbboMpe.js
|
|
20358
20565
|
/**
|
|
20359
20566
|
* Discover available fields for a dataset by querying Sentry's tags API
|
|
20360
20567
|
*/
|
|
@@ -20504,11 +20711,11 @@ function getCommonPatterns(dataset) {
|
|
|
20504
20711
|
}
|
|
20505
20712
|
|
|
20506
20713
|
//#endregion
|
|
20507
|
-
//#region ../mcp-core/dist/config-
|
|
20714
|
+
//#region ../mcp-core/dist/config-BFaJp4hW.js
|
|
20508
20715
|
/**
|
|
20509
20716
|
* Configuration for the search-issues agent
|
|
20510
20717
|
*/
|
|
20511
|
-
const systemPrompt$
|
|
20718
|
+
const systemPrompt$3 = `You are a Sentry issue search query translator. Convert natural language queries to Sentry issue search syntax.
|
|
20512
20719
|
|
|
20513
20720
|
IMPORTANT RULES:
|
|
20514
20721
|
1. Use Sentry issue search syntax, NOT SQL
|
|
@@ -20576,7 +20783,7 @@ Always use the issueFields tool to discover available fields when needed.
|
|
|
20576
20783
|
Use the whoami tool when you need to resolve 'me' references.`;
|
|
20577
20784
|
|
|
20578
20785
|
//#endregion
|
|
20579
|
-
//#region ../mcp-core/dist/agent-
|
|
20786
|
+
//#region ../mcp-core/dist/agent-Jg5_CT7U.js
|
|
20580
20787
|
const searchIssuesAgentOutputSchema = z.object({
|
|
20581
20788
|
query: z.string().describe("The Sentry issue search query"),
|
|
20582
20789
|
sort: z.enum([
|
|
@@ -20594,7 +20801,7 @@ const searchIssuesAgentOutputSchema = z.object({
|
|
|
20594
20801
|
async function searchIssuesAgent(options) {
|
|
20595
20802
|
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for semantic search");
|
|
20596
20803
|
return await callEmbeddedAgent({
|
|
20597
|
-
system: systemPrompt$
|
|
20804
|
+
system: systemPrompt$3,
|
|
20598
20805
|
prompt: options.query,
|
|
20599
20806
|
tools: {
|
|
20600
20807
|
issueFields: createDatasetFieldsTool({
|
|
@@ -20610,7 +20817,7 @@ async function searchIssuesAgent(options) {
|
|
|
20610
20817
|
}
|
|
20611
20818
|
|
|
20612
20819
|
//#endregion
|
|
20613
|
-
//#region ../mcp-core/dist/formatters-
|
|
20820
|
+
//#region ../mcp-core/dist/formatters-W4LF85x9.js
|
|
20614
20821
|
/**
|
|
20615
20822
|
* Format an explanation for how a natural language query was translated
|
|
20616
20823
|
*/
|
|
@@ -20634,12 +20841,12 @@ function formatIssueResults(params) {
|
|
|
20634
20841
|
output += `⚠️ **IMPORTANT**: Display these issues as highlighted cards with status indicators, assignee info, and clickable Issue IDs.\n\n`;
|
|
20635
20842
|
}
|
|
20636
20843
|
if (issues.length === 0) {
|
|
20637
|
-
|
|
20844
|
+
logInfo(`No issues found for query: ${naturalLanguageQuery || query}`, { extra: {
|
|
20638
20845
|
query,
|
|
20639
20846
|
organizationSlug,
|
|
20640
20847
|
projectSlug: projectSlugOrId,
|
|
20641
20848
|
naturalLanguageQuery
|
|
20642
|
-
});
|
|
20849
|
+
} });
|
|
20643
20850
|
output += "No issues found matching your search criteria.\n\n";
|
|
20644
20851
|
output += "Try adjusting your search criteria or time range.";
|
|
20645
20852
|
return output;
|
|
@@ -20691,10 +20898,10 @@ function formatDate(dateString) {
|
|
|
20691
20898
|
}
|
|
20692
20899
|
|
|
20693
20900
|
//#endregion
|
|
20694
|
-
//#region ../mcp-core/dist/handler-
|
|
20901
|
+
//#region ../mcp-core/dist/handler-rR_VkT5b.js
|
|
20695
20902
|
var handler_default$1 = defineTool({
|
|
20696
20903
|
name: "search_issues",
|
|
20697
|
-
|
|
20904
|
+
skills: [
|
|
20698
20905
|
"inspect",
|
|
20699
20906
|
"triage",
|
|
20700
20907
|
"seer"
|
|
@@ -20812,7 +21019,564 @@ var handler_default$1 = defineTool({
|
|
|
20812
21019
|
});
|
|
20813
21020
|
|
|
20814
21021
|
//#endregion
|
|
20815
|
-
//#region ../mcp-core/dist/config-
|
|
21022
|
+
//#region ../mcp-core/dist/config-DbfMHS7d.js
|
|
21023
|
+
const systemPrompt$2 = `You are a Sentry issue event filter translator. Your job is to:
|
|
21024
|
+
1. Translate natural language queries into Sentry tag filters for events within a SPECIFIC issue
|
|
21025
|
+
2. Select appropriate fields to return in the results
|
|
21026
|
+
3. Determine sort order and time ranges
|
|
21027
|
+
|
|
21028
|
+
IMPORTANT CONTEXT:
|
|
21029
|
+
- You are filtering events WITHIN a specific issue (the API endpoint is already scoped to that issue)
|
|
21030
|
+
- DO NOT include "issue:" in your query - the endpoint filters by issue automatically
|
|
21031
|
+
- Focus on tag-based filtering: release, environment, user, trace ID, URL, etc.
|
|
21032
|
+
- You are working with the "errors" dataset (issues are groups of error events)
|
|
21033
|
+
|
|
21034
|
+
CRITICAL - TAG FIELD VERIFICATION:
|
|
21035
|
+
Before using ANY tag or field, you should call the issueEventFields tool to verify it exists:
|
|
21036
|
+
1. Available tags vary by project and what data is being sent
|
|
21037
|
+
2. Using non-existent tags will cause query failures
|
|
21038
|
+
3. The issueEventFields tool returns ALL available tags for the issue's project
|
|
21039
|
+
4. Field names may not be what you expect (e.g., "user_agent.original" not "browser")
|
|
21040
|
+
|
|
21041
|
+
TOOL USAGE GUIDELINES:
|
|
21042
|
+
1. Use issueEventFields tool (no parameters) to discover available tags and fields
|
|
21043
|
+
2. Use whoami tool when queries reference "me", "my", or "myself" for user.id/user.email
|
|
21044
|
+
3. CRITICAL: All tools return {error?, result?} format - check for errors before using results
|
|
21045
|
+
|
|
21046
|
+
QUERY CONSTRUCTION:
|
|
21047
|
+
Your query should contain ONLY the filter expressions (tags, operators, values):
|
|
21048
|
+
- CORRECT: "environment:production release:v1.0.5"
|
|
21049
|
+
- CORRECT: "user.email:alice@example.com"
|
|
21050
|
+
- CORRECT: 'url:"*/checkout/*"'
|
|
21051
|
+
- WRONG: "issue:MCP-41 environment:production" ← DO NOT include issue: prefix
|
|
21052
|
+
|
|
21053
|
+
COMMON TAG PATTERNS:
|
|
21054
|
+
- release:VERSION - Filter by software release/version
|
|
21055
|
+
- environment:ENV - Filter by environment (production, staging, development)
|
|
21056
|
+
- user:USER_ID or user.email:EMAIL - Filter by user
|
|
21057
|
+
- trace:TRACE_ID - Filter by distributed trace ID
|
|
21058
|
+
- url:URL_PATTERN - Filter by request URL (use wildcards: "*/path/*")
|
|
21059
|
+
- transaction:NAME - Filter by transaction name
|
|
21060
|
+
- level:LEVEL - Filter by error level (error, warning, fatal, info)
|
|
21061
|
+
- device:DEVICE - Filter by device identifier
|
|
21062
|
+
- os:OS_NAME - Filter by operating system
|
|
21063
|
+
- browser:BROWSER - Filter by browser name
|
|
21064
|
+
- runtime:RUNTIME - Filter by runtime version (e.g., "python 3.11")
|
|
21065
|
+
|
|
21066
|
+
WILDCARD MATCHING:
|
|
21067
|
+
- Use "*" for wildcards in string values
|
|
21068
|
+
- Example: url:"*/checkout/*" matches any URL containing /checkout/
|
|
21069
|
+
- Example: release:"1.2.*" matches any 1.2.x release
|
|
21070
|
+
|
|
21071
|
+
TIME RANGE HANDLING:
|
|
21072
|
+
For time-based queries ("last hour", "yesterday", "from Dec 16"):
|
|
21073
|
+
- Relative: Use statsPeriod ("1h", "24h", "7d", "14d", "30d")
|
|
21074
|
+
- "last hour" → {"statsPeriod": "1h"}
|
|
21075
|
+
- "yesterday" → {"statsPeriod": "24h"}
|
|
21076
|
+
- "last week" → {"statsPeriod": "7d"}
|
|
21077
|
+
- Absolute: Use start/end (ISO 8601 format)
|
|
21078
|
+
- "from Dec 16 2025 17:50 UTC" → {"start": "2025-12-16T17:50:00Z", "end": "2025-12-17T23:59:59Z"}
|
|
21079
|
+
- Default: If no time mentioned, use {"statsPeriod": "14d"}
|
|
21080
|
+
|
|
21081
|
+
FIELD SELECTION:
|
|
21082
|
+
- Use recommended default fields unless user asks for specific data
|
|
21083
|
+
- For custom fields, verify availability with issueEventFields tool
|
|
21084
|
+
- Common useful fields:
|
|
21085
|
+
- id: Event ID
|
|
21086
|
+
- timestamp: When event occurred
|
|
21087
|
+
- title: Event title/message
|
|
21088
|
+
- message: Full error message
|
|
21089
|
+
- level: Error severity
|
|
21090
|
+
- environment: Deployment environment
|
|
21091
|
+
- release: Release version
|
|
21092
|
+
- user.display: User identifier
|
|
21093
|
+
- trace: Trace ID
|
|
21094
|
+
- url: Request URL
|
|
21095
|
+
- device: Device identifier
|
|
21096
|
+
- os: Operating system
|
|
21097
|
+
- runtime: Runtime environment
|
|
21098
|
+
|
|
21099
|
+
SORTING RULES (CRITICAL):
|
|
21100
|
+
1. ALWAYS specify a sort parameter
|
|
21101
|
+
2. Default: "-timestamp" (newest first) for time-based browsing
|
|
21102
|
+
3. Use "-" prefix for descending order
|
|
21103
|
+
4. CRITICAL: Sort field MUST be included in your fields array
|
|
21104
|
+
5. Examples:
|
|
21105
|
+
- sort: "-timestamp", fields: ["id", "timestamp", "message"] ✓ CORRECT
|
|
21106
|
+
- sort: "-level", fields: ["id", "timestamp"] ✗ WRONG (level not in fields)
|
|
21107
|
+
|
|
21108
|
+
DO NOT USE:
|
|
21109
|
+
- Aggregate functions (count, avg, sum) - this tool returns individual events, not statistics
|
|
21110
|
+
- SQL syntax (IS NULL, yesterday(), etc.) - use has: operator and timeRange instead
|
|
21111
|
+
- Field existence checks unless necessary (has:field_name, !has:field_name)
|
|
21112
|
+
|
|
21113
|
+
HANDLING "ME" REFERENCES:
|
|
21114
|
+
- If query contains "me", "my errors", "assigned to me", use whoami tool
|
|
21115
|
+
- Replace "me" with actual user.id or user.email value
|
|
21116
|
+
- Example: "my errors" + whoami returns user.email:"alice@example.com"
|
|
21117
|
+
→ query: "user.email:alice@example.com"
|
|
21118
|
+
|
|
21119
|
+
YOUR RESPONSE FORMAT:
|
|
21120
|
+
Return a JSON object with:
|
|
21121
|
+
- "query": Tag filter expressions (empty string "" for no filters)
|
|
21122
|
+
- "fields": Array of field names to return (use recommended defaults if not specified)
|
|
21123
|
+
- "sort": Sort parameter (REQUIRED - default to "-timestamp")
|
|
21124
|
+
- "timeRange": Optional time range
|
|
21125
|
+
- Relative: {"statsPeriod": "24h"}
|
|
21126
|
+
- Absolute: {"start": "2025-01-01T00:00:00Z", "end": "2025-01-02T00:00:00Z"}
|
|
21127
|
+
- Omit for default 14-day window
|
|
21128
|
+
- "explanation": Brief explanation of how you translated the query
|
|
21129
|
+
|
|
21130
|
+
CORRECT QUERY EXAMPLES:
|
|
21131
|
+
1. "events from last hour"
|
|
21132
|
+
→ {
|
|
21133
|
+
"query": "",
|
|
21134
|
+
"fields": ["id", "timestamp", "title", "message", "level"],
|
|
21135
|
+
"sort": "-timestamp",
|
|
21136
|
+
"timeRange": {"statsPeriod": "1h"},
|
|
21137
|
+
"explanation": "Filtering to events from last hour, sorted newest first"
|
|
21138
|
+
}
|
|
21139
|
+
|
|
21140
|
+
2. "production events with release v1.0.5"
|
|
21141
|
+
→ {
|
|
21142
|
+
"query": "environment:production release:v1.0.5",
|
|
21143
|
+
"fields": ["id", "timestamp", "title", "environment", "release"],
|
|
21144
|
+
"sort": "-timestamp",
|
|
21145
|
+
"timeRange": {"statsPeriod": "14d"},
|
|
21146
|
+
"explanation": "Filtering to production environment with specific release"
|
|
21147
|
+
}
|
|
21148
|
+
|
|
21149
|
+
3. "errors affecting user alice@example.com"
|
|
21150
|
+
→ {
|
|
21151
|
+
"query": "user.email:alice@example.com",
|
|
21152
|
+
"fields": ["id", "timestamp", "title", "user.display", "message"],
|
|
21153
|
+
"sort": "-timestamp",
|
|
21154
|
+
"timeRange": {"statsPeriod": "14d"},
|
|
21155
|
+
"explanation": "Filtering to events affecting specific user"
|
|
21156
|
+
}
|
|
21157
|
+
|
|
21158
|
+
4. "events with trace ID abc123"
|
|
21159
|
+
→ {
|
|
21160
|
+
"query": "trace:abc123",
|
|
21161
|
+
"fields": ["id", "timestamp", "title", "trace", "url", "transaction"],
|
|
21162
|
+
"sort": "-timestamp",
|
|
21163
|
+
"timeRange": {"statsPeriod": "14d"},
|
|
21164
|
+
"explanation": "Filtering to events with specific trace ID"
|
|
21165
|
+
}
|
|
21166
|
+
|
|
21167
|
+
PROCESS:
|
|
21168
|
+
1. Analyze the user's natural language query
|
|
21169
|
+
2. Call issueEventFields tool to discover available tags (if needed)
|
|
21170
|
+
3. Call whoami tool if query references "me" (if needed)
|
|
21171
|
+
4. Construct tag filters (WITHOUT "issue:" prefix)
|
|
21172
|
+
5. Select appropriate fields
|
|
21173
|
+
6. Determine sort order (default: "-timestamp")
|
|
21174
|
+
7. Determine time range (if applicable)
|
|
21175
|
+
8. Return JSON response with explanation
|
|
21176
|
+
|
|
21177
|
+
COMMON ERRORS TO AVOID:
|
|
21178
|
+
- Including "issue:" in query (handler adds this automatically)
|
|
21179
|
+
- Using aggregate functions like count() or avg()
|
|
21180
|
+
- Using non-existent field names (verify with issueEventFields tool)
|
|
21181
|
+
- Forgetting to include sort field in fields array
|
|
21182
|
+
- Using SQL syntax instead of Sentry query syntax`;
|
|
21183
|
+
const ISSUE_EVENT_TAGS = {
|
|
21184
|
+
release: "Software version/release identifier",
|
|
21185
|
+
environment: "Deployment environment (production, staging, development, etc.)",
|
|
21186
|
+
level: "Error severity level (error, warning, fatal, info, debug)",
|
|
21187
|
+
user: "User identifier",
|
|
21188
|
+
"user.id": "User ID",
|
|
21189
|
+
"user.email": "User email address",
|
|
21190
|
+
"user.username": "Username",
|
|
21191
|
+
"user.display": "User display name (formatted)",
|
|
21192
|
+
transaction: "Transaction name/route",
|
|
21193
|
+
url: "Request URL",
|
|
21194
|
+
trace: "Distributed trace ID",
|
|
21195
|
+
device: "Device identifier",
|
|
21196
|
+
"device.family": "Device family",
|
|
21197
|
+
os: "Operating system name",
|
|
21198
|
+
"os.name": "OS name",
|
|
21199
|
+
"os.version": "OS version",
|
|
21200
|
+
runtime: "Runtime environment",
|
|
21201
|
+
"runtime.name": "Runtime name (e.g., CPython)",
|
|
21202
|
+
"runtime.version": "Runtime version",
|
|
21203
|
+
browser: "Browser identifier",
|
|
21204
|
+
"browser.name": "Browser name",
|
|
21205
|
+
"browser.version": "Browser version",
|
|
21206
|
+
handled: "Whether error was handled (true/false)",
|
|
21207
|
+
mechanism: "Error mechanism type",
|
|
21208
|
+
"error.type": "Exception type/class name",
|
|
21209
|
+
"stack.filename": "Source file where error occurred",
|
|
21210
|
+
"stack.function": "Function where error occurred",
|
|
21211
|
+
"stack.module": "Module where error occurred",
|
|
21212
|
+
platform: "SDK platform (javascript, python, etc.)",
|
|
21213
|
+
"sdk.name": "SDK name",
|
|
21214
|
+
"sdk.version": "SDK version",
|
|
21215
|
+
"http.method": "HTTP request method",
|
|
21216
|
+
"http.status_code": "HTTP status code",
|
|
21217
|
+
"user_agent.original": "Original user agent string"
|
|
21218
|
+
};
|
|
21219
|
+
const RECOMMENDED_FIELDS$1 = [
|
|
21220
|
+
"id",
|
|
21221
|
+
"timestamp",
|
|
21222
|
+
"title",
|
|
21223
|
+
"message",
|
|
21224
|
+
"level",
|
|
21225
|
+
"environment",
|
|
21226
|
+
"release",
|
|
21227
|
+
"user.display",
|
|
21228
|
+
"trace",
|
|
21229
|
+
"url"
|
|
21230
|
+
];
|
|
21231
|
+
const EXAMPLE_QUERIES = [
|
|
21232
|
+
{
|
|
21233
|
+
description: "Events from last hour",
|
|
21234
|
+
output: {
|
|
21235
|
+
query: "",
|
|
21236
|
+
fields: RECOMMENDED_FIELDS$1,
|
|
21237
|
+
sort: "-timestamp",
|
|
21238
|
+
timeRange: { statsPeriod: "1h" }
|
|
21239
|
+
}
|
|
21240
|
+
},
|
|
21241
|
+
{
|
|
21242
|
+
description: "Production events with specific release",
|
|
21243
|
+
output: {
|
|
21244
|
+
query: "environment:production release:09f66121-a5a3-4947-8be1-1454c4cefa3d",
|
|
21245
|
+
fields: [
|
|
21246
|
+
"id",
|
|
21247
|
+
"timestamp",
|
|
21248
|
+
"title",
|
|
21249
|
+
"environment",
|
|
21250
|
+
"release",
|
|
21251
|
+
"user.display"
|
|
21252
|
+
],
|
|
21253
|
+
sort: "-timestamp",
|
|
21254
|
+
timeRange: { statsPeriod: "7d" }
|
|
21255
|
+
}
|
|
21256
|
+
},
|
|
21257
|
+
{
|
|
21258
|
+
description: "Events affecting specific user",
|
|
21259
|
+
output: {
|
|
21260
|
+
query: "user.email:alice@example.com",
|
|
21261
|
+
fields: [
|
|
21262
|
+
"id",
|
|
21263
|
+
"timestamp",
|
|
21264
|
+
"title",
|
|
21265
|
+
"user.display",
|
|
21266
|
+
"user.email",
|
|
21267
|
+
"message"
|
|
21268
|
+
],
|
|
21269
|
+
sort: "-timestamp",
|
|
21270
|
+
timeRange: { statsPeriod: "14d" }
|
|
21271
|
+
}
|
|
21272
|
+
},
|
|
21273
|
+
{
|
|
21274
|
+
description: "Events with specific trace ID",
|
|
21275
|
+
output: {
|
|
21276
|
+
query: "trace:abc123def456",
|
|
21277
|
+
fields: [
|
|
21278
|
+
"id",
|
|
21279
|
+
"timestamp",
|
|
21280
|
+
"title",
|
|
21281
|
+
"trace",
|
|
21282
|
+
"url",
|
|
21283
|
+
"transaction"
|
|
21284
|
+
],
|
|
21285
|
+
sort: "-timestamp",
|
|
21286
|
+
timeRange: { statsPeriod: "14d" }
|
|
21287
|
+
}
|
|
21288
|
+
},
|
|
21289
|
+
{
|
|
21290
|
+
description: "Events from checkout flow",
|
|
21291
|
+
output: {
|
|
21292
|
+
query: "url:\"*/checkout/*\"",
|
|
21293
|
+
fields: [
|
|
21294
|
+
"id",
|
|
21295
|
+
"timestamp",
|
|
21296
|
+
"title",
|
|
21297
|
+
"url",
|
|
21298
|
+
"transaction",
|
|
21299
|
+
"user.display"
|
|
21300
|
+
],
|
|
21301
|
+
sort: "-timestamp",
|
|
21302
|
+
timeRange: { statsPeriod: "7d" }
|
|
21303
|
+
}
|
|
21304
|
+
},
|
|
21305
|
+
{
|
|
21306
|
+
description: "Fatal errors only",
|
|
21307
|
+
output: {
|
|
21308
|
+
query: "level:fatal",
|
|
21309
|
+
fields: [
|
|
21310
|
+
"id",
|
|
21311
|
+
"timestamp",
|
|
21312
|
+
"title",
|
|
21313
|
+
"level",
|
|
21314
|
+
"message",
|
|
21315
|
+
"error.type"
|
|
21316
|
+
],
|
|
21317
|
+
sort: "-timestamp",
|
|
21318
|
+
timeRange: { statsPeriod: "30d" }
|
|
21319
|
+
}
|
|
21320
|
+
},
|
|
21321
|
+
{
|
|
21322
|
+
description: "Events on mobile devices",
|
|
21323
|
+
output: {
|
|
21324
|
+
query: "device:mobile OR device.family:mobile",
|
|
21325
|
+
fields: [
|
|
21326
|
+
"id",
|
|
21327
|
+
"timestamp",
|
|
21328
|
+
"title",
|
|
21329
|
+
"device",
|
|
21330
|
+
"device.family",
|
|
21331
|
+
"os",
|
|
21332
|
+
"browser"
|
|
21333
|
+
],
|
|
21334
|
+
sort: "-timestamp",
|
|
21335
|
+
timeRange: { statsPeriod: "7d" }
|
|
21336
|
+
}
|
|
21337
|
+
},
|
|
21338
|
+
{
|
|
21339
|
+
description: "Events from specific browser",
|
|
21340
|
+
output: {
|
|
21341
|
+
query: "browser.name:Chrome",
|
|
21342
|
+
fields: [
|
|
21343
|
+
"id",
|
|
21344
|
+
"timestamp",
|
|
21345
|
+
"title",
|
|
21346
|
+
"browser.name",
|
|
21347
|
+
"browser.version",
|
|
21348
|
+
"os"
|
|
21349
|
+
],
|
|
21350
|
+
sort: "-timestamp",
|
|
21351
|
+
timeRange: { statsPeriod: "7d" }
|
|
21352
|
+
}
|
|
21353
|
+
}
|
|
21354
|
+
];
|
|
21355
|
+
|
|
21356
|
+
//#endregion
|
|
21357
|
+
//#region ../mcp-core/dist/utils-jBgE1HtJ.js
|
|
21358
|
+
/**
|
|
21359
|
+
* Create a tool for the agent to query available tags and fields for issue events
|
|
21360
|
+
* The tool is pre-bound with the API service and organization configured for the appropriate region
|
|
21361
|
+
*/
|
|
21362
|
+
function createIssueEventFieldsTool(options) {
|
|
21363
|
+
const { apiService, organizationSlug, projectId } = options;
|
|
21364
|
+
return agentTool({
|
|
21365
|
+
description: "Get available tags and fields for issue events to understand what filters are available",
|
|
21366
|
+
parameters: z.object({}),
|
|
21367
|
+
execute: async () => {
|
|
21368
|
+
const tagsResponse = await apiService.listTags({
|
|
21369
|
+
organizationSlug,
|
|
21370
|
+
dataset: "events",
|
|
21371
|
+
project: projectId,
|
|
21372
|
+
statsPeriod: "14d",
|
|
21373
|
+
useCache: true,
|
|
21374
|
+
useFlagsBackend: true
|
|
21375
|
+
});
|
|
21376
|
+
const availableTags = {};
|
|
21377
|
+
for (const tag of tagsResponse) if (tag.key) {
|
|
21378
|
+
const knownTagDescription = ISSUE_EVENT_TAGS[tag.key];
|
|
21379
|
+
availableTags[tag.key] = tag.name || knownTagDescription || tag.key;
|
|
21380
|
+
}
|
|
21381
|
+
const allTags = {
|
|
21382
|
+
...ISSUE_EVENT_TAGS,
|
|
21383
|
+
...availableTags
|
|
21384
|
+
};
|
|
21385
|
+
return `Available Tags and Fields (${Object.keys(allTags).length} total):
|
|
21386
|
+
|
|
21387
|
+
Common Tags:
|
|
21388
|
+
${Object.entries(ISSUE_EVENT_TAGS).slice(0, 30).map(([key, desc]) => `- ${key}: ${desc}`).join("\n")}
|
|
21389
|
+
${Object.keys(ISSUE_EVENT_TAGS).length > 30 ? `\n... and ${Object.keys(ISSUE_EVENT_TAGS).length - 30} more common tags` : ""}
|
|
21390
|
+
|
|
21391
|
+
Project-Specific Tags (from API):
|
|
21392
|
+
${Object.entries(availableTags).filter(([key]) => !ISSUE_EVENT_TAGS[key]).slice(0, 20).map(([key, desc]) => `- ${key}: ${desc}`).join("\n")}
|
|
21393
|
+
|
|
21394
|
+
Recommended Fields for Results:
|
|
21395
|
+
${RECOMMENDED_FIELDS$1.map((f) => `- ${f}`).join("\n")}
|
|
21396
|
+
|
|
21397
|
+
EXAMPLE QUERIES:
|
|
21398
|
+
${EXAMPLE_QUERIES.map((ex) => `- "${ex.description}" →\n ${JSON.stringify(ex.output, null, 2)}`).join("\n\n")}
|
|
21399
|
+
|
|
21400
|
+
IMPORTANT:
|
|
21401
|
+
- Use these tag names exactly as shown in your query
|
|
21402
|
+
- Tags are case-insensitive
|
|
21403
|
+
- Use wildcards with quotes: url:"*/checkout/*"
|
|
21404
|
+
- Your query should NOT include "issue:" prefix - the handler adds it automatically`;
|
|
21405
|
+
}
|
|
21406
|
+
});
|
|
21407
|
+
}
|
|
21408
|
+
/**
|
|
21409
|
+
* Parse issue parameters from various input formats
|
|
21410
|
+
* Supports both direct issueId/organizationSlug and issueUrl parsing
|
|
21411
|
+
*/
|
|
21412
|
+
function parseIssueParams(params) {
|
|
21413
|
+
if (params.issueUrl) {
|
|
21414
|
+
const orgMatch = params.issueUrl.match(/\/organizations\/([^/]+)\/issues\/([^/?]+)/) || params.issueUrl.match(/https?:\/\/([^.]+)\.sentry\.io\/issues\/([^/?]+)/);
|
|
21415
|
+
if (!orgMatch) throw new UserInputError(`Invalid issue URL format. Expected format like:
|
|
21416
|
+
- https://sentry.io/organizations/my-org/issues/123/
|
|
21417
|
+
- https://my-org.sentry.io/issues/123/
|
|
21418
|
+
|
|
21419
|
+
Received: ${params.issueUrl}`);
|
|
21420
|
+
return {
|
|
21421
|
+
organizationSlug: orgMatch[1],
|
|
21422
|
+
issueId: orgMatch[2]
|
|
21423
|
+
};
|
|
21424
|
+
}
|
|
21425
|
+
if (!params.issueId) throw new UserInputError("Must provide either issueUrl or issueId parameter. Use issueUrl for convenience, or provide both issueId and organizationSlug.");
|
|
21426
|
+
if (!params.organizationSlug) throw new UserInputError("When using issueId parameter, organizationSlug is required. Alternatively, provide issueUrl which includes both organization and issue ID.");
|
|
21427
|
+
return {
|
|
21428
|
+
organizationSlug: params.organizationSlug,
|
|
21429
|
+
issueId: params.issueId
|
|
21430
|
+
};
|
|
21431
|
+
}
|
|
21432
|
+
|
|
21433
|
+
//#endregion
|
|
21434
|
+
//#region ../mcp-core/dist/agent-CuQeP0Og.js
|
|
21435
|
+
const searchIssueEventsAgentOutputSchema = z.object({
|
|
21436
|
+
query: z.string().describe("Sentry query filters for tags/fields (NOT including issue: prefix - handler adds that)"),
|
|
21437
|
+
fields: z.array(z.string()).describe("Array of field names to return in results"),
|
|
21438
|
+
sort: z.string().describe("Sort parameter for results (e.g., -timestamp)"),
|
|
21439
|
+
timeRange: z.union([
|
|
21440
|
+
z.object({ statsPeriod: z.string().describe("Relative time period like '1h', '24h', '7d', '14d'") }),
|
|
21441
|
+
z.object({
|
|
21442
|
+
start: z.string().describe("ISO 8601 start time"),
|
|
21443
|
+
end: z.string().describe("ISO 8601 end time")
|
|
21444
|
+
}),
|
|
21445
|
+
z.null()
|
|
21446
|
+
]).describe("Time range for filtering events. Use either statsPeriod for relative time or start/end for absolute time. Use null for default 14-day window."),
|
|
21447
|
+
explanation: z.string().describe("Brief explanation of how you translated this query")
|
|
21448
|
+
}).refine((data) => {
|
|
21449
|
+
if (!data.sort || !data.fields || data.fields.length === 0) return true;
|
|
21450
|
+
const sortField = data.sort.startsWith("-") ? data.sort.substring(1) : data.sort;
|
|
21451
|
+
return data.fields.includes(sortField);
|
|
21452
|
+
}, { message: "Sort field must be included in the fields array. Sentry requires that any field used for sorting must also be explicitly selected. Add the sort field to the fields array or choose a different sort field that's already included." });
|
|
21453
|
+
/**
|
|
21454
|
+
* Search issue events agent - translates natural language queries to Sentry tag filters for events within a specific issue
|
|
21455
|
+
* Returns both the translated query result AND the tool calls made by the agent
|
|
21456
|
+
*/
|
|
21457
|
+
async function searchIssueEventsAgent(options) {
|
|
21458
|
+
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for natural language query translation");
|
|
21459
|
+
const issueEventFieldsTool = createIssueEventFieldsTool({
|
|
21460
|
+
apiService: options.apiService,
|
|
21461
|
+
organizationSlug: options.organizationSlug,
|
|
21462
|
+
projectId: options.projectId
|
|
21463
|
+
});
|
|
21464
|
+
const whoamiTool = createWhoamiTool({ apiService: options.apiService });
|
|
21465
|
+
return await callEmbeddedAgent({
|
|
21466
|
+
system: systemPrompt$2,
|
|
21467
|
+
prompt: options.query,
|
|
21468
|
+
tools: {
|
|
21469
|
+
issueEventFields: issueEventFieldsTool,
|
|
21470
|
+
whoami: whoamiTool
|
|
21471
|
+
},
|
|
21472
|
+
schema: searchIssueEventsAgentOutputSchema
|
|
21473
|
+
});
|
|
21474
|
+
}
|
|
21475
|
+
|
|
21476
|
+
//#endregion
|
|
21477
|
+
//#region ../mcp-core/dist/handler-Ca256WDv.js
|
|
21478
|
+
var handler_default$2 = defineTool({
|
|
21479
|
+
name: "search_issue_events",
|
|
21480
|
+
skills: ["inspect", "triage"],
|
|
21481
|
+
requiredScopes: ["event:read"],
|
|
21482
|
+
description: [
|
|
21483
|
+
"Search and filter events within a specific issue using natural language queries.",
|
|
21484
|
+
"",
|
|
21485
|
+
"Use this to filter events by time, environment, release, user, trace ID, or other tags. The tool automatically constrains results to the specified issue.",
|
|
21486
|
+
"",
|
|
21487
|
+
"For cross-issue searches use search_issues, for single event details use get_issue_details.",
|
|
21488
|
+
"",
|
|
21489
|
+
"<examples>",
|
|
21490
|
+
"search_issue_events(issueId='MCP-41', organizationSlug='my-org', naturalLanguageQuery='from last hour')",
|
|
21491
|
+
"search_issue_events(issueUrl='https://sentry.io/.../issues/123/', naturalLanguageQuery='production with release v1.0')",
|
|
21492
|
+
"</examples>"
|
|
21493
|
+
].join("\n"),
|
|
21494
|
+
inputSchema: {
|
|
21495
|
+
organizationSlug: ParamOrganizationSlug.nullable().default(null).describe("Organization slug. Required when using issueId. Not needed when using issueUrl."),
|
|
21496
|
+
issueId: z.string().optional().describe("Issue ID (e.g., 'MCP-41', 'PROJECT-123'). Requires organizationSlug. Alternatively, use issueUrl."),
|
|
21497
|
+
issueUrl: z.string().url().optional().describe("Full Sentry issue URL (e.g., 'https://sentry.io/organizations/my-org/issues/123/'). Includes both organization and issue ID."),
|
|
21498
|
+
naturalLanguageQuery: z.string().trim().min(1).describe("Natural language description of what events you want to find within this issue. Examples: 'from last hour', 'production with release v1.0', 'affecting user alice@example.com', 'with trace ID abc123'"),
|
|
21499
|
+
projectSlug: ParamProjectSlug.nullable().default(null).describe("Project slug for better tag discovery. Optional - helps find project-specific tags."),
|
|
21500
|
+
regionUrl: ParamRegionUrl.nullable().default(null).describe("Sentry region URL. Optional - defaults to main region."),
|
|
21501
|
+
limit: z.number().min(1).max(100).default(50).describe("Maximum number of events to return (1-100, default: 50)"),
|
|
21502
|
+
includeExplanation: z.boolean().default(false).describe("Include explanation of how the natural language query was translated to Sentry syntax")
|
|
21503
|
+
},
|
|
21504
|
+
annotations: {
|
|
21505
|
+
readOnlyHint: true,
|
|
21506
|
+
openWorldHint: true
|
|
21507
|
+
},
|
|
21508
|
+
async handler(params, context$1) {
|
|
21509
|
+
const { organizationSlug, issueId } = parseIssueParams({
|
|
21510
|
+
organizationSlug: params.organizationSlug,
|
|
21511
|
+
issueId: params.issueId,
|
|
21512
|
+
issueUrl: params.issueUrl
|
|
21513
|
+
});
|
|
21514
|
+
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
21515
|
+
setTag("organization.slug", organizationSlug);
|
|
21516
|
+
setTag("issue.id", issueId);
|
|
21517
|
+
if (params.projectSlug) setTag("project.slug", params.projectSlug);
|
|
21518
|
+
let projectId;
|
|
21519
|
+
if (params.projectSlug) try {
|
|
21520
|
+
const project = await apiService.getProject({
|
|
21521
|
+
organizationSlug,
|
|
21522
|
+
projectSlugOrId: params.projectSlug
|
|
21523
|
+
});
|
|
21524
|
+
projectId = String(project.id);
|
|
21525
|
+
} catch (error) {
|
|
21526
|
+
console.warn(`Could not resolve project ${params.projectSlug}:`, error);
|
|
21527
|
+
}
|
|
21528
|
+
const agentResult = await searchIssueEventsAgent({
|
|
21529
|
+
query: params.naturalLanguageQuery,
|
|
21530
|
+
organizationSlug,
|
|
21531
|
+
apiService,
|
|
21532
|
+
projectId
|
|
21533
|
+
});
|
|
21534
|
+
const parsed = agentResult.result;
|
|
21535
|
+
if (!parsed.sort) throw new UserInputError(`Search Issue Events Agent response missing required 'sort' parameter. Received: ${JSON.stringify(parsed, null, 2)}. The agent must specify how to sort results (e.g., '-timestamp' for newest first).`);
|
|
21536
|
+
const query = parsed.query || "";
|
|
21537
|
+
const requestedFields = parsed.fields || [];
|
|
21538
|
+
const fields = requestedFields.length > 0 ? requestedFields : RECOMMENDED_FIELDS$1;
|
|
21539
|
+
const sortParam = parsed.sort;
|
|
21540
|
+
const timeParams = {};
|
|
21541
|
+
if (parsed.timeRange) {
|
|
21542
|
+
if ("statsPeriod" in parsed.timeRange) timeParams.statsPeriod = parsed.timeRange.statsPeriod;
|
|
21543
|
+
else if ("start" in parsed.timeRange && "end" in parsed.timeRange) {
|
|
21544
|
+
timeParams.start = parsed.timeRange.start;
|
|
21545
|
+
timeParams.end = parsed.timeRange.end;
|
|
21546
|
+
}
|
|
21547
|
+
} else timeParams.statsPeriod = "14d";
|
|
21548
|
+
const eventsResponse = await apiService.listEventsForIssue({
|
|
21549
|
+
organizationSlug,
|
|
21550
|
+
issueId,
|
|
21551
|
+
query,
|
|
21552
|
+
limit: params.limit,
|
|
21553
|
+
sort: sortParam,
|
|
21554
|
+
...timeParams
|
|
21555
|
+
});
|
|
21556
|
+
const explorerQuery = query ? `issue:${issueId} ${query}` : `issue:${issueId}`;
|
|
21557
|
+
const explorerUrl = apiService.getEventsExplorerUrl(organizationSlug, explorerQuery, projectId, "errors", fields, sortParam, [], [], timeParams.statsPeriod, timeParams.start, timeParams.end);
|
|
21558
|
+
function isValidEventArray(data) {
|
|
21559
|
+
return Array.isArray(data) && data.every((item) => typeof item === "object" && item !== null);
|
|
21560
|
+
}
|
|
21561
|
+
if (!isValidEventArray(eventsResponse)) throw new Error("Invalid event data format from Sentry API: expected array of objects");
|
|
21562
|
+
const eventData = eventsResponse;
|
|
21563
|
+
const naturalLanguageContext = `Events in issue ${issueId}: ${params.naturalLanguageQuery}`;
|
|
21564
|
+
return formatErrorResults({
|
|
21565
|
+
eventData,
|
|
21566
|
+
naturalLanguageQuery: naturalLanguageContext,
|
|
21567
|
+
includeExplanation: params.includeExplanation,
|
|
21568
|
+
apiService,
|
|
21569
|
+
organizationSlug,
|
|
21570
|
+
explorerUrl,
|
|
21571
|
+
sentryQuery: explorerQuery,
|
|
21572
|
+
fields,
|
|
21573
|
+
explanation: parsed.explanation
|
|
21574
|
+
});
|
|
21575
|
+
}
|
|
21576
|
+
});
|
|
21577
|
+
|
|
21578
|
+
//#endregion
|
|
21579
|
+
//#region ../mcp-core/dist/config-eV2du5VJ.js
|
|
20816
21580
|
/**
|
|
20817
21581
|
* Configuration for the use_sentry embedded agent.
|
|
20818
21582
|
*
|
|
@@ -20831,7 +21595,7 @@ The user may include various parameters to pass to those tools in their prompt.
|
|
|
20831
21595
|
You MUST return tool results directly without interpreting them.`;
|
|
20832
21596
|
|
|
20833
21597
|
//#endregion
|
|
20834
|
-
//#region ../mcp-core/dist/agent-
|
|
21598
|
+
//#region ../mcp-core/dist/agent-DfZ797Yi.js
|
|
20835
21599
|
/**
|
|
20836
21600
|
* Output schema for the embedded agent.
|
|
20837
21601
|
* The agent returns the final result string directly from its tool calls.
|
|
@@ -20853,7 +21617,7 @@ async function useSentryAgent(options) {
|
|
|
20853
21617
|
}
|
|
20854
21618
|
|
|
20855
21619
|
//#endregion
|
|
20856
|
-
//#region ../mcp-core/dist/error-handling-
|
|
21620
|
+
//#region ../mcp-core/dist/error-handling-DrvyGci6.js
|
|
20857
21621
|
/**
|
|
20858
21622
|
* Type guard to identify user input validation errors.
|
|
20859
21623
|
*/
|
|
@@ -20944,7 +21708,7 @@ async function formatErrorForUser(error) {
|
|
|
20944
21708
|
}
|
|
20945
21709
|
|
|
20946
21710
|
//#endregion
|
|
20947
|
-
//#region ../mcp-core/dist/constraint-helpers-
|
|
21711
|
+
//#region ../mcp-core/dist/constraint-helpers-CCO6wSRb.js
|
|
20948
21712
|
/**
|
|
20949
21713
|
* Determines which tool parameter keys should be filtered out of the schema
|
|
20950
21714
|
* because they will be injected from constraints.
|
|
@@ -21006,7 +21770,7 @@ function getConstraintParametersToInject(constraints, toolInputSchema) {
|
|
|
21006
21770
|
}
|
|
21007
21771
|
|
|
21008
21772
|
//#endregion
|
|
21009
|
-
//#region ../mcp-core/dist/server-
|
|
21773
|
+
//#region ../mcp-core/dist/server-CAslpEs0.js
|
|
21010
21774
|
/**
|
|
21011
21775
|
* Format tool calls into a readable trace
|
|
21012
21776
|
*/
|
|
@@ -21025,9 +21789,9 @@ function formatToolCallTrace(toolCalls) {
|
|
|
21025
21789
|
}
|
|
21026
21790
|
return trace$1;
|
|
21027
21791
|
}
|
|
21028
|
-
var handler_default$
|
|
21792
|
+
var handler_default$3 = defineTool({
|
|
21029
21793
|
name: "use_sentry",
|
|
21030
|
-
|
|
21794
|
+
skills: [],
|
|
21031
21795
|
requiredScopes: [],
|
|
21032
21796
|
description: [
|
|
21033
21797
|
"Natural language interface to Sentry via an embedded AI agent.",
|
|
@@ -21116,12 +21880,13 @@ var tools_default = {
|
|
|
21116
21880
|
search_docs: search_docs_default,
|
|
21117
21881
|
get_doc: get_doc_default,
|
|
21118
21882
|
search_issues: handler_default$1,
|
|
21119
|
-
|
|
21883
|
+
search_issue_events: handler_default$2,
|
|
21884
|
+
use_sentry: handler_default$3
|
|
21120
21885
|
};
|
|
21121
21886
|
/**
|
|
21122
21887
|
* Creates and configures a complete MCP server with Sentry instrumentation.
|
|
21123
21888
|
*
|
|
21124
|
-
* The server is built with tools filtered based on the granted
|
|
21889
|
+
* The server is built with tools filtered based on the granted skills in the context.
|
|
21125
21890
|
* Context is captured in tool handler closures and passed directly to handlers.
|
|
21126
21891
|
*
|
|
21127
21892
|
* @example Usage with stdio transport
|
|
@@ -21168,18 +21933,17 @@ function buildServer({ context: context$1, agentMode = false, tools: customTools
|
|
|
21168
21933
|
return wrapMcpServerWithSentry(server$1);
|
|
21169
21934
|
}
|
|
21170
21935
|
/**
|
|
21171
|
-
* Configures an MCP server with tools filtered by granted skills
|
|
21936
|
+
* Configures an MCP server with tools filtered by granted skills.
|
|
21172
21937
|
*
|
|
21173
21938
|
* Internal function used by buildServer(). Use buildServer() instead for most cases.
|
|
21174
|
-
* Tools are filtered at registration time based on grantedSkills
|
|
21175
|
-
*
|
|
21939
|
+
* Tools are filtered at registration time based on grantedSkills, and context is
|
|
21940
|
+
* captured in closures for tool handler execution.
|
|
21176
21941
|
*
|
|
21177
21942
|
* In agent mode, only the use_sentry tool is registered, bypassing authorization checks.
|
|
21178
21943
|
*/
|
|
21179
21944
|
function configureServer({ server: server$1, context: context$1, agentMode = false, tools: customTools }) {
|
|
21180
21945
|
const toolsToRegister = agentMode ? { use_sentry: tools_default.use_sentry } : customTools ?? tools_default;
|
|
21181
21946
|
const grantedSkills = context$1.grantedSkills ? new Set(context$1.grantedSkills) : void 0;
|
|
21182
|
-
const grantedScopes = context$1.grantedScopes ? new Set(context$1.grantedScopes) : void 0;
|
|
21183
21947
|
server$1.server.onerror = (error) => {
|
|
21184
21948
|
const transportLogOptions = {
|
|
21185
21949
|
loggerScope: ["server", "transport"],
|
|
@@ -21189,47 +21953,32 @@ function configureServer({ server: server$1, context: context$1, agentMode = fal
|
|
|
21189
21953
|
};
|
|
21190
21954
|
for (const [toolKey, tool$1] of Object.entries(toolsToRegister)) {
|
|
21191
21955
|
/**
|
|
21192
|
-
* Authorization
|
|
21193
|
-
*
|
|
21194
|
-
*
|
|
21195
|
-
* The server supports two authorization systems:
|
|
21196
|
-
* 1. **Skills System (NEW)** - User-facing permission groups (inspect, triage, etc.)
|
|
21197
|
-
* 2. **Scopes System (LEGACY)** - Low-level API permissions (event:read, project:write, etc.)
|
|
21956
|
+
* Skills-Based Authorization
|
|
21957
|
+
* ==========================
|
|
21198
21958
|
*
|
|
21199
|
-
*
|
|
21959
|
+
* Tools are filtered at registration time based on grantedSkills.
|
|
21960
|
+
* Tool must have non-empty `skills` array to be exposed.
|
|
21961
|
+
* Empty `skills: []` means intentionally excluded from skills system.
|
|
21200
21962
|
*
|
|
21201
|
-
*
|
|
21202
|
-
* - ONLY skills are checked (scopes are ignored)
|
|
21203
|
-
* - Tool must have non-empty `requiredSkills` array to be exposed
|
|
21204
|
-
* - Empty `requiredSkills: []` means intentionally excluded from skills system
|
|
21205
|
-
* - Authorization: `allowed = hasRequiredSkills(grantedSkills, tool.requiredSkills)`
|
|
21206
|
-
*
|
|
21207
|
-
* ## Scopes Mode (when grantedSkills is NOT set, but grantedScopes is set):
|
|
21208
|
-
* - Falls back to legacy scope checking
|
|
21209
|
-
* - Empty `requiredScopes: []` means no scopes required (always allowed)
|
|
21210
|
-
* - Authorization: `allowed = isToolAllowed(tool.requiredScopes, grantedScopes)`
|
|
21211
|
-
*
|
|
21212
|
-
* ## Tool Visibility:
|
|
21213
|
-
* - If not allowed by active authorization system: tool is NOT registered
|
|
21214
|
-
* - Only registered tools are visible to MCP clients
|
|
21963
|
+
* In agent mode, authorization is skipped - use_sentry handles it internally.
|
|
21215
21964
|
*
|
|
21216
21965
|
* ## Examples:
|
|
21217
21966
|
* ```typescript
|
|
21218
|
-
* // Tool
|
|
21219
|
-
* {
|
|
21967
|
+
* // Tool belongs to "triage" skill only:
|
|
21968
|
+
* { skills: ["triage"] }
|
|
21220
21969
|
*
|
|
21221
|
-
* // Tool
|
|
21222
|
-
* {
|
|
21970
|
+
* // Tool belongs to ALL skills (foundational tool like whoami):
|
|
21971
|
+
* { skills: ALL_SKILLS }
|
|
21223
21972
|
*
|
|
21224
21973
|
* // Tool excluded from skills system (like use_sentry in agent mode):
|
|
21225
|
-
* {
|
|
21974
|
+
* { skills: [] }
|
|
21226
21975
|
* ```
|
|
21227
21976
|
*/
|
|
21228
21977
|
let allowed = false;
|
|
21229
21978
|
if (agentMode) allowed = true;
|
|
21230
21979
|
else if (grantedSkills) {
|
|
21231
|
-
if (tool$1.
|
|
21232
|
-
}
|
|
21980
|
+
if (tool$1.skills && tool$1.skills.length > 0) allowed = isEnabledBySkills(grantedSkills, tool$1.skills);
|
|
21981
|
+
}
|
|
21233
21982
|
if (!allowed) continue;
|
|
21234
21983
|
if (toolKey === "find_organizations" && context$1.constraints.organizationSlug || toolKey === "find_projects" && context$1.constraints.projectSlug) continue;
|
|
21235
21984
|
const constraintKeysToFilter = new Set(getConstraintKeysToFilter(context$1.constraints, tool$1.inputSchema));
|
|
@@ -21274,7 +22023,7 @@ function configureServer({ server: server$1, context: context$1, agentMode = fal
|
|
|
21274
22023
|
}
|
|
21275
22024
|
|
|
21276
22025
|
//#endregion
|
|
21277
|
-
//#region ../mcp-core/dist/sentry-
|
|
22026
|
+
//#region ../mcp-core/dist/sentry-Cfj4OGMQ.js
|
|
21278
22027
|
const SCRUB_PATTERNS = [
|
|
21279
22028
|
{
|
|
21280
22029
|
pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
|
|
@@ -21379,7 +22128,7 @@ function sentryBeforeSend(event, hint) {
|
|
|
21379
22128
|
//#region src/index.ts
|
|
21380
22129
|
const packageName = "@sentry/mcp-server";
|
|
21381
22130
|
const allSkills = Object.keys(SKILLS);
|
|
21382
|
-
const usageText = buildUsage(packageName,
|
|
22131
|
+
const usageText = buildUsage(packageName, allSkills);
|
|
21383
22132
|
function die(message) {
|
|
21384
22133
|
console.error(message);
|
|
21385
22134
|
console.error(usageText);
|
|
@@ -21448,7 +22197,6 @@ if (cli.agent) {
|
|
|
21448
22197
|
const SENTRY_TIMEOUT = 5e3;
|
|
21449
22198
|
const context = {
|
|
21450
22199
|
accessToken: cfg.accessToken,
|
|
21451
|
-
grantedScopes: cfg.finalScopes,
|
|
21452
22200
|
grantedSkills: cfg.finalSkills,
|
|
21453
22201
|
constraints: {
|
|
21454
22202
|
organizationSlug: cfg.organizationSlug ?? null,
|