@sentry/mcp-server 0.39.0 → 0.40.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/auth/constants.cjs +1 -1
- package/dist/auth/constants.js +1 -1
- package/dist/auth/device-code-flow.cjs +3 -3
- package/dist/auth/device-code-flow.js +3 -3
- package/dist/auth/resolve-token.cjs +4 -4
- package/dist/auth/resolve-token.js +4 -4
- package/dist/{auth-CMwoYDhh.cjs → auth-CmmVlYDi.cjs} +4 -4
- package/dist/{auth-CMwoYDhh.cjs.map → auth-CmmVlYDi.cjs.map} +1 -1
- package/dist/{auth-BmLsTuwM.js → auth-CpyUfxVa.js} +4 -4
- package/dist/{auth-BmLsTuwM.js.map → auth-CpyUfxVa.js.map} +1 -1
- package/dist/blob-utils-CJyQkdm-.js +3 -0
- package/dist/blob-utils-DGsI5_gF.cjs +3 -0
- package/dist/{blob-utils-CdbE_jsd-zazUDulT.cjs → blob-utils-DgVug_Di-B5c8BuPf.cjs} +17 -2
- package/dist/{blob-utils-CdbE_jsd-zazUDulT.cjs.map → blob-utils-DgVug_Di-B5c8BuPf.cjs.map} +1 -1
- package/dist/{blob-utils-CdbE_jsd-9sHzy4nK.js → blob-utils-DgVug_Di-DaP7N_l-.js} +12 -3
- package/dist/{blob-utils-CdbE_jsd-9sHzy4nK.js.map → blob-utils-DgVug_Di-DaP7N_l-.js.map} +1 -1
- package/dist/cli/commands/auth.cjs +5 -5
- package/dist/cli/commands/auth.js +5 -5
- package/dist/cli/resolve.cjs +2 -2
- package/dist/cli/resolve.js +2 -2
- package/dist/{config-BqCCImAX-CqsS5Qiu.cjs → config-B-l88mOS-DNM_M--P.cjs} +8 -6
- package/dist/config-B-l88mOS-DNM_M--P.cjs.map +1 -0
- package/dist/{config-BqCCImAX-C9xxoOuk.js → config-B-l88mOS-v5IBYyQU.js} +8 -6
- package/dist/config-B-l88mOS-v5IBYyQU.js.map +1 -0
- package/dist/config-DRWtJff1.cjs +7 -0
- package/dist/{config-BUwpc74z.js → config-_di9BWJ0.js} +1 -1
- package/dist/{constants-BZbaI-zR.js → constants-CS0iQGX_.js} +3 -3
- package/dist/{constants-BZbaI-zR.js.map → constants-CS0iQGX_.js.map} +1 -1
- package/dist/{constants-BF1H5JLS.cjs → constants-DyDxXiYc.cjs} +3 -3
- package/dist/{constants-BF1H5JLS.cjs.map → constants-DyDxXiYc.cjs.map} +1 -1
- package/dist/{device-code-flow-BRSc_1Sh.js → device-code-flow-CARIuIzP.js} +3 -3
- package/dist/{device-code-flow-BRSc_1Sh.js.map → device-code-flow-CARIuIzP.js.map} +1 -1
- package/dist/{device-code-flow-Btx7zPjy.cjs → device-code-flow-D1UFW6dK.cjs} +3 -3
- package/dist/{device-code-flow-Btx7zPjy.cjs.map → device-code-flow-D1UFW6dK.cjs.map} +1 -1
- package/dist/index.cjs +1785 -748
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1779 -742
- package/dist/index.js.map +1 -1
- package/dist/{resolve-CS-Bms6W.js → resolve-C9Uf3wka.js} +2 -2
- package/dist/{resolve-CS-Bms6W.js.map → resolve-C9Uf3wka.js.map} +1 -1
- package/dist/{resolve-BsYckCew.cjs → resolve-D3vntNua.cjs} +2 -2
- package/dist/{resolve-BsYckCew.cjs.map → resolve-D3vntNua.cjs.map} +1 -1
- package/dist/{resolve-token-D8oZbjtT.js → resolve-token-CYqj4HQ5.js} +3 -3
- package/dist/{resolve-token-D8oZbjtT.js.map → resolve-token-CYqj4HQ5.js.map} +1 -1
- package/dist/{resolve-token-TOq9-TtB.cjs → resolve-token-DKvK-YrS.cjs} +3 -3
- package/dist/{resolve-token-TOq9-TtB.cjs.map → resolve-token-DKvK-YrS.cjs.map} +1 -1
- package/dist/{stdio-DFPpP3Gf.cjs → stdio-BhYLPDOA.cjs} +2 -2
- package/dist/{stdio-DFPpP3Gf.cjs.map → stdio-BhYLPDOA.cjs.map} +1 -1
- package/dist/{stdio-DrtNVy01.js → stdio-iZJ0t3f6.js} +2 -2
- package/dist/{stdio-DrtNVy01.js.map → stdio-iZJ0t3f6.js.map} +1 -1
- package/dist/transports/stdio.cjs +2 -2
- package/dist/transports/stdio.js +2 -2
- package/dist/{version-BHLBRM5t.cjs → version-CDZpvmqM.cjs} +3 -3
- package/dist/version-CDZpvmqM.cjs.map +1 -0
- package/dist/version-a8th87fY.js +7 -0
- package/dist/version-a8th87fY.js.map +1 -0
- package/package.json +7 -7
- package/dist/blob-utils-ByQZ_jqM.cjs +0 -3
- package/dist/blob-utils-KYOyFu79.js +0 -3
- package/dist/config-BqCCImAX-C9xxoOuk.js.map +0 -1
- package/dist/config-BqCCImAX-CqsS5Qiu.cjs.map +0 -1
- package/dist/config-Md3ohhLy.cjs +0 -7
- package/dist/version-BHLBRM5t.cjs.map +0 -1
- package/dist/version-BWR2MRdi.js +0 -7
- package/dist/version-BWR2MRdi.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_chunk = require('./chunk-Cv9WC9bY.cjs');
|
|
3
|
-
const require_resolve = require('./resolve-
|
|
4
|
-
const require_constants = require('./constants-
|
|
5
|
-
const require_version = require('./version-
|
|
3
|
+
const require_resolve = require('./resolve-D3vntNua.cjs');
|
|
4
|
+
const require_constants = require('./constants-DyDxXiYc.cjs');
|
|
5
|
+
const require_version = require('./version-CDZpvmqM.cjs');
|
|
6
6
|
const require_token_error$1 = require('./token-error-x_miDBP3.cjs');
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const require_stdio = require('./stdio-
|
|
7
|
+
const require_blob_utils_DgVug_Di = require('./blob-utils-DgVug_Di-B5c8BuPf.cjs');
|
|
8
|
+
const require_config_B_l88mOS = require('./config-B-l88mOS-DNM_M--P.cjs');
|
|
9
|
+
const require_stdio = require('./stdio-BhYLPDOA.cjs');
|
|
10
10
|
const require_usage = require('./usage-Crfzx1qJ.cjs');
|
|
11
11
|
const require_output = require('./output-DEoNyYz7.cjs');
|
|
12
12
|
const require_parse = require('./parse-CPY7-_2_.cjs');
|
|
13
13
|
require('./types-dghCRFW4.cjs');
|
|
14
|
-
require('./device-code-flow-
|
|
14
|
+
require('./device-code-flow-D1UFW6dK.cjs');
|
|
15
15
|
require('./token-cache-ATUcs1cg.cjs');
|
|
16
|
-
const require_resolve_token = require('./resolve-token-
|
|
17
|
-
const require_auth = require('./auth-
|
|
16
|
+
const require_resolve_token = require('./resolve-token-DKvK-YrS.cjs');
|
|
17
|
+
const require_auth = require('./auth-CmmVlYDi.cjs');
|
|
18
18
|
const zod = require_chunk.__toESM(require("zod"));
|
|
19
19
|
const __sentry_core = require_chunk.__toESM(require("@sentry/core"));
|
|
20
20
|
const node_util = require_chunk.__toESM(require("node:util"));
|
|
21
21
|
const zod_v4 = require_chunk.__toESM(require("zod/v4"));
|
|
22
22
|
const zod_v3 = require_chunk.__toESM(require("zod/v3"));
|
|
23
23
|
const __modelcontextprotocol_sdk_server_mcp_js = require_chunk.__toESM(require("@modelcontextprotocol/sdk/server/mcp.js"));
|
|
24
|
+
const __sentry_core_server = require_chunk.__toESM(require("@sentry/core/server"));
|
|
24
25
|
const __sentry_node = require_chunk.__toESM(require("@sentry/node"));
|
|
25
26
|
|
|
26
27
|
//#region ../mcp-core/dist/constants-CEZaLsGe.js
|
|
@@ -398,7 +399,7 @@ function validateSlugOrId(val, ctx) {
|
|
|
398
399
|
}
|
|
399
400
|
|
|
400
401
|
//#endregion
|
|
401
|
-
//#region ../mcp-core/dist/schema-
|
|
402
|
+
//#region ../mcp-core/dist/schema-BPiG3cQY.js
|
|
402
403
|
const ParamOrganizationSlug = zod.z.string().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.");
|
|
403
404
|
const ParamTeamSlug = zod.z.string().trim().superRefine(validateSlug).describe("The team's slug. You can find a list of existing teams in an organization with the Sentry tool `find_teams`.");
|
|
404
405
|
const ParamProjectSlug = zod.z.string().trim().superRefine(validateSlug).describe("The project's slug. You can find a list of existing projects in an organization using the `find_projects()` tool.");
|
|
@@ -445,7 +446,7 @@ const ParamIssueIgnoreMode = zod.z.enum([
|
|
|
445
446
|
"untilOccurrenceCount",
|
|
446
447
|
"untilUserCount"
|
|
447
448
|
]).describe("How ignored issues should behave. Use 'untilEscalating' to match the Sentry UI default, 'forever' for a permanent ignore, 'forDuration' with ignoreDurationMinutes, 'untilOccurrenceCount' with ignoreCount and optional ignoreWindowMinutes, or 'untilUserCount' with ignoreUserCount and optional ignoreUserWindowMinutes.");
|
|
448
|
-
const ParamAssignedTo = zod.z.string().trim().describe("The assignee in format 'user:ID' or 'team:ID_OR_SLUG' where ID is numeric. Example: 'user:123456', 'team:789', or 'team:my-team-slug'. Use `execute_sentry_tool(name='whoami', arguments={})` to find your user ID.");
|
|
449
|
+
const ParamAssignedTo = zod.z.string().trim().min(1).nullable().describe("The assignee in format 'user:ID' or 'team:ID_OR_SLUG' where ID is numeric. Pass null to unassign the issue. Example: 'user:123456', 'team:789', or 'team:my-team-slug'. Use `execute_sentry_tool(name='whoami', arguments={})` to find your user ID.");
|
|
449
450
|
const ParamIgnoreDurationMinutes = zod.z.number().int().positive().describe("How many minutes to ignore the issue when ignoreMode is 'forDuration'.");
|
|
450
451
|
const ParamIgnoreCount = zod.z.number().int().positive().describe("How many times the issue must occur before it stops being ignored when ignoreMode is 'untilOccurrenceCount'.");
|
|
451
452
|
const ParamIgnoreWindowMinutes = zod.z.number().int().positive().max(7 * 24 * 60).describe("Optional time window in minutes for ignoreCount. If omitted, Sentry counts all future occurrences.");
|
|
@@ -461,6 +462,56 @@ const ParamEventId = zod.z.string().trim().regex(/^[0-9a-fA-F]{32}$/, "Event ID
|
|
|
461
462
|
const ParamEventIdOrLatest = zod.z.union([zod.z.literal("latest"), ParamEventId]).default("latest").describe("The event ID for the issue, or `latest`. Defaults to `latest`.");
|
|
462
463
|
const ParamAttachmentId = zod.z.string().trim().superRefine(validateResourceId).describe("The ID of the attachment to download.");
|
|
463
464
|
|
|
465
|
+
//#endregion
|
|
466
|
+
//#region ../mcp-core/dist/fetch-utils-CowPZ6ZQ.js
|
|
467
|
+
/**
|
|
468
|
+
* Fetch with timeout using AbortController
|
|
469
|
+
* @param url - The URL to fetch
|
|
470
|
+
* @param options - Standard fetch options
|
|
471
|
+
* @param timeoutMs - Timeout in milliseconds (default: 30000)
|
|
472
|
+
* @returns Promise<Response>
|
|
473
|
+
* @throws Error if request times out
|
|
474
|
+
*/
|
|
475
|
+
async function fetchWithTimeout(url, options = {}, timeoutMs = 3e4) {
|
|
476
|
+
const controller = new AbortController();
|
|
477
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
478
|
+
try {
|
|
479
|
+
const response = await fetch(url, {
|
|
480
|
+
...options,
|
|
481
|
+
signal: controller.signal
|
|
482
|
+
});
|
|
483
|
+
return response;
|
|
484
|
+
} catch (error) {
|
|
485
|
+
if (error instanceof Error && error.name === "AbortError") throw new Error(`Request timeout after ${timeoutMs}ms`);
|
|
486
|
+
throw error;
|
|
487
|
+
} finally {
|
|
488
|
+
clearTimeout(timeoutId);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Retry a function with exponential backoff
|
|
493
|
+
* @param fn - The async function to retry
|
|
494
|
+
* @param options - Retry options
|
|
495
|
+
* @param options.maxRetries - Maximum number of retries (default: 3)
|
|
496
|
+
* @param options.initialDelay - Initial delay in milliseconds (default: 1000)
|
|
497
|
+
* @param options.shouldRetry - Predicate to determine if error should be retried (default: always retry)
|
|
498
|
+
* @returns Promise with the function result
|
|
499
|
+
* @throws The last error if all retries are exhausted
|
|
500
|
+
*/
|
|
501
|
+
async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, shouldRetry = (error) => true } = {}) {
|
|
502
|
+
let lastError;
|
|
503
|
+
let delay$1 = initialDelay;
|
|
504
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) try {
|
|
505
|
+
return await fn();
|
|
506
|
+
} catch (error) {
|
|
507
|
+
lastError = error;
|
|
508
|
+
if (attempt === maxRetries || !shouldRetry(error)) throw error;
|
|
509
|
+
await new Promise((resolve$1) => setTimeout(resolve$1, delay$1));
|
|
510
|
+
delay$1 = Math.min(delay$1 * 2, 3e4);
|
|
511
|
+
}
|
|
512
|
+
throw lastError;
|
|
513
|
+
}
|
|
514
|
+
|
|
464
515
|
//#endregion
|
|
465
516
|
//#region ../../node_modules/.pnpm/@logtape+logtape@1.1.1/node_modules/@logtape/logtape/dist/filter.js
|
|
466
517
|
/**
|
|
@@ -1626,7 +1677,7 @@ var ConfigError = class extends Error {
|
|
|
1626
1677
|
};
|
|
1627
1678
|
|
|
1628
1679
|
//#endregion
|
|
1629
|
-
//#region ../mcp-core/dist/logging-
|
|
1680
|
+
//#region ../mcp-core/dist/logging-dXuBsQDs.js
|
|
1630
1681
|
const ROOT_LOG_CATEGORY = ["sentry", "mcp"];
|
|
1631
1682
|
const STDERR_CONSOLE_LEVEL_MAP = {
|
|
1632
1683
|
trace: "error",
|
|
@@ -1849,7 +1900,7 @@ function logIssue(error, options = {}) {
|
|
|
1849
1900
|
}
|
|
1850
1901
|
|
|
1851
1902
|
//#endregion
|
|
1852
|
-
//#region ../mcp-core/dist/api-path-
|
|
1903
|
+
//#region ../mcp-core/dist/api-path-CjJMa7Rg.js
|
|
1853
1904
|
/**
|
|
1854
1905
|
* Builds an API request path, confining each interpolated value to one path segment.
|
|
1855
1906
|
*
|
|
@@ -1876,7 +1927,7 @@ function apiPath(strings, ...values) {
|
|
|
1876
1927
|
}
|
|
1877
1928
|
|
|
1878
1929
|
//#endregion
|
|
1879
|
-
//#region ../mcp-core/dist/errors-
|
|
1930
|
+
//#region ../mcp-core/dist/errors-Dj_qmFqH.js
|
|
1880
1931
|
/**
|
|
1881
1932
|
* API Error Class Hierarchy
|
|
1882
1933
|
*
|
|
@@ -2107,7 +2158,7 @@ function isApiAuthenticationErrorDeep(error) {
|
|
|
2107
2158
|
}
|
|
2108
2159
|
|
|
2109
2160
|
//#endregion
|
|
2110
|
-
//#region ../mcp-core/dist/schema-
|
|
2161
|
+
//#region ../mcp-core/dist/schema-y99KGEDP.js
|
|
2111
2162
|
/**
|
|
2112
2163
|
* Schema for Sentry API error responses.
|
|
2113
2164
|
*
|
|
@@ -2281,6 +2332,61 @@ const IssueAlertRuleSchema = zod.z.object({
|
|
|
2281
2332
|
lastTriggered: zod.z.string().nullable().optional()
|
|
2282
2333
|
}).passthrough();
|
|
2283
2334
|
const IssueAlertRuleListSchema = zod.z.array(IssueAlertRuleSchema);
|
|
2335
|
+
const AlertRuleProjectScopeSchema = zod.z.object({
|
|
2336
|
+
projectIds: zod.z.array(zod.z.string()),
|
|
2337
|
+
includesAllProjects: zod.z.boolean()
|
|
2338
|
+
});
|
|
2339
|
+
const AlertActionOptionSchema = zod.z.object({
|
|
2340
|
+
type: zod.z.string(),
|
|
2341
|
+
handlerGroup: zod.z.string(),
|
|
2342
|
+
configSchema: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
2343
|
+
dataSchema: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
2344
|
+
integrations: zod.z.array(zod.z.object({
|
|
2345
|
+
id: zod.z.string(),
|
|
2346
|
+
name: zod.z.string(),
|
|
2347
|
+
services: zod.z.array(zod.z.object({
|
|
2348
|
+
id: zod.z.string(),
|
|
2349
|
+
name: zod.z.string()
|
|
2350
|
+
})).optional()
|
|
2351
|
+
})).optional(),
|
|
2352
|
+
services: zod.z.array(zod.z.object({
|
|
2353
|
+
slug: zod.z.string(),
|
|
2354
|
+
name: zod.z.string()
|
|
2355
|
+
})).optional(),
|
|
2356
|
+
sentryApp: zod.z.object({
|
|
2357
|
+
id: zod.z.string(),
|
|
2358
|
+
name: zod.z.string(),
|
|
2359
|
+
installationId: zod.z.string(),
|
|
2360
|
+
installationUuid: zod.z.string(),
|
|
2361
|
+
status: zod.z.number(),
|
|
2362
|
+
settings: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
2363
|
+
title: zod.z.string().optional()
|
|
2364
|
+
}).optional()
|
|
2365
|
+
});
|
|
2366
|
+
const AlertConditionOptionSchema = zod.z.object({
|
|
2367
|
+
type: zod.z.string(),
|
|
2368
|
+
handlerGroup: zod.z.string(),
|
|
2369
|
+
handlerSubgroup: zod.z.string().optional(),
|
|
2370
|
+
comparisonJsonSchema: zod.z.record(zod.z.string(), zod.z.unknown())
|
|
2371
|
+
});
|
|
2372
|
+
const DetectorSchema = zod.z.object({
|
|
2373
|
+
id: zod.z.string(),
|
|
2374
|
+
projectId: zod.z.string().nullable(),
|
|
2375
|
+
name: zod.z.string(),
|
|
2376
|
+
type: zod.z.string(),
|
|
2377
|
+
enabled: zod.z.boolean(),
|
|
2378
|
+
config: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
2379
|
+
conditionGroup: AlertRuleComponentSchema.nullable(),
|
|
2380
|
+
dataSources: zod.z.array(AlertRuleComponentSchema).nullable(),
|
|
2381
|
+
workflowIds: zod.z.array(zod.z.string()).nullable(),
|
|
2382
|
+
description: zod.z.string().nullable().optional(),
|
|
2383
|
+
owner: zod.z.unknown().optional(),
|
|
2384
|
+
createdBy: zod.z.string().nullable().optional(),
|
|
2385
|
+
dateCreated: zod.z.string(),
|
|
2386
|
+
dateUpdated: zod.z.string(),
|
|
2387
|
+
alertRuleId: zod.z.number().nullable().optional(),
|
|
2388
|
+
ruleId: zod.z.number().nullable().optional()
|
|
2389
|
+
}).passthrough();
|
|
2284
2390
|
const MetricAlertRuleSchema = zod.z.object({
|
|
2285
2391
|
id: zod.z.union([zod.z.string(), zod.z.number()]),
|
|
2286
2392
|
name: zod.z.string(),
|
|
@@ -2808,7 +2914,11 @@ const BaseEventSchema = zod.z.object({
|
|
|
2808
2914
|
geo: zod.z.record(zod.z.string(), zod.z.union([zod.z.string(), zod.z.null()])).nullable().optional()
|
|
2809
2915
|
}).passthrough().nullable().optional(),
|
|
2810
2916
|
_meta: zod.z.unknown().optional(),
|
|
2811
|
-
dateReceived: zod.z.string().datetime().nullish()
|
|
2917
|
+
dateReceived: zod.z.string().datetime().nullish(),
|
|
2918
|
+
formatted: zod.z.object({
|
|
2919
|
+
format: zod.z.string(),
|
|
2920
|
+
content: zod.z.string()
|
|
2921
|
+
}).optional()
|
|
2812
2922
|
});
|
|
2813
2923
|
const ErrorEventSchema = BaseEventSchema.omit({ type: true }).extend({
|
|
2814
2924
|
type: zod.z.literal("error"),
|
|
@@ -2950,15 +3060,21 @@ const AutofixBlockSchema = zod.z.object({
|
|
|
2950
3060
|
* - `src/sentry/seer/endpoints/group_ai_autofix.py`
|
|
2951
3061
|
* - `src/sentry/seer/agent/client_models.py` (`SeerRunState`)
|
|
2952
3062
|
*/
|
|
2953
|
-
const AutofixRunStateSchema = zod.z.object({
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
3063
|
+
const AutofixRunStateSchema = zod.z.object({
|
|
3064
|
+
autofix: zod.z.object({
|
|
3065
|
+
run_id: zod.z.number(),
|
|
3066
|
+
updated_at: zod.z.string().nullable().optional(),
|
|
3067
|
+
status: AutofixStatusSchema,
|
|
3068
|
+
blocks: zod.z.array(AutofixBlockSchema).default([]),
|
|
3069
|
+
pending_user_input: zod.z.unknown().nullable().optional(),
|
|
3070
|
+
repo_pr_states: zod.z.record(zod.z.string(), zod.z.object({ pr_url: zod.z.string().nullable().optional() }).passthrough()).optional(),
|
|
3071
|
+
coding_agents: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
3072
|
+
}).passthrough().nullable(),
|
|
3073
|
+
formatted: zod.z.object({
|
|
3074
|
+
format: zod.z.string(),
|
|
3075
|
+
content: zod.z.string()
|
|
3076
|
+
}).optional()
|
|
3077
|
+
});
|
|
2962
3078
|
const EventAttachmentSchema = zod.z.object({
|
|
2963
3079
|
id: zod.z.string(),
|
|
2964
3080
|
name: zod.z.string(),
|
|
@@ -2969,6 +3085,11 @@ const EventAttachmentSchema = zod.z.object({
|
|
|
2969
3085
|
headers: zod.z.record(zod.z.string(), zod.z.string()).optional()
|
|
2970
3086
|
});
|
|
2971
3087
|
const EventAttachmentListSchema = zod.z.array(EventAttachmentSchema);
|
|
3088
|
+
const OrganizationEnvironmentSchema = zod.z.object({
|
|
3089
|
+
id: zod.z.string(),
|
|
3090
|
+
name: zod.z.string()
|
|
3091
|
+
});
|
|
3092
|
+
const OrganizationEnvironmentListSchema = zod.z.array(OrganizationEnvironmentSchema);
|
|
2972
3093
|
/**
|
|
2973
3094
|
* Schema for individual tag values within an issue's tag distribution.
|
|
2974
3095
|
*
|
|
@@ -3594,9 +3715,19 @@ const AgenticOnboardingRunSchema = zod.z.object({
|
|
|
3594
3715
|
runStatus: AgenticOnboardingRunStatusSchema,
|
|
3595
3716
|
stages: zod.z.array(AgenticOnboardingStageStateSchema)
|
|
3596
3717
|
});
|
|
3718
|
+
/**
|
|
3719
|
+
* Response from the events-stats (timeseries) endpoint for a single yAxis:
|
|
3720
|
+
* a series of `[unixTimestampSeconds, [{ count }]]` buckets. `count` holds the
|
|
3721
|
+
* yAxis value for that bucket regardless of the aggregate function.
|
|
3722
|
+
*/
|
|
3723
|
+
const EventsStatsResponseSchema = zod.z.object({
|
|
3724
|
+
data: zod.z.array(zod.z.tuple([zod.z.number(), zod.z.array(zod.z.object({ count: zod.z.number().nullish() }).passthrough())])),
|
|
3725
|
+
start: zod.z.number().optional(),
|
|
3726
|
+
end: zod.z.number().optional()
|
|
3727
|
+
}).passthrough();
|
|
3597
3728
|
|
|
3598
3729
|
//#endregion
|
|
3599
|
-
//#region ../mcp-core/dist/client-
|
|
3730
|
+
//#region ../mcp-core/dist/client-BXJ5ud71.js
|
|
3600
3731
|
const SENTRY_MCP_SEARCH_EVENTS_REFERRER = "api.mcp.search-events";
|
|
3601
3732
|
/**
|
|
3602
3733
|
* Mapping of common network error codes to user-friendly messages.
|
|
@@ -3617,9 +3748,6 @@ function formatWorkflowNameQuery(query) {
|
|
|
3617
3748
|
const escapedQuery = query.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
3618
3749
|
return `name:"*${escapedQuery}*"`;
|
|
3619
3750
|
}
|
|
3620
|
-
function filterAttachedIssueAlertRules(rules) {
|
|
3621
|
-
return rules.filter((rule) => (rule.detectorIds ?? []).length > 0);
|
|
3622
|
-
}
|
|
3623
3751
|
function parseStatsPeriod(statsPeriod) {
|
|
3624
3752
|
const match = /^(\d+)([smhdw])$/.exec(statsPeriod);
|
|
3625
3753
|
if (!match) throw new ApiValidationError("statsPeriod must use a supported relative time format, such as `24h`, `7d`, or `2w`.");
|
|
@@ -3637,6 +3765,24 @@ function getNextCursor(linkHeader) {
|
|
|
3637
3765
|
}
|
|
3638
3766
|
return null;
|
|
3639
3767
|
}
|
|
3768
|
+
/**
|
|
3769
|
+
* Automatic retry policy for transient upstream gateway failures (502/503/504).
|
|
3770
|
+
*
|
|
3771
|
+
* Sentry's edge intermittently returns short-lived gateway errors (e.g.
|
|
3772
|
+
* "upstream connect error or disconnect/reset before headers") that clear on a
|
|
3773
|
+
* retry. We retry only idempotent GET requests so an automatic retry can never
|
|
3774
|
+
* replay a mutation, and keep the budget small so a still-failing tool call
|
|
3775
|
+
* resolves quickly under the Cloudflare Workers request lifetime.
|
|
3776
|
+
*/
|
|
3777
|
+
const RETRYABLE_REQUEST_MAX_RETRIES = 2;
|
|
3778
|
+
const RETRYABLE_REQUEST_INITIAL_DELAY_MS = 250;
|
|
3779
|
+
/**
|
|
3780
|
+
* Default cap for returning attachment bytes inline over the MCP transport.
|
|
3781
|
+
* A 30 MB attachment takes ~80 MB in memory once base64-encoded and serialized,
|
|
3782
|
+
* which fits the Cloudflare Worker's 128 MB isolate with room for the rest of the
|
|
3783
|
+
* request; above it, getEventAttachment returns a reference instead of the bytes.
|
|
3784
|
+
*/
|
|
3785
|
+
const DEFAULT_MAX_INLINE_ATTACHMENT_BYTES = 30 * 1024 * 1024;
|
|
3640
3786
|
const TraceItemAttributeTypeSchema = zod.z.enum([
|
|
3641
3787
|
"string",
|
|
3642
3788
|
"number",
|
|
@@ -3870,6 +4016,32 @@ var SentryApiService = class {
|
|
|
3870
4016
|
if (resolutionSeconds !== void 0) queryParams.set("resolution", `${resolutionSeconds}s`);
|
|
3871
4017
|
}
|
|
3872
4018
|
/**
|
|
4019
|
+
* Makes an authenticated request to the Sentry API, transparently retrying
|
|
4020
|
+
* transient upstream gateway failures (502/503/504).
|
|
4021
|
+
*
|
|
4022
|
+
* Retries are limited to idempotent GET requests so an automatic retry can
|
|
4023
|
+
* never replay a mutation, and are gated on `ApiServerError.isGatewayError()`
|
|
4024
|
+
* so persistent 500s, 4xx client errors, and network/configuration errors
|
|
4025
|
+
* fail fast without waiting. Callers that opt a 5xx into `allowStatuses`
|
|
4026
|
+
* receive the raw response from `requestOnce` and are never retried.
|
|
4027
|
+
*
|
|
4028
|
+
* @param path API endpoint path (without /api/0 prefix)
|
|
4029
|
+
* @param options Fetch options
|
|
4030
|
+
* @param requestOptions Additional request configuration
|
|
4031
|
+
* @returns Promise resolving to Response object
|
|
4032
|
+
* @throws {ApiError} Enhanced API errors with user-friendly messages
|
|
4033
|
+
* @throws {Error} Network or parsing errors
|
|
4034
|
+
*/
|
|
4035
|
+
async request(path, options = {}, requestOptions = {}) {
|
|
4036
|
+
const method = (options.method ?? "GET").toUpperCase();
|
|
4037
|
+
const isIdempotent = method === "GET";
|
|
4038
|
+
return retryWithBackoff(() => this.requestOnce(path, options, requestOptions), {
|
|
4039
|
+
maxRetries: isIdempotent ? RETRYABLE_REQUEST_MAX_RETRIES : 0,
|
|
4040
|
+
initialDelay: RETRYABLE_REQUEST_INITIAL_DELAY_MS,
|
|
4041
|
+
shouldRetry: (error) => error instanceof ApiServerError && error.isGatewayError()
|
|
4042
|
+
});
|
|
4043
|
+
}
|
|
4044
|
+
/**
|
|
3873
4045
|
* Internal method for making authenticated requests to Sentry API.
|
|
3874
4046
|
*
|
|
3875
4047
|
* Handles:
|
|
@@ -3885,7 +4057,7 @@ var SentryApiService = class {
|
|
|
3885
4057
|
* @throws {ApiError} Enhanced API errors with user-friendly messages
|
|
3886
4058
|
* @throws {Error} Network or parsing errors
|
|
3887
4059
|
*/
|
|
3888
|
-
async
|
|
4060
|
+
async requestOnce(path, options = {}, { host, allowStatuses } = {}) {
|
|
3889
4061
|
const url = host ? `${this.protocol}://${host}/api/0${path}` : `${this.apiPrefix}${path}`;
|
|
3890
4062
|
const headers = {
|
|
3891
4063
|
"Content-Type": "application/json",
|
|
@@ -4321,7 +4493,7 @@ var SentryApiService = class {
|
|
|
4321
4493
|
const queryString = queryParams.toString();
|
|
4322
4494
|
const path = `/organizations/?${queryString}`;
|
|
4323
4495
|
let host = void 0;
|
|
4324
|
-
if (this.isSaas()) host = "sentry.io";
|
|
4496
|
+
if (this.isSaas() && !this.host.endsWith(".my.sentry.io")) host = "sentry.io";
|
|
4325
4497
|
const body = await this.requestJSON(path, void 0, { host });
|
|
4326
4498
|
return OrganizationListSchema.parse(body);
|
|
4327
4499
|
}
|
|
@@ -4510,45 +4682,77 @@ var SentryApiService = class {
|
|
|
4510
4682
|
return page.rules;
|
|
4511
4683
|
}
|
|
4512
4684
|
async listIssueAlertRulesPage({ organizationSlug, projectSlug: projectSlug$1, query, cursor, limit }, opts) {
|
|
4513
|
-
const
|
|
4685
|
+
const searchQuery = new URLSearchParams({ sortBy: "-id" });
|
|
4686
|
+
if (projectSlug$1) searchQuery.set("projectSlug", projectSlug$1);
|
|
4687
|
+
if (query) searchQuery.set("query", formatWorkflowNameQuery(query));
|
|
4688
|
+
if (cursor) searchQuery.set("cursor", cursor);
|
|
4689
|
+
if (limit !== void 0) searchQuery.set("per_page", String(limit));
|
|
4690
|
+
const response = await this.request(apiPath`/organizations/${organizationSlug}/workflows/` + `?${searchQuery.toString()}`, void 0, opts);
|
|
4691
|
+
const rules = IssueAlertRuleListSchema.parse(await this.parseJsonResponse(response));
|
|
4514
4692
|
const targetLimit = limit ?? 100;
|
|
4515
|
-
let currentCursor = cursor;
|
|
4516
|
-
let nextCursor = null;
|
|
4517
|
-
do {
|
|
4518
|
-
const searchQuery = new URLSearchParams();
|
|
4519
|
-
searchQuery.append("projectSlug", projectSlug$1);
|
|
4520
|
-
searchQuery.set("sortBy", "-id");
|
|
4521
|
-
if (query) searchQuery.set("query", formatWorkflowNameQuery(query));
|
|
4522
|
-
if (currentCursor) searchQuery.set("cursor", currentCursor);
|
|
4523
|
-
if (limit !== void 0) searchQuery.set("per_page", String(targetLimit - rules.length));
|
|
4524
|
-
const response = await this.request(apiPath`/organizations/${organizationSlug}/workflows/` + `?${searchQuery.toString()}`, void 0, opts);
|
|
4525
|
-
const body = await this.parseJsonResponse(response);
|
|
4526
|
-
const attachedRules = filterAttachedIssueAlertRules(IssueAlertRuleListSchema.parse(body));
|
|
4527
|
-
const remaining = targetLimit - rules.length;
|
|
4528
|
-
if (attachedRules.length > remaining) {
|
|
4529
|
-
rules.push(...attachedRules.slice(0, remaining));
|
|
4530
|
-
nextCursor = null;
|
|
4531
|
-
break;
|
|
4532
|
-
}
|
|
4533
|
-
rules.push(...attachedRules);
|
|
4534
|
-
nextCursor = getNextCursor(response.headers.get("link"));
|
|
4535
|
-
currentCursor = nextCursor;
|
|
4536
|
-
} while (rules.length < targetLimit && nextCursor);
|
|
4537
4693
|
return {
|
|
4538
|
-
rules,
|
|
4539
|
-
nextCursor
|
|
4694
|
+
rules: rules.slice(0, targetLimit),
|
|
4695
|
+
nextCursor: rules.length > targetLimit ? null : getNextCursor(response.headers.get("link"))
|
|
4540
4696
|
};
|
|
4541
4697
|
}
|
|
4542
4698
|
async getIssueAlertRule({ organizationSlug, projectSlug: projectSlug$1, ruleId }, opts) {
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4699
|
+
if (projectSlug$1) {
|
|
4700
|
+
const [project, scope] = await Promise.all([this.getProject({
|
|
4701
|
+
organizationSlug,
|
|
4702
|
+
projectSlugOrId: projectSlug$1
|
|
4703
|
+
}, opts), this.getAlertRuleProjectScope({
|
|
4704
|
+
organizationSlug,
|
|
4705
|
+
ruleId
|
|
4706
|
+
}, opts)]);
|
|
4707
|
+
if (!scope.includesAllProjects && !scope.projectIds.includes(String(project.id))) throw new ApiNotFoundError("Workflow not found in this project", void 0, void 0, "workflow", String(ruleId));
|
|
4708
|
+
}
|
|
4709
|
+
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/workflows/${ruleId}/`, void 0, opts);
|
|
4710
|
+
return IssueAlertRuleSchema.parse(body);
|
|
4711
|
+
}
|
|
4712
|
+
/** Private Sentry endpoint: keep the complete association check separate from filtered lists. */
|
|
4713
|
+
async getAlertRuleProjectScope({ organizationSlug, ruleId }, opts) {
|
|
4714
|
+
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/workflows/${ruleId}/project-scope/`, void 0, opts);
|
|
4715
|
+
return AlertRuleProjectScopeSchema.parse(body);
|
|
4716
|
+
}
|
|
4717
|
+
async getDetector({ organizationSlug, detectorId }, opts) {
|
|
4718
|
+
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/detectors/${detectorId}/`, void 0, opts);
|
|
4719
|
+
return DetectorSchema.parse(body);
|
|
4720
|
+
}
|
|
4721
|
+
async listDetectorsPage({ organizationSlug, projectId, types, query, cursor, limit = 25 }, opts) {
|
|
4722
|
+
const search = new URLSearchParams({
|
|
4723
|
+
project: projectId ?? "-1",
|
|
4724
|
+
per_page: String(limit)
|
|
4725
|
+
});
|
|
4726
|
+
for (const type of types ?? []) search.append("type", type);
|
|
4727
|
+
if (query) search.set("query", query);
|
|
4728
|
+
if (cursor) search.set("cursor", cursor);
|
|
4729
|
+
const response = await this.request(`${apiPath`/organizations/${organizationSlug}/detectors/`}?${search}`, void 0, opts);
|
|
4730
|
+
return {
|
|
4731
|
+
detectors: zod.z.array(DetectorSchema).parse(await this.parseJsonResponse(response)),
|
|
4732
|
+
nextCursor: getNextCursor(response.headers.get("link"))
|
|
4733
|
+
};
|
|
4734
|
+
}
|
|
4735
|
+
async listAvailableAlertActionsPage({ organizationSlug, types, cursor, limit = 25 }, opts) {
|
|
4736
|
+
const search = new URLSearchParams({ per_page: String(limit) });
|
|
4737
|
+
for (const type of types ?? []) search.append("type", type);
|
|
4738
|
+
if (cursor) search.set("cursor", cursor);
|
|
4739
|
+
const response = await this.request(`${apiPath`/organizations/${organizationSlug}/available-actions/`}?${search}`, void 0, opts);
|
|
4740
|
+
return {
|
|
4741
|
+
actions: zod.z.array(AlertActionOptionSchema).parse(await this.parseJsonResponse(response)),
|
|
4742
|
+
nextCursor: getNextCursor(response.headers.get("link"))
|
|
4743
|
+
};
|
|
4744
|
+
}
|
|
4745
|
+
async listAlertConditionsPage({ organizationSlug, group, cursor, limit = 25 }, opts) {
|
|
4746
|
+
const search = new URLSearchParams({
|
|
4747
|
+
group,
|
|
4748
|
+
per_page: String(limit)
|
|
4749
|
+
});
|
|
4750
|
+
if (cursor) search.set("cursor", cursor);
|
|
4751
|
+
const response = await this.request(`${apiPath`/organizations/${organizationSlug}/data-conditions/`}?${search}`, void 0, opts);
|
|
4752
|
+
return {
|
|
4753
|
+
conditions: zod.z.array(AlertConditionOptionSchema).parse(await this.parseJsonResponse(response)),
|
|
4754
|
+
nextCursor: getNextCursor(response.headers.get("link"))
|
|
4755
|
+
};
|
|
4552
4756
|
}
|
|
4553
4757
|
async listMetricAlertRules(params, opts) {
|
|
4554
4758
|
const page = await this.listMetricAlertRulesPage(params, opts);
|
|
@@ -5035,6 +5239,20 @@ var SentryApiService = class {
|
|
|
5035
5239
|
const body = await this.parseJsonResponse(response);
|
|
5036
5240
|
return EventsValidationResponseSchema.parse(body);
|
|
5037
5241
|
}
|
|
5242
|
+
/**
|
|
5243
|
+
* List the organization's visible environments, optionally scoped to a
|
|
5244
|
+
* project. The endpoint (`GET /organizations/{org}/environments/`) already
|
|
5245
|
+
* filters to visible environments and excludes the empty-name "No Environment"
|
|
5246
|
+
* pseudo-env; passing `project` narrows the list (verified against
|
|
5247
|
+
* getsentry/sentry `OrganizationEnvironmentsEndpoint`).
|
|
5248
|
+
*/
|
|
5249
|
+
async listEnvironments({ organizationSlug, projectId }, opts) {
|
|
5250
|
+
const queryParams = new URLSearchParams();
|
|
5251
|
+
if (projectId) queryParams.set("project", projectId);
|
|
5252
|
+
const suffix = queryParams.toString();
|
|
5253
|
+
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/environments/` + (suffix ? `?${suffix}` : ""), void 0, opts);
|
|
5254
|
+
return OrganizationEnvironmentListSchema.parse(body);
|
|
5255
|
+
}
|
|
5038
5256
|
async fetchTraceItemAttributes(organizationSlug, itemType, project, statsPeriod, start, end, substringMatch, query, opts) {
|
|
5039
5257
|
const queryParams = new URLSearchParams();
|
|
5040
5258
|
queryParams.set("itemType", itemType);
|
|
@@ -5157,7 +5375,7 @@ var SentryApiService = class {
|
|
|
5157
5375
|
};
|
|
5158
5376
|
}
|
|
5159
5377
|
async getEventForIssue({ organizationSlug, issueId, eventId }, opts) {
|
|
5160
|
-
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/issues/${issueId}/events/${eventId}
|
|
5378
|
+
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/issues/${issueId}/events/${eventId}/` + `?llmFormat=json`, void 0, opts);
|
|
5161
5379
|
const parseResult = EventSchema.safeParse(body);
|
|
5162
5380
|
if (parseResult.success) {
|
|
5163
5381
|
const rawEvent = parseResult.data;
|
|
@@ -5230,22 +5448,52 @@ var SentryApiService = class {
|
|
|
5230
5448
|
const body = await this.requestJSON(apiPath`/projects/${organizationSlug}/${projectSlug$1}/events/${eventId}/attachments/`, void 0, opts);
|
|
5231
5449
|
return EventAttachmentListSchema.parse(body);
|
|
5232
5450
|
}
|
|
5233
|
-
async getEventAttachment({ organizationSlug, projectSlug: projectSlug$1, eventId, attachmentId }, opts) {
|
|
5451
|
+
async getEventAttachment({ organizationSlug, projectSlug: projectSlug$1, eventId, attachmentId, maxInlineBytes = DEFAULT_MAX_INLINE_ATTACHMENT_BYTES }, opts) {
|
|
5234
5452
|
const attachmentsData = await this.requestJSON(apiPath`/projects/${organizationSlug}/${projectSlug$1}/events/${eventId}/attachments/`, void 0, opts);
|
|
5235
5453
|
const attachments = EventAttachmentListSchema.parse(attachmentsData);
|
|
5236
5454
|
const attachment = attachments.find((att) => att.id === attachmentId);
|
|
5237
5455
|
if (!attachment) throw new ApiNotFoundError(`Attachment with ID ${attachmentId} not found for event ${eventId}`);
|
|
5238
|
-
const
|
|
5239
|
-
|
|
5456
|
+
const downloadPath = apiPath`/projects/${organizationSlug}/${projectSlug$1}/events/${eventId}/attachments/${attachmentId}/` + `?download=1`;
|
|
5457
|
+
if (attachment.size > maxInlineBytes) {
|
|
5458
|
+
const directDownloadUrl = await this.resolveDirectDownloadUrl(downloadPath, opts);
|
|
5459
|
+
return {
|
|
5460
|
+
attachment,
|
|
5461
|
+
downloadUrl: `${this.apiPrefix}${downloadPath}`,
|
|
5462
|
+
directDownloadUrl,
|
|
5463
|
+
filename: attachment.name,
|
|
5464
|
+
bytes: null,
|
|
5465
|
+
contentType: attachment.mimetype || "application/octet-stream"
|
|
5466
|
+
};
|
|
5467
|
+
}
|
|
5468
|
+
const downloadResponse = await this.request(downloadPath, { method: "GET" }, opts);
|
|
5240
5469
|
const contentType = downloadResponse.headers.get("content-type")?.split(";")[0].trim() || attachment.mimetype || "application/octet-stream";
|
|
5470
|
+
const bytes = new Uint8Array(await downloadResponse.arrayBuffer());
|
|
5241
5471
|
return {
|
|
5242
5472
|
attachment,
|
|
5243
5473
|
downloadUrl: downloadResponse.url,
|
|
5474
|
+
directDownloadUrl: null,
|
|
5244
5475
|
filename: attachment.name,
|
|
5245
|
-
|
|
5476
|
+
bytes,
|
|
5246
5477
|
contentType
|
|
5247
5478
|
};
|
|
5248
5479
|
}
|
|
5480
|
+
/**
|
|
5481
|
+
* Probe the download endpoint for a presigned URL without buffering the file.
|
|
5482
|
+
*
|
|
5483
|
+
* Objectstore attachments redirect to a presigned URL (returned here); legacy
|
|
5484
|
+
* ones stream a 200 with no redirect, so there is no direct URL. The body is
|
|
5485
|
+
* discarded either way — we only need the URL.
|
|
5486
|
+
*/
|
|
5487
|
+
async resolveDirectDownloadUrl(downloadPath, opts) {
|
|
5488
|
+
try {
|
|
5489
|
+
const response = await this.request(downloadPath, { method: "GET" }, opts);
|
|
5490
|
+
const directUrl = response.redirected ? response.url : null;
|
|
5491
|
+
response.body?.cancel().catch(() => {});
|
|
5492
|
+
return directUrl;
|
|
5493
|
+
} catch {
|
|
5494
|
+
return null;
|
|
5495
|
+
}
|
|
5496
|
+
}
|
|
5249
5497
|
async getReplayDetails({ organizationSlug, replayId }, opts) {
|
|
5250
5498
|
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/replays/${replayId}/`, void 0, opts);
|
|
5251
5499
|
return zod.z.object({ data: ReplayDetailsSchema }).parse(body).data;
|
|
@@ -5269,7 +5517,7 @@ var SentryApiService = class {
|
|
|
5269
5517
|
async updateIssue({ organizationSlug, issueId, status, assignedTo, substatus, ignoreDuration, ignoreCount, ignoreWindow, ignoreUserCount, ignoreUserWindow }, opts) {
|
|
5270
5518
|
const updateData = {};
|
|
5271
5519
|
if (status !== void 0) updateData.status = status;
|
|
5272
|
-
if (assignedTo !== void 0) updateData.assignedTo = assignedTo;
|
|
5520
|
+
if (assignedTo !== void 0) updateData.assignedTo = assignedTo ?? "";
|
|
5273
5521
|
if (substatus !== void 0) updateData.substatus = substatus;
|
|
5274
5522
|
if (ignoreDuration !== void 0) updateData.ignoreDuration = ignoreDuration;
|
|
5275
5523
|
if (ignoreCount !== void 0) updateData.ignoreCount = ignoreCount;
|
|
@@ -5417,6 +5665,27 @@ var SentryApiService = class {
|
|
|
5417
5665
|
const apiUrl = apiPath`/organizations/${organizationSlug}/events/` + `?${queryParams.toString()}`;
|
|
5418
5666
|
return await this.requestJSON(apiUrl, void 0, opts);
|
|
5419
5667
|
}
|
|
5668
|
+
/**
|
|
5669
|
+
* Fetch a timeseries (events-stats) for a single yAxis, bucketed over time.
|
|
5670
|
+
*
|
|
5671
|
+
* `interval` is optional: omit it to let Sentry pick a sensible bucket size
|
|
5672
|
+
* for the range (mirrors get_interval_from_range in the Sentry source).
|
|
5673
|
+
* Environment and other filters travel in `query`, same as searchEvents.
|
|
5674
|
+
*/
|
|
5675
|
+
async getEventsTimeSeries({ organizationSlug, query, yAxis, interval, projectId, dataset = "errors", statsPeriod, start, end }, opts) {
|
|
5676
|
+
const queryParams = new URLSearchParams();
|
|
5677
|
+
queryParams.set("dataset", require_constants.normalizeEventsDataset(dataset));
|
|
5678
|
+
queryParams.set("query", query);
|
|
5679
|
+
queryParams.set("yAxis", yAxis);
|
|
5680
|
+
if (interval) queryParams.set("interval", interval);
|
|
5681
|
+
this.applyTimeParams(queryParams, statsPeriod, start, end);
|
|
5682
|
+
if (projectId) queryParams.set("project", projectId);
|
|
5683
|
+
queryParams.set("partial", "1");
|
|
5684
|
+
queryParams.set("referrer", SENTRY_MCP_SEARCH_EVENTS_REFERRER);
|
|
5685
|
+
const apiUrl = apiPath`/organizations/${organizationSlug}/events-stats/` + `?${queryParams.toString()}`;
|
|
5686
|
+
const body = await this.requestJSON(apiUrl, void 0, opts);
|
|
5687
|
+
return EventsStatsResponseSchema.parse(body);
|
|
5688
|
+
}
|
|
5420
5689
|
async startAutofix({ organizationSlug, issueId, eventId, instruction = "" }, opts) {
|
|
5421
5690
|
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/issues/${issueId}/autofix/`, {
|
|
5422
5691
|
method: "POST",
|
|
@@ -5428,7 +5697,7 @@ var SentryApiService = class {
|
|
|
5428
5697
|
return AutofixRunSchema.parse(body);
|
|
5429
5698
|
}
|
|
5430
5699
|
async getAutofixState({ organizationSlug, issueId }, opts) {
|
|
5431
|
-
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/issues/${issueId}/autofix
|
|
5700
|
+
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/issues/${issueId}/autofix/` + `?llmFormat=markdown`, void 0, opts);
|
|
5432
5701
|
return AutofixRunStateSchema.parse(body);
|
|
5433
5702
|
}
|
|
5434
5703
|
/**
|
|
@@ -5659,7 +5928,7 @@ var SentryApiService = class {
|
|
|
5659
5928
|
const blob = await response.blob();
|
|
5660
5929
|
let contentType = response.headers.get("content-type") ?? "";
|
|
5661
5930
|
if (!contentType.startsWith("image/")) {
|
|
5662
|
-
const { detectImageMimeType } = await Promise.resolve().then(() => require("./blob-utils-
|
|
5931
|
+
const { detectImageMimeType } = await Promise.resolve().then(() => require("./blob-utils-DGsI5_gF.cjs"));
|
|
5663
5932
|
contentType = await detectImageMimeType(blob) ?? contentType;
|
|
5664
5933
|
}
|
|
5665
5934
|
return {
|
|
@@ -13156,7 +13425,7 @@ var _a19;
|
|
|
13156
13425
|
_a19 = symbol19;
|
|
13157
13426
|
|
|
13158
13427
|
//#endregion
|
|
13159
|
-
//#region ../mcp-core/dist/error-handling-
|
|
13428
|
+
//#region ../mcp-core/dist/error-handling-ChAIYsge.js
|
|
13160
13429
|
/**
|
|
13161
13430
|
* Type guard to identify user input validation errors.
|
|
13162
13431
|
*/
|
|
@@ -13358,9 +13627,19 @@ async function formatErrorForUser(error, options) {
|
|
|
13358
13627
|
}
|
|
13359
13628
|
return parts.join("\n\n");
|
|
13360
13629
|
}
|
|
13630
|
+
/**
|
|
13631
|
+
* Invoke a tool's onError hook for failure telemetry, isolated so a misbehaving
|
|
13632
|
+
* hook can't disrupt the surrounding error handling. Call this at every point
|
|
13633
|
+
* where a tool handler is run and may throw.
|
|
13634
|
+
*/
|
|
13635
|
+
function recordToolFailure(tool$1, error, params, context$1) {
|
|
13636
|
+
try {
|
|
13637
|
+
tool$1.onError?.(error, params, context$1);
|
|
13638
|
+
} catch {}
|
|
13639
|
+
}
|
|
13361
13640
|
|
|
13362
13641
|
//#endregion
|
|
13363
|
-
//#region ../mcp-core/dist/constraint-helpers-
|
|
13642
|
+
//#region ../mcp-core/dist/constraint-helpers-DQeAySy6.js
|
|
13364
13643
|
/**
|
|
13365
13644
|
* Determines which tool parameter keys should be filtered out of the schema
|
|
13366
13645
|
* because they will be injected from constraints.
|
|
@@ -13422,7 +13701,7 @@ function getConstraintParametersToInject(constraints, toolInputSchema) {
|
|
|
13422
13701
|
}
|
|
13423
13702
|
|
|
13424
13703
|
//#endregion
|
|
13425
|
-
//#region ../mcp-core/dist/surfaces-
|
|
13704
|
+
//#region ../mcp-core/dist/surfaces-DCc7zT-1.js
|
|
13426
13705
|
/**
|
|
13427
13706
|
* Central policy for direct MCP exposure.
|
|
13428
13707
|
*
|
|
@@ -13457,7 +13736,7 @@ function isCatalogInfrastructureToolName(toolName) {
|
|
|
13457
13736
|
}
|
|
13458
13737
|
|
|
13459
13738
|
//#endregion
|
|
13460
|
-
//#region ../mcp-core/dist/types-
|
|
13739
|
+
//#region ../mcp-core/dist/types-DzNDeR5X.js
|
|
13461
13740
|
/**
|
|
13462
13741
|
* Resolves a tool description to a string.
|
|
13463
13742
|
* Handles both static strings and dynamic description functions.
|
|
@@ -13475,7 +13754,7 @@ function isToolVisibleInMode(tool$1, experimentalMode) {
|
|
|
13475
13754
|
}
|
|
13476
13755
|
|
|
13477
13756
|
//#endregion
|
|
13478
|
-
//#region ../mcp-core/dist/availability-
|
|
13757
|
+
//#region ../mcp-core/dist/availability-KeZ7TRFd.js
|
|
13479
13758
|
function getToolPlacement({ key, experimentalMode, useDefaultSurfacePolicy }) {
|
|
13480
13759
|
if (useDefaultSurfacePolicy) return {
|
|
13481
13760
|
isCatalogTool: !isOutsideCatalogToolName(key),
|
|
@@ -13573,13 +13852,13 @@ function resolveToolDescription(tool$1, context$1) {
|
|
|
13573
13852
|
}
|
|
13574
13853
|
|
|
13575
13854
|
//#endregion
|
|
13576
|
-
//#region ../mcp-core/dist/define-
|
|
13855
|
+
//#region ../mcp-core/dist/define-CmkKwzq9.js
|
|
13577
13856
|
function defineTool(config) {
|
|
13578
13857
|
return config;
|
|
13579
13858
|
}
|
|
13580
13859
|
|
|
13581
13860
|
//#endregion
|
|
13582
|
-
//#region ../mcp-core/dist/validate-region-url-
|
|
13861
|
+
//#region ../mcp-core/dist/validate-region-url-DbvSZfG2.js
|
|
13583
13862
|
/**
|
|
13584
13863
|
* Validates that a regionUrl is valid.
|
|
13585
13864
|
* Prevents SSRF attacks by only allowing the base host itself or domains from an allowlist.
|
|
@@ -13611,7 +13890,7 @@ function validateRegionUrl(regionUrl, baseHost) {
|
|
|
13611
13890
|
}
|
|
13612
13891
|
|
|
13613
13892
|
//#endregion
|
|
13614
|
-
//#region ../mcp-core/dist/api-
|
|
13893
|
+
//#region ../mcp-core/dist/api-D4GH5wp9.js
|
|
13615
13894
|
/**
|
|
13616
13895
|
* Create a Sentry API service from server context with optional region override
|
|
13617
13896
|
* @param context - Server context containing host and access token
|
|
@@ -13637,17 +13916,35 @@ function apiServiceFromContext(context$1, opts = {}) {
|
|
|
13637
13916
|
}
|
|
13638
13917
|
|
|
13639
13918
|
//#endregion
|
|
13640
|
-
//#region ../mcp-core/dist/results-
|
|
13919
|
+
//#region ../mcp-core/dist/results-zMvHfnlV.js
|
|
13920
|
+
/**
|
|
13921
|
+
* Tool result packing policy
|
|
13922
|
+
*
|
|
13923
|
+
* - `structuredContent` is the source of truth when present.
|
|
13924
|
+
* - `content` text is a compatibility view of that same answer.
|
|
13925
|
+
* - Never put unique product data in only one side. If both fields are present,
|
|
13926
|
+
* they must be equivalent. Form-only differences (JSON vs pretty text of the
|
|
13927
|
+
* same payload) are fine; a second answer that exists in only one field is a
|
|
13928
|
+
* bug.
|
|
13929
|
+
* - Prefer `structuredResult(payload)` for data tools. The server generates
|
|
13930
|
+
* `content` as pretty JSON of the same payload.
|
|
13931
|
+
* - Markdown-only tools should return markdown and omit `structuredContent`
|
|
13932
|
+
* until they have a real structured payload. Do not attach sparse structured
|
|
13933
|
+
* side-channels (for example suggestedActions alone) on top of markdown.
|
|
13934
|
+
*/
|
|
13641
13935
|
/**
|
|
13642
13936
|
* Marks a tool result as structured-only. The server generates compatibility
|
|
13643
13937
|
* text for clients that do not read structuredContent yet.
|
|
13938
|
+
*
|
|
13939
|
+
* The returned payload is the full answer. Do not use this helper to ship a
|
|
13940
|
+
* partial hint while leaving the real answer only in handwritten markdown.
|
|
13644
13941
|
*/
|
|
13645
13942
|
function structuredResult(structuredContent) {
|
|
13646
13943
|
return { structuredContent };
|
|
13647
13944
|
}
|
|
13648
13945
|
|
|
13649
13946
|
//#endregion
|
|
13650
|
-
//#region ../mcp-core/dist/whoami-
|
|
13947
|
+
//#region ../mcp-core/dist/whoami-DthGP5fH.js
|
|
13651
13948
|
const whoamiOutputSchema = zod.z.object({
|
|
13652
13949
|
user: zod.z.object({
|
|
13653
13950
|
id: zod.z.string(),
|
|
@@ -13698,7 +13995,33 @@ var whoami_default = defineTool({
|
|
|
13698
13995
|
});
|
|
13699
13996
|
|
|
13700
13997
|
//#endregion
|
|
13701
|
-
//#region ../mcp-core/dist/
|
|
13998
|
+
//#region ../mcp-core/dist/get-sentry-mcp-info-Dg-_VZlQ.js
|
|
13999
|
+
const getSentryMcpInfoOutputSchema = zod.z.object({ version: zod.z.string().describe("The Sentry MCP server version.") });
|
|
14000
|
+
var get_sentry_mcp_info_default = defineTool({
|
|
14001
|
+
name: "get_sentry_mcp_info",
|
|
14002
|
+
description: [
|
|
14003
|
+
"Get information about the running Sentry MCP server.",
|
|
14004
|
+
"",
|
|
14005
|
+
"Use this tool when you need to:",
|
|
14006
|
+
"- Check the Sentry MCP server version",
|
|
14007
|
+
"- Verify compatibility with a Skill or integration"
|
|
14008
|
+
].join("\n"),
|
|
14009
|
+
inputSchema: {},
|
|
14010
|
+
outputSchema: getSentryMcpInfoOutputSchema,
|
|
14011
|
+
skills: require_resolve.ALL_SKILLS,
|
|
14012
|
+
requiredScopes: [],
|
|
14013
|
+
annotations: {
|
|
14014
|
+
readOnlyHint: true,
|
|
14015
|
+
destructiveHint: false,
|
|
14016
|
+
openWorldHint: false
|
|
14017
|
+
},
|
|
14018
|
+
async handler() {
|
|
14019
|
+
return structuredResult({ version: require_version.LIB_VERSION });
|
|
14020
|
+
}
|
|
14021
|
+
});
|
|
14022
|
+
|
|
14023
|
+
//#endregion
|
|
14024
|
+
//#region ../mcp-core/dist/find-organizations-BjoY7_gy.js
|
|
13702
14025
|
const RESULT_LIMIT$3 = 25;
|
|
13703
14026
|
const findOrganizationsOutputSchema = zod.z.object({
|
|
13704
14027
|
organizations: zod.z.array(zod.z.object({
|
|
@@ -13750,7 +14073,14 @@ var find_organizations_default = defineTool({
|
|
|
13750
14073
|
});
|
|
13751
14074
|
|
|
13752
14075
|
//#endregion
|
|
13753
|
-
//#region ../mcp-core/dist/
|
|
14076
|
+
//#region ../mcp-core/dist/organization-KfwiyEVH.js
|
|
14077
|
+
function setOrganizationContext(organizationSlug) {
|
|
14078
|
+
(0, __sentry_core.setAttribute)("organization.slug", organizationSlug);
|
|
14079
|
+
(0, __sentry_core.setTag)("organization.slug", organizationSlug);
|
|
14080
|
+
}
|
|
14081
|
+
|
|
14082
|
+
//#endregion
|
|
14083
|
+
//#region ../mcp-core/dist/find-teams-C5yde5nc.js
|
|
13754
14084
|
const RESULT_LIMIT$2 = 25;
|
|
13755
14085
|
const findTeamsOutputSchema = zod.z.object({
|
|
13756
14086
|
teams: zod.z.array(zod.z.object({
|
|
@@ -13792,7 +14122,7 @@ var find_teams_default = defineTool({
|
|
|
13792
14122
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
13793
14123
|
const organizationSlug = params.organizationSlug;
|
|
13794
14124
|
if (!organizationSlug) throw new UserInputError("Organization slug is required. Please provide an organizationSlug parameter.");
|
|
13795
|
-
(
|
|
14125
|
+
setOrganizationContext(organizationSlug);
|
|
13796
14126
|
const teams = await apiService.listTeams(organizationSlug, {
|
|
13797
14127
|
query: params.query ?? void 0,
|
|
13798
14128
|
limit: RESULT_LIMIT$2 + 1
|
|
@@ -13808,7 +14138,7 @@ var find_teams_default = defineTool({
|
|
|
13808
14138
|
});
|
|
13809
14139
|
|
|
13810
14140
|
//#endregion
|
|
13811
|
-
//#region ../mcp-core/dist/find-projects-
|
|
14141
|
+
//#region ../mcp-core/dist/find-projects-DBOb3oe-.js
|
|
13812
14142
|
const RESULT_LIMIT$1 = 25;
|
|
13813
14143
|
const findProjectsOutputSchema = zod.z.object({
|
|
13814
14144
|
projects: zod.z.array(zod.z.object({ slug: zod.z.string() })),
|
|
@@ -13843,7 +14173,7 @@ var find_projects_default = defineTool({
|
|
|
13843
14173
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
13844
14174
|
const organizationSlug = params.organizationSlug;
|
|
13845
14175
|
if (!organizationSlug) throw new UserInputError("Organization slug is required. Please provide an organizationSlug parameter.");
|
|
13846
|
-
(
|
|
14176
|
+
setOrganizationContext(organizationSlug);
|
|
13847
14177
|
const projects = await apiService.listProjects(organizationSlug, {
|
|
13848
14178
|
query: params.query ?? void 0,
|
|
13849
14179
|
limit: RESULT_LIMIT$1 + 1
|
|
@@ -13856,7 +14186,7 @@ var find_projects_default = defineTool({
|
|
|
13856
14186
|
});
|
|
13857
14187
|
|
|
13858
14188
|
//#endregion
|
|
13859
|
-
//#region ../mcp-core/dist/find-releases-
|
|
14189
|
+
//#region ../mcp-core/dist/find-releases-BF8-U7mW.js
|
|
13860
14190
|
const RESULT_LIMIT = 25;
|
|
13861
14191
|
const findReleasesOutputSchema = zod.z.object({
|
|
13862
14192
|
releases: zod.z.array(zod.z.object({
|
|
@@ -13929,7 +14259,7 @@ var find_releases_default = defineTool({
|
|
|
13929
14259
|
async handler(params, context$1) {
|
|
13930
14260
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
13931
14261
|
const organizationSlug = params.organizationSlug;
|
|
13932
|
-
(
|
|
14262
|
+
setOrganizationContext(organizationSlug);
|
|
13933
14263
|
const releases = await apiService.listReleases({
|
|
13934
14264
|
organizationSlug,
|
|
13935
14265
|
projectSlug: params.projectSlug ?? void 0,
|
|
@@ -13964,13 +14294,13 @@ var find_releases_default = defineTool({
|
|
|
13964
14294
|
});
|
|
13965
14295
|
|
|
13966
14296
|
//#endregion
|
|
13967
|
-
//#region ../mcp-core/dist/type-guards-
|
|
14297
|
+
//#region ../mcp-core/dist/type-guards-CsRf3nQI.js
|
|
13968
14298
|
function isPlainObject$3(value) {
|
|
13969
14299
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13970
14300
|
}
|
|
13971
14301
|
|
|
13972
14302
|
//#endregion
|
|
13973
|
-
//#region ../mcp-core/dist/api-formatting-
|
|
14303
|
+
//#region ../mcp-core/dist/api-formatting-Czl92Wir.js
|
|
13974
14304
|
function formatId(value) {
|
|
13975
14305
|
return value === void 0 || value === null ? "unknown" : String(value);
|
|
13976
14306
|
}
|
|
@@ -14007,7 +14337,7 @@ function compactLines(lines) {
|
|
|
14007
14337
|
}
|
|
14008
14338
|
|
|
14009
14339
|
//#endregion
|
|
14010
|
-
//#region ../mcp-core/dist/project-constraints-
|
|
14340
|
+
//#region ../mcp-core/dist/project-constraints-B-KhJpNB.js
|
|
14011
14341
|
function projectConstraintError(resourceLabel, projectSlug$1) {
|
|
14012
14342
|
return new UserInputError(`${resourceLabel} is outside the active project constraint. Expected project "${projectSlug$1}".`);
|
|
14013
14343
|
}
|
|
@@ -14025,7 +14355,7 @@ function assertProjectListContainsConstraint({ resourceLabel, scopedProjectSlug,
|
|
|
14025
14355
|
}
|
|
14026
14356
|
|
|
14027
14357
|
//#endregion
|
|
14028
|
-
//#region ../mcp-core/dist/get-release-details-
|
|
14358
|
+
//#region ../mcp-core/dist/get-release-details-DvY_TDet.js
|
|
14029
14359
|
function formatProjects(release) {
|
|
14030
14360
|
if (!release.projects || release.projects.length === 0) return null;
|
|
14031
14361
|
return release.projects.map((project) => project.slug ?? project.name).join(", ");
|
|
@@ -14097,7 +14427,7 @@ var get_release_details_default = defineTool({
|
|
|
14097
14427
|
async handler(params, context$1) {
|
|
14098
14428
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14099
14429
|
const organizationSlug = params.organizationSlug;
|
|
14100
|
-
(
|
|
14430
|
+
setOrganizationContext(organizationSlug);
|
|
14101
14431
|
(0, __sentry_core.setTag)("release.version", params.releaseVersion);
|
|
14102
14432
|
const scopedProjectSlug = context$1.constraints.projectSlug ?? void 0;
|
|
14103
14433
|
const requestedProjectSlugOrId = params.projectSlugOrId ?? void 0;
|
|
@@ -14177,7 +14507,7 @@ var get_release_details_default = defineTool({
|
|
|
14177
14507
|
});
|
|
14178
14508
|
|
|
14179
14509
|
//#endregion
|
|
14180
|
-
//#region ../mcp-core/dist/dashboards-
|
|
14510
|
+
//#region ../mcp-core/dist/dashboards-CHADwOiv.js
|
|
14181
14511
|
function formatList(values) {
|
|
14182
14512
|
if (!values || values.length === 0) return null;
|
|
14183
14513
|
return values.map(String).join(", ");
|
|
@@ -14309,7 +14639,7 @@ async function resolveDashboardId({ apiService, organizationSlug, dashboardIdOrT
|
|
|
14309
14639
|
}
|
|
14310
14640
|
|
|
14311
14641
|
//#endregion
|
|
14312
|
-
//#region ../mcp-core/dist/find-dashboards-
|
|
14642
|
+
//#region ../mcp-core/dist/find-dashboards-oyqvVv8a.js
|
|
14313
14643
|
const PROJECT_DASHBOARD_CURSOR_PREFIX = "mcp-dashboard-project:";
|
|
14314
14644
|
const dashboardSummarySchema = zod.z.object({
|
|
14315
14645
|
id: zod.z.string(),
|
|
@@ -14468,7 +14798,7 @@ var find_dashboards_default = defineTool({
|
|
|
14468
14798
|
async handler(params, context$1) {
|
|
14469
14799
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14470
14800
|
const organizationSlug = params.organizationSlug;
|
|
14471
|
-
(
|
|
14801
|
+
setOrganizationContext(organizationSlug);
|
|
14472
14802
|
const scopedProject = await resolveDashboardProjectConstraint({
|
|
14473
14803
|
apiService,
|
|
14474
14804
|
organizationSlug,
|
|
@@ -14520,7 +14850,7 @@ var find_dashboards_default = defineTool({
|
|
|
14520
14850
|
});
|
|
14521
14851
|
|
|
14522
14852
|
//#endregion
|
|
14523
|
-
//#region ../mcp-core/dist/get-dashboard-details-
|
|
14853
|
+
//#region ../mcp-core/dist/get-dashboard-details-D_U6hOFe.js
|
|
14524
14854
|
var get_dashboard_details_default = defineTool({
|
|
14525
14855
|
name: "get_dashboard_details",
|
|
14526
14856
|
skills: ["inspect"],
|
|
@@ -14557,7 +14887,7 @@ var get_dashboard_details_default = defineTool({
|
|
|
14557
14887
|
async handler(params, context$1) {
|
|
14558
14888
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14559
14889
|
const organizationSlug = params.organizationSlug;
|
|
14560
|
-
(
|
|
14890
|
+
setOrganizationContext(organizationSlug);
|
|
14561
14891
|
const scopedProject = await resolveDashboardProjectConstraint({
|
|
14562
14892
|
apiService,
|
|
14563
14893
|
organizationSlug,
|
|
@@ -14594,7 +14924,7 @@ var get_dashboard_details_default = defineTool({
|
|
|
14594
14924
|
});
|
|
14595
14925
|
|
|
14596
14926
|
//#endregion
|
|
14597
|
-
//#region ../mcp-core/dist/find-monitors-
|
|
14927
|
+
//#region ../mcp-core/dist/find-monitors-CwXZsdiJ.js
|
|
14598
14928
|
const ENVIRONMENT_LIMIT = 5;
|
|
14599
14929
|
const monitorScheduleOutputSchema = zod.z.object({
|
|
14600
14930
|
type: zod.z.string().nullable(),
|
|
@@ -14726,7 +15056,7 @@ var find_monitors_default = defineTool({
|
|
|
14726
15056
|
async handler(params, context$1) {
|
|
14727
15057
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14728
15058
|
const organizationSlug = params.organizationSlug;
|
|
14729
|
-
(
|
|
15059
|
+
setOrganizationContext(organizationSlug);
|
|
14730
15060
|
const requestedProjectSlug = params.projectSlug && params.projectSlug !== "all" ? params.projectSlug : void 0;
|
|
14731
15061
|
if (requestedProjectSlug) assertProjectRefWithinConstraint({
|
|
14732
15062
|
resourceLabel: "Monitor list",
|
|
@@ -14772,7 +15102,7 @@ var find_monitors_default = defineTool({
|
|
|
14772
15102
|
});
|
|
14773
15103
|
|
|
14774
15104
|
//#endregion
|
|
14775
|
-
//#region ../mcp-core/dist/get-monitor-details-
|
|
15105
|
+
//#region ../mcp-core/dist/get-monitor-details-CDcHPW6x.js
|
|
14776
15106
|
function formatProject(monitor) {
|
|
14777
15107
|
if (!monitor.project) return null;
|
|
14778
15108
|
return monitor.project.slug ?? monitor.project.name ?? null;
|
|
@@ -14837,7 +15167,7 @@ var get_monitor_details_default = defineTool({
|
|
|
14837
15167
|
async handler(params, context$1) {
|
|
14838
15168
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14839
15169
|
const organizationSlug = params.organizationSlug;
|
|
14840
|
-
(
|
|
15170
|
+
setOrganizationContext(organizationSlug);
|
|
14841
15171
|
(0, __sentry_core.setTag)("monitor.slug", params.monitorSlug);
|
|
14842
15172
|
const requestedProjectSlugOrId = params.projectSlugOrId ?? void 0;
|
|
14843
15173
|
const projectSlugOrId = requestedProjectSlugOrId ?? context$1.constraints.projectSlug ?? null;
|
|
@@ -14932,7 +15262,7 @@ var get_monitor_details_default = defineTool({
|
|
|
14932
15262
|
});
|
|
14933
15263
|
|
|
14934
15264
|
//#endregion
|
|
14935
|
-
//#region ../mcp-core/dist/uptime-monitors-
|
|
15265
|
+
//#region ../mcp-core/dist/uptime-monitors-D7xvJsr1.js
|
|
14936
15266
|
/** Verified against UptimeSubscription.IntervalSeconds in getsentry/sentry. */
|
|
14937
15267
|
const UPTIME_INTERVAL_SECONDS = [
|
|
14938
15268
|
60,
|
|
@@ -15065,7 +15395,7 @@ function toUptimeMonitorSummary(monitor, webUrl) {
|
|
|
15065
15395
|
}
|
|
15066
15396
|
|
|
15067
15397
|
//#endregion
|
|
15068
|
-
//#region ../mcp-core/dist/find-uptime-monitors-
|
|
15398
|
+
//#region ../mcp-core/dist/find-uptime-monitors-B5dw0P9D.js
|
|
15069
15399
|
const findUptimeMonitorsOutputSchema = zod.z.object({
|
|
15070
15400
|
monitors: zod.z.array(uptimeMonitorListItemSchema),
|
|
15071
15401
|
hasMore: zod.z.boolean()
|
|
@@ -15108,7 +15438,7 @@ var find_uptime_monitors_default = defineTool({
|
|
|
15108
15438
|
async handler(params, context$1) {
|
|
15109
15439
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15110
15440
|
const organizationSlug = params.organizationSlug;
|
|
15111
|
-
(
|
|
15441
|
+
setOrganizationContext(organizationSlug);
|
|
15112
15442
|
const requestedProjectSlug = params.projectSlug && params.projectSlug !== "all" ? params.projectSlug : void 0;
|
|
15113
15443
|
if (requestedProjectSlug) assertProjectRefWithinConstraint({
|
|
15114
15444
|
resourceLabel: "Uptime monitor list",
|
|
@@ -15133,7 +15463,7 @@ var find_uptime_monitors_default = defineTool({
|
|
|
15133
15463
|
});
|
|
15134
15464
|
|
|
15135
15465
|
//#endregion
|
|
15136
|
-
//#region ../mcp-core/dist/get-uptime-monitor-details-
|
|
15466
|
+
//#region ../mcp-core/dist/get-uptime-monitor-details-B40FMp1m.js
|
|
15137
15467
|
function formatCheck(check, monitorEnvironment) {
|
|
15138
15468
|
const time = formatDate(check.timestamp) ?? formatDate(check.scheduledCheckTime) ?? "unknown time";
|
|
15139
15469
|
const status = check.checkStatus ?? "unknown";
|
|
@@ -15186,7 +15516,7 @@ var get_uptime_monitor_details_default = defineTool({
|
|
|
15186
15516
|
async handler(params, context$1) {
|
|
15187
15517
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15188
15518
|
const organizationSlug = params.organizationSlug;
|
|
15189
|
-
(
|
|
15519
|
+
setOrganizationContext(organizationSlug);
|
|
15190
15520
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
15191
15521
|
(0, __sentry_core.setTag)("uptime.monitor_id", params.uptimeMonitorId);
|
|
15192
15522
|
assertProjectRefWithinConstraint({
|
|
@@ -15255,7 +15585,7 @@ var get_uptime_monitor_details_default = defineTool({
|
|
|
15255
15585
|
});
|
|
15256
15586
|
|
|
15257
15587
|
//#endregion
|
|
15258
|
-
//#region ../mcp-core/dist/create-uptime-monitor-
|
|
15588
|
+
//#region ../mcp-core/dist/create-uptime-monitor-BarA-8c1.js
|
|
15259
15589
|
const createUptimeMonitorOutputSchema = zod.z.object({ monitor: uptimeMonitorSummarySchema });
|
|
15260
15590
|
var create_uptime_monitor_default = defineTool({
|
|
15261
15591
|
name: "create_uptime_monitor",
|
|
@@ -15306,7 +15636,7 @@ var create_uptime_monitor_default = defineTool({
|
|
|
15306
15636
|
async handler(params, context$1) {
|
|
15307
15637
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15308
15638
|
const organizationSlug = params.organizationSlug;
|
|
15309
|
-
(
|
|
15639
|
+
setOrganizationContext(organizationSlug);
|
|
15310
15640
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
15311
15641
|
assertProjectRefWithinConstraint({
|
|
15312
15642
|
resourceLabel: "Uptime monitor",
|
|
@@ -15336,7 +15666,7 @@ var create_uptime_monitor_default = defineTool({
|
|
|
15336
15666
|
});
|
|
15337
15667
|
|
|
15338
15668
|
//#endregion
|
|
15339
|
-
//#region ../mcp-core/dist/update-uptime-monitor-
|
|
15669
|
+
//#region ../mcp-core/dist/update-uptime-monitor-Borxg5io.js
|
|
15340
15670
|
const updateUptimeMonitorOutputSchema = zod.z.object({ monitor: uptimeMonitorSummarySchema });
|
|
15341
15671
|
function hasDefinedUpdate(value) {
|
|
15342
15672
|
return value !== void 0;
|
|
@@ -15393,7 +15723,7 @@ var update_uptime_monitor_default = defineTool({
|
|
|
15393
15723
|
async handler(params, context$1) {
|
|
15394
15724
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15395
15725
|
const organizationSlug = params.organizationSlug;
|
|
15396
|
-
(
|
|
15726
|
+
setOrganizationContext(organizationSlug);
|
|
15397
15727
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
15398
15728
|
(0, __sentry_core.setTag)("uptime.monitor_id", params.uptimeMonitorId);
|
|
15399
15729
|
assertProjectRefWithinConstraint({
|
|
@@ -15427,7 +15757,7 @@ var update_uptime_monitor_default = defineTool({
|
|
|
15427
15757
|
});
|
|
15428
15758
|
|
|
15429
15759
|
//#endregion
|
|
15430
|
-
//#region ../mcp-core/dist/delete-uptime-monitor-
|
|
15760
|
+
//#region ../mcp-core/dist/delete-uptime-monitor-CpzZ4G3P.js
|
|
15431
15761
|
const deleteUptimeMonitorOutputSchema = zod.z.object({
|
|
15432
15762
|
success: zod.z.literal(true),
|
|
15433
15763
|
uptimeMonitorId: zod.z.string(),
|
|
@@ -15464,7 +15794,7 @@ var delete_uptime_monitor_default = defineTool({
|
|
|
15464
15794
|
async handler(params, context$1) {
|
|
15465
15795
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15466
15796
|
const organizationSlug = params.organizationSlug;
|
|
15467
|
-
(
|
|
15797
|
+
setOrganizationContext(organizationSlug);
|
|
15468
15798
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
15469
15799
|
(0, __sentry_core.setTag)("uptime.monitor_id", params.uptimeMonitorId);
|
|
15470
15800
|
assertProjectRefWithinConstraint({
|
|
@@ -15486,12 +15816,12 @@ var delete_uptime_monitor_default = defineTool({
|
|
|
15486
15816
|
});
|
|
15487
15817
|
|
|
15488
15818
|
//#endregion
|
|
15489
|
-
//#region ../mcp-core/dist/find-alert-rules-
|
|
15819
|
+
//#region ../mcp-core/dist/find-alert-rules-Dc55EgzE.js
|
|
15490
15820
|
const AlertRuleKind$1 = zod.z.enum([
|
|
15491
15821
|
"all",
|
|
15492
15822
|
"issue",
|
|
15493
15823
|
"metric"
|
|
15494
|
-
]).describe("Which alert rule family to search. Use `all` to include
|
|
15824
|
+
]).describe("Which alert rule family to search. Use `all` to include Alerts (workflows) and legacy metric alerts.");
|
|
15495
15825
|
const issueAlertRuleSummarySchema = zod.z.object({
|
|
15496
15826
|
id: zod.z.string(),
|
|
15497
15827
|
name: zod.z.string(),
|
|
@@ -15527,9 +15857,10 @@ const findAlertRulesOutputSchema = zod.z.object({
|
|
|
15527
15857
|
pagination: zod.z.object({
|
|
15528
15858
|
issue: paginationStateSchema.nullable(),
|
|
15529
15859
|
metric: paginationStateSchema.nullable()
|
|
15530
|
-
})
|
|
15860
|
+
}),
|
|
15861
|
+
warnings: zod.z.array(zod.z.string()).optional()
|
|
15531
15862
|
});
|
|
15532
|
-
function getIssueAlertRuleFrequency
|
|
15863
|
+
function getIssueAlertRuleFrequency(rule) {
|
|
15533
15864
|
if (typeof rule.frequency === "number") return rule.frequency;
|
|
15534
15865
|
const frequency = rule.config.frequency;
|
|
15535
15866
|
return typeof frequency === "number" ? frequency : null;
|
|
@@ -15550,7 +15881,7 @@ var find_alert_rules_default = defineTool({
|
|
|
15550
15881
|
"Find Sentry alert rules.",
|
|
15551
15882
|
"",
|
|
15552
15883
|
"Use this tool when you need to:",
|
|
15553
|
-
"- List
|
|
15884
|
+
"- List Alerts (workflows) for an organization or project, including Alerts without connected sources",
|
|
15554
15885
|
"- List metric alert rules for an organization or project",
|
|
15555
15886
|
"- Find an alert rule ID by name before inspecting it",
|
|
15556
15887
|
"- Check alert conditions, queries, triggers, actions, owner, or environment",
|
|
@@ -15562,8 +15893,8 @@ var find_alert_rules_default = defineTool({
|
|
|
15562
15893
|
"</examples>",
|
|
15563
15894
|
"",
|
|
15564
15895
|
"<hints>",
|
|
15565
|
-
"-
|
|
15566
|
-
"-
|
|
15896
|
+
"- Omit `projectSlug` to search organization-wide. A project filter finds connected Alerts, which may also cover other projects.",
|
|
15897
|
+
"- With `kind='all'`, an unavailable legacy metric alert API is reported in `warnings`; the returned Alerts are still usable.",
|
|
15567
15898
|
"- Issue and metric alert rules have independent pagination state. Reuse a nextCursor only with its matching kind.",
|
|
15568
15899
|
"</hints>"
|
|
15569
15900
|
].join("\n"),
|
|
@@ -15590,15 +15921,14 @@ var find_alert_rules_default = defineTool({
|
|
|
15590
15921
|
project: { slug: requestedProjectSlug }
|
|
15591
15922
|
});
|
|
15592
15923
|
const projectSlug$1 = context$1.constraints.projectSlug ?? requestedProjectSlug;
|
|
15593
|
-
if (params.kind === "issue" && !projectSlug$1) throw new UserInputError("projectSlug is required when searching issue alert rules.");
|
|
15594
15924
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15595
15925
|
const organizationSlug = params.organizationSlug;
|
|
15596
|
-
(
|
|
15926
|
+
setOrganizationContext(organizationSlug);
|
|
15597
15927
|
if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
|
|
15598
|
-
const includeIssue = params.kind !== "metric"
|
|
15928
|
+
const includeIssue = params.kind !== "metric";
|
|
15599
15929
|
const includeMetric = params.kind !== "issue";
|
|
15600
15930
|
if (params.cursor && includeIssue && includeMetric) throw new UserInputError("cursor cannot be used with `kind='all'` when both issue and metric alert rules are included. Retry with `kind='issue'` or `kind='metric'` using a cursor from the same alert rule family.");
|
|
15601
|
-
const issuePage = includeIssue
|
|
15931
|
+
const issuePage = includeIssue ? await apiService.listIssueAlertRulesPage({
|
|
15602
15932
|
organizationSlug,
|
|
15603
15933
|
projectSlug: projectSlug$1,
|
|
15604
15934
|
query: params.query ?? void 0,
|
|
@@ -15608,16 +15938,18 @@ var find_alert_rules_default = defineTool({
|
|
|
15608
15938
|
rules: [],
|
|
15609
15939
|
nextCursor: null
|
|
15610
15940
|
};
|
|
15941
|
+
const warnings = [];
|
|
15611
15942
|
const metricPage = includeMetric ? await apiService.listMetricAlertRulesPage({
|
|
15612
15943
|
organizationSlug,
|
|
15613
15944
|
projectSlug: projectSlug$1,
|
|
15614
15945
|
query: params.query ?? void 0,
|
|
15615
15946
|
cursor: params.cursor ?? void 0,
|
|
15616
15947
|
limit: params.limit
|
|
15617
|
-
})
|
|
15618
|
-
|
|
15619
|
-
|
|
15620
|
-
|
|
15948
|
+
}).catch((error) => {
|
|
15949
|
+
if (params.kind !== "all" || !(error instanceof ApiError) || error.status !== 410) throw error;
|
|
15950
|
+
warnings.push("Metric alerts could not be listed: Sentry's legacy metric alert API is no longer available for this organization.");
|
|
15951
|
+
return null;
|
|
15952
|
+
}) : null;
|
|
15621
15953
|
return structuredResult({
|
|
15622
15954
|
issueRules: issuePage.rules.map((rule) => ({
|
|
15623
15955
|
id: String(rule.id),
|
|
@@ -15625,7 +15957,7 @@ var find_alert_rules_default = defineTool({
|
|
|
15625
15957
|
status: getIssueAlertRuleStatus(rule),
|
|
15626
15958
|
actionMatch: rule.actionMatch ?? null,
|
|
15627
15959
|
filterMatch: rule.filterMatch ?? null,
|
|
15628
|
-
frequencyMinutes: getIssueAlertRuleFrequency
|
|
15960
|
+
frequencyMinutes: getIssueAlertRuleFrequency(rule),
|
|
15629
15961
|
environment: rule.environment ?? null,
|
|
15630
15962
|
owner: getOwner(rule.owner),
|
|
15631
15963
|
dateCreated: formatDate(rule.dateCreated),
|
|
@@ -15633,7 +15965,7 @@ var find_alert_rules_default = defineTool({
|
|
|
15633
15965
|
lastTriggered: formatDate(rule.lastTriggered),
|
|
15634
15966
|
webUrl: apiService.getIssueAlertRuleUrl(organizationSlug, rule.id)
|
|
15635
15967
|
})),
|
|
15636
|
-
metricRules: metricPage
|
|
15968
|
+
metricRules: (metricPage?.rules ?? []).map((rule) => ({
|
|
15637
15969
|
id: String(rule.id),
|
|
15638
15970
|
name: rule.name,
|
|
15639
15971
|
status: rule.status ?? null,
|
|
@@ -15649,14 +15981,184 @@ var find_alert_rules_default = defineTool({
|
|
|
15649
15981
|
})),
|
|
15650
15982
|
pagination: {
|
|
15651
15983
|
issue: includeIssue ? { nextCursor: issuePage.nextCursor } : null,
|
|
15652
|
-
metric:
|
|
15653
|
-
}
|
|
15984
|
+
metric: metricPage ? { nextCursor: metricPage.nextCursor } : null
|
|
15985
|
+
},
|
|
15986
|
+
...warnings.length > 0 ? { warnings } : {}
|
|
15654
15987
|
});
|
|
15655
15988
|
}
|
|
15656
15989
|
});
|
|
15657
15990
|
|
|
15658
15991
|
//#endregion
|
|
15659
|
-
//#region ../mcp-core/dist/
|
|
15992
|
+
//#region ../mcp-core/dist/alert-rule-details-CJ-FfoC7.js
|
|
15993
|
+
const componentId = zod.z.union([zod.z.string(), zod.z.number()]);
|
|
15994
|
+
const conditionSchema = zod.z.object({
|
|
15995
|
+
id: componentId.optional(),
|
|
15996
|
+
type: zod.z.string(),
|
|
15997
|
+
comparison: zod.z.unknown(),
|
|
15998
|
+
conditionResult: zod.z.unknown()
|
|
15999
|
+
});
|
|
16000
|
+
const conditionGroupSchema$1 = zod.z.object({
|
|
16001
|
+
id: componentId.optional(),
|
|
16002
|
+
logicType: zod.z.string(),
|
|
16003
|
+
conditions: zod.z.array(conditionSchema)
|
|
16004
|
+
});
|
|
16005
|
+
const actionGroupSchema = conditionGroupSchema$1.extend({ actions: zod.z.array(zod.z.object({
|
|
16006
|
+
id: componentId.optional(),
|
|
16007
|
+
type: zod.z.string(),
|
|
16008
|
+
integrationId: componentId.nullable().optional(),
|
|
16009
|
+
config: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
16010
|
+
data: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
16011
|
+
status: zod.z.string().optional()
|
|
16012
|
+
})) });
|
|
16013
|
+
const metricQuerySchema = zod.z.object({
|
|
16014
|
+
dataset: zod.z.string(),
|
|
16015
|
+
query: zod.z.string(),
|
|
16016
|
+
aggregate: zod.z.string(),
|
|
16017
|
+
timeWindow: zod.z.number(),
|
|
16018
|
+
environment: zod.z.string().nullable(),
|
|
16019
|
+
eventTypes: zod.z.array(zod.z.string()),
|
|
16020
|
+
extrapolationMode: zod.z.string().nullable().optional()
|
|
16021
|
+
});
|
|
16022
|
+
const uptimeQuerySchema = zod.z.object({
|
|
16023
|
+
url: zod.z.string(),
|
|
16024
|
+
method: zod.z.string(),
|
|
16025
|
+
intervalSeconds: zod.z.number(),
|
|
16026
|
+
timeoutMs: zod.z.number(),
|
|
16027
|
+
assertion: zod.z.unknown(),
|
|
16028
|
+
traceSampling: zod.z.boolean().optional(),
|
|
16029
|
+
responseCaptureEnabled: zod.z.boolean().optional()
|
|
16030
|
+
});
|
|
16031
|
+
const cronQuerySchema = zod.z.object({
|
|
16032
|
+
id: zod.z.string(),
|
|
16033
|
+
name: zod.z.string(),
|
|
16034
|
+
slug: zod.z.string(),
|
|
16035
|
+
status: zod.z.string(),
|
|
16036
|
+
isMuted: zod.z.boolean(),
|
|
16037
|
+
config: zod.z.object({
|
|
16038
|
+
schedule_type: zod.z.string(),
|
|
16039
|
+
schedule: zod.z.union([zod.z.string(), zod.z.array(zod.z.union([zod.z.number(), zod.z.string()]))]),
|
|
16040
|
+
checkin_margin: zod.z.number().nullable().optional(),
|
|
16041
|
+
max_runtime: zod.z.number().nullable().optional(),
|
|
16042
|
+
timezone: zod.z.string().nullable().optional(),
|
|
16043
|
+
failure_issue_threshold: zod.z.number().nullable().optional(),
|
|
16044
|
+
recovery_threshold: zod.z.number().nullable().optional()
|
|
16045
|
+
}),
|
|
16046
|
+
environments: zod.z.array(zod.z.object({
|
|
16047
|
+
name: zod.z.string(),
|
|
16048
|
+
status: zod.z.string(),
|
|
16049
|
+
isMuted: zod.z.boolean()
|
|
16050
|
+
}))
|
|
16051
|
+
});
|
|
16052
|
+
function sourceDetails(source) {
|
|
16053
|
+
const type = typeof source.type === "string" ? source.type : "unknown";
|
|
16054
|
+
const query = source.queryObj;
|
|
16055
|
+
const unavailable = {
|
|
16056
|
+
type,
|
|
16057
|
+
unavailableReason: "Source configuration is unavailable."
|
|
16058
|
+
};
|
|
16059
|
+
if (!isPlainObject$3(query)) return unavailable;
|
|
16060
|
+
if (type === "snuba_query_subscription") {
|
|
16061
|
+
const parsed = metricQuerySchema.safeParse(query.snubaQuery);
|
|
16062
|
+
if (!parsed.success) return unavailable;
|
|
16063
|
+
const { timeWindow,...config } = parsed.data;
|
|
16064
|
+
return {
|
|
16065
|
+
type,
|
|
16066
|
+
query: {
|
|
16067
|
+
...config,
|
|
16068
|
+
timeWindowSeconds: timeWindow
|
|
16069
|
+
}
|
|
16070
|
+
};
|
|
16071
|
+
}
|
|
16072
|
+
if (type === "uptime_subscription") {
|
|
16073
|
+
const parsed = uptimeQuerySchema.safeParse(query);
|
|
16074
|
+
return parsed.success ? {
|
|
16075
|
+
type,
|
|
16076
|
+
query: parsed.data,
|
|
16077
|
+
omittedFields: ["headers", "body"]
|
|
16078
|
+
} : unavailable;
|
|
16079
|
+
}
|
|
16080
|
+
if (type === "cron_monitor") {
|
|
16081
|
+
const parsed = cronQuerySchema.safeParse(query);
|
|
16082
|
+
return parsed.success ? {
|
|
16083
|
+
type,
|
|
16084
|
+
query: parsed.data
|
|
16085
|
+
} : unavailable;
|
|
16086
|
+
}
|
|
16087
|
+
return {
|
|
16088
|
+
type,
|
|
16089
|
+
unavailableReason: "This source type is not supported for inspection."
|
|
16090
|
+
};
|
|
16091
|
+
}
|
|
16092
|
+
/** Project native configuration explicitly so backend metadata stays private. */
|
|
16093
|
+
async function getAlertRuleDetails(api, organizationSlug, rule, scopedProjectSlug) {
|
|
16094
|
+
const scope = await api.getAlertRuleProjectScope({
|
|
16095
|
+
organizationSlug,
|
|
16096
|
+
ruleId: rule.id
|
|
16097
|
+
});
|
|
16098
|
+
const project = scopedProjectSlug ? await api.getProject({
|
|
16099
|
+
organizationSlug,
|
|
16100
|
+
projectSlugOrId: scopedProjectSlug
|
|
16101
|
+
}) : void 0;
|
|
16102
|
+
const sources = [];
|
|
16103
|
+
for (const id of rule.detectorIds ?? []) try {
|
|
16104
|
+
const detector = await api.getDetector({
|
|
16105
|
+
organizationSlug,
|
|
16106
|
+
detectorId: id
|
|
16107
|
+
});
|
|
16108
|
+
if (project && detector.projectId !== null && String(detector.projectId) !== String(project.id)) {
|
|
16109
|
+
sources.push({
|
|
16110
|
+
id: String(id),
|
|
16111
|
+
status: "outside_project_constraint"
|
|
16112
|
+
});
|
|
16113
|
+
continue;
|
|
16114
|
+
}
|
|
16115
|
+
sources.push({
|
|
16116
|
+
id: String(detector.id),
|
|
16117
|
+
status: "available",
|
|
16118
|
+
name: detector.name,
|
|
16119
|
+
type: detector.type,
|
|
16120
|
+
projectId: detector.projectId === null ? null : String(detector.projectId),
|
|
16121
|
+
enabled: detector.enabled,
|
|
16122
|
+
config: detector.type === "issue_stream" ? {} : detector.config,
|
|
16123
|
+
conditionGroup: detector.conditionGroup ? conditionGroupSchema$1.parse(detector.conditionGroup) : null,
|
|
16124
|
+
dataSources: (detector.dataSources ?? []).map(sourceDetails)
|
|
16125
|
+
});
|
|
16126
|
+
} catch (error) {
|
|
16127
|
+
if (!(error instanceof ApiNotFoundError || error instanceof ApiPermissionError)) throw error;
|
|
16128
|
+
sources.push({
|
|
16129
|
+
id: String(id),
|
|
16130
|
+
status: "unavailable",
|
|
16131
|
+
reason: "Not found or not accessible."
|
|
16132
|
+
});
|
|
16133
|
+
}
|
|
16134
|
+
const projectIds = project ? scope.projectIds.filter((id) => id === String(project.id)) : scope.projectIds;
|
|
16135
|
+
return {
|
|
16136
|
+
id: String(rule.id),
|
|
16137
|
+
name: rule.name,
|
|
16138
|
+
enabled: rule.enabled,
|
|
16139
|
+
config: zod.z.object({ frequency: zod.z.number().optional() }).parse(rule.config),
|
|
16140
|
+
environment: rule.environment,
|
|
16141
|
+
owner: rule.owner ? formatActor(rule.owner) : null,
|
|
16142
|
+
dateCreated: formatDate(rule.dateCreated),
|
|
16143
|
+
dateUpdated: formatDate(rule.dateUpdated),
|
|
16144
|
+
lastTriggered: formatDate(rule.lastTriggered),
|
|
16145
|
+
triggers: rule.triggers ? conditionGroupSchema$1.parse(rule.triggers) : null,
|
|
16146
|
+
actionFilters: (rule.actionFilters ?? []).map((group) => actionGroupSchema.parse(group)),
|
|
16147
|
+
scope: {
|
|
16148
|
+
includesAllProjects: scope.includesAllProjects,
|
|
16149
|
+
projectIds,
|
|
16150
|
+
...project ? {
|
|
16151
|
+
limitedToProject: scopedProjectSlug,
|
|
16152
|
+
...!scope.includesAllProjects ? { outsideProjectCount: scope.projectIds.length - projectIds.length } : {}
|
|
16153
|
+
} : {}
|
|
16154
|
+
},
|
|
16155
|
+
sources,
|
|
16156
|
+
webUrl: api.getIssueAlertRuleUrl(organizationSlug, rule.id)
|
|
16157
|
+
};
|
|
16158
|
+
}
|
|
16159
|
+
|
|
16160
|
+
//#endregion
|
|
16161
|
+
//#region ../mcp-core/dist/alerts-Cv9MFDEC.js
|
|
15660
16162
|
const NUMERIC_ID_PATTERN = /^\d+$/;
|
|
15661
16163
|
const COMPONENT_DETAIL_SKIP_KEYS = new Set([
|
|
15662
16164
|
"id",
|
|
@@ -15784,40 +16286,6 @@ function formatComponentSummary(label, components, headingLevel) {
|
|
|
15784
16286
|
if (components.length > 5) lines.push(`- ...and ${components.length - 5} more`);
|
|
15785
16287
|
return lines;
|
|
15786
16288
|
}
|
|
15787
|
-
function getIssueAlertRuleFrequency(rule) {
|
|
15788
|
-
if (rule.frequency !== void 0 && rule.frequency !== null) return rule.frequency;
|
|
15789
|
-
const frequency = rule.config.frequency;
|
|
15790
|
-
return typeof frequency === "number" ? frequency : null;
|
|
15791
|
-
}
|
|
15792
|
-
function formatIssueAlertRule(rule, projectSlug$1, options = {}) {
|
|
15793
|
-
const headingLevel = options.headingLevel ?? 2;
|
|
15794
|
-
const includeComponents = options.includeComponents ?? true;
|
|
15795
|
-
const heading = "#".repeat(Math.min(headingLevel, 6));
|
|
15796
|
-
const owner = rule.owner ? formatActor(rule.owner) : null;
|
|
15797
|
-
const frequency = getIssueAlertRuleFrequency(rule);
|
|
15798
|
-
const lines = compactLines([
|
|
15799
|
-
`${heading} ${rule.name}`,
|
|
15800
|
-
"",
|
|
15801
|
-
`**Kind**: Issue Alert`,
|
|
15802
|
-
`**ID**: ${formatId(rule.id)}`,
|
|
15803
|
-
`**Project**: ${projectSlug$1}`,
|
|
15804
|
-
rule.status ? `**Status**: ${rule.status}` : rule.enabled !== void 0 ? `**Status**: ${rule.enabled ? "enabled" : "disabled"}` : null,
|
|
15805
|
-
rule.actionMatch ? `**Action Match**: ${rule.actionMatch}` : null,
|
|
15806
|
-
rule.filterMatch ? `**Filter Match**: ${rule.filterMatch}` : null,
|
|
15807
|
-
frequency !== null ? `**Frequency**: ${frequency} minutes` : null,
|
|
15808
|
-
rule.environment ? `**Environment**: ${rule.environment}` : null,
|
|
15809
|
-
owner ? `**Owner**: ${owner}` : null,
|
|
15810
|
-
formatDate(rule.dateCreated) ? `**Created**: ${formatDate(rule.dateCreated)}` : null,
|
|
15811
|
-
formatDate(rule.dateUpdated) ? `**Updated**: ${formatDate(rule.dateUpdated)}` : null,
|
|
15812
|
-
formatDate(rule.lastTriggered) ? `**Last Triggered**: ${formatDate(rule.lastTriggered)}` : null,
|
|
15813
|
-
options.url ? `**URL**: ${options.url}` : null
|
|
15814
|
-
]);
|
|
15815
|
-
if (includeComponents) {
|
|
15816
|
-
const workflowTriggers = rule.triggers ? [rule.triggers] : [];
|
|
15817
|
-
lines.push(...formatComponentSummary("Conditions", rule.conditions, headingLevel + 1), ...formatComponentSummary("Filters", rule.filters, headingLevel + 1), ...formatComponentSummary("Actions", rule.actions, headingLevel + 1), ...formatComponentSummary("Triggers", workflowTriggers, headingLevel + 1), ...formatComponentSummary("Action Filters", rule.actionFilters ?? [], headingLevel + 1));
|
|
15818
|
-
}
|
|
15819
|
-
return lines.join("\n");
|
|
15820
|
-
}
|
|
15821
16289
|
function formatMetricAlertRule(rule, options = {}) {
|
|
15822
16290
|
const headingLevel = options.headingLevel ?? 2;
|
|
15823
16291
|
const includeComponents = options.includeComponents ?? true;
|
|
@@ -15843,14 +16311,16 @@ function formatMetricAlertRule(rule, options = {}) {
|
|
|
15843
16311
|
if (includeComponents) lines.push(...formatComponentSummary("Triggers", rule.triggers, headingLevel + 1));
|
|
15844
16312
|
return lines.join("\n");
|
|
15845
16313
|
}
|
|
16314
|
+
/** Resolve case-insensitive names only when the search results are complete. */
|
|
15846
16315
|
async function findExactIssueAlertRuleMatches(apiService, params) {
|
|
15847
|
-
const
|
|
16316
|
+
const page = await apiService.listIssueAlertRulesPage({
|
|
15848
16317
|
organizationSlug: params.organizationSlug,
|
|
15849
16318
|
projectSlug: params.projectSlug,
|
|
15850
16319
|
query: params.ruleName,
|
|
15851
16320
|
limit: 100
|
|
15852
16321
|
});
|
|
15853
|
-
|
|
16322
|
+
if (page.nextCursor) throw new UserInputError("Alert name search is incomplete. Find the Alert with find_alert_rules and retry with its numeric ID and explicit kind.");
|
|
16323
|
+
return page.rules.filter((rule) => rule.name.toLowerCase() === params.ruleName.toLowerCase());
|
|
15854
16324
|
}
|
|
15855
16325
|
async function findExactMetricAlertRuleMatches(apiService, params) {
|
|
15856
16326
|
const rules = await apiService.listMetricAlertRules({
|
|
@@ -15882,7 +16352,7 @@ async function resolveIssueAlertRule(apiService, params) {
|
|
|
15882
16352
|
ruleId: matches[0].id
|
|
15883
16353
|
});
|
|
15884
16354
|
if (matches.length > 1) throw new UserInputError(`Multiple issue alert rules named "${params.ruleIdOrName}" were found. Retry with the numeric rule ID.`);
|
|
15885
|
-
throw new UserInputError(`Issue alert rule "${params.ruleIdOrName}" was not found in project ${params.projectSlug}.`);
|
|
16355
|
+
throw new UserInputError(`Issue alert rule "${params.ruleIdOrName}" was not found${params.projectSlug ? ` in project ${params.projectSlug}` : ""}.`);
|
|
15886
16356
|
}
|
|
15887
16357
|
async function resolveMetricAlertRule(apiService, params) {
|
|
15888
16358
|
if (isNumericAlertRuleId(params.ruleIdOrName)) try {
|
|
@@ -15907,7 +16377,7 @@ async function resolveMetricAlertRule(apiService, params) {
|
|
|
15907
16377
|
}
|
|
15908
16378
|
|
|
15909
16379
|
//#endregion
|
|
15910
|
-
//#region ../mcp-core/dist/get-alert-rule-
|
|
16380
|
+
//#region ../mcp-core/dist/get-alert-rule-DOk7Olu5.js
|
|
15911
16381
|
const AlertRuleKind = zod.z.enum([
|
|
15912
16382
|
"all",
|
|
15913
16383
|
"issue",
|
|
@@ -15939,7 +16409,8 @@ var get_alert_rule_default = defineTool({
|
|
|
15939
16409
|
"<hints>",
|
|
15940
16410
|
"- Use `kind='issue'` or `kind='metric'` for numeric IDs because issue and metric alerts use separate endpoints.",
|
|
15941
16411
|
"- With `kind='all'`, a digit-only `ruleIdOrName` is treated as an exact alert rule name.",
|
|
15942
|
-
"- Issue
|
|
16412
|
+
"- Issue Alerts are notification workflows and may cover multiple projects or have no connected sources. Omit projectSlug to inspect organization-wide.",
|
|
16413
|
+
"- Issue details include complete conditions, notification actions, connected monitors and project scope. Inaccessible or session-restricted sources are marked explicitly.",
|
|
15943
16414
|
"</hints>"
|
|
15944
16415
|
].join("\n"),
|
|
15945
16416
|
inputSchema: {
|
|
@@ -15962,22 +16433,22 @@ var get_alert_rule_default = defineTool({
|
|
|
15962
16433
|
project: { slug: requestedProjectSlug }
|
|
15963
16434
|
});
|
|
15964
16435
|
const projectSlug$1 = context$1.constraints.projectSlug ?? requestedProjectSlug;
|
|
15965
|
-
if (params.kind === "issue" && !projectSlug$1) throw new UserInputError("projectSlug is required when inspecting an issue alert rule.");
|
|
15966
16436
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15967
16437
|
const organizationSlug = params.organizationSlug;
|
|
15968
|
-
(
|
|
16438
|
+
setOrganizationContext(organizationSlug);
|
|
15969
16439
|
if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
|
|
16440
|
+
const warnings = [];
|
|
15970
16441
|
let match;
|
|
15971
16442
|
if (params.kind === "issue") {
|
|
15972
16443
|
const rule = await resolveIssueAlertRule(apiService, {
|
|
15973
16444
|
organizationSlug,
|
|
15974
|
-
projectSlug: projectSlug$1
|
|
16445
|
+
projectSlug: projectSlug$1,
|
|
15975
16446
|
ruleIdOrName: params.ruleIdOrName
|
|
15976
16447
|
});
|
|
15977
16448
|
match = {
|
|
15978
16449
|
kind: "issue",
|
|
15979
16450
|
rule,
|
|
15980
|
-
projectSlug: projectSlug$1
|
|
16451
|
+
projectSlug: projectSlug$1
|
|
15981
16452
|
};
|
|
15982
16453
|
} else if (params.kind === "metric") {
|
|
15983
16454
|
const rule = await resolveMetricAlertRule(apiService, {
|
|
@@ -15993,31 +16464,34 @@ var get_alert_rule_default = defineTool({
|
|
|
15993
16464
|
};
|
|
15994
16465
|
} else {
|
|
15995
16466
|
const matches = [];
|
|
15996
|
-
|
|
15997
|
-
|
|
16467
|
+
const issueRules = await findExactIssueAlertRuleMatches(apiService, {
|
|
16468
|
+
organizationSlug,
|
|
16469
|
+
projectSlug: projectSlug$1,
|
|
16470
|
+
ruleName: params.ruleIdOrName
|
|
16471
|
+
});
|
|
16472
|
+
matches.push(...issueRules.map((rule) => ({
|
|
16473
|
+
kind: "issue",
|
|
16474
|
+
rule,
|
|
16475
|
+
projectSlug: projectSlug$1
|
|
16476
|
+
})));
|
|
16477
|
+
try {
|
|
16478
|
+
const metricPage = await apiService.listMetricAlertRulesPage({
|
|
15998
16479
|
organizationSlug,
|
|
15999
16480
|
projectSlug: projectSlug$1,
|
|
16000
16481
|
query: params.ruleIdOrName,
|
|
16001
16482
|
limit: 100
|
|
16002
16483
|
});
|
|
16003
|
-
|
|
16004
|
-
|
|
16484
|
+
if (metricPage.nextCursor) throw new UserInputError("Alert name search is incomplete. Find the Alert with find_alert_rules and retry with its numeric ID and explicit kind.");
|
|
16485
|
+
matches.push(...metricPage.rules.filter((rule) => rule.name.toLowerCase() === params.ruleIdOrName.toLowerCase()).map((rule) => ({
|
|
16486
|
+
kind: "metric",
|
|
16005
16487
|
rule,
|
|
16006
16488
|
projectSlug: projectSlug$1
|
|
16007
16489
|
})));
|
|
16490
|
+
} catch (error) {
|
|
16491
|
+
if (!(error instanceof ApiClientError) || error.status !== 410) throw error;
|
|
16492
|
+
warnings.push("Metric alert lookup is unavailable because the legacy API has been retired. Only issue Alerts were searched.");
|
|
16008
16493
|
}
|
|
16009
|
-
|
|
16010
|
-
organizationSlug,
|
|
16011
|
-
projectSlug: projectSlug$1,
|
|
16012
|
-
query: params.ruleIdOrName,
|
|
16013
|
-
limit: 100
|
|
16014
|
-
});
|
|
16015
|
-
matches.push(...metricRules.filter((rule) => rule.name.toLowerCase() === params.ruleIdOrName.toLowerCase()).map((rule) => ({
|
|
16016
|
-
kind: "metric",
|
|
16017
|
-
rule,
|
|
16018
|
-
projectSlug: projectSlug$1
|
|
16019
|
-
})));
|
|
16020
|
-
if (matches.length === 0) throw new UserInputError(`Alert rule "${params.ruleIdOrName}" was not found.`);
|
|
16494
|
+
if (matches.length === 0) throw new UserInputError(`Alert rule "${params.ruleIdOrName}" was not found.${warnings.length ? ` ${warnings.join(" ")}` : ""}`);
|
|
16021
16495
|
if (matches.length > 1) throw new UserInputError(`Multiple alert rules named "${params.ruleIdOrName}" were found: ${matches.map(describeMatch).join(", ")}. Retry with the numeric rule ID and explicit kind.`);
|
|
16022
16496
|
const [found] = matches;
|
|
16023
16497
|
match = found.kind === "issue" ? {
|
|
@@ -16036,9 +16510,13 @@ var get_alert_rule_default = defineTool({
|
|
|
16036
16510
|
};
|
|
16037
16511
|
if (match.kind === "metric") assertMetricAlertRuleWithinProject(match.rule, match.projectSlug);
|
|
16038
16512
|
}
|
|
16513
|
+
if (match.kind === "issue") return structuredResult({
|
|
16514
|
+
alertRule: await getAlertRuleDetails(apiService, organizationSlug, match.rule, context$1.constraints.projectSlug),
|
|
16515
|
+
...warnings.length ? { warnings } : {}
|
|
16516
|
+
});
|
|
16039
16517
|
const scopeLabel = projectSlug$1 ? `${organizationSlug}/${projectSlug$1}` : organizationSlug;
|
|
16040
16518
|
let output = `# Alert Rule in **${scopeLabel}**\n\n`;
|
|
16041
|
-
output +=
|
|
16519
|
+
output += formatMetricAlertRule(match.rule, { url: apiService.getMetricAlertRuleUrl(organizationSlug, match.rule.id) });
|
|
16042
16520
|
output += "\n\n## Response Notes\n\n";
|
|
16043
16521
|
output += "- Use these details to inspect alert conditions, filters, routing, and notification actions before changing the rule in Sentry.\n";
|
|
16044
16522
|
return output;
|
|
@@ -16046,7 +16524,203 @@ var get_alert_rule_default = defineTool({
|
|
|
16046
16524
|
});
|
|
16047
16525
|
|
|
16048
16526
|
//#endregion
|
|
16049
|
-
//#region ../mcp-core/dist/
|
|
16527
|
+
//#region ../mcp-core/dist/get-alert-options-DaJVqiFn.js
|
|
16528
|
+
const sectionSchema = zod.z.enum([
|
|
16529
|
+
"actions",
|
|
16530
|
+
"conditions",
|
|
16531
|
+
"sources"
|
|
16532
|
+
]);
|
|
16533
|
+
const conditionGroupSchema = zod.z.enum(["workflow_trigger", "action_filter"]);
|
|
16534
|
+
const getAlertOptionsOutputSchema = zod.z.object({
|
|
16535
|
+
section: sectionSchema,
|
|
16536
|
+
actions: zod.z.array(AlertActionOptionSchema).optional(),
|
|
16537
|
+
conditions: zod.z.array(AlertConditionOptionSchema).optional(),
|
|
16538
|
+
conditionGroup: conditionGroupSchema.optional(),
|
|
16539
|
+
sources: zod.z.array(zod.z.object({
|
|
16540
|
+
id: zod.z.string(),
|
|
16541
|
+
name: zod.z.string(),
|
|
16542
|
+
type: zod.z.string(),
|
|
16543
|
+
projectId: zod.z.string().nullable(),
|
|
16544
|
+
enabled: zod.z.boolean(),
|
|
16545
|
+
workflowIds: zod.z.array(zod.z.string())
|
|
16546
|
+
})).optional(),
|
|
16547
|
+
nextCursor: zod.z.string().nullable(),
|
|
16548
|
+
inputGuide: zod.z.object({
|
|
16549
|
+
schemaFormat: zod.z.string(),
|
|
16550
|
+
fieldNames: zod.z.record(zod.z.string(), zod.z.string()),
|
|
16551
|
+
targetTypes: zod.z.record(zod.z.string(), zod.z.string()),
|
|
16552
|
+
notes: zod.z.array(zod.z.string())
|
|
16553
|
+
}).optional()
|
|
16554
|
+
});
|
|
16555
|
+
var get_alert_options_default = defineTool({
|
|
16556
|
+
name: "get_alert_options",
|
|
16557
|
+
skills: ["inspect"],
|
|
16558
|
+
requiredScopes: ["org:read", "project:read"],
|
|
16559
|
+
description: [
|
|
16560
|
+
"Discover available actions, conditions, or sources for a Sentry Alert (notification workflow).",
|
|
16561
|
+
"",
|
|
16562
|
+
"Choose one section per call; reuse its cursor with the same section and filters.",
|
|
16563
|
+
"- actions: installed integrations, notification services, native config/data schemas and Sentry App settings. These schemas use Sentry's internal field names and target enums; inputGuide explains the update format.",
|
|
16564
|
+
"- conditions: condition types and comparison schemas for workflow triggers or action filters.",
|
|
16565
|
+
"- sources: accessible monitors and project issue streams. Use an issue_stream source to connect all issues from its project; a source with projectId=null covers all projects.",
|
|
16566
|
+
"Slack and Teams accept channel names; Discord needs a channel ID or URL. Dynamic Sentry App fields require explicit values; this tool does not enumerate their external choices.",
|
|
16567
|
+
"",
|
|
16568
|
+
"<examples>",
|
|
16569
|
+
"get_alert_options(organizationSlug='my-org', section='actions', actionTypes=['slack', 'msteams'])",
|
|
16570
|
+
"get_alert_options(organizationSlug='my-org', section='conditions', conditionGroup='action_filter')",
|
|
16571
|
+
"get_alert_options(organizationSlug='my-org', section='sources', projectSlug='backend', sourceTypes=['issue_stream'])",
|
|
16572
|
+
"</examples>"
|
|
16573
|
+
].join("\n"),
|
|
16574
|
+
inputSchema: {
|
|
16575
|
+
organizationSlug: ParamOrganizationSlug,
|
|
16576
|
+
regionUrl: ParamRegionUrl.nullable().default(null),
|
|
16577
|
+
section: sectionSchema.describe("The kind of Alert options to discover."),
|
|
16578
|
+
actionTypes: zod.z.array(zod.z.string().trim().min(1)).max(20).nullable().default(null).describe("Actions only: restrict to action types, such as slack, msteams, email, or pagerduty."),
|
|
16579
|
+
conditionGroup: conditionGroupSchema.nullable().default(null).describe("Required for conditions: workflow_trigger for Alert triggers, action_filter for action groups."),
|
|
16580
|
+
projectSlug: ParamProjectSlugOrAll.nullable().default(null),
|
|
16581
|
+
sourceTypes: zod.z.array(zod.z.string().trim().min(1)).max(20).nullable().default(null).describe("Sources only: restrict by monitor type, such as issue_stream or metric_issue."),
|
|
16582
|
+
query: zod.z.string().trim().min(1).nullable().default(null).describe("Sources only: Sentry monitor search, such as name:latency or workflow:123."),
|
|
16583
|
+
cursor: zod.z.string().nullable().default(null).describe("Next cursor from the same section and filters."),
|
|
16584
|
+
limit: zod.z.number().int().min(1).max(100).default(25).describe("Maximum options to return in this page.")
|
|
16585
|
+
},
|
|
16586
|
+
outputSchema: getAlertOptionsOutputSchema,
|
|
16587
|
+
annotations: {
|
|
16588
|
+
readOnlyHint: true,
|
|
16589
|
+
destructiveHint: false,
|
|
16590
|
+
openWorldHint: true
|
|
16591
|
+
},
|
|
16592
|
+
async handler(params, context$1) {
|
|
16593
|
+
const { section, organizationSlug } = params;
|
|
16594
|
+
if (params.actionTypes !== null && section !== "actions") throw new UserInputError("actionTypes can only be used with section='actions'.");
|
|
16595
|
+
if (params.conditionGroup !== null && section !== "conditions") throw new UserInputError("conditionGroup can only be used with section='conditions'.");
|
|
16596
|
+
if ((params.sourceTypes !== null || params.query !== null) && section !== "sources") throw new UserInputError("sourceTypes and query can only be used with section='sources'.");
|
|
16597
|
+
const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
16598
|
+
setOrganizationContext(organizationSlug);
|
|
16599
|
+
const pageParams = {
|
|
16600
|
+
organizationSlug,
|
|
16601
|
+
cursor: params.cursor ?? void 0,
|
|
16602
|
+
limit: params.limit
|
|
16603
|
+
};
|
|
16604
|
+
if (section === "actions") {
|
|
16605
|
+
const page$1 = await api.listAvailableAlertActionsPage({
|
|
16606
|
+
...pageParams,
|
|
16607
|
+
types: params.actionTypes ?? void 0
|
|
16608
|
+
});
|
|
16609
|
+
return structuredResult({
|
|
16610
|
+
section,
|
|
16611
|
+
...page$1,
|
|
16612
|
+
inputGuide: {
|
|
16613
|
+
schemaFormat: "Sentry-native schemas; workflow action inputs use camelCase fields and string target types.",
|
|
16614
|
+
fieldNames: {
|
|
16615
|
+
target_identifier: "targetIdentifier",
|
|
16616
|
+
target_display: "targetDisplay",
|
|
16617
|
+
target_type: "targetType",
|
|
16618
|
+
fallthrough_type: "fallthroughType"
|
|
16619
|
+
},
|
|
16620
|
+
targetTypes: {
|
|
16621
|
+
"0": "specific",
|
|
16622
|
+
"1": "user",
|
|
16623
|
+
"2": "team",
|
|
16624
|
+
"3": "sentry_app",
|
|
16625
|
+
"4": "issue_owners"
|
|
16626
|
+
},
|
|
16627
|
+
notes: [
|
|
16628
|
+
"Integration actions also require integrationId; choose a returned integration and service ID when applicable.",
|
|
16629
|
+
"Email team IDs can be found with find_teams; member destinations require a user ID.",
|
|
16630
|
+
"Sentry App settings include static field choices. Dynamic fields require explicit values; preserve existing settings when editing unrelated fields."
|
|
16631
|
+
]
|
|
16632
|
+
}
|
|
16633
|
+
});
|
|
16634
|
+
}
|
|
16635
|
+
if (section === "conditions") {
|
|
16636
|
+
if (!params.conditionGroup) throw new UserInputError("conditionGroup is required with section='conditions'.");
|
|
16637
|
+
return structuredResult({
|
|
16638
|
+
section,
|
|
16639
|
+
conditionGroup: params.conditionGroup,
|
|
16640
|
+
...await api.listAlertConditionsPage({
|
|
16641
|
+
...pageParams,
|
|
16642
|
+
group: params.conditionGroup
|
|
16643
|
+
})
|
|
16644
|
+
});
|
|
16645
|
+
}
|
|
16646
|
+
const requestedProjectSlug = params.projectSlug && params.projectSlug !== "all" ? params.projectSlug : void 0;
|
|
16647
|
+
if (requestedProjectSlug) assertProjectRefWithinConstraint({
|
|
16648
|
+
resourceLabel: "Alert source",
|
|
16649
|
+
scopedProjectSlug: context$1.constraints.projectSlug,
|
|
16650
|
+
project: { slug: requestedProjectSlug }
|
|
16651
|
+
});
|
|
16652
|
+
const projectSlug$1 = context$1.constraints.projectSlug ?? requestedProjectSlug;
|
|
16653
|
+
const project = projectSlug$1 ? await api.getProject({
|
|
16654
|
+
organizationSlug,
|
|
16655
|
+
projectSlugOrId: projectSlug$1
|
|
16656
|
+
}) : void 0;
|
|
16657
|
+
const page = await api.listDetectorsPage({
|
|
16658
|
+
...pageParams,
|
|
16659
|
+
projectId: project ? String(project.id) : void 0,
|
|
16660
|
+
types: params.sourceTypes ?? void 0,
|
|
16661
|
+
query: params.query ?? void 0
|
|
16662
|
+
});
|
|
16663
|
+
return structuredResult({
|
|
16664
|
+
section,
|
|
16665
|
+
sources: page.detectors.filter((detector) => !project || detector.projectId === String(project.id)).map((detector) => ({
|
|
16666
|
+
id: detector.id,
|
|
16667
|
+
name: detector.name,
|
|
16668
|
+
type: detector.type,
|
|
16669
|
+
projectId: detector.projectId,
|
|
16670
|
+
enabled: detector.enabled,
|
|
16671
|
+
workflowIds: detector.workflowIds ?? []
|
|
16672
|
+
})),
|
|
16673
|
+
nextCursor: page.nextCursor
|
|
16674
|
+
});
|
|
16675
|
+
}
|
|
16676
|
+
});
|
|
16677
|
+
|
|
16678
|
+
//#endregion
|
|
16679
|
+
//#region ../mcp-core/dist/enhance-error-C-IasWwg.js
|
|
16680
|
+
/**
|
|
16681
|
+
* Enhances a 404 error with parameter context to help users understand what went wrong.
|
|
16682
|
+
* This is optional - tools can use this when they want to provide extra context.
|
|
16683
|
+
*
|
|
16684
|
+
* @example
|
|
16685
|
+
* ```typescript
|
|
16686
|
+
* try {
|
|
16687
|
+
* const issue = await apiService.getIssue({ organizationSlug, issueId });
|
|
16688
|
+
* } catch (error) {
|
|
16689
|
+
* if (error instanceof ApiNotFoundError) {
|
|
16690
|
+
* throw enhanceNotFoundError(error, { organizationSlug, issueId });
|
|
16691
|
+
* }
|
|
16692
|
+
* throw error;
|
|
16693
|
+
* }
|
|
16694
|
+
* ```
|
|
16695
|
+
*/
|
|
16696
|
+
function enhanceNotFoundError(error, params) {
|
|
16697
|
+
const paramsList = [];
|
|
16698
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null && value !== "") paramsList.push(`${key}: '${value}'`);
|
|
16699
|
+
if (paramsList.length > 0) {
|
|
16700
|
+
const enhancedMessage = `${error.message}\nPlease verify these parameters are correct:\n${paramsList.map((p) => ` - ${p}`).join("\n")}`;
|
|
16701
|
+
return new ApiNotFoundError(enhancedMessage, error.detail, error.responseBody);
|
|
16702
|
+
}
|
|
16703
|
+
return error;
|
|
16704
|
+
}
|
|
16705
|
+
|
|
16706
|
+
//#endregion
|
|
16707
|
+
//#region ../mcp-core/dist/code-location-B3p1xz3c.js
|
|
16708
|
+
/** Formats a verified source location for the issue-details response. */
|
|
16709
|
+
function formatCodeLocation(codeLocation) {
|
|
16710
|
+
const output = ["## Code Location", ""];
|
|
16711
|
+
if (codeLocation.repository) output.push(`**Repository**: ${codeLocation.repository}`);
|
|
16712
|
+
if (codeLocation.path) output.push(`**Path**: ${codeLocation.path}`);
|
|
16713
|
+
if (codeLocation.line !== void 0) output.push(`**Line**: ${codeLocation.line}`);
|
|
16714
|
+
output.push(`**Source**: ${codeLocation.url}`, "");
|
|
16715
|
+
return `${output.join("\n")}\n`;
|
|
16716
|
+
}
|
|
16717
|
+
/** Selects Sentry's most relevant application frame: the last in-app frame. */
|
|
16718
|
+
function findMostRelevantInAppFrame(frames) {
|
|
16719
|
+
return frames.findLast((frame) => frame.inApp === true);
|
|
16720
|
+
}
|
|
16721
|
+
|
|
16722
|
+
//#endregion
|
|
16723
|
+
//#region ../mcp-core/dist/tool-call-formatting-DQggqUN_.js
|
|
16050
16724
|
function formatArgumentValue(value) {
|
|
16051
16725
|
if (typeof value === "string") return `'${value.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
|
|
16052
16726
|
if (Array.isArray(value) || typeof value === "object") return JSON.stringify(value);
|
|
@@ -16099,7 +16773,7 @@ function formatAvailableToolCallInstruction({ toolName, experimentalMode, purpos
|
|
|
16099
16773
|
}
|
|
16100
16774
|
|
|
16101
16775
|
//#endregion
|
|
16102
|
-
//#region ../mcp-core/dist/ai-conversation-actions-
|
|
16776
|
+
//#region ../mcp-core/dist/ai-conversation-actions-CLccuTm5.js
|
|
16103
16777
|
const MAX_SUGGESTED_ACTIONS = 3;
|
|
16104
16778
|
function formatInlineCode$1(value) {
|
|
16105
16779
|
const backtickRuns = value.match(/`+/g) ?? [];
|
|
@@ -16151,179 +16825,9 @@ function formatAIConversationActionInstructions({ organizationSlug, aiConversati
|
|
|
16151
16825
|
arguments: action.arguments
|
|
16152
16826
|
}))} to fetch the full transcript.`);
|
|
16153
16827
|
}
|
|
16154
|
-
/**
|
|
16155
|
-
* Adds concrete transcript follow-ups to otherwise markdown-first results.
|
|
16156
|
-
* The markdown remains the compatibility path for clients that do not read
|
|
16157
|
-
* structured content.
|
|
16158
|
-
*/
|
|
16159
|
-
function addAIConversationSuggestedActions({ markdown, organizationSlug, aiConversations, experimentalMode, availableToolNames, directToolNames }) {
|
|
16160
|
-
const suggestedActions = getAIConversationSuggestedActions({
|
|
16161
|
-
organizationSlug,
|
|
16162
|
-
aiConversations,
|
|
16163
|
-
experimentalMode,
|
|
16164
|
-
availableToolNames,
|
|
16165
|
-
directToolNames
|
|
16166
|
-
});
|
|
16167
|
-
if (suggestedActions.length === 0) return markdown;
|
|
16168
|
-
return {
|
|
16169
|
-
content: [{
|
|
16170
|
-
type: "text",
|
|
16171
|
-
text: markdown
|
|
16172
|
-
}],
|
|
16173
|
-
structuredContent: { suggestedActions }
|
|
16174
|
-
};
|
|
16175
|
-
}
|
|
16176
16828
|
|
|
16177
16829
|
//#endregion
|
|
16178
|
-
//#region ../mcp-core/dist/
|
|
16179
|
-
/**
|
|
16180
|
-
* Enhances a 404 error with parameter context to help users understand what went wrong.
|
|
16181
|
-
* This is optional - tools can use this when they want to provide extra context.
|
|
16182
|
-
*
|
|
16183
|
-
* @example
|
|
16184
|
-
* ```typescript
|
|
16185
|
-
* try {
|
|
16186
|
-
* const issue = await apiService.getIssue({ organizationSlug, issueId });
|
|
16187
|
-
* } catch (error) {
|
|
16188
|
-
* if (error instanceof ApiNotFoundError) {
|
|
16189
|
-
* throw enhanceNotFoundError(error, { organizationSlug, issueId });
|
|
16190
|
-
* }
|
|
16191
|
-
* throw error;
|
|
16192
|
-
* }
|
|
16193
|
-
* ```
|
|
16194
|
-
*/
|
|
16195
|
-
function enhanceNotFoundError(error, params) {
|
|
16196
|
-
const paramsList = [];
|
|
16197
|
-
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null && value !== "") paramsList.push(`${key}: '${value}'`);
|
|
16198
|
-
if (paramsList.length > 0) {
|
|
16199
|
-
const enhancedMessage = `${error.message}\nPlease verify these parameters are correct:\n${paramsList.map((p) => ` - ${p}`).join("\n")}`;
|
|
16200
|
-
return new ApiNotFoundError(enhancedMessage, error.detail, error.responseBody);
|
|
16201
|
-
}
|
|
16202
|
-
return error;
|
|
16203
|
-
}
|
|
16204
|
-
|
|
16205
|
-
//#endregion
|
|
16206
|
-
//#region ../mcp-core/dist/url-scope-CRM5sNo7.js
|
|
16207
|
-
function resolveScopedOrganizationSlug({ resourceLabel, scopedOrganizationSlug, urlOrganizationSlug }) {
|
|
16208
|
-
if (!scopedOrganizationSlug) return urlOrganizationSlug;
|
|
16209
|
-
if (scopedOrganizationSlug !== urlOrganizationSlug) throw new UserInputError(`${resourceLabel} URL is outside the active organization constraint. Expected organization "${scopedOrganizationSlug}" but got "${urlOrganizationSlug}".`);
|
|
16210
|
-
return scopedOrganizationSlug;
|
|
16211
|
-
}
|
|
16212
|
-
function resolveScopedProjectSlug({ resourceLabel, scopedProjectSlug, urlProjectSlug }) {
|
|
16213
|
-
if (!scopedProjectSlug) return urlProjectSlug;
|
|
16214
|
-
if (scopedProjectSlug !== urlProjectSlug) throw new UserInputError(`${resourceLabel} URL is outside the active project constraint. Expected project "${scopedProjectSlug}" but got "${urlProjectSlug}".`);
|
|
16215
|
-
return scopedProjectSlug;
|
|
16216
|
-
}
|
|
16217
|
-
function assertScopedProjectSlug({ resourceLabel, scopedProjectSlug, actualProjectSlug }) {
|
|
16218
|
-
if (!scopedProjectSlug) return actualProjectSlug;
|
|
16219
|
-
if (scopedProjectSlug !== actualProjectSlug) throw new UserInputError(`${resourceLabel} is outside the active project constraint. Expected project "${scopedProjectSlug}".`);
|
|
16220
|
-
return actualProjectSlug;
|
|
16221
|
-
}
|
|
16222
|
-
function resolveScopedProjectSlugOrId({ resourceLabel, scopedProjectSlugOrId, urlProjectSlug }) {
|
|
16223
|
-
if (scopedProjectSlugOrId == null || typeof scopedProjectSlugOrId === "string" && scopedProjectSlugOrId.trim() === "") return urlProjectSlug;
|
|
16224
|
-
if (typeof scopedProjectSlugOrId === "number" || isNumericId(String(scopedProjectSlugOrId))) return urlProjectSlug;
|
|
16225
|
-
if (scopedProjectSlugOrId !== urlProjectSlug) throw new UserInputError(`${resourceLabel} URL is outside the active project constraint. Expected project "${scopedProjectSlugOrId}" but got "${urlProjectSlug}".`);
|
|
16226
|
-
return scopedProjectSlugOrId;
|
|
16227
|
-
}
|
|
16228
|
-
|
|
16229
|
-
//#endregion
|
|
16230
|
-
//#region ../mcp-core/dist/issue-helpers-0Dnme3Ym.js
|
|
16231
|
-
/**
|
|
16232
|
-
* Extracts the Sentry issue ID and organization slug from a full URL
|
|
16233
|
-
*
|
|
16234
|
-
* @param url - A full Sentry issue URL
|
|
16235
|
-
* @returns Object containing the numeric issue ID and organization slug (if found)
|
|
16236
|
-
* @throws Error if the input is invalid
|
|
16237
|
-
*/
|
|
16238
|
-
function extractIssueId(url) {
|
|
16239
|
-
if (!url || typeof url !== "string") throw new UserInputError("Invalid Sentry issue URL. URL must be a non-empty string.");
|
|
16240
|
-
if (!url.startsWith("http://") && !url.startsWith("https://")) throw new UserInputError("Invalid Sentry issue URL. Must start with http:// or https://");
|
|
16241
|
-
let parsedUrl;
|
|
16242
|
-
try {
|
|
16243
|
-
parsedUrl = new URL(url);
|
|
16244
|
-
} catch (error) {
|
|
16245
|
-
throw new UserInputError(`Invalid Sentry issue URL. Unable to parse URL: ${url}`);
|
|
16246
|
-
}
|
|
16247
|
-
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
16248
|
-
if (pathParts.length < 2 || !pathParts.includes("issues")) throw new UserInputError("Invalid Sentry issue URL. Path must contain '/issues/{issue_id}'");
|
|
16249
|
-
const issueId = pathParts[pathParts.indexOf("issues") + 1];
|
|
16250
|
-
if (!issueId) throw new UserInputError("Unable to determine issue ID from URL.");
|
|
16251
|
-
let organizationSlug;
|
|
16252
|
-
if (pathParts.includes("organizations")) organizationSlug = pathParts[pathParts.indexOf("organizations") + 1];
|
|
16253
|
-
else if (pathParts.length > 1 && pathParts[0] !== "issues") organizationSlug = pathParts[0];
|
|
16254
|
-
else {
|
|
16255
|
-
const hostParts = parsedUrl.hostname.split(".");
|
|
16256
|
-
if (hostParts.length > 2 && hostParts[0] !== "www") organizationSlug = hostParts[0];
|
|
16257
|
-
}
|
|
16258
|
-
if (!organizationSlug) throw new UserInputError("Invalid Sentry issue URL. Could not determine organization.");
|
|
16259
|
-
return {
|
|
16260
|
-
issueId,
|
|
16261
|
-
organizationSlug
|
|
16262
|
-
};
|
|
16263
|
-
}
|
|
16264
|
-
/**
|
|
16265
|
-
* Sometimes the LLM will pass in a funky issue shortId. For example it might pass
|
|
16266
|
-
* in "CLOUDFLARE-MCP-41." instead of "CLOUDFLARE-MCP-41". This function attempts to
|
|
16267
|
-
* fix common issues.
|
|
16268
|
-
*
|
|
16269
|
-
* @param issueId - The issue ID to parse
|
|
16270
|
-
* @returns The parsed issue ID
|
|
16271
|
-
*/
|
|
16272
|
-
function parseIssueId(issueId) {
|
|
16273
|
-
if (!issueId.trim()) throw new UserInputError("Issue ID cannot be empty");
|
|
16274
|
-
let finalIssueId = issueId;
|
|
16275
|
-
finalIssueId = finalIssueId.replace(/[^\w-]/g, "");
|
|
16276
|
-
if (!finalIssueId) throw new UserInputError("Issue ID cannot be empty after removing special characters");
|
|
16277
|
-
const validFormatRegex = /^(\d+|[A-Za-z0-9][\w-]*-[A-Za-z0-9]+)$/;
|
|
16278
|
-
if (!validFormatRegex.test(finalIssueId)) throw new UserInputError(`Invalid issue ID format: "${finalIssueId}". Expected either a numeric ID or a project code followed by an alphanumeric identifier (e.g., "PROJECT-ABC123").`);
|
|
16279
|
-
return finalIssueId;
|
|
16280
|
-
}
|
|
16281
|
-
/**
|
|
16282
|
-
* Parses issue parameters from a variety of formats.
|
|
16283
|
-
*
|
|
16284
|
-
* @param params - Object containing issue URL, issue ID, and organization slug
|
|
16285
|
-
* @returns Object containing the parsed organization slug and issue ID
|
|
16286
|
-
* @throws Error if the input is invalid
|
|
16287
|
-
*/
|
|
16288
|
-
function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
|
|
16289
|
-
if (issueUrl) {
|
|
16290
|
-
const resolved = extractIssueId(issueUrl);
|
|
16291
|
-
if (!resolved) throw new Error("Invalid Sentry issue URL. Path should contain '/issues/{issue_id}'");
|
|
16292
|
-
return {
|
|
16293
|
-
organizationSlug: resolveScopedOrganizationSlug({
|
|
16294
|
-
resourceLabel: "Issue",
|
|
16295
|
-
scopedOrganizationSlug: organizationSlug,
|
|
16296
|
-
urlOrganizationSlug: resolved.organizationSlug
|
|
16297
|
-
}),
|
|
16298
|
-
issueId: parseIssueId(resolved.issueId)
|
|
16299
|
-
};
|
|
16300
|
-
}
|
|
16301
|
-
if (!organizationSlug) throw new UserInputError("Organization slug is required");
|
|
16302
|
-
if (issueId) return {
|
|
16303
|
-
organizationSlug,
|
|
16304
|
-
issueId: parseIssueId(issueId)
|
|
16305
|
-
};
|
|
16306
|
-
throw new UserInputError("Either issueId or issueUrl must be provided");
|
|
16307
|
-
}
|
|
16308
|
-
|
|
16309
|
-
//#endregion
|
|
16310
|
-
//#region ../mcp-core/dist/code-location-DW_YNpMG.js
|
|
16311
|
-
/** Formats a verified source location for the issue-details response. */
|
|
16312
|
-
function formatCodeLocation(codeLocation) {
|
|
16313
|
-
const output = ["## Code Location", ""];
|
|
16314
|
-
if (codeLocation.repository) output.push(`**Repository**: ${codeLocation.repository}`);
|
|
16315
|
-
if (codeLocation.path) output.push(`**Path**: ${codeLocation.path}`);
|
|
16316
|
-
if (codeLocation.line !== void 0) output.push(`**Line**: ${codeLocation.line}`);
|
|
16317
|
-
output.push(`**Source**: ${codeLocation.url}`, "");
|
|
16318
|
-
return `${output.join("\n")}\n`;
|
|
16319
|
-
}
|
|
16320
|
-
/** Selects Sentry's most relevant application frame: the last in-app frame. */
|
|
16321
|
-
function findMostRelevantInAppFrame(frames) {
|
|
16322
|
-
return frames.findLast((frame) => frame.inApp === true);
|
|
16323
|
-
}
|
|
16324
|
-
|
|
16325
|
-
//#endregion
|
|
16326
|
-
//#region ../mcp-core/dist/seer-BoTKAK7k.js
|
|
16830
|
+
//#region ../mcp-core/dist/seer-DqLgmvV9.js
|
|
16327
16831
|
const SEER_POLLING_INTERVAL = 5e3;
|
|
16328
16832
|
const SEER_TIMEOUT = 5 * 60 * 1e3;
|
|
16329
16833
|
const SEER_MAX_RETRIES = 3;
|
|
@@ -16388,6 +16892,19 @@ function wrapSeerAnalysisOutput({ output, runId, step, includeProvenanceTags })
|
|
|
16388
16892
|
const attrs = [runId === void 0 ? null : `run_id="${escapeXmlAttribute(runId)}"`, `step="${escapeXmlAttribute(step)}"`].filter(Boolean);
|
|
16389
16893
|
return `<seer_analysis ${attrs.join(" ")}>\n${output.trimEnd()}\n</seer_analysis>\n`;
|
|
16390
16894
|
}
|
|
16895
|
+
/**
|
|
16896
|
+
* Wraps shared-formatter Seer analysis content in the provenance boundary,
|
|
16897
|
+
* mirroring the tags getOutputForAutofixRun applies to MCP-rendered output.
|
|
16898
|
+
* Seer content is LLM-generated, so it must be marked as untrusted data.
|
|
16899
|
+
*/
|
|
16900
|
+
function wrapSeerContent(content, runId) {
|
|
16901
|
+
return wrapSeerAnalysisOutput({
|
|
16902
|
+
output: content,
|
|
16903
|
+
runId,
|
|
16904
|
+
step: "analysis",
|
|
16905
|
+
includeProvenanceTags: true
|
|
16906
|
+
});
|
|
16907
|
+
}
|
|
16391
16908
|
const RootCauseArtifactDataSchema = zod.z.object({
|
|
16392
16909
|
one_line_description: zod.z.string().optional(),
|
|
16393
16910
|
five_whys: zod.z.array(zod.z.string()).default([]),
|
|
@@ -16488,7 +17005,7 @@ function getActiveAutofixTodo(autofix) {
|
|
|
16488
17005
|
}
|
|
16489
17006
|
|
|
16490
17007
|
//#endregion
|
|
16491
|
-
//#region ../mcp-core/dist/user-formatting-
|
|
17008
|
+
//#region ../mcp-core/dist/user-formatting-CTX3nhjo.js
|
|
16492
17009
|
function formatUserGeoSummary(value) {
|
|
16493
17010
|
if (!isPlainObject$3(value)) return null;
|
|
16494
17011
|
const parts = [
|
|
@@ -16502,7 +17019,7 @@ function formatUserGeoSummary(value) {
|
|
|
16502
17019
|
}
|
|
16503
17020
|
|
|
16504
17021
|
//#endregion
|
|
16505
|
-
//#region ../mcp-core/dist/formatting-
|
|
17022
|
+
//#region ../mcp-core/dist/formatting-31tlKXsb.js
|
|
16506
17023
|
/**
|
|
16507
17024
|
* Convert Seer fixability score to actionability label.
|
|
16508
17025
|
* Thresholds match Sentry core: src/sentry/seer/autofix/constants.py
|
|
@@ -16596,6 +17113,29 @@ function formatFrameHeader(frame, frameIndex, platform) {
|
|
|
16596
17113
|
}
|
|
16597
17114
|
}
|
|
16598
17115
|
/**
|
|
17116
|
+
* Whether the shared formatter covers this event type, and so whether its body should be used
|
|
17117
|
+
* instead of the local rendering.
|
|
17118
|
+
*
|
|
17119
|
+
* "default" is an error event without exception data, "generic" a performance regression or
|
|
17120
|
+
* metric issue, "csp" a Content Security Policy violation. Anything else (a transaction, most
|
|
17121
|
+
* notably) keeps the local path, which renders things the shared body does not carry such as
|
|
17122
|
+
* the fetched performance trace.
|
|
17123
|
+
*/
|
|
17124
|
+
/**
|
|
17125
|
+
* Whether to read the issue's metadata instead of its top level fields. Performance issues can
|
|
17126
|
+
* have various categories such as 'db_query', but the issueType starts with 'performance_'.
|
|
17127
|
+
*
|
|
17128
|
+
* It matters which side of this an issue falls on: metadata.value is a query pattern for a
|
|
17129
|
+
* performance issue and the exception message for an error, so reading it unconditionally
|
|
17130
|
+
* misnames the error text.
|
|
17131
|
+
*/
|
|
17132
|
+
function isPerformanceIssueType(issue) {
|
|
17133
|
+
return issue.issueType?.startsWith("performance_") === true || issue.issueCategory === "performance";
|
|
17134
|
+
}
|
|
17135
|
+
function usesSharedFormatterBody(event) {
|
|
17136
|
+
return event.type === "error" || event.type === "default" || event.type === "generic" || event.type === "csp";
|
|
17137
|
+
}
|
|
17138
|
+
/**
|
|
16599
17139
|
* Formats a Sentry event into a structured markdown output.
|
|
16600
17140
|
* Includes error messages, stack traces, request info, and contextual data.
|
|
16601
17141
|
*
|
|
@@ -17537,14 +18077,17 @@ function formatSeerSummary(autofixState) {
|
|
|
17537
18077
|
parts.push(`**Status:** ${getStatusDisplayName(autofix.status)}`);
|
|
17538
18078
|
parts.push("");
|
|
17539
18079
|
}
|
|
17540
|
-
|
|
17541
|
-
|
|
17542
|
-
|
|
17543
|
-
|
|
17544
|
-
|
|
17545
|
-
|
|
17546
|
-
|
|
17547
|
-
|
|
18080
|
+
if (autofixState.formatted?.content) parts.push(wrapSeerContent(autofixState.formatted.content, autofix.run_id));
|
|
18081
|
+
else {
|
|
18082
|
+
const { rootCause, solution } = getAutofixArtifactSummaries(autofix);
|
|
18083
|
+
if (solution) {
|
|
18084
|
+
parts.push("**Summary:**");
|
|
18085
|
+
parts.push(solution);
|
|
18086
|
+
} else if (rootCause) {
|
|
18087
|
+
parts.push("**Root Cause Identified:**");
|
|
18088
|
+
parts.push(rootCause);
|
|
18089
|
+
} else if (!isTerminalStatus(autofix.status)) parts.push("Analysis has started but no results yet.");
|
|
18090
|
+
}
|
|
17548
18091
|
if (autofix.status === "error") {
|
|
17549
18092
|
parts.push("");
|
|
17550
18093
|
parts.push("**Status:** Analysis failed.");
|
|
@@ -17563,7 +18106,7 @@ function formatSeerSummary(autofixState) {
|
|
|
17563
18106
|
*/
|
|
17564
18107
|
function formatIssueOutput({ organizationSlug, issue, event, apiService, autofixState, performanceTrace, externalIssues, relatedReplayIds, aiConversations, codeLocation, experimentalMode, availableToolNames, directToolNames }) {
|
|
17565
18108
|
let output = `# Issue ${issue.shortId} in **${organizationSlug}**\n\n`;
|
|
17566
|
-
const isPerformanceIssue = issue
|
|
18109
|
+
const isPerformanceIssue = isPerformanceIssueType(issue);
|
|
17567
18110
|
if (isPerformanceIssue && issue.metadata) {
|
|
17568
18111
|
const issueTitle = issue.metadata.title || issue.title;
|
|
17569
18112
|
output += `**Description**: ${issueTitle}\n`;
|
|
@@ -17626,13 +18169,26 @@ function formatIssueOutput({ organizationSlug, issue, event, apiService, autofix
|
|
|
17626
18169
|
}
|
|
17627
18170
|
output += `**Event ID**: ${event.id}\n`;
|
|
17628
18171
|
output += `**Type**: ${event.type}\n`;
|
|
17629
|
-
|
|
18172
|
+
const isSharedFormatterType = usesSharedFormatterBody(event);
|
|
18173
|
+
if (isSharedFormatterType) {
|
|
17630
18174
|
const typedEvent = event;
|
|
17631
18175
|
if (typedEvent.dateCreated) output += `**Occurred At**: ${new Date(typedEvent.dateCreated).toISOString()}\n`;
|
|
17632
18176
|
}
|
|
17633
18177
|
if (event.message) output += `**Message**:\n${event.message}\n`;
|
|
17634
18178
|
output += "\n";
|
|
17635
|
-
|
|
18179
|
+
if (isSharedFormatterType && event.formatted?.format === "markdown" && event.formatted.content) {
|
|
18180
|
+
output += formatIssueReplayOutput({
|
|
18181
|
+
apiService,
|
|
18182
|
+
organizationSlug,
|
|
18183
|
+
event,
|
|
18184
|
+
relatedReplayIds,
|
|
18185
|
+
experimentalMode: experimentalMode ?? false,
|
|
18186
|
+
availableToolNames,
|
|
18187
|
+
directToolNames
|
|
18188
|
+
});
|
|
18189
|
+
const formattedContent = event.formatted.content;
|
|
18190
|
+
output += formattedContent.endsWith("\n") ? formattedContent : `${formattedContent}\n`;
|
|
18191
|
+
} else output += formatEventOutput(event, {
|
|
17636
18192
|
performanceTrace,
|
|
17637
18193
|
replaySummary: {
|
|
17638
18194
|
apiService,
|
|
@@ -17850,7 +18406,111 @@ function stripReplayMetadata(event) {
|
|
|
17850
18406
|
}
|
|
17851
18407
|
|
|
17852
18408
|
//#endregion
|
|
17853
|
-
//#region ../mcp-core/dist/
|
|
18409
|
+
//#region ../mcp-core/dist/url-scope-V6MOdP9h.js
|
|
18410
|
+
function resolveScopedOrganizationSlug({ resourceLabel, scopedOrganizationSlug, urlOrganizationSlug }) {
|
|
18411
|
+
if (!scopedOrganizationSlug) return urlOrganizationSlug;
|
|
18412
|
+
if (scopedOrganizationSlug !== urlOrganizationSlug) throw new UserInputError(`${resourceLabel} URL is outside the active organization constraint. Expected organization "${scopedOrganizationSlug}" but got "${urlOrganizationSlug}".`);
|
|
18413
|
+
return scopedOrganizationSlug;
|
|
18414
|
+
}
|
|
18415
|
+
function resolveScopedProjectSlug({ resourceLabel, scopedProjectSlug, urlProjectSlug }) {
|
|
18416
|
+
if (!scopedProjectSlug) return urlProjectSlug;
|
|
18417
|
+
if (scopedProjectSlug !== urlProjectSlug) throw new UserInputError(`${resourceLabel} URL is outside the active project constraint. Expected project "${scopedProjectSlug}" but got "${urlProjectSlug}".`);
|
|
18418
|
+
return scopedProjectSlug;
|
|
18419
|
+
}
|
|
18420
|
+
function assertScopedProjectSlug({ resourceLabel, scopedProjectSlug, actualProjectSlug }) {
|
|
18421
|
+
if (!scopedProjectSlug) return actualProjectSlug;
|
|
18422
|
+
if (scopedProjectSlug !== actualProjectSlug) throw new UserInputError(`${resourceLabel} is outside the active project constraint. Expected project "${scopedProjectSlug}".`);
|
|
18423
|
+
return actualProjectSlug;
|
|
18424
|
+
}
|
|
18425
|
+
function resolveScopedProjectSlugOrId({ resourceLabel, scopedProjectSlugOrId, urlProjectSlug }) {
|
|
18426
|
+
if (scopedProjectSlugOrId == null || typeof scopedProjectSlugOrId === "string" && scopedProjectSlugOrId.trim() === "") return urlProjectSlug;
|
|
18427
|
+
if (typeof scopedProjectSlugOrId === "number" || isNumericId(String(scopedProjectSlugOrId))) return urlProjectSlug;
|
|
18428
|
+
if (scopedProjectSlugOrId !== urlProjectSlug) throw new UserInputError(`${resourceLabel} URL is outside the active project constraint. Expected project "${scopedProjectSlugOrId}" but got "${urlProjectSlug}".`);
|
|
18429
|
+
return scopedProjectSlugOrId;
|
|
18430
|
+
}
|
|
18431
|
+
|
|
18432
|
+
//#endregion
|
|
18433
|
+
//#region ../mcp-core/dist/issue-helpers-qGxiGeE5.js
|
|
18434
|
+
/**
|
|
18435
|
+
* Extracts the Sentry issue ID and organization slug from a full URL
|
|
18436
|
+
*
|
|
18437
|
+
* @param url - A full Sentry issue URL
|
|
18438
|
+
* @returns Object containing the numeric issue ID and organization slug (if found)
|
|
18439
|
+
* @throws Error if the input is invalid
|
|
18440
|
+
*/
|
|
18441
|
+
function extractIssueId(url) {
|
|
18442
|
+
if (!url || typeof url !== "string") throw new UserInputError("Invalid Sentry issue URL. URL must be a non-empty string.");
|
|
18443
|
+
if (!url.startsWith("http://") && !url.startsWith("https://")) throw new UserInputError("Invalid Sentry issue URL. Must start with http:// or https://");
|
|
18444
|
+
let parsedUrl;
|
|
18445
|
+
try {
|
|
18446
|
+
parsedUrl = new URL(url);
|
|
18447
|
+
} catch (error) {
|
|
18448
|
+
throw new UserInputError(`Invalid Sentry issue URL. Unable to parse URL: ${url}`);
|
|
18449
|
+
}
|
|
18450
|
+
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
18451
|
+
if (pathParts.length < 2 || !pathParts.includes("issues")) throw new UserInputError("Invalid Sentry issue URL. Path must contain '/issues/{issue_id}'");
|
|
18452
|
+
const issueId = pathParts[pathParts.indexOf("issues") + 1];
|
|
18453
|
+
if (!issueId) throw new UserInputError("Unable to determine issue ID from URL.");
|
|
18454
|
+
let organizationSlug;
|
|
18455
|
+
if (pathParts.includes("organizations")) organizationSlug = pathParts[pathParts.indexOf("organizations") + 1];
|
|
18456
|
+
else if (pathParts.length > 1 && pathParts[0] !== "issues") organizationSlug = pathParts[0];
|
|
18457
|
+
else {
|
|
18458
|
+
const hostParts = parsedUrl.hostname.split(".");
|
|
18459
|
+
if (hostParts.length > 2 && hostParts[0] !== "www") organizationSlug = hostParts[0];
|
|
18460
|
+
}
|
|
18461
|
+
if (!organizationSlug) throw new UserInputError("Invalid Sentry issue URL. Could not determine organization.");
|
|
18462
|
+
return {
|
|
18463
|
+
issueId,
|
|
18464
|
+
organizationSlug
|
|
18465
|
+
};
|
|
18466
|
+
}
|
|
18467
|
+
/**
|
|
18468
|
+
* Sometimes the LLM will pass in a funky issue shortId. For example it might pass
|
|
18469
|
+
* in "CLOUDFLARE-MCP-41." instead of "CLOUDFLARE-MCP-41". This function attempts to
|
|
18470
|
+
* fix common issues.
|
|
18471
|
+
*
|
|
18472
|
+
* @param issueId - The issue ID to parse
|
|
18473
|
+
* @returns The parsed issue ID
|
|
18474
|
+
*/
|
|
18475
|
+
function parseIssueId(issueId) {
|
|
18476
|
+
if (!issueId.trim()) throw new UserInputError("Issue ID cannot be empty");
|
|
18477
|
+
let finalIssueId = issueId;
|
|
18478
|
+
finalIssueId = finalIssueId.replace(/[^\w-]/g, "");
|
|
18479
|
+
if (!finalIssueId) throw new UserInputError("Issue ID cannot be empty after removing special characters");
|
|
18480
|
+
const validFormatRegex = /^(\d+|[A-Za-z0-9][\w-]*-[A-Za-z0-9]+)$/;
|
|
18481
|
+
if (!validFormatRegex.test(finalIssueId)) throw new UserInputError(`Invalid issue ID format: "${finalIssueId}". Expected either a numeric ID or a project code followed by an alphanumeric identifier (e.g., "PROJECT-ABC123").`);
|
|
18482
|
+
return finalIssueId;
|
|
18483
|
+
}
|
|
18484
|
+
/**
|
|
18485
|
+
* Parses issue parameters from a variety of formats.
|
|
18486
|
+
*
|
|
18487
|
+
* @param params - Object containing issue URL, issue ID, and organization slug
|
|
18488
|
+
* @returns Object containing the parsed organization slug and issue ID
|
|
18489
|
+
* @throws Error if the input is invalid
|
|
18490
|
+
*/
|
|
18491
|
+
function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
|
|
18492
|
+
if (issueUrl) {
|
|
18493
|
+
const resolved = extractIssueId(issueUrl);
|
|
18494
|
+
if (!resolved) throw new Error("Invalid Sentry issue URL. Path should contain '/issues/{issue_id}'");
|
|
18495
|
+
return {
|
|
18496
|
+
organizationSlug: resolveScopedOrganizationSlug({
|
|
18497
|
+
resourceLabel: "Issue",
|
|
18498
|
+
scopedOrganizationSlug: organizationSlug,
|
|
18499
|
+
urlOrganizationSlug: resolved.organizationSlug
|
|
18500
|
+
}),
|
|
18501
|
+
issueId: parseIssueId(resolved.issueId)
|
|
18502
|
+
};
|
|
18503
|
+
}
|
|
18504
|
+
if (!organizationSlug) throw new UserInputError("Organization slug is required");
|
|
18505
|
+
if (issueId) return {
|
|
18506
|
+
organizationSlug,
|
|
18507
|
+
issueId: parseIssueId(issueId)
|
|
18508
|
+
};
|
|
18509
|
+
throw new UserInputError("Either issueId or issueUrl must be provided");
|
|
18510
|
+
}
|
|
18511
|
+
|
|
18512
|
+
//#endregion
|
|
18513
|
+
//#region ../mcp-core/dist/issue-y4HGWyCn.js
|
|
17854
18514
|
function assertIssueWithinProjectConstraint({ issue, projectSlug: projectSlug$1, resourceLabel = "Issue" }) {
|
|
17855
18515
|
assertScopedProjectSlug({
|
|
17856
18516
|
resourceLabel,
|
|
@@ -17872,7 +18532,7 @@ async function ensureIssueWithinProjectConstraint({ apiService, organizationSlug
|
|
|
17872
18532
|
}
|
|
17873
18533
|
|
|
17874
18534
|
//#endregion
|
|
17875
|
-
//#region ../mcp-core/dist/code-location-
|
|
18535
|
+
//#region ../mcp-core/dist/code-location-Dh_XFzfu.js
|
|
17876
18536
|
const CODE_LOCATION_TIMEOUT_MS = 3e3;
|
|
17877
18537
|
/** Resolves a verified source location, omitting optional enrichment failures. */
|
|
17878
18538
|
async function resolveCodeLocation({ apiService, organizationSlug, projectSlug: projectSlug$1, event }) {
|
|
@@ -17975,10 +18635,174 @@ function getString$1(value) {
|
|
|
17975
18635
|
}
|
|
17976
18636
|
|
|
17977
18637
|
//#endregion
|
|
17978
|
-
//#region ../mcp-core/dist/get-issue-details-
|
|
18638
|
+
//#region ../mcp-core/dist/get-issue-details-t289hNuc.js
|
|
18639
|
+
const MAX_RELATED_REPLAYS = 5;
|
|
17979
18640
|
const MAX_AI_CONVERSATION_MATCHES = 3;
|
|
17980
18641
|
const AI_CONVERSATION_LOOKUP_WINDOW_MS = 24 * 60 * 60 * 1e3;
|
|
17981
18642
|
const TRACE_ID_PATTERN = /^[0-9a-fA-F]{32}$/;
|
|
18643
|
+
/**
|
|
18644
|
+
* The issue payload as `structuredContent`.
|
|
18645
|
+
*
|
|
18646
|
+
* Every field is mapped explicitly rather than spread from an api response, so a passthrough
|
|
18647
|
+
* upstream schema cannot leak backend-only fields into the public interface.
|
|
18648
|
+
*
|
|
18649
|
+
* `event.body` is the one open record: it is whatever Sentry's shared formatter emits
|
|
18650
|
+
* for `?llmFormat=json`, and its sections are decided there. Enumerating them here would make
|
|
18651
|
+
* this schema a second declaration of that contract, needing a bump every time a section is
|
|
18652
|
+
* added on the Sentry side.
|
|
18653
|
+
*/
|
|
18654
|
+
const getIssueDetailsOutputSchema = zod.z.object({
|
|
18655
|
+
issue: zod.z.object({
|
|
18656
|
+
shortId: zod.z.string(),
|
|
18657
|
+
title: zod.z.string(),
|
|
18658
|
+
culprit: zod.z.string().nullish(),
|
|
18659
|
+
firstSeen: zod.z.string().nullish(),
|
|
18660
|
+
lastSeen: zod.z.string().nullish(),
|
|
18661
|
+
occurrences: zod.z.number().nullish(),
|
|
18662
|
+
usersImpacted: zod.z.number().nullish(),
|
|
18663
|
+
status: zod.z.string().nullish(),
|
|
18664
|
+
substatus: zod.z.string().nullish(),
|
|
18665
|
+
assignedTo: zod.z.string().nullish(),
|
|
18666
|
+
issueType: zod.z.string().nullish(),
|
|
18667
|
+
issueCategory: zod.z.string().nullish(),
|
|
18668
|
+
seerActionability: zod.z.string().nullish(),
|
|
18669
|
+
platform: zod.z.string().nullish(),
|
|
18670
|
+
project: zod.z.string().nullish(),
|
|
18671
|
+
url: zod.z.string(),
|
|
18672
|
+
location: zod.z.string().nullish(),
|
|
18673
|
+
queryPattern: zod.z.string().nullish()
|
|
18674
|
+
}),
|
|
18675
|
+
event: zod.z.object({
|
|
18676
|
+
id: zod.z.string(),
|
|
18677
|
+
type: zod.z.string().nullish(),
|
|
18678
|
+
occurredAt: zod.z.string().nullish(),
|
|
18679
|
+
body: zod.z.record(zod.z.string(), zod.z.unknown())
|
|
18680
|
+
}),
|
|
18681
|
+
seer: zod.z.object({
|
|
18682
|
+
status: zod.z.string().nullish(),
|
|
18683
|
+
rootCause: zod.z.string().nullish(),
|
|
18684
|
+
solution: zod.z.string().nullish()
|
|
18685
|
+
}).nullish(),
|
|
18686
|
+
codeLocation: zod.z.object({
|
|
18687
|
+
repository: zod.z.string().nullish(),
|
|
18688
|
+
path: zod.z.string().nullish(),
|
|
18689
|
+
line: zod.z.number().nullish(),
|
|
18690
|
+
url: zod.z.string()
|
|
18691
|
+
}).nullish(),
|
|
18692
|
+
replays: zod.z.object({
|
|
18693
|
+
attached: zod.z.string().nullish(),
|
|
18694
|
+
related: zod.z.array(zod.z.string()),
|
|
18695
|
+
relatedCount: zod.z.number()
|
|
18696
|
+
}).nullish(),
|
|
18697
|
+
externalIssues: zod.z.array(zod.z.object({
|
|
18698
|
+
id: zod.z.string(),
|
|
18699
|
+
issueId: zod.z.string(),
|
|
18700
|
+
serviceType: zod.z.string(),
|
|
18701
|
+
displayName: zod.z.string(),
|
|
18702
|
+
webUrl: zod.z.string()
|
|
18703
|
+
})).nullish(),
|
|
18704
|
+
aiConversations: zod.z.array(zod.z.object({
|
|
18705
|
+
conversationId: zod.z.string(),
|
|
18706
|
+
spanId: zod.z.string().nullish()
|
|
18707
|
+
})).nullish()
|
|
18708
|
+
});
|
|
18709
|
+
/**
|
|
18710
|
+
* Parses the shared formatter's json body. Returns undefined when the caller's org is not on
|
|
18711
|
+
* the rollout yet, which is the signal to keep returning markdown: a structured result has to
|
|
18712
|
+
* carry the whole answer, and without the body it would not.
|
|
18713
|
+
*/
|
|
18714
|
+
function parseFormattedBody(event) {
|
|
18715
|
+
if (!usesSharedFormatterBody(event)) return void 0;
|
|
18716
|
+
const content = event.formatted?.content;
|
|
18717
|
+
if (!content) return void 0;
|
|
18718
|
+
try {
|
|
18719
|
+
const parsed = JSON.parse(content);
|
|
18720
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : void 0;
|
|
18721
|
+
} catch {
|
|
18722
|
+
return void 0;
|
|
18723
|
+
}
|
|
18724
|
+
}
|
|
18725
|
+
/**
|
|
18726
|
+
* The attached replay plus the related ones, derived the way the markdown output derives them.
|
|
18727
|
+
* The attached id lives on the event rather than in the related list, so passing that list
|
|
18728
|
+
* through alone loses the replay for an issue whose only one is attached.
|
|
18729
|
+
*/
|
|
18730
|
+
/**
|
|
18731
|
+
* ``dateCreated`` sits on the shared-formatter event types rather than the base union, and
|
|
18732
|
+
* the markdown path normalizes it to ISO. Read it the same way and tolerate a bad value.
|
|
18733
|
+
*/
|
|
18734
|
+
function eventOccurredAt(event) {
|
|
18735
|
+
const raw = "dateCreated" in event ? event.dateCreated : null;
|
|
18736
|
+
if (typeof raw !== "string") return null;
|
|
18737
|
+
const parsed = new Date(raw);
|
|
18738
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString();
|
|
18739
|
+
}
|
|
18740
|
+
function buildReplays(event, relatedReplayIds) {
|
|
18741
|
+
const attached = getReplayIdFromEvent(event);
|
|
18742
|
+
const related = dedupeReplayIds(relatedReplayIds ?? []).filter((replayId) => replayId !== attached);
|
|
18743
|
+
if (!attached && related.length === 0) return null;
|
|
18744
|
+
return {
|
|
18745
|
+
attached,
|
|
18746
|
+
related: related.slice(0, MAX_RELATED_REPLAYS),
|
|
18747
|
+
relatedCount: related.length
|
|
18748
|
+
};
|
|
18749
|
+
}
|
|
18750
|
+
function buildIssueDetailsPayload({ organizationSlug, issue, event, body, apiService, autofixState, externalIssues, relatedReplayIds, aiConversations, codeLocation }) {
|
|
18751
|
+
const autofix = autofixState?.autofix;
|
|
18752
|
+
const summaries = autofix ? getAutofixArtifactSummaries(autofix) : void 0;
|
|
18753
|
+
const isPerf = isPerformanceIssueType(issue) && !!issue.metadata;
|
|
18754
|
+
return {
|
|
18755
|
+
issue: {
|
|
18756
|
+
shortId: issue.shortId,
|
|
18757
|
+
title: (isPerf ? issue.metadata?.title : null) || issue.title,
|
|
18758
|
+
culprit: issue.culprit,
|
|
18759
|
+
firstSeen: issue.firstSeen,
|
|
18760
|
+
lastSeen: issue.lastSeen,
|
|
18761
|
+
occurrences: issue.count == null ? null : Number(issue.count),
|
|
18762
|
+
usersImpacted: issue.userCount == null ? null : Number(issue.userCount),
|
|
18763
|
+
status: issue.status,
|
|
18764
|
+
substatus: issue.substatus,
|
|
18765
|
+
assignedTo: typeof issue.assignedTo === "string" ? issue.assignedTo : issue.assignedTo?.name,
|
|
18766
|
+
issueType: issue.issueType,
|
|
18767
|
+
issueCategory: issue.issueCategory,
|
|
18768
|
+
seerActionability: issue.seerFixabilityScore == null ? null : getSeerActionabilityLabel(issue.seerFixabilityScore),
|
|
18769
|
+
platform: issue.platform,
|
|
18770
|
+
project: issue.project?.name,
|
|
18771
|
+
url: apiService.getIssueUrl(organizationSlug, issue.shortId),
|
|
18772
|
+
location: isPerf ? issue.metadata?.location : null,
|
|
18773
|
+
queryPattern: isPerf ? issue.metadata?.value : null
|
|
18774
|
+
},
|
|
18775
|
+
event: {
|
|
18776
|
+
id: event.id,
|
|
18777
|
+
type: typeof event.type === "string" ? event.type : null,
|
|
18778
|
+
occurredAt: eventOccurredAt(event),
|
|
18779
|
+
body
|
|
18780
|
+
},
|
|
18781
|
+
seer: autofix ? {
|
|
18782
|
+
status: getStatusDisplayName(autofix.status),
|
|
18783
|
+
rootCause: summaries?.rootCause,
|
|
18784
|
+
solution: summaries?.solution
|
|
18785
|
+
} : null,
|
|
18786
|
+
codeLocation: codeLocation ? {
|
|
18787
|
+
repository: codeLocation.repository,
|
|
18788
|
+
path: codeLocation.path,
|
|
18789
|
+
line: codeLocation.line,
|
|
18790
|
+
url: codeLocation.url
|
|
18791
|
+
} : null,
|
|
18792
|
+
replays: buildReplays(event, relatedReplayIds),
|
|
18793
|
+
externalIssues: externalIssues?.length ? externalIssues.map((issue$1) => ({
|
|
18794
|
+
id: String(issue$1.id),
|
|
18795
|
+
issueId: String(issue$1.issueId),
|
|
18796
|
+
serviceType: issue$1.serviceType,
|
|
18797
|
+
displayName: issue$1.displayName,
|
|
18798
|
+
webUrl: issue$1.webUrl
|
|
18799
|
+
})) : null,
|
|
18800
|
+
aiConversations: aiConversations?.length ? aiConversations.map((conversation) => ({
|
|
18801
|
+
conversationId: conversation.conversationId,
|
|
18802
|
+
spanId: conversation.spanId
|
|
18803
|
+
})) : null
|
|
18804
|
+
};
|
|
18805
|
+
}
|
|
17982
18806
|
var get_issue_details_default = defineTool({
|
|
17983
18807
|
name: "get_issue_details",
|
|
17984
18808
|
skills: [
|
|
@@ -18045,7 +18869,7 @@ var get_issue_details_default = defineTool({
|
|
|
18045
18869
|
const orgSlug$1 = params.organizationSlug;
|
|
18046
18870
|
const eventId = params.eventId;
|
|
18047
18871
|
if (!orgSlug$1) throw new UserInputError("`organizationSlug` is required when providing `eventId`");
|
|
18048
|
-
(
|
|
18872
|
+
setOrganizationContext(orgSlug$1);
|
|
18049
18873
|
let issue$1;
|
|
18050
18874
|
if (params.issueId) issue$1 = await apiService.getIssue({
|
|
18051
18875
|
organizationSlug: orgSlug$1,
|
|
@@ -18056,7 +18880,7 @@ var get_issue_details_default = defineTool({
|
|
|
18056
18880
|
organizationSlug: orgSlug$1,
|
|
18057
18881
|
query: eventId
|
|
18058
18882
|
});
|
|
18059
|
-
if (!found)
|
|
18883
|
+
if (!found) throw new UserInputError(`No issue found for Event ID: ${eventId}`);
|
|
18060
18884
|
issue$1 = found;
|
|
18061
18885
|
}
|
|
18062
18886
|
assertIssueWithinProjectConstraint({
|
|
@@ -18065,12 +18889,12 @@ var get_issue_details_default = defineTool({
|
|
|
18065
18889
|
});
|
|
18066
18890
|
const [{ event: event$1, performanceTrace: performanceTrace$1, aiConversations: aiConversations$1, codeLocation: codeLocation$1 }, { autofixState: autofixState$1, externalIssues: externalIssues$1, relatedReplayIds: relatedReplayIds$1 }] = await Promise.all([apiService.getEventForIssue({
|
|
18067
18891
|
organizationSlug: orgSlug$1,
|
|
18068
|
-
issueId: issue$1.
|
|
18892
|
+
issueId: String(issue$1.id),
|
|
18069
18893
|
eventId
|
|
18070
18894
|
}).catch((error) => {
|
|
18071
18895
|
if (error instanceof ApiNotFoundError) throw enhanceNotFoundError(error, {
|
|
18072
18896
|
organizationSlug: orgSlug$1,
|
|
18073
|
-
issueId: issue$1.
|
|
18897
|
+
issueId: String(issue$1.id),
|
|
18074
18898
|
eventId
|
|
18075
18899
|
});
|
|
18076
18900
|
throw error;
|
|
@@ -18088,25 +18912,31 @@ var get_issue_details_default = defineTool({
|
|
|
18088
18912
|
issue: issue$1,
|
|
18089
18913
|
seerEnabled: isSeerGranted(context$1)
|
|
18090
18914
|
})]);
|
|
18091
|
-
|
|
18092
|
-
|
|
18093
|
-
organizationSlug: orgSlug$1,
|
|
18094
|
-
issue: issue$1,
|
|
18095
|
-
event: event$1,
|
|
18096
|
-
apiService,
|
|
18097
|
-
autofixState: autofixState$1,
|
|
18098
|
-
performanceTrace: performanceTrace$1,
|
|
18099
|
-
externalIssues: externalIssues$1,
|
|
18100
|
-
relatedReplayIds: relatedReplayIds$1,
|
|
18101
|
-
aiConversations: aiConversations$1,
|
|
18102
|
-
codeLocation: codeLocation$1,
|
|
18103
|
-
experimentalMode: context$1.experimentalMode,
|
|
18104
|
-
availableToolNames: context$1.availableToolNames,
|
|
18105
|
-
directToolNames: context$1.directToolNames
|
|
18106
|
-
}),
|
|
18915
|
+
const body$1 = parseFormattedBody(event$1);
|
|
18916
|
+
if (body$1) return structuredResult(buildIssueDetailsPayload({
|
|
18107
18917
|
organizationSlug: orgSlug$1,
|
|
18918
|
+
issue: issue$1,
|
|
18919
|
+
event: event$1,
|
|
18920
|
+
body: body$1,
|
|
18921
|
+
apiService,
|
|
18922
|
+
autofixState: autofixState$1,
|
|
18923
|
+
externalIssues: externalIssues$1,
|
|
18924
|
+
relatedReplayIds: relatedReplayIds$1,
|
|
18108
18925
|
aiConversations: aiConversations$1,
|
|
18109
|
-
|
|
18926
|
+
codeLocation: codeLocation$1
|
|
18927
|
+
}));
|
|
18928
|
+
return formatIssueOutput({
|
|
18929
|
+
organizationSlug: orgSlug$1,
|
|
18930
|
+
issue: issue$1,
|
|
18931
|
+
event: event$1,
|
|
18932
|
+
apiService,
|
|
18933
|
+
autofixState: autofixState$1,
|
|
18934
|
+
performanceTrace: performanceTrace$1,
|
|
18935
|
+
externalIssues: externalIssues$1,
|
|
18936
|
+
relatedReplayIds: relatedReplayIds$1,
|
|
18937
|
+
aiConversations: aiConversations$1,
|
|
18938
|
+
codeLocation: codeLocation$1,
|
|
18939
|
+
experimentalMode: context$1.experimentalMode,
|
|
18110
18940
|
availableToolNames: context$1.availableToolNames,
|
|
18111
18941
|
directToolNames: context$1.directToolNames
|
|
18112
18942
|
});
|
|
@@ -18118,7 +18948,7 @@ var get_issue_details_default = defineTool({
|
|
|
18118
18948
|
issueId: params.issueId,
|
|
18119
18949
|
issueUrl: params.issueUrl
|
|
18120
18950
|
});
|
|
18121
|
-
(
|
|
18951
|
+
setOrganizationContext(orgSlug);
|
|
18122
18952
|
let issue;
|
|
18123
18953
|
try {
|
|
18124
18954
|
issue = await apiService.getIssue({
|
|
@@ -18138,7 +18968,7 @@ var get_issue_details_default = defineTool({
|
|
|
18138
18968
|
});
|
|
18139
18969
|
const [{ event, performanceTrace, aiConversations, codeLocation }, { autofixState, externalIssues, relatedReplayIds }] = await Promise.all([apiService.getLatestEventForIssue({
|
|
18140
18970
|
organizationSlug: orgSlug,
|
|
18141
|
-
issueId: issue.
|
|
18971
|
+
issueId: String(issue.id)
|
|
18142
18972
|
}).then(async (event$1) => ({
|
|
18143
18973
|
event: event$1,
|
|
18144
18974
|
...await fetchEventEnrichment({
|
|
@@ -18153,25 +18983,31 @@ var get_issue_details_default = defineTool({
|
|
|
18153
18983
|
issue,
|
|
18154
18984
|
seerEnabled: isSeerGranted(context$1)
|
|
18155
18985
|
})]);
|
|
18156
|
-
|
|
18157
|
-
|
|
18158
|
-
organizationSlug: orgSlug,
|
|
18159
|
-
issue,
|
|
18160
|
-
event,
|
|
18161
|
-
apiService,
|
|
18162
|
-
autofixState,
|
|
18163
|
-
performanceTrace,
|
|
18164
|
-
externalIssues,
|
|
18165
|
-
relatedReplayIds,
|
|
18166
|
-
aiConversations,
|
|
18167
|
-
codeLocation,
|
|
18168
|
-
experimentalMode: context$1.experimentalMode,
|
|
18169
|
-
availableToolNames: context$1.availableToolNames,
|
|
18170
|
-
directToolNames: context$1.directToolNames
|
|
18171
|
-
}),
|
|
18986
|
+
const body = parseFormattedBody(event);
|
|
18987
|
+
if (body) return structuredResult(buildIssueDetailsPayload({
|
|
18172
18988
|
organizationSlug: orgSlug,
|
|
18989
|
+
issue,
|
|
18990
|
+
event,
|
|
18991
|
+
body,
|
|
18992
|
+
apiService,
|
|
18993
|
+
autofixState,
|
|
18994
|
+
externalIssues,
|
|
18995
|
+
relatedReplayIds,
|
|
18173
18996
|
aiConversations,
|
|
18174
|
-
|
|
18997
|
+
codeLocation
|
|
18998
|
+
}));
|
|
18999
|
+
return formatIssueOutput({
|
|
19000
|
+
organizationSlug: orgSlug,
|
|
19001
|
+
issue,
|
|
19002
|
+
event,
|
|
19003
|
+
apiService,
|
|
19004
|
+
autofixState,
|
|
19005
|
+
performanceTrace,
|
|
19006
|
+
externalIssues,
|
|
19007
|
+
relatedReplayIds,
|
|
19008
|
+
aiConversations,
|
|
19009
|
+
codeLocation,
|
|
19010
|
+
experimentalMode: context$1.experimentalMode,
|
|
18175
19011
|
availableToolNames: context$1.availableToolNames,
|
|
18176
19012
|
directToolNames: context$1.directToolNames
|
|
18177
19013
|
});
|
|
@@ -18219,7 +19055,7 @@ async function fetchIssueEnrichmentData({ apiService, organizationSlug, issue, s
|
|
|
18219
19055
|
}),
|
|
18220
19056
|
apiService.getIssueExternalLinks({
|
|
18221
19057
|
organizationSlug,
|
|
18222
|
-
issueId
|
|
19058
|
+
issueId
|
|
18223
19059
|
}).catch(() => void 0),
|
|
18224
19060
|
apiService.listReplayIdsForIssue({
|
|
18225
19061
|
organizationSlug,
|
|
@@ -18249,7 +19085,7 @@ async function maybeFetchAutofixState({ apiService, organizationSlug, issue, see
|
|
|
18249
19085
|
if (!seerEnabled) return void 0;
|
|
18250
19086
|
return apiService.getAutofixState({
|
|
18251
19087
|
organizationSlug,
|
|
18252
|
-
issueId: issue.
|
|
19088
|
+
issueId: String(issue.id)
|
|
18253
19089
|
}).catch(() => void 0);
|
|
18254
19090
|
}
|
|
18255
19091
|
async function maybeFetchPerformanceTrace({ apiService, organizationSlug, event }) {
|
|
@@ -18349,7 +19185,7 @@ function getReplayDataSource(issue) {
|
|
|
18349
19185
|
}
|
|
18350
19186
|
|
|
18351
19187
|
//#endregion
|
|
18352
|
-
//#region ../mcp-core/dist/event-stacktrace-
|
|
19188
|
+
//#region ../mcp-core/dist/event-stacktrace-WES63IMe.js
|
|
18353
19189
|
/**
|
|
18354
19190
|
* Fetches an issue event and formats the selected thread stacktrace.
|
|
18355
19191
|
*/
|
|
@@ -18428,7 +19264,7 @@ function selectUnique(threads, predicate, notFoundMessage, ambiguousMessage) {
|
|
|
18428
19264
|
}
|
|
18429
19265
|
|
|
18430
19266
|
//#endregion
|
|
18431
|
-
//#region ../mcp-core/dist/get-event-stacktrace-
|
|
19267
|
+
//#region ../mcp-core/dist/get-event-stacktrace-CDGRtbOg.js
|
|
18432
19268
|
var get_event_stacktrace_default = defineTool({
|
|
18433
19269
|
name: "get_event_stacktrace",
|
|
18434
19270
|
skills: [
|
|
@@ -18471,7 +19307,7 @@ var get_event_stacktrace_default = defineTool({
|
|
|
18471
19307
|
},
|
|
18472
19308
|
async handler(params, context$1) {
|
|
18473
19309
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
18474
|
-
(
|
|
19310
|
+
setOrganizationContext(params.organizationSlug);
|
|
18475
19311
|
(0, __sentry_core.setTag)("issue.id", params.issueId);
|
|
18476
19312
|
try {
|
|
18477
19313
|
await ensureIssueWithinProjectConstraint({
|
|
@@ -18499,7 +19335,7 @@ var get_event_stacktrace_default = defineTool({
|
|
|
18499
19335
|
});
|
|
18500
19336
|
|
|
18501
19337
|
//#endregion
|
|
18502
|
-
//#region ../mcp-core/dist/get-issue-activity-
|
|
19338
|
+
//#region ../mcp-core/dist/get-issue-activity-DA97QQfR.js
|
|
18503
19339
|
function getActivityText(activity) {
|
|
18504
19340
|
const data = activity.data;
|
|
18505
19341
|
if (!data) return null;
|
|
@@ -18549,7 +19385,7 @@ var get_issue_activity_default = defineTool({
|
|
|
18549
19385
|
organizationSlug: params.organizationSlug ?? context$1.constraints.organizationSlug
|
|
18550
19386
|
});
|
|
18551
19387
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
18552
|
-
(
|
|
19388
|
+
setOrganizationContext(parsed.organizationSlug);
|
|
18553
19389
|
(0, __sentry_core.setTag)("issue.id", parsed.issueId);
|
|
18554
19390
|
await ensureIssueWithinProjectConstraint({
|
|
18555
19391
|
apiService,
|
|
@@ -18592,7 +19428,7 @@ var get_issue_activity_default = defineTool({
|
|
|
18592
19428
|
});
|
|
18593
19429
|
|
|
18594
19430
|
//#endregion
|
|
18595
|
-
//#region ../mcp-core/dist/breadcrumbs-
|
|
19431
|
+
//#region ../mcp-core/dist/breadcrumbs-uFW9kNaP.js
|
|
18596
19432
|
/**
|
|
18597
19433
|
* Fetches breadcrumbs from an issue event and formats them.
|
|
18598
19434
|
* Defaults to the latest event when eventId is omitted.
|
|
@@ -18656,7 +19492,7 @@ function cleanAndTruncate(str, maxLen) {
|
|
|
18656
19492
|
}
|
|
18657
19493
|
|
|
18658
19494
|
//#endregion
|
|
18659
|
-
//#region ../mcp-core/dist/get-issue-breadcrumbs-
|
|
19495
|
+
//#region ../mcp-core/dist/get-issue-breadcrumbs-D-UCFqx1.js
|
|
18660
19496
|
var get_issue_breadcrumbs_default = defineTool({
|
|
18661
19497
|
name: "get_issue_breadcrumbs",
|
|
18662
19498
|
skills: ["inspect", "triage"],
|
|
@@ -18696,7 +19532,7 @@ var get_issue_breadcrumbs_default = defineTool({
|
|
|
18696
19532
|
organizationSlug: params.organizationSlug ?? context$1.constraints.organizationSlug
|
|
18697
19533
|
});
|
|
18698
19534
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
18699
|
-
(
|
|
19535
|
+
setOrganizationContext(parsed.organizationSlug);
|
|
18700
19536
|
(0, __sentry_core.setTag)("issue.id", parsed.issueId);
|
|
18701
19537
|
try {
|
|
18702
19538
|
await ensureIssueWithinProjectConstraint({
|
|
@@ -18718,7 +19554,7 @@ var get_issue_breadcrumbs_default = defineTool({
|
|
|
18718
19554
|
});
|
|
18719
19555
|
|
|
18720
19556
|
//#endregion
|
|
18721
|
-
//#region ../mcp-core/dist/get-issue-tag-values-
|
|
19557
|
+
//#region ../mcp-core/dist/get-issue-tag-values-CyHuVJ-4.js
|
|
18722
19558
|
const getIssueTagValuesOutputSchema = zod.z.object({ tag: zod.z.object({
|
|
18723
19559
|
key: zod.z.string(),
|
|
18724
19560
|
name: zod.z.string(),
|
|
@@ -18799,7 +19635,7 @@ var get_issue_tag_values_default = defineTool({
|
|
|
18799
19635
|
issueId: params.issueId,
|
|
18800
19636
|
issueUrl: params.issueUrl
|
|
18801
19637
|
});
|
|
18802
|
-
(
|
|
19638
|
+
setOrganizationContext(orgSlug);
|
|
18803
19639
|
await ensureIssueWithinProjectConstraint({
|
|
18804
19640
|
apiService,
|
|
18805
19641
|
organizationSlug: orgSlug,
|
|
@@ -18836,7 +19672,7 @@ var get_issue_tag_values_default = defineTool({
|
|
|
18836
19672
|
});
|
|
18837
19673
|
|
|
18838
19674
|
//#endregion
|
|
18839
|
-
//#region ../mcp-core/dist/get-issue-user-reports-
|
|
19675
|
+
//#region ../mcp-core/dist/get-issue-user-reports-DhU4yW1i.js
|
|
18840
19676
|
function getReporter(report) {
|
|
18841
19677
|
const userId = report.user?.id?.trim();
|
|
18842
19678
|
const userIdReporter = userId && !["none", "null"].includes(userId.toLowerCase()) ? `user:${userId}` : null;
|
|
@@ -18889,7 +19725,7 @@ var get_issue_user_reports_default = defineTool({
|
|
|
18889
19725
|
organizationSlug: params.organizationSlug ?? context$1.constraints.organizationSlug
|
|
18890
19726
|
});
|
|
18891
19727
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
18892
|
-
(
|
|
19728
|
+
setOrganizationContext(parsed.organizationSlug);
|
|
18893
19729
|
(0, __sentry_core.setTag)("issue.id", parsed.issueId);
|
|
18894
19730
|
await ensureIssueWithinProjectConstraint({
|
|
18895
19731
|
apiService,
|
|
@@ -22424,7 +23260,7 @@ function createAnthropic(options = {}) {
|
|
|
22424
23260
|
var anthropic = createAnthropic();
|
|
22425
23261
|
|
|
22426
23262
|
//#endregion
|
|
22427
|
-
//#region ../mcp-core/dist/anthropic-provider-
|
|
23263
|
+
//#region ../mcp-core/dist/anthropic-provider-NqnQSpoe.js
|
|
22428
23264
|
const DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-5";
|
|
22429
23265
|
let configuredBaseUrl$2;
|
|
22430
23266
|
/**
|
|
@@ -27077,7 +27913,7 @@ function createOpenAI(options = {}) {
|
|
|
27077
27913
|
var openai = createOpenAI();
|
|
27078
27914
|
|
|
27079
27915
|
//#endregion
|
|
27080
|
-
//#region ../mcp-core/dist/azure-openai-provider-
|
|
27916
|
+
//#region ../mcp-core/dist/azure-openai-provider-BcsSfFBw.js
|
|
27081
27917
|
const DEFAULT_OPENAI_MODEL$1 = "gpt-5";
|
|
27082
27918
|
let configuredBaseUrl$1;
|
|
27083
27919
|
function setAzureOpenAIBaseUrl(baseUrl) {
|
|
@@ -27135,7 +27971,7 @@ function getAzureOpenAIModel(model) {
|
|
|
27135
27971
|
}
|
|
27136
27972
|
|
|
27137
27973
|
//#endregion
|
|
27138
|
-
//#region ../mcp-core/dist/openai-provider-
|
|
27974
|
+
//#region ../mcp-core/dist/openai-provider-DNtIUzcM.js
|
|
27139
27975
|
const DEFAULT_OPENAI_MODEL = "gpt-5";
|
|
27140
27976
|
let configuredBaseUrl;
|
|
27141
27977
|
/**
|
|
@@ -27175,7 +28011,7 @@ function getOpenAIModel(model) {
|
|
|
27175
28011
|
}
|
|
27176
28012
|
|
|
27177
28013
|
//#endregion
|
|
27178
|
-
//#region ../mcp-core/dist/openrouter-provider-
|
|
28014
|
+
//#region ../mcp-core/dist/openrouter-provider-Bq38hmFY.js
|
|
27179
28015
|
const DEFAULT_OPENROUTER_MODEL = "openai/gpt-5.6-luna";
|
|
27180
28016
|
const DEFAULT_OPENROUTER_REASONING_EFFORT = "high";
|
|
27181
28017
|
const OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1";
|
|
@@ -27227,7 +28063,7 @@ function getOpenRouterProviderOptions() {
|
|
|
27227
28063
|
}
|
|
27228
28064
|
|
|
27229
28065
|
//#endregion
|
|
27230
|
-
//#region ../mcp-core/dist/provider-factory-
|
|
28066
|
+
//#region ../mcp-core/dist/provider-factory-BNDtCneN.js
|
|
27231
28067
|
let configuredProvider;
|
|
27232
28068
|
/**
|
|
27233
28069
|
* Configure the embedded agent provider explicitly.
|
|
@@ -27372,7 +28208,7 @@ function getResolvedProviderType() {
|
|
|
27372
28208
|
}
|
|
27373
28209
|
|
|
27374
28210
|
//#endregion
|
|
27375
|
-
//#region ../mcp-core/dist/resolve-region-url-
|
|
28211
|
+
//#region ../mcp-core/dist/resolve-region-url-DgkcX4pA.js
|
|
27376
28212
|
const regionUrlCache = /* @__PURE__ */ new WeakMap();
|
|
27377
28213
|
function getRegionUrlCache(context$1) {
|
|
27378
28214
|
let cache = regionUrlCache.get(context$1);
|
|
@@ -27411,7 +28247,7 @@ async function resolveRegionUrlForOrganization({ context: context$1, organizatio
|
|
|
27411
28247
|
}
|
|
27412
28248
|
|
|
27413
28249
|
//#endregion
|
|
27414
|
-
//#region ../mcp-core/dist/semantic-display-
|
|
28250
|
+
//#region ../mcp-core/dist/semantic-display-C9x4ir1O.js
|
|
27415
28251
|
const SPAN_LABEL_MAX_LENGTH = 160;
|
|
27416
28252
|
const SPAN_METADATA_MAX_LENGTH = 64;
|
|
27417
28253
|
const SPAN_ATTRIBUTE_MAX_LENGTH = 2048;
|
|
@@ -27799,7 +28635,7 @@ function formatDisplayPart(value, maxLength) {
|
|
|
27799
28635
|
}
|
|
27800
28636
|
|
|
27801
28637
|
//#endregion
|
|
27802
|
-
//#region ../mcp-core/dist/get-trace-details-
|
|
28638
|
+
//#region ../mcp-core/dist/get-trace-details-DIFsJzLU.js
|
|
27803
28639
|
const MAX_TRACE_FETCH_LIMIT = 1e3;
|
|
27804
28640
|
const MAX_FOCUSED_TRACE_FETCH_LIMIT = 1e4;
|
|
27805
28641
|
const MIN_TRACE_FETCH_LIMIT = 50;
|
|
@@ -27873,7 +28709,7 @@ var get_trace_details_default = defineTool({
|
|
|
27873
28709
|
regionUrl: params.regionUrl
|
|
27874
28710
|
});
|
|
27875
28711
|
const apiService = apiServiceFromContext(context$1, { regionUrl: regionUrl ?? void 0 });
|
|
27876
|
-
(
|
|
28712
|
+
setOrganizationContext(params.organizationSlug);
|
|
27877
28713
|
(0, __sentry_core.setTag)("trace.id", params.traceId);
|
|
27878
28714
|
if (params.spanId) (0, __sentry_core.setTag)("trace.span_id", params.spanId);
|
|
27879
28715
|
if (context$1.constraints.projectSlug) (0, __sentry_core.setTag)("project.slug", context$1.constraints.projectSlug);
|
|
@@ -27913,14 +28749,7 @@ var get_trace_details_default = defineTool({
|
|
|
27913
28749
|
directToolNames: context$1.directToolNames,
|
|
27914
28750
|
aiConversations
|
|
27915
28751
|
});
|
|
27916
|
-
return
|
|
27917
|
-
markdown,
|
|
27918
|
-
organizationSlug: params.organizationSlug,
|
|
27919
|
-
aiConversations,
|
|
27920
|
-
experimentalMode: context$1.experimentalMode ?? false,
|
|
27921
|
-
availableToolNames: context$1.availableToolNames,
|
|
27922
|
-
directToolNames: context$1.directToolNames
|
|
27923
|
-
});
|
|
28752
|
+
return markdown;
|
|
27924
28753
|
}
|
|
27925
28754
|
});
|
|
27926
28755
|
function isTraceSpanNode(node) {
|
|
@@ -28559,7 +29388,7 @@ function buildTraceNextSteps({ organizationSlug, traceId, spanFocused = false, e
|
|
|
28559
29388
|
}
|
|
28560
29389
|
|
|
28561
29390
|
//#endregion
|
|
28562
|
-
//#region ../mcp-core/dist/get-span-details-
|
|
29391
|
+
//#region ../mcp-core/dist/get-span-details-CC9cxfpa.js
|
|
28563
29392
|
var get_span_details_default = defineTool({
|
|
28564
29393
|
name: "get_span_details",
|
|
28565
29394
|
skills: ["inspect"],
|
|
@@ -28600,7 +29429,7 @@ var get_span_details_default = defineTool({
|
|
|
28600
29429
|
});
|
|
28601
29430
|
|
|
28602
29431
|
//#endregion
|
|
28603
|
-
//#region ../mcp-core/dist/url-helpers-
|
|
29432
|
+
//#region ../mcp-core/dist/url-helpers-DtpSKjOI.js
|
|
28604
29433
|
/**
|
|
28605
29434
|
* Parses a Sentry URL and extracts resource type and identifiers.
|
|
28606
29435
|
*
|
|
@@ -28863,7 +29692,7 @@ function isProfileUrl(url) {
|
|
|
28863
29692
|
}
|
|
28864
29693
|
|
|
28865
29694
|
//#endregion
|
|
28866
|
-
//#region ../mcp-core/dist/get-replay-details-
|
|
29695
|
+
//#region ../mcp-core/dist/get-replay-details-BM6gDmGp.js
|
|
28867
29696
|
const MAX_ACTIVITY_EVENTS = 6;
|
|
28868
29697
|
const MAX_RELATED_ERRORS = 3;
|
|
28869
29698
|
const MAX_RELATED_TRACES = 2;
|
|
@@ -28915,7 +29744,7 @@ var get_replay_details_default = defineTool({
|
|
|
28915
29744
|
regionUrl: params.regionUrl
|
|
28916
29745
|
});
|
|
28917
29746
|
const apiService = apiServiceFromContext(context$1, { regionUrl: regionUrl ?? void 0 });
|
|
28918
|
-
(
|
|
29747
|
+
setOrganizationContext(resolved.organizationSlug);
|
|
28919
29748
|
(0, __sentry_core.setTag)("replay.id", resolved.replayId);
|
|
28920
29749
|
const replay = await apiService.getReplayDetails({
|
|
28921
29750
|
organizationSlug: resolved.organizationSlug,
|
|
@@ -29200,7 +30029,44 @@ function quoteDetail(value) {
|
|
|
29200
30029
|
}
|
|
29201
30030
|
|
|
29202
30031
|
//#endregion
|
|
29203
|
-
//#region ../mcp-core/dist/get-event-attachment-
|
|
30032
|
+
//#region ../mcp-core/dist/get-event-attachment-LSEqrcub.js
|
|
30033
|
+
function formatMegabytes(bytes) {
|
|
30034
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
30035
|
+
}
|
|
30036
|
+
/**
|
|
30037
|
+
* Render the response for an attachment too large to inline: a presigned direct
|
|
30038
|
+
* link when available, otherwise authenticated-download instructions.
|
|
30039
|
+
*/
|
|
30040
|
+
function formatOversizedAttachment(params, attachment) {
|
|
30041
|
+
const sizeBytes = attachment.attachment.size;
|
|
30042
|
+
const downloadApiPath = `projects/${params.organizationSlug}/${params.projectSlug}/events/${params.eventId}/attachments/${params.attachmentId}/?download=1`;
|
|
30043
|
+
const outputName = `attachment-${params.attachmentId}`;
|
|
30044
|
+
let output = "# Event Attachment — Too Large to Return Inline\n\n";
|
|
30045
|
+
output += `**Event ID:** ${params.eventId}\n`;
|
|
30046
|
+
output += `**Attachment ID:** ${params.attachmentId}\n`;
|
|
30047
|
+
output += `**Filename:** ${attachment.filename}\n`;
|
|
30048
|
+
output += `**Type:** ${attachment.attachment.type}\n`;
|
|
30049
|
+
output += `**Size:** ${sizeBytes} bytes (${formatMegabytes(sizeBytes)})\n`;
|
|
30050
|
+
output += `**MIME Type:** ${attachment.contentType}\n`;
|
|
30051
|
+
output += `**Created:** ${attachment.attachment.dateCreated}\n\n`;
|
|
30052
|
+
output += `This attachment (${formatMegabytes(sizeBytes)}) exceeds the ${formatMegabytes(DEFAULT_MAX_INLINE_ATTACHMENT_BYTES)} inline limit for MCP responses, so its contents were not downloaded.\n\n`;
|
|
30053
|
+
output += "## How to download it\n\n";
|
|
30054
|
+
if (attachment.directDownloadUrl) {
|
|
30055
|
+
output += "**Direct download** (a presigned link — no authentication needed; it expires shortly, so fetch it promptly):\n\n";
|
|
30056
|
+
output += `${attachment.directDownloadUrl}\n\n`;
|
|
30057
|
+
output += "If the link has expired, re-run this tool to get a fresh one, or use the authenticated API endpoint below.\n\n";
|
|
30058
|
+
output += "**Authenticated Sentry API endpoint** (requires Sentry credentials):\n";
|
|
30059
|
+
output += `- Sentry CLI: \`sentry api ${downloadApiPath} > ${outputName}\`\n`;
|
|
30060
|
+
output += `- Or an \`Authorization: Bearer <token>\` request to: ${attachment.downloadUrl}\n`;
|
|
30061
|
+
} else {
|
|
30062
|
+
output += "The download URL is an authenticated Sentry API endpoint — it is not a public link and requires your Sentry credentials (a bare fetch returns HTTP 401).\n\n";
|
|
30063
|
+
output += "- **Sentry CLI** (handles auth automatically):\n";
|
|
30064
|
+
output += ` \`sentry api ${downloadApiPath} > ${outputName}\`\n`;
|
|
30065
|
+
output += `- **Any HTTP client** with an \`Authorization: Bearer <token>\` header against: ${attachment.downloadUrl}\n`;
|
|
30066
|
+
output += "- **Sentry UI:** open the event and use the Attachments tab.\n";
|
|
30067
|
+
}
|
|
30068
|
+
return output;
|
|
30069
|
+
}
|
|
29204
30070
|
var get_event_attachment_default = defineTool({
|
|
29205
30071
|
name: "get_event_attachment",
|
|
29206
30072
|
skills: ["inspect"],
|
|
@@ -29248,7 +30114,7 @@ var get_event_attachment_default = defineTool({
|
|
|
29248
30114
|
},
|
|
29249
30115
|
async handler(params, context$1) {
|
|
29250
30116
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
29251
|
-
(
|
|
30117
|
+
setOrganizationContext(params.organizationSlug);
|
|
29252
30118
|
if (params.attachmentId) {
|
|
29253
30119
|
const attachment = await apiService.getEventAttachment({
|
|
29254
30120
|
organizationSlug: params.organizationSlug,
|
|
@@ -29256,12 +30122,19 @@ var get_event_attachment_default = defineTool({
|
|
|
29256
30122
|
eventId: params.eventId,
|
|
29257
30123
|
attachmentId: params.attachmentId
|
|
29258
30124
|
});
|
|
30125
|
+
if (attachment.bytes === null) return formatOversizedAttachment({
|
|
30126
|
+
organizationSlug: params.organizationSlug,
|
|
30127
|
+
projectSlug: params.projectSlug,
|
|
30128
|
+
eventId: params.eventId,
|
|
30129
|
+
attachmentId: params.attachmentId
|
|
30130
|
+
}, attachment);
|
|
29259
30131
|
const contentParts = [];
|
|
29260
30132
|
const effectiveMimeType = attachment.contentType;
|
|
29261
30133
|
const isBinary = !effectiveMimeType.startsWith("text/");
|
|
29262
|
-
|
|
30134
|
+
const isEmpty = attachment.bytes.length === 0;
|
|
30135
|
+
if (isBinary && !isEmpty) {
|
|
29263
30136
|
const isImage = effectiveMimeType.startsWith("image/");
|
|
29264
|
-
const base64 =
|
|
30137
|
+
const base64 = require_blob_utils_DgVug_Di.bytesToBase64(attachment.bytes);
|
|
29265
30138
|
if (isImage) {
|
|
29266
30139
|
const image = {
|
|
29267
30140
|
type: "image",
|
|
@@ -29290,11 +30163,15 @@ var get_event_attachment_default = defineTool({
|
|
|
29290
30163
|
output$1 += `**MIME Type:** ${effectiveMimeType}\n`;
|
|
29291
30164
|
output$1 += `**Created:** ${attachment.attachment.dateCreated}\n\n`;
|
|
29292
30165
|
output$1 += `**Download URL:** ${attachment.downloadUrl}\n\n`;
|
|
29293
|
-
if (
|
|
30166
|
+
if (isEmpty) {
|
|
30167
|
+
output$1 += `## Empty Content\n\n`;
|
|
30168
|
+
if (attachment.attachment.size > 0) output$1 += `The download returned no data even though the attachment metadata reports ${attachment.attachment.size} bytes. This usually indicates a failed or truncated download; try again, or download it directly from the URL above (requires Sentry authentication).\n`;
|
|
30169
|
+
else output$1 += `This attachment is empty (0 bytes).\n`;
|
|
30170
|
+
} else if (isBinary) {
|
|
29294
30171
|
output$1 += `## Binary Content\n\n`;
|
|
29295
30172
|
output$1 += `The attachment is included as a resource and accessible through your client.\n`;
|
|
29296
30173
|
} else {
|
|
29297
|
-
const textContent =
|
|
30174
|
+
const textContent = new TextDecoder().decode(attachment.bytes);
|
|
29298
30175
|
output$1 += `## File Content\n\n`;
|
|
29299
30176
|
output$1 += `\`\`\`\n${textContent}\n\`\`\`\n\n`;
|
|
29300
30177
|
}
|
|
@@ -29345,7 +30222,7 @@ var get_event_attachment_default = defineTool({
|
|
|
29345
30222
|
});
|
|
29346
30223
|
|
|
29347
30224
|
//#endregion
|
|
29348
|
-
//#region ../mcp-core/dist/formatting-
|
|
30225
|
+
//#region ../mcp-core/dist/formatting-BG8yQUmg.js
|
|
29349
30226
|
/**
|
|
29350
30227
|
* Helper function to format assignedTo field for display
|
|
29351
30228
|
*/
|
|
@@ -29357,7 +30234,7 @@ function formatAssignedTo(assignedTo) {
|
|
|
29357
30234
|
}
|
|
29358
30235
|
|
|
29359
30236
|
//#endregion
|
|
29360
|
-
//#region ../mcp-core/dist/update-issue-
|
|
30237
|
+
//#region ../mcp-core/dist/update-issue-BH3fTM71.js
|
|
29361
30238
|
function pluralize(value, noun) {
|
|
29362
30239
|
return `${value} ${noun}${value === 1 ? "" : "s"}`;
|
|
29363
30240
|
}
|
|
@@ -29496,7 +30373,9 @@ function buildNoChangesOutput(params) {
|
|
|
29496
30373
|
return output;
|
|
29497
30374
|
}
|
|
29498
30375
|
function isAssigneeAlreadySet(issue, requestedAssignee, currentUserId) {
|
|
29499
|
-
if (
|
|
30376
|
+
if (requestedAssignee === void 0) return false;
|
|
30377
|
+
if (requestedAssignee === null) return !issue.assignedTo;
|
|
30378
|
+
if (!issue.assignedTo) return false;
|
|
29500
30379
|
if (typeof issue.assignedTo === "string") return issue.assignedTo === requestedAssignee;
|
|
29501
30380
|
if (requestedAssignee === "me") return issue.assignedTo.type === "user" && currentUserId !== void 0 && String(issue.assignedTo.id) === currentUserId;
|
|
29502
30381
|
if (requestedAssignee.startsWith("user:")) return issue.assignedTo.type === "user" && String(issue.assignedTo.id) === requestedAssignee.slice(5);
|
|
@@ -29621,12 +30500,13 @@ var update_issue_default = defineTool({
|
|
|
29621
30500
|
description: [
|
|
29622
30501
|
"Update a Sentry issue's status or assignment.",
|
|
29623
30502
|
"",
|
|
29624
|
-
"Use this to resolve, reopen, assign, or ignore an issue.",
|
|
30503
|
+
"Use this to resolve, reopen, assign, unassign, or ignore an issue.",
|
|
29625
30504
|
"",
|
|
29626
30505
|
"<examples>",
|
|
29627
30506
|
"```",
|
|
29628
30507
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', status='resolved')",
|
|
29629
30508
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', assignedTo='user:123456')",
|
|
30509
|
+
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', assignedTo=null)",
|
|
29630
30510
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', status='ignored')",
|
|
29631
30511
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', status='ignored', ignoreMode='forever')",
|
|
29632
30512
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', status='ignored', ignoreMode='untilOccurrenceCount', ignoreCount=100, ignoreWindowMinutes=60)",
|
|
@@ -29637,7 +30517,7 @@ var update_issue_default = defineTool({
|
|
|
29637
30517
|
"<hints>",
|
|
29638
30518
|
"- Provide `issueUrl` or `organizationSlug` + `issueId`.",
|
|
29639
30519
|
"- At least one of `status` or `assignedTo` is required.",
|
|
29640
|
-
"- `assignedTo`
|
|
30520
|
+
"- Omit `assignedTo` to leave assignment unchanged. Pass `null` to unassign; otherwise use `user:ID` or `team:ID_OR_SLUG`.",
|
|
29641
30521
|
"- Use `execute_sentry_tool(name='whoami', arguments={})` to find your user ID for self-assignment.",
|
|
29642
30522
|
"- Status values: `resolved`, `resolvedInNextRelease`, `unresolved`, `ignored`.",
|
|
29643
30523
|
"- `status='ignored'` defaults to `ignoreMode='untilEscalating'`.",
|
|
@@ -29672,13 +30552,13 @@ var update_issue_default = defineTool({
|
|
|
29672
30552
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
29673
30553
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
29674
30554
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
29675
|
-
if (
|
|
30555
|
+
if (params.status === void 0 && params.assignedTo === void 0) throw new UserInputError("At least one of `status` or `assignedTo` must be provided to update the issue");
|
|
29676
30556
|
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
29677
30557
|
organizationSlug: params.organizationSlug,
|
|
29678
30558
|
issueId: params.issueId,
|
|
29679
30559
|
issueUrl: params.issueUrl
|
|
29680
30560
|
});
|
|
29681
|
-
(
|
|
30561
|
+
setOrganizationContext(orgSlug);
|
|
29682
30562
|
const currentIssue = await apiService.getIssue({
|
|
29683
30563
|
organizationSlug: orgSlug,
|
|
29684
30564
|
issueId: parsedIssueId
|
|
@@ -29706,7 +30586,7 @@ var update_issue_default = defineTool({
|
|
|
29706
30586
|
} else if (currentIgnoreState && requestedIgnoreFamily && currentIgnoreState.family !== requestedIgnoreFamily) throw new UserInputError("Changing ignore behavior on an already ignored issue between `untilEscalating`, `forever`, and condition-based modes is not supported. First set `status` to `unresolved`, then ignore it again with the new rule.");
|
|
29707
30587
|
}
|
|
29708
30588
|
const requestedIssueUrl = apiService.getIssueUrl(orgSlug, currentIssue.shortId);
|
|
29709
|
-
if (
|
|
30589
|
+
if (updateStatus === void 0 && updateAssignedTo === void 0 && updateIgnore === void 0) {
|
|
29710
30590
|
const commentResult$1 = await tryPostReasonComment(apiService, orgSlug, parsedIssueId, params.reason);
|
|
29711
30591
|
return buildNoChangesOutput({
|
|
29712
30592
|
issue: currentIssue,
|
|
@@ -29741,7 +30621,7 @@ var update_issue_default = defineTool({
|
|
|
29741
30621
|
if (statusChanged) output += `**Status**: ${currentStatusDisplay} → **${updatedStatusDisplay}**\n`;
|
|
29742
30622
|
if (updatedIgnoreState && (statusChanged || ignoreBehaviorChanged) && (ignoreBehaviorChanged || params.status === "ignored")) if (currentIgnoreState && ignoreBehaviorChanged) output += `**Ignore Behavior**: ${currentIgnoreState.behavior} → **${updatedIgnoreState.behavior}**\n`;
|
|
29743
30623
|
else output += `**Ignore Behavior**: **${updatedIgnoreState.behavior}**\n`;
|
|
29744
|
-
if (updateAssignedTo && assignmentChanged) {
|
|
30624
|
+
if (updateAssignedTo !== void 0 && assignmentChanged) {
|
|
29745
30625
|
const oldAssignee = formatAssignedTo(currentIssue.assignedTo ?? null);
|
|
29746
30626
|
const newAssignee = params.assignedTo === "me" ? "You" : formatAssignedTo(updatedIssue.assignedTo ?? null);
|
|
29747
30627
|
output += `**Assigned To**: ${oldAssignee} → **${newAssignee}**\n`;
|
|
@@ -29763,7 +30643,7 @@ var update_issue_default = defineTool({
|
|
|
29763
30643
|
});
|
|
29764
30644
|
|
|
29765
30645
|
//#endregion
|
|
29766
|
-
//#region ../mcp-core/dist/provider-fallback-
|
|
30646
|
+
//#region ../mcp-core/dist/provider-fallback-B4jxYMQu.js
|
|
29767
30647
|
/**
|
|
29768
30648
|
* Run an optional embedded-agent rewrite and fall back to the caller's direct
|
|
29769
30649
|
* behavior when the agent cannot complete the rewrite.
|
|
@@ -29803,7 +30683,126 @@ async function withProviderFallback({ operation, fallback, onFallback, run }) {
|
|
|
29803
30683
|
}
|
|
29804
30684
|
|
|
29805
30685
|
//#endregion
|
|
29806
|
-
//#region ../mcp-core/dist/
|
|
30686
|
+
//#region ../mcp-core/dist/sentry-CcB-AERp.js
|
|
30687
|
+
const SCRUB_PATTERNS = [
|
|
30688
|
+
{
|
|
30689
|
+
pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
|
|
30690
|
+
replacement: "[REDACTED_OPENAI_KEY]",
|
|
30691
|
+
description: "OpenAI API key"
|
|
30692
|
+
},
|
|
30693
|
+
{
|
|
30694
|
+
pattern: /\bBearer\s+[a-zA-Z0-9\-._~+/]+={0,}/g,
|
|
30695
|
+
replacement: "Bearer [REDACTED_TOKEN]",
|
|
30696
|
+
description: "Bearer token"
|
|
30697
|
+
},
|
|
30698
|
+
{
|
|
30699
|
+
pattern: /\bsntrys_[a-zA-Z0-9_]+\b/g,
|
|
30700
|
+
replacement: "[REDACTED_SENTRY_TOKEN]",
|
|
30701
|
+
description: "Sentry access token"
|
|
30702
|
+
}
|
|
30703
|
+
];
|
|
30704
|
+
const MAX_SCRUB_DEPTH = 20;
|
|
30705
|
+
/**
|
|
30706
|
+
* Recursively scrub sensitive data from any value.
|
|
30707
|
+
* Returns tuple of [scrubbedValue, didScrub, descriptionsOfMatchedPatterns]
|
|
30708
|
+
*/
|
|
30709
|
+
function scrubValue(value, depth = 0) {
|
|
30710
|
+
if (depth >= MAX_SCRUB_DEPTH) return [
|
|
30711
|
+
"[MAX_DEPTH_EXCEEDED]",
|
|
30712
|
+
false,
|
|
30713
|
+
[]
|
|
30714
|
+
];
|
|
30715
|
+
if (typeof value === "string") {
|
|
30716
|
+
let scrubbed = value;
|
|
30717
|
+
let didScrub = false;
|
|
30718
|
+
const matchedDescriptions = [];
|
|
30719
|
+
for (const { pattern, replacement, description: description$73 } of SCRUB_PATTERNS) {
|
|
30720
|
+
pattern.lastIndex = 0;
|
|
30721
|
+
if (pattern.test(scrubbed)) {
|
|
30722
|
+
didScrub = true;
|
|
30723
|
+
matchedDescriptions.push(description$73);
|
|
30724
|
+
pattern.lastIndex = 0;
|
|
30725
|
+
scrubbed = scrubbed.replace(pattern, replacement);
|
|
30726
|
+
}
|
|
30727
|
+
}
|
|
30728
|
+
return [
|
|
30729
|
+
scrubbed,
|
|
30730
|
+
didScrub,
|
|
30731
|
+
matchedDescriptions
|
|
30732
|
+
];
|
|
30733
|
+
}
|
|
30734
|
+
if (Array.isArray(value)) {
|
|
30735
|
+
let arrayDidScrub = false;
|
|
30736
|
+
const arrayDescriptions = [];
|
|
30737
|
+
const scrubbedArray = value.map((item) => {
|
|
30738
|
+
const [scrubbed, didScrub, descriptions] = scrubValue(item, depth + 1);
|
|
30739
|
+
if (didScrub) {
|
|
30740
|
+
arrayDidScrub = true;
|
|
30741
|
+
arrayDescriptions.push(...descriptions);
|
|
30742
|
+
}
|
|
30743
|
+
return scrubbed;
|
|
30744
|
+
});
|
|
30745
|
+
return [
|
|
30746
|
+
scrubbedArray,
|
|
30747
|
+
arrayDidScrub,
|
|
30748
|
+
arrayDescriptions
|
|
30749
|
+
];
|
|
30750
|
+
}
|
|
30751
|
+
if (value && typeof value === "object") {
|
|
30752
|
+
let objectDidScrub = false;
|
|
30753
|
+
const objectDescriptions = [];
|
|
30754
|
+
const scrubbed = {};
|
|
30755
|
+
for (const [key, val] of Object.entries(value)) {
|
|
30756
|
+
const [scrubbedVal, didScrub, descriptions] = scrubValue(val, depth + 1);
|
|
30757
|
+
if (didScrub) {
|
|
30758
|
+
objectDidScrub = true;
|
|
30759
|
+
objectDescriptions.push(...descriptions);
|
|
30760
|
+
}
|
|
30761
|
+
scrubbed[key] = scrubbedVal;
|
|
30762
|
+
}
|
|
30763
|
+
return [
|
|
30764
|
+
scrubbed,
|
|
30765
|
+
objectDidScrub,
|
|
30766
|
+
objectDescriptions
|
|
30767
|
+
];
|
|
30768
|
+
}
|
|
30769
|
+
return [
|
|
30770
|
+
value,
|
|
30771
|
+
false,
|
|
30772
|
+
[]
|
|
30773
|
+
];
|
|
30774
|
+
}
|
|
30775
|
+
/**
|
|
30776
|
+
* Sentry beforeSend hook that scrubs sensitive data from events
|
|
30777
|
+
* and applies custom fingerprinting for specific error types.
|
|
30778
|
+
*/
|
|
30779
|
+
function sentryBeforeSend(event, hint) {
|
|
30780
|
+
const firstException = event?.exception?.values?.[0];
|
|
30781
|
+
if (firstException?.type === "AI_APICallError" && firstException.value) event.fingerprint = ["AI_APICallError", firstException.value];
|
|
30782
|
+
const [scrubbedEvent, didScrub, descriptions] = scrubValue(event);
|
|
30783
|
+
if (didScrub) {
|
|
30784
|
+
const uniqueDescriptions = [...new Set(descriptions)];
|
|
30785
|
+
console.warn(`[Sentry] Event contained sensitive data: ${uniqueDescriptions.join(", ")}`);
|
|
30786
|
+
}
|
|
30787
|
+
return scrubbedEvent;
|
|
30788
|
+
}
|
|
30789
|
+
const EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
30790
|
+
/**
|
|
30791
|
+
* Scrub tokens (OpenAI/Bearer/Sentry) and emails from a free-form string before
|
|
30792
|
+
* logging it. Applied at the log call site so it covers every sink (stderr and
|
|
30793
|
+
* Sentry Logs).
|
|
30794
|
+
*/
|
|
30795
|
+
function scrubSensitiveText(text$1) {
|
|
30796
|
+
let scrubbed = text$1;
|
|
30797
|
+
for (const { pattern, replacement } of SCRUB_PATTERNS) {
|
|
30798
|
+
pattern.lastIndex = 0;
|
|
30799
|
+
scrubbed = scrubbed.replace(pattern, replacement);
|
|
30800
|
+
}
|
|
30801
|
+
return scrubbed.replace(EMAIL_PATTERN, "[REDACTED_EMAIL]");
|
|
30802
|
+
}
|
|
30803
|
+
|
|
30804
|
+
//#endregion
|
|
30805
|
+
//#region ../mcp-core/dist/callEmbeddedAgent-DvwjAsbW.js
|
|
29807
30806
|
/**
|
|
29808
30807
|
* Resolve the underlying provider failure from an AI SDK error.
|
|
29809
30808
|
*
|
|
@@ -29895,6 +30894,13 @@ async function callEmbeddedAgent({ system, prompt, tools, schema }) {
|
|
|
29895
30894
|
});
|
|
29896
30895
|
throw new UserInputError("The AI was unable to process your query. Please try rephrasing.");
|
|
29897
30896
|
}
|
|
30897
|
+
if (NoOutputGeneratedError.isInstance(error)) {
|
|
30898
|
+
logWarn("Embedded agent produced no output", {
|
|
30899
|
+
loggerScope: ["agents", "embedded"],
|
|
30900
|
+
extra: { errorMessage: error.message }
|
|
30901
|
+
});
|
|
30902
|
+
throw new UserInputError("The AI could not construct a valid query for this request. Please rephrase or narrow it — for example, specify the fields, a real environment name, or a time range.");
|
|
30903
|
+
}
|
|
29898
30904
|
const providerError = resolveProviderApiCallError(error);
|
|
29899
30905
|
if (providerError) throw toLLMProviderError(providerError, error);
|
|
29900
30906
|
if (RetryError.isInstance(error)) throw new LLMProviderError(`The AI provider is currently unavailable: ${error.message}. Please try again later.`, { cause: error });
|
|
@@ -29991,7 +30997,7 @@ function rescueFromText(text$1, schema) {
|
|
|
29991
30997
|
}
|
|
29992
30998
|
|
|
29993
30999
|
//#endregion
|
|
29994
|
-
//#region ../mcp-core/dist/utils-
|
|
31000
|
+
//#region ../mcp-core/dist/utils-_7jC6e0y.js
|
|
29995
31001
|
/**
|
|
29996
31002
|
* Standard response schema for all embedded agent tools.
|
|
29997
31003
|
* Tools return either an error message or the result data, never both.
|
|
@@ -30110,7 +31116,7 @@ function agentTool(config) {
|
|
|
30110
31116
|
}
|
|
30111
31117
|
|
|
30112
31118
|
//#endregion
|
|
30113
|
-
//#region ../mcp-core/dist/dataset-fields-
|
|
31119
|
+
//#region ../mcp-core/dist/dataset-fields-nUaj8nt3.js
|
|
30114
31120
|
const REPLAY_EXCLUDED_TAGS = new Set([
|
|
30115
31121
|
"browser",
|
|
30116
31122
|
"device",
|
|
@@ -30609,7 +31615,7 @@ function getReplayCommonPatterns(availableFields) {
|
|
|
30609
31615
|
}
|
|
30610
31616
|
|
|
30611
31617
|
//#endregion
|
|
30612
|
-
//#region ../mcp-core/dist/otel-semantics-
|
|
31618
|
+
//#region ../mcp-core/dist/otel-semantics-D9c5D-bO.js
|
|
30613
31619
|
var namespace$72 = "android";
|
|
30614
31620
|
var description$72 = "The Android platform on which the Android application is running.\n";
|
|
30615
31621
|
var attributes$72 = {
|
|
@@ -35631,7 +36637,7 @@ function createOtelLookupTool(options) {
|
|
|
35631
36637
|
}
|
|
35632
36638
|
|
|
35633
36639
|
//#endregion
|
|
35634
|
-
//#region ../mcp-core/dist/whoami-
|
|
36640
|
+
//#region ../mcp-core/dist/whoami-B81Oqo48.js
|
|
35635
36641
|
/**
|
|
35636
36642
|
* Get the current authenticated user's information from Sentry API
|
|
35637
36643
|
*/
|
|
@@ -35660,7 +36666,7 @@ function createWhoamiTool(options) {
|
|
|
35660
36666
|
}
|
|
35661
36667
|
|
|
35662
36668
|
//#endregion
|
|
35663
|
-
//#region ../mcp-core/dist/utils-
|
|
36669
|
+
//#region ../mcp-core/dist/utils-DNoGJro2.js
|
|
35664
36670
|
const DEFAULT_MAX_VALUE_LENGTH = 200;
|
|
35665
36671
|
const DEFAULT_MAX_ARRAY_ITEMS = 20;
|
|
35666
36672
|
const SENTRY_SEARCH_TOKEN_PATTERN = /(^|\s)!?([A-Za-z_][A-Za-z0-9_.[\],-]*):(?=\S)(?!\/\/)/g;
|
|
@@ -36121,7 +37127,7 @@ function createDatasetAttributesTool(options) {
|
|
|
36121
37127
|
attributeTypes: zod.z.array(traceItemAttributeTypeSchema).min(1).optional().describe("Optional attribute types to list. Use ['string','number','boolean'] when unsure.")
|
|
36122
37128
|
}),
|
|
36123
37129
|
execute: async ({ dataset, substringMatch, query, attributeTypes }) => {
|
|
36124
|
-
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await Promise.resolve().then(() => require("./config-
|
|
37130
|
+
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await Promise.resolve().then(() => require("./config-DRWtJff1.cjs"));
|
|
36125
37131
|
const normalizedDataset = require_constants.normalizeEventsDataset(dataset);
|
|
36126
37132
|
const attributeTimeParams = { statsPeriod: "14d" };
|
|
36127
37133
|
const { attributes: customAttributes, fieldTypes } = await fetchCustomAttributes(apiService, organizationSlug, dataset, projectId, attributeTimeParams, {
|
|
@@ -36211,14 +37217,18 @@ function createValidateEventsSearchTool(options) {
|
|
|
36211
37217
|
}
|
|
36212
37218
|
|
|
36213
37219
|
//#endregion
|
|
36214
|
-
//#region ../mcp-core/dist/agent-
|
|
37220
|
+
//#region ../mcp-core/dist/agent-D-RH-_8n.js
|
|
36215
37221
|
const SEARCH_EVENTS_DATASETS$1 = [...require_constants.PUBLIC_EVENTS_DATASETS, "replays"];
|
|
36216
37222
|
const searchEventsAgentOutputSchema = zod.z.object({
|
|
36217
37223
|
dataset: zod.z.enum(SEARCH_EVENTS_DATASETS$1).describe("Which dataset to use for the query"),
|
|
36218
37224
|
query: zod.z.string().describe("The Sentry query string for filtering results"),
|
|
36219
37225
|
fields: zod.z.array(zod.z.string()).describe("Array of field names to return in results."),
|
|
36220
37226
|
sort: zod.z.string().describe("Sort parameter for results."),
|
|
36221
|
-
environment: zod.z.union([zod.z.string(), zod.z.array(zod.z.string()).min(1)]).nullable().default(null).describe("Separate environment filter for datasets like replays that do not support environment in the query string.
|
|
37227
|
+
environment: zod.z.union([zod.z.string().min(1), zod.z.array(zod.z.string().min(1)).min(1)]).nullable().default(null).describe("Separate environment filter for datasets like replays that do not support environment in the query string. Set only to a real environment the user named (see the 'Available environments' list); omit otherwise. Never use wildcards, placeholders, or example values."),
|
|
37228
|
+
timeSeries: zod.z.object({
|
|
37229
|
+
yAxis: zod.z.string().describe("The aggregate to plot over time, e.g. 'count()', 'count_unique(user)', 'sum(span.duration)'."),
|
|
37230
|
+
interval: zod.z.string().nullable().default(null).describe("Bucket size like '1h' or '1d'. Set ONLY when the user names a granularity (e.g. 'per hour' -> '1h'); otherwise null so Sentry picks a sensible bucket for the time range.")
|
|
37231
|
+
}).nullable().default(null).describe("Set ONLY when the user wants a metric OVER TIME (e.g. 'per hour', 'per day', 'trend', 'over time'). Otherwise leave null and return a normal query. The interval is decided here, never required from the caller."),
|
|
36222
37232
|
timeRange: zod.z.union([
|
|
36223
37233
|
zod.z.object({ statsPeriod: zod.z.string().describe("Relative time period like '1h', '24h', '7d'") }),
|
|
36224
37234
|
zod.z.object({
|
|
@@ -36230,10 +37240,44 @@ const searchEventsAgentOutputSchema = zod.z.object({
|
|
|
36230
37240
|
explanation: zod.z.string().default("").describe("Brief explanation of how you translated this query.")
|
|
36231
37241
|
}).refine((data) => {
|
|
36232
37242
|
if (data.dataset === "replays") return true;
|
|
37243
|
+
if (data.timeSeries) return true;
|
|
36233
37244
|
if (!data.sort || !data.fields || data.fields.length === 0) return true;
|
|
36234
37245
|
const sortField = data.sort.startsWith("-") ? data.sort.substring(1) : data.sort;
|
|
36235
37246
|
return data.fields.includes(sortField);
|
|
36236
37247
|
}, { 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." });
|
|
37248
|
+
const MAX_INLINE_ENVIRONMENTS = 100;
|
|
37249
|
+
/**
|
|
37250
|
+
* Append the organization's real environment names to the system prompt.
|
|
37251
|
+
*
|
|
37252
|
+
* Without this the model invents `environment` values (e.g. `":null"`, `".*"`)
|
|
37253
|
+
* that Sentry rejects, burning the step budget and producing no output — the top
|
|
37254
|
+
* source of search_events failures. Grounding it lets the model pick a real one
|
|
37255
|
+
* or omit the field.
|
|
37256
|
+
*/
|
|
37257
|
+
function buildSystemPromptWithEnvironments(base, environmentNames) {
|
|
37258
|
+
if (environmentNames.length === 0) return base;
|
|
37259
|
+
const rule = "When the user names an environment, set the `environment` field to a matching value from this list EXACTLY; otherwise OMIT the field. Never use wildcards, placeholders, \"null\", \"*\", empty strings, or example values.";
|
|
37260
|
+
if (environmentNames.length <= MAX_INLINE_ENVIRONMENTS) {
|
|
37261
|
+
const list = environmentNames.map((name$4) => `"${name$4}"`).join(", ");
|
|
37262
|
+
return `${base}\n\n## Available environments\nThe only valid \`environment\` values for this organization are: ${list}.\n${rule}`;
|
|
37263
|
+
}
|
|
37264
|
+
return `${base}\n\n## Environments\nThis organization has ${environmentNames.length} environments. ${rule}`;
|
|
37265
|
+
}
|
|
37266
|
+
/**
|
|
37267
|
+
* Best-effort fetch of the org's environment names (scoped to the project when
|
|
37268
|
+
* known). Failures are non-fatal — callers still run, just without grounding.
|
|
37269
|
+
*/
|
|
37270
|
+
async function fetchEnvironmentNames(options) {
|
|
37271
|
+
try {
|
|
37272
|
+
const environments = await options.apiService.listEnvironments({
|
|
37273
|
+
organizationSlug: options.organizationSlug,
|
|
37274
|
+
projectId: options.projectId
|
|
37275
|
+
});
|
|
37276
|
+
return environments.map((environment) => environment.name).filter((name$4) => name$4.length > 0);
|
|
37277
|
+
} catch {
|
|
37278
|
+
return [];
|
|
37279
|
+
}
|
|
37280
|
+
}
|
|
36237
37281
|
/**
|
|
36238
37282
|
* Search events agent - single entry point for translating natural language queries to Sentry search syntax
|
|
36239
37283
|
* This returns both the translated query result AND the tool calls made by the agent
|
|
@@ -36261,8 +37305,9 @@ async function searchEventsAgent(options) {
|
|
|
36261
37305
|
projectId: options.projectId
|
|
36262
37306
|
});
|
|
36263
37307
|
const whoamiTool = createWhoamiTool({ apiService: options.apiService });
|
|
37308
|
+
const environmentNames = options.environmentNames ?? await fetchEnvironmentNames(options);
|
|
36264
37309
|
return await callEmbeddedAgent({
|
|
36265
|
-
system:
|
|
37310
|
+
system: buildSystemPromptWithEnvironments(require_config_B_l88mOS.systemPrompt, environmentNames),
|
|
36266
37311
|
prompt: options.query,
|
|
36267
37312
|
tools: {
|
|
36268
37313
|
datasetAttributes: datasetAttributesTool,
|
|
@@ -36276,7 +37321,7 @@ async function searchEventsAgent(options) {
|
|
|
36276
37321
|
}
|
|
36277
37322
|
|
|
36278
37323
|
//#endregion
|
|
36279
|
-
//#region ../mcp-core/dist/analyzer-
|
|
37324
|
+
//#region ../mcp-core/dist/analyzer-BuS9K0e5.js
|
|
36280
37325
|
/**
|
|
36281
37326
|
* Analyzes flamegraph data to extract hot paths (most CPU-intensive call stacks).
|
|
36282
37327
|
*
|
|
@@ -36535,7 +37580,7 @@ function hasProfileData(flamegraph) {
|
|
|
36535
37580
|
}
|
|
36536
37581
|
|
|
36537
37582
|
//#endregion
|
|
36538
|
-
//#region ../mcp-core/dist/formatters-
|
|
37583
|
+
//#region ../mcp-core/dist/formatters-DsABISrU.js
|
|
36539
37584
|
/**
|
|
36540
37585
|
* Format an explanation for how the input query was translated
|
|
36541
37586
|
*/
|
|
@@ -37000,9 +38045,47 @@ function formatTraceMetricsResults(params) {
|
|
|
37000
38045
|
output += "- Switch between samples and aggregates in Sentry for deeper analysis\n";
|
|
37001
38046
|
return output;
|
|
37002
38047
|
}
|
|
38048
|
+
/**
|
|
38049
|
+
* Whether summing per-bucket values yields a meaningful series total.
|
|
38050
|
+
* Only `count()` and `sum(...)` are additive across time buckets;
|
|
38051
|
+
* `count_unique`, `avg`, percentiles, min/max, rates, etc. are not.
|
|
38052
|
+
*/
|
|
38053
|
+
function isAdditiveAggregate(yAxis) {
|
|
38054
|
+
const fn = yAxis.trim().toLowerCase();
|
|
38055
|
+
return fn === "count()" || fn.startsWith("sum(");
|
|
38056
|
+
}
|
|
38057
|
+
/**
|
|
38058
|
+
* Format an events-stats (timeseries) result: a metric bucketed over time.
|
|
38059
|
+
* `interval` is null when Sentry chose the bucket size for the range.
|
|
38060
|
+
*/
|
|
38061
|
+
function formatTimeSeriesResults(params) {
|
|
38062
|
+
const { series, yAxis, interval, inputQuery, includeExplanation, explanation, timeRange, url } = params;
|
|
38063
|
+
const points = series.data.map(([ts, values]) => ({
|
|
38064
|
+
time: (/* @__PURE__ */ new Date(ts * 1e3)).toISOString().slice(0, 16).replace("T", " "),
|
|
38065
|
+
value: values[0]?.count ?? 0
|
|
38066
|
+
}));
|
|
38067
|
+
const total = isAdditiveAggregate(yAxis) ? points.reduce((sum, p) => sum + p.value, 0) : null;
|
|
38068
|
+
const peak = points.reduce((max, p) => max === void 0 || p.value > max.value ? p : max, void 0);
|
|
38069
|
+
const MAX_ROWS = 48;
|
|
38070
|
+
const shown = points.length > MAX_ROWS ? points.slice(-MAX_ROWS) : points;
|
|
38071
|
+
const truncatedNote = points.length > MAX_ROWS ? ` (most recent ${MAX_ROWS} of ${points.length})` : "";
|
|
38072
|
+
const lines = [`# Search Results for "${inputQuery}"`];
|
|
38073
|
+
if (includeExplanation && explanation) lines.push("", formatExplanation$1(explanation));
|
|
38074
|
+
lines.push("", `## ${yAxis} over time`);
|
|
38075
|
+
lines.push(`- **Interval**: ${interval ? `\`${interval}\`` : "auto (chosen by Sentry for the range)"}`);
|
|
38076
|
+
lines.push(`- **Time range**: ${formatExecutedTimeRange(timeRange)}`);
|
|
38077
|
+
if (total !== null) lines.push(`- **Total**: ${total.toLocaleString()}`);
|
|
38078
|
+
if (peak) lines.push(`- **Peak**: ${peak.value.toLocaleString()} at ${peak.time}`);
|
|
38079
|
+
if (shown.length > 0) {
|
|
38080
|
+
lines.push("", `## Buckets${truncatedNote}`, "", "| Time (UTC) | Value |", "| --- | --- |");
|
|
38081
|
+
for (const p of shown) lines.push(`| ${p.time} | ${p.value.toLocaleString()} |`);
|
|
38082
|
+
} else lines.push("", "No data points in this range.");
|
|
38083
|
+
if (url) lines.push("", formatSentryDashboardLink(url).trimEnd());
|
|
38084
|
+
return lines.join("\n");
|
|
38085
|
+
}
|
|
37003
38086
|
|
|
37004
38087
|
//#endregion
|
|
37005
|
-
//#region ../mcp-core/dist/replays-
|
|
38088
|
+
//#region ../mcp-core/dist/replays-DQeYjWub.js
|
|
37006
38089
|
const DEFAULT_REPLAY_SORT = "-started_at";
|
|
37007
38090
|
const DEFAULT_REPLAY_STATS_PERIOD = "14d";
|
|
37008
38091
|
const REPLAY_SORT_FIELDS = [
|
|
@@ -37127,14 +38210,14 @@ function formatReplayEnvironment(environment) {
|
|
|
37127
38210
|
}
|
|
37128
38211
|
|
|
37129
38212
|
//#endregion
|
|
37130
|
-
//#region ../mcp-core/dist/search-events-
|
|
38213
|
+
//#region ../mcp-core/dist/search-events-BFGK2Xtv.js
|
|
37131
38214
|
const SEARCH_EVENTS_DATASETS = [...require_constants.PUBLIC_EVENTS_DATASETS, "replays"];
|
|
37132
38215
|
const DEFAULT_EVENTS_SORT = "-timestamp";
|
|
37133
38216
|
function defaultSortForDataset(dataset) {
|
|
37134
38217
|
return dataset === "replays" ? DEFAULT_REPLAY_SORT : DEFAULT_EVENTS_SORT;
|
|
37135
38218
|
}
|
|
37136
38219
|
function defaultFieldsForDataset(dataset) {
|
|
37137
|
-
return
|
|
38220
|
+
return require_config_B_l88mOS.RECOMMENDED_FIELDS[require_constants.normalizeEventsDataset(dataset)].basic;
|
|
37138
38221
|
}
|
|
37139
38222
|
function resolveEventFields({ dataset, explicitFields, agentFields, trustExplicitFields }) {
|
|
37140
38223
|
if (trustExplicitFields && explicitFields && explicitFields.length > 0) return explicitFields;
|
|
@@ -37157,7 +38240,7 @@ function augmentFieldsWithSort(fields, sort) {
|
|
|
37157
38240
|
return fields;
|
|
37158
38241
|
}
|
|
37159
38242
|
function buildRequestFields(dataset, fields) {
|
|
37160
|
-
return dataset !== "replays" && require_constants.isMetricsDataset(dataset) && !isAggregateQuery(fields) ? Array.from(new Set([...fields, ...
|
|
38243
|
+
return dataset !== "replays" && require_constants.isMetricsDataset(dataset) && !isAggregateQuery(fields) ? Array.from(new Set([...fields, ...require_config_B_l88mOS.TRACE_METRICS_SAMPLE_IDENTITY_FIELDS])) : fields;
|
|
37161
38244
|
}
|
|
37162
38245
|
function isTraceItemDataset(dataset) {
|
|
37163
38246
|
return dataset === "spans" || dataset === "logs" || dataset === "metrics";
|
|
@@ -37184,6 +38267,42 @@ function appendSearchFilter(query, filter$1) {
|
|
|
37184
38267
|
if (tokenizeSearchQuery(trimmedQuery).includes(filter$1)) return trimmedQuery;
|
|
37185
38268
|
return [trimmedQuery, filter$1].filter(Boolean).join(" ");
|
|
37186
38269
|
}
|
|
38270
|
+
/**
|
|
38271
|
+
* Collect the environment names a search actually filters on — from both the
|
|
38272
|
+
* separate `environment` field and any `environment:` token in the query string.
|
|
38273
|
+
* Sentry only validates the former against real environments, so a bad value in
|
|
38274
|
+
* the query (e.g. a typo) otherwise slips through and silently returns nothing.
|
|
38275
|
+
*/
|
|
38276
|
+
function collectRequestedEnvironments(environment, query) {
|
|
38277
|
+
const values = [];
|
|
38278
|
+
if (typeof environment === "string") values.push(environment);
|
|
38279
|
+
else if (Array.isArray(environment)) values.push(...environment);
|
|
38280
|
+
const tokens = tokenizeSearchQuery(query);
|
|
38281
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
38282
|
+
const match = /^environment:(.*)$/is.exec(tokens[i]);
|
|
38283
|
+
if (!match) continue;
|
|
38284
|
+
let value = match[1];
|
|
38285
|
+
while (value.startsWith("[") && !value.includes("]") && i + 1 < tokens.length) value += ` ${tokens[++i]}`;
|
|
38286
|
+
const inner = value.startsWith("[") && value.endsWith("]") ? value.slice(1, -1) : value;
|
|
38287
|
+
for (const part of inner.split(",")) {
|
|
38288
|
+
const cleaned = part.trim().replace(/^["']|["']$/g, "");
|
|
38289
|
+
if (cleaned) values.push(cleaned);
|
|
38290
|
+
}
|
|
38291
|
+
}
|
|
38292
|
+
return values;
|
|
38293
|
+
}
|
|
38294
|
+
/**
|
|
38295
|
+
* Note listing the org's real environments when a search references one that
|
|
38296
|
+
* doesn't exist, so the caller can retry with a valid name. We don't guess a
|
|
38297
|
+
* match — the calling agent maps from the list.
|
|
38298
|
+
*/
|
|
38299
|
+
function formatUnknownEnvironmentNote(unknown, available) {
|
|
38300
|
+
const uniqueUnknown = [...new Set(unknown)].map((name$4) => `\`${name$4}\``);
|
|
38301
|
+
const shown = available.slice(0, 50).map((name$4) => `\`${name$4}\``);
|
|
38302
|
+
const more = available.length > shown.length ? ` (${available.length} total)` : "";
|
|
38303
|
+
const label = uniqueUnknown.length === 1 ? "environment" : "environments";
|
|
38304
|
+
return `> ⚠️ Requested ${label} not found in this organization: ${uniqueUnknown.join(", ")}. Available environments: ${shown.join(", ")}${more}. Re-run filtering by one of these, or omit the environment to search all.`;
|
|
38305
|
+
}
|
|
37187
38306
|
function applyEnvironmentToEventsQuery(dataset, query, environment) {
|
|
37188
38307
|
if (dataset === "replays") return query;
|
|
37189
38308
|
return appendSearchFilter(query, formatEnvironmentFilter(environment));
|
|
@@ -37275,11 +38394,12 @@ var search_events_default = defineTool({
|
|
|
37275
38394
|
description: [
|
|
37276
38395
|
"Search Sentry events and replays. Use for event counts/statistics.",
|
|
37277
38396
|
"",
|
|
37278
|
-
"`query`
|
|
38397
|
+
"`query` is natural language or Sentry search syntax; a configured agent fixes dataset, query, fields, and sort.",
|
|
37279
38398
|
"",
|
|
37280
|
-
"Supports
|
|
38399
|
+
"Supports THREE query types:",
|
|
37281
38400
|
"1. AGGREGATIONS (counts, sums, averages): 'how many errors', 'total tokens'",
|
|
37282
38401
|
"2. Individual events with timestamps: 'error logs from last hour'",
|
|
38402
|
+
"3. TIME SERIES (metric over time): 'errors per hour', 'error trend over time'",
|
|
37283
38403
|
"",
|
|
37284
38404
|
"Datasets:",
|
|
37285
38405
|
"- errors: Exception/crash events with stack traces, usually grouped into issues",
|
|
@@ -37296,15 +38416,14 @@ var search_events_default = defineTool({
|
|
|
37296
38416
|
"",
|
|
37297
38417
|
"<examples>",
|
|
37298
38418
|
"search_events(organizationSlug='my-org', query='how many errors today')",
|
|
37299
|
-
"search_events(organizationSlug='my-org', dataset='errors', query='level:error')",
|
|
37300
38419
|
"search_events(organizationSlug='my-org', dataset='errors', fields=['issue', 'count()'], sort='-count()')",
|
|
38420
|
+
"search_events(organizationSlug='my-org', query='errors per hour last 24h')",
|
|
37301
38421
|
"search_events(organizationSlug='my-org', dataset='spans', query='span.op:db', sort='-span.duration')",
|
|
37302
38422
|
"search_events(organizationSlug='my-org', dataset='replays', query='count_errors:>0', sort='-count_errors')",
|
|
37303
38423
|
"</examples>",
|
|
37304
38424
|
"",
|
|
37305
38425
|
"<hints>",
|
|
37306
|
-
"-
|
|
37307
|
-
"- Parse org/project notation directly without calling find_organizations or find_projects.",
|
|
38426
|
+
"- name/otherName notation means <organizationSlug>/<projectSlug>; parse it directly, don't call find_organizations/find_projects.",
|
|
37308
38427
|
"- Use fields with aggregate functions like count(), avg(), sum() for statistics",
|
|
37309
38428
|
"- Sort by -count() for most common, -timestamp for newest",
|
|
37310
38429
|
"</hints>"
|
|
@@ -37327,10 +38446,22 @@ var search_events_default = defineTool({
|
|
|
37327
38446
|
destructiveHint: false,
|
|
37328
38447
|
openWorldHint: true
|
|
37329
38448
|
},
|
|
38449
|
+
onError(error, params, context$1) {
|
|
38450
|
+
const query = params.query;
|
|
38451
|
+
logWarn("search_events query failed", {
|
|
38452
|
+
loggerScope: ["tools", "search_events"],
|
|
38453
|
+
extra: {
|
|
38454
|
+
errorName: error instanceof Error ? error.name : typeof error,
|
|
38455
|
+
errorMessage: scrubSensitiveText(error instanceof Error ? error.message : String(error)),
|
|
38456
|
+
organizationSlug: (typeof params.organizationSlug === "string" ? params.organizationSlug : null) ?? context$1.constraints.organizationSlug,
|
|
38457
|
+
query: typeof query === "string" ? scrubSensitiveText(query) : null
|
|
38458
|
+
}
|
|
38459
|
+
});
|
|
38460
|
+
},
|
|
37330
38461
|
async handler(params, context$1) {
|
|
37331
38462
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37332
38463
|
const organizationSlug = params.organizationSlug;
|
|
37333
|
-
(
|
|
38464
|
+
setOrganizationContext(organizationSlug);
|
|
37334
38465
|
if (params.projectSlug) (0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
37335
38466
|
const inputDataset = params.dataset ?? "errors";
|
|
37336
38467
|
const hasStructuredQuery = looksLikeSentrySearchSyntax(params.query);
|
|
@@ -37351,6 +38482,7 @@ var search_events_default = defineTool({
|
|
|
37351
38482
|
let timeParams;
|
|
37352
38483
|
let explanation;
|
|
37353
38484
|
let environment = params.environment;
|
|
38485
|
+
let timeSeries = null;
|
|
37354
38486
|
const explicitSort = params.sort?.trim() || void 0;
|
|
37355
38487
|
const hasExplicitDataset = params.dataset !== void 0;
|
|
37356
38488
|
const hasExplicitFields = hasFields(params.fields);
|
|
@@ -37361,7 +38493,15 @@ var search_events_default = defineTool({
|
|
|
37361
38493
|
const environmentFilter = formatEnvironmentFilter(params.environment);
|
|
37362
38494
|
const explicitStructuredTraceQuery = shouldTrustStructuredTraceSearch ? appendSearchFilter(params.query ?? "", environmentFilter) : params.query ?? "";
|
|
37363
38495
|
const canRunWithoutAgent = shouldTrustStructuredTraceSearch && hasExplicitFields && hasExplicitSort;
|
|
37364
|
-
|
|
38496
|
+
const willRunAgent = hasAgentProvider() && !canRunWithoutAgent;
|
|
38497
|
+
const inputReferencesEnvironment = params.environment != null || collectRequestedEnvironments(null, params.query ?? "").length > 0;
|
|
38498
|
+
const environmentNames = willRunAgent || inputReferencesEnvironment ? await fetchEnvironmentNames({
|
|
38499
|
+
apiService,
|
|
38500
|
+
organizationSlug,
|
|
38501
|
+
projectId
|
|
38502
|
+
}) : [];
|
|
38503
|
+
const knownEnvironments = new Set(environmentNames.map((name$4) => name$4.toLowerCase()));
|
|
38504
|
+
if (willRunAgent) {
|
|
37365
38505
|
const parsed = await withProviderFallback({
|
|
37366
38506
|
operation: "search_events.rewrite",
|
|
37367
38507
|
fallback: () => ({
|
|
@@ -37370,6 +38510,7 @@ var search_events_default = defineTool({
|
|
|
37370
38510
|
fields: inputDataset === "replays" ? [] : params.fields ?? defaultFieldsForDataset(inputDataset),
|
|
37371
38511
|
sort: explicitSort || defaultSortForDataset(inputDataset),
|
|
37372
38512
|
environment: params.environment ?? null,
|
|
38513
|
+
timeSeries: null,
|
|
37373
38514
|
timeRange: { statsPeriod: params.period ?? "14d" },
|
|
37374
38515
|
explanation: ""
|
|
37375
38516
|
}),
|
|
@@ -37384,11 +38525,13 @@ var search_events_default = defineTool({
|
|
|
37384
38525
|
}),
|
|
37385
38526
|
organizationSlug,
|
|
37386
38527
|
apiService,
|
|
37387
|
-
projectId
|
|
38528
|
+
projectId,
|
|
38529
|
+
environmentNames
|
|
37388
38530
|
})).result
|
|
37389
38531
|
});
|
|
37390
38532
|
const shouldTrustExplicitSearchParams = shouldTrustStructuredTraceSearch || hasStructuredQuery && parsed.dataset === inputDataset;
|
|
37391
|
-
|
|
38533
|
+
timeSeries = parsed.timeSeries ?? null;
|
|
38534
|
+
if (!timeSeries && !parsed.sort?.trim() && !(shouldTrustExplicitSearchParams && hasExplicitSort)) 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).`);
|
|
37392
38535
|
dataset = shouldTrustStructuredTraceSearch ? inputDataset : parsed.dataset;
|
|
37393
38536
|
sentryQuery = shouldTrustStructuredTraceSearch ? choosePreservingRepairedQuery({
|
|
37394
38537
|
originalQuery: params.query ?? "",
|
|
@@ -37413,6 +38556,9 @@ var search_events_default = defineTool({
|
|
|
37413
38556
|
timeParams = { statsPeriod: params.period ?? "14d" };
|
|
37414
38557
|
fields = dataset === "replays" ? [] : params.fields ?? defaultFieldsForDataset(dataset);
|
|
37415
38558
|
}
|
|
38559
|
+
const unknownEnvironments = knownEnvironments.size > 0 ? collectRequestedEnvironments(environment, sentryQuery).filter((name$4) => !knownEnvironments.has(name$4.toLowerCase())) : [];
|
|
38560
|
+
const environmentNote = unknownEnvironments.length > 0 ? formatUnknownEnvironmentNote(unknownEnvironments, environmentNames) : "";
|
|
38561
|
+
const withEnvironmentNote = (text$1) => environmentNote ? `${environmentNote}\n\n${text$1}` : text$1;
|
|
37416
38562
|
if (dataset === "replays") {
|
|
37417
38563
|
const replaySort = sortParam || DEFAULT_REPLAY_SORT;
|
|
37418
38564
|
if (!isValidReplaySort(replaySort)) throw new UserInputError(`Invalid replay sort "${replaySort}". Use a supported replay sort like ${DEFAULT_REPLAY_SORT}, -count_errors, -count_rage_clicks, or -duration.`);
|
|
@@ -37435,7 +38581,7 @@ var search_events_default = defineTool({
|
|
|
37435
38581
|
...replayTimeParams
|
|
37436
38582
|
});
|
|
37437
38583
|
(0, __sentry_core.getActiveSpan)()?.setAttribute("gen_ai.tool.call.result.count", replays.length);
|
|
37438
|
-
|
|
38584
|
+
const replayOutput = formatReplayResults({
|
|
37439
38585
|
replays,
|
|
37440
38586
|
inputQuery: params.query || sentryQuery || "recent replays",
|
|
37441
38587
|
includeExplanation: params.includeExplanation,
|
|
@@ -37458,6 +38604,30 @@ var search_events_default = defineTool({
|
|
|
37458
38604
|
availableToolNames: context$1.availableToolNames,
|
|
37459
38605
|
directToolNames: context$1.directToolNames
|
|
37460
38606
|
});
|
|
38607
|
+
return withEnvironmentNote(replayOutput);
|
|
38608
|
+
}
|
|
38609
|
+
if (timeSeries) {
|
|
38610
|
+
const timeSeriesQuery = applyEnvironmentToEventsQuery(dataset, sentryQuery, environment);
|
|
38611
|
+
const series = await apiService.getEventsTimeSeries({
|
|
38612
|
+
organizationSlug,
|
|
38613
|
+
query: timeSeriesQuery,
|
|
38614
|
+
yAxis: timeSeries.yAxis,
|
|
38615
|
+
interval: timeSeries.interval ?? void 0,
|
|
38616
|
+
projectId,
|
|
38617
|
+
dataset,
|
|
38618
|
+
...timeParams
|
|
38619
|
+
});
|
|
38620
|
+
const statsUrl = apiService.getEventsExplorerUrl(organizationSlug, timeSeriesQuery, projectId, dataset, [timeSeries.yAxis], `-${timeSeries.yAxis}`, [timeSeries.yAxis], [], timeParams.statsPeriod, timeParams.start, timeParams.end);
|
|
38621
|
+
return withEnvironmentNote(formatTimeSeriesResults({
|
|
38622
|
+
series,
|
|
38623
|
+
yAxis: timeSeries.yAxis,
|
|
38624
|
+
interval: timeSeries.interval,
|
|
38625
|
+
inputQuery: params.query || timeSeriesQuery,
|
|
38626
|
+
includeExplanation: params.includeExplanation,
|
|
38627
|
+
explanation,
|
|
38628
|
+
timeRange: timeParams,
|
|
38629
|
+
url: statsUrl
|
|
38630
|
+
}));
|
|
37461
38631
|
}
|
|
37462
38632
|
fields = augmentFieldsWithSort(fields, sortParam);
|
|
37463
38633
|
const requestFields = buildRequestFields(dataset, fields);
|
|
@@ -37528,17 +38698,17 @@ var search_events_default = defineTool({
|
|
|
37528
38698
|
directToolNames: context$1.directToolNames
|
|
37529
38699
|
};
|
|
37530
38700
|
switch (dataset) {
|
|
37531
|
-
case "errors": return formatErrorResults(formatParams);
|
|
37532
|
-
case "logs": return formatLogResults(formatParams);
|
|
37533
|
-
case "spans": return formatSpanResults(formatParams);
|
|
37534
|
-
case "profiles": return formatProfileResults(formatParams);
|
|
37535
|
-
default: return formatTraceMetricsResults(formatParams);
|
|
38701
|
+
case "errors": return withEnvironmentNote(formatErrorResults(formatParams));
|
|
38702
|
+
case "logs": return withEnvironmentNote(formatLogResults(formatParams));
|
|
38703
|
+
case "spans": return withEnvironmentNote(formatSpanResults(formatParams));
|
|
38704
|
+
case "profiles": return withEnvironmentNote(formatProfileResults(formatParams));
|
|
38705
|
+
default: return withEnvironmentNote(formatTraceMetricsResults(formatParams));
|
|
37536
38706
|
}
|
|
37537
38707
|
}
|
|
37538
38708
|
});
|
|
37539
38709
|
|
|
37540
38710
|
//#endregion
|
|
37541
|
-
//#region ../mcp-core/dist/create-team-
|
|
38711
|
+
//#region ../mcp-core/dist/create-team-CgnBfkV1.js
|
|
37542
38712
|
const createTeamOutputSchema = zod.z.object({ team: zod.z.object({
|
|
37543
38713
|
id: zod.z.string(),
|
|
37544
38714
|
slug: zod.z.string(),
|
|
@@ -37583,7 +38753,7 @@ var create_team_default = defineTool({
|
|
|
37583
38753
|
async handler(params, context$1) {
|
|
37584
38754
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37585
38755
|
const organizationSlug = params.organizationSlug;
|
|
37586
|
-
(
|
|
38756
|
+
setOrganizationContext(organizationSlug);
|
|
37587
38757
|
const team = await apiService.createTeam({
|
|
37588
38758
|
organizationSlug,
|
|
37589
38759
|
name: params.name
|
|
@@ -37597,7 +38767,7 @@ var create_team_default = defineTool({
|
|
|
37597
38767
|
});
|
|
37598
38768
|
|
|
37599
38769
|
//#endregion
|
|
37600
|
-
//#region ../mcp-core/dist/create-project-
|
|
38770
|
+
//#region ../mcp-core/dist/create-project-BHO4uN-y.js
|
|
37601
38771
|
function getUsableClientKey(clientKeys) {
|
|
37602
38772
|
return clientKeys.find((key) => key.name === "Default" && key.isActive && key.dsn.public) ?? clientKeys.find((key) => key.isActive && key.dsn.public);
|
|
37603
38773
|
}
|
|
@@ -37693,7 +38863,7 @@ var create_project_default = defineTool({
|
|
|
37693
38863
|
async handler(params, context$1) {
|
|
37694
38864
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37695
38865
|
const organizationSlug = params.organizationSlug;
|
|
37696
|
-
(
|
|
38866
|
+
setOrganizationContext(organizationSlug);
|
|
37697
38867
|
(0, __sentry_core.setTag)("team.slug", params.teamSlug);
|
|
37698
38868
|
const repositoryMatch = params.repository ? findRepositoryMatch(await apiService.listRepos({ organizationSlug }), params.repository) : null;
|
|
37699
38869
|
const project = await apiService.createProject({
|
|
@@ -37753,7 +38923,7 @@ var create_project_default = defineTool({
|
|
|
37753
38923
|
});
|
|
37754
38924
|
|
|
37755
38925
|
//#endregion
|
|
37756
|
-
//#region ../mcp-core/dist/update-project-
|
|
38926
|
+
//#region ../mcp-core/dist/update-project-CQdb0Elv.js
|
|
37757
38927
|
const updateProjectOutputSchema = zod.z.object({ project: zod.z.object({
|
|
37758
38928
|
id: zod.z.string(),
|
|
37759
38929
|
slug: zod.z.string(),
|
|
@@ -37814,7 +38984,7 @@ var update_project_default = defineTool({
|
|
|
37814
38984
|
async handler(params, context$1) {
|
|
37815
38985
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37816
38986
|
const organizationSlug = params.organizationSlug;
|
|
37817
|
-
(
|
|
38987
|
+
setOrganizationContext(organizationSlug);
|
|
37818
38988
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
37819
38989
|
const hasProjectUpdates = params.name || params.slug || params.platform;
|
|
37820
38990
|
if (!hasProjectUpdates) throw new UserInputError("At least one project metadata field is required: `name`, `slug`, or `platform`.");
|
|
@@ -37842,7 +39012,7 @@ var update_project_default = defineTool({
|
|
|
37842
39012
|
});
|
|
37843
39013
|
|
|
37844
39014
|
//#endregion
|
|
37845
|
-
//#region ../mcp-core/dist/add-team-to-project-
|
|
39015
|
+
//#region ../mcp-core/dist/add-team-to-project-CNjkc5mL.js
|
|
37846
39016
|
const assignedTeamSchema$1 = zod.z.object({
|
|
37847
39017
|
id: zod.z.string(),
|
|
37848
39018
|
slug: zod.z.string(),
|
|
@@ -37900,7 +39070,7 @@ var add_team_to_project_default = defineTool({
|
|
|
37900
39070
|
async handler(params, context$1) {
|
|
37901
39071
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37902
39072
|
const organizationSlug = params.organizationSlug;
|
|
37903
|
-
(
|
|
39073
|
+
setOrganizationContext(organizationSlug);
|
|
37904
39074
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
37905
39075
|
(0, __sentry_core.setTag)("team.slug", params.teamSlug);
|
|
37906
39076
|
const currentTeams = await apiService.listProjectTeams({
|
|
@@ -37929,7 +39099,7 @@ var add_team_to_project_default = defineTool({
|
|
|
37929
39099
|
});
|
|
37930
39100
|
|
|
37931
39101
|
//#endregion
|
|
37932
|
-
//#region ../mcp-core/dist/remove-team-from-project-
|
|
39102
|
+
//#region ../mcp-core/dist/remove-team-from-project-CM2_RkK5.js
|
|
37933
39103
|
const assignedTeamSchema = zod.z.object({
|
|
37934
39104
|
id: zod.z.string(),
|
|
37935
39105
|
slug: zod.z.string(),
|
|
@@ -37988,7 +39158,7 @@ var remove_team_from_project_default = defineTool({
|
|
|
37988
39158
|
async handler(params, context$1) {
|
|
37989
39159
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37990
39160
|
const organizationSlug = params.organizationSlug;
|
|
37991
|
-
(
|
|
39161
|
+
setOrganizationContext(organizationSlug);
|
|
37992
39162
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
37993
39163
|
(0, __sentry_core.setTag)("team.slug", params.teamSlug);
|
|
37994
39164
|
const currentTeams = await apiService.listProjectTeams({
|
|
@@ -38015,7 +39185,7 @@ var remove_team_from_project_default = defineTool({
|
|
|
38015
39185
|
});
|
|
38016
39186
|
|
|
38017
39187
|
//#endregion
|
|
38018
|
-
//#region ../mcp-core/dist/create-dsn-
|
|
39188
|
+
//#region ../mcp-core/dist/create-dsn-BtFKEMq7.js
|
|
38019
39189
|
const createDsnOutputSchema = zod.z.object({ dsn: zod.z.object({
|
|
38020
39190
|
id: zod.z.string(),
|
|
38021
39191
|
name: zod.z.string(),
|
|
@@ -38064,7 +39234,7 @@ var create_dsn_default = defineTool({
|
|
|
38064
39234
|
async handler(params, context$1) {
|
|
38065
39235
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
38066
39236
|
const organizationSlug = params.organizationSlug;
|
|
38067
|
-
(
|
|
39237
|
+
setOrganizationContext(organizationSlug);
|
|
38068
39238
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
38069
39239
|
const clientKey = await apiService.createClientKey({
|
|
38070
39240
|
organizationSlug,
|
|
@@ -38080,7 +39250,7 @@ var create_dsn_default = defineTool({
|
|
|
38080
39250
|
});
|
|
38081
39251
|
|
|
38082
39252
|
//#endregion
|
|
38083
|
-
//#region ../mcp-core/dist/find-dsns-
|
|
39253
|
+
//#region ../mcp-core/dist/find-dsns-CqiIxv7u.js
|
|
38084
39254
|
const findDsnsOutputSchema = zod.z.object({ dsns: zod.z.array(zod.z.object({
|
|
38085
39255
|
id: zod.z.string(),
|
|
38086
39256
|
name: zod.z.string(),
|
|
@@ -38115,7 +39285,7 @@ var find_dsns_default = defineTool({
|
|
|
38115
39285
|
async handler(params, context$1) {
|
|
38116
39286
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
38117
39287
|
const organizationSlug = params.organizationSlug;
|
|
38118
|
-
(
|
|
39288
|
+
setOrganizationContext(organizationSlug);
|
|
38119
39289
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
38120
39290
|
const clientKeys = await apiService.listClientKeys({
|
|
38121
39291
|
organizationSlug,
|
|
@@ -38130,7 +39300,7 @@ var find_dsns_default = defineTool({
|
|
|
38130
39300
|
});
|
|
38131
39301
|
|
|
38132
39302
|
//#endregion
|
|
38133
|
-
//#region ../mcp-core/dist/update-dsn-
|
|
39303
|
+
//#region ../mcp-core/dist/update-dsn-DP7ljBh8.js
|
|
38134
39304
|
var update_dsn_default = defineTool({
|
|
38135
39305
|
name: "update_dsn",
|
|
38136
39306
|
skills: ["project-management"],
|
|
@@ -38194,7 +39364,7 @@ var update_dsn_default = defineTool({
|
|
|
38194
39364
|
async handler(params, context$1) {
|
|
38195
39365
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
38196
39366
|
const organizationSlug = params.organizationSlug;
|
|
38197
|
-
(
|
|
39367
|
+
setOrganizationContext(organizationSlug);
|
|
38198
39368
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
38199
39369
|
const hasUpdates = params.name !== void 0 || params.isActive !== void 0 || params.disableRateLimit !== void 0 || params.rateLimitWindow !== void 0 || params.rateLimitCount !== void 0 || params.browserSdkVersion !== void 0 || params.loaderHasReplay !== void 0 || params.loaderHasPerformance !== void 0 || params.loaderHasDebug !== void 0 || params.loaderHasFeedback !== void 0 || params.loaderHasLogsAndMetrics !== void 0;
|
|
38200
39370
|
if (!hasUpdates) throw new UserInputError("At least one setting must be provided to update. Provide one or more of: name, isActive, rateLimitWindow + rateLimitCount, disableRateLimit, browserSdkVersion, or loader options.");
|
|
@@ -38264,57 +39434,7 @@ var update_dsn_default = defineTool({
|
|
|
38264
39434
|
});
|
|
38265
39435
|
|
|
38266
39436
|
//#endregion
|
|
38267
|
-
//#region ../mcp-core/dist/
|
|
38268
|
-
/**
|
|
38269
|
-
* Fetch with timeout using AbortController
|
|
38270
|
-
* @param url - The URL to fetch
|
|
38271
|
-
* @param options - Standard fetch options
|
|
38272
|
-
* @param timeoutMs - Timeout in milliseconds (default: 30000)
|
|
38273
|
-
* @returns Promise<Response>
|
|
38274
|
-
* @throws Error if request times out
|
|
38275
|
-
*/
|
|
38276
|
-
async function fetchWithTimeout(url, options = {}, timeoutMs = 3e4) {
|
|
38277
|
-
const controller = new AbortController();
|
|
38278
|
-
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
38279
|
-
try {
|
|
38280
|
-
const response = await fetch(url, {
|
|
38281
|
-
...options,
|
|
38282
|
-
signal: controller.signal
|
|
38283
|
-
});
|
|
38284
|
-
return response;
|
|
38285
|
-
} catch (error) {
|
|
38286
|
-
if (error instanceof Error && error.name === "AbortError") throw new Error(`Request timeout after ${timeoutMs}ms`);
|
|
38287
|
-
throw error;
|
|
38288
|
-
} finally {
|
|
38289
|
-
clearTimeout(timeoutId);
|
|
38290
|
-
}
|
|
38291
|
-
}
|
|
38292
|
-
/**
|
|
38293
|
-
* Retry a function with exponential backoff
|
|
38294
|
-
* @param fn - The async function to retry
|
|
38295
|
-
* @param options - Retry options
|
|
38296
|
-
* @param options.maxRetries - Maximum number of retries (default: 3)
|
|
38297
|
-
* @param options.initialDelay - Initial delay in milliseconds (default: 1000)
|
|
38298
|
-
* @param options.shouldRetry - Predicate to determine if error should be retried (default: always retry)
|
|
38299
|
-
* @returns Promise with the function result
|
|
38300
|
-
* @throws The last error if all retries are exhausted
|
|
38301
|
-
*/
|
|
38302
|
-
async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, shouldRetry = (error) => true } = {}) {
|
|
38303
|
-
let lastError;
|
|
38304
|
-
let delay$1 = initialDelay;
|
|
38305
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) try {
|
|
38306
|
-
return await fn();
|
|
38307
|
-
} catch (error) {
|
|
38308
|
-
lastError = error;
|
|
38309
|
-
if (attempt === maxRetries || !shouldRetry(error)) throw error;
|
|
38310
|
-
await new Promise((resolve$1) => setTimeout(resolve$1, delay$1));
|
|
38311
|
-
delay$1 = Math.min(delay$1 * 2, 3e4);
|
|
38312
|
-
}
|
|
38313
|
-
throw lastError;
|
|
38314
|
-
}
|
|
38315
|
-
|
|
38316
|
-
//#endregion
|
|
38317
|
-
//#region ../mcp-core/dist/analyze-issue-with-seer-Dy01BWPf.js
|
|
39437
|
+
//#region ../mcp-core/dist/analyze-issue-with-seer-Bh4zPWGl.js
|
|
38318
39438
|
var analyze_issue_with_seer_default = defineTool({
|
|
38319
39439
|
name: "analyze_issue_with_seer",
|
|
38320
39440
|
skills: ["seer"],
|
|
@@ -38380,7 +39500,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38380
39500
|
issueId: params.issueId,
|
|
38381
39501
|
issueUrl: params.issueUrl
|
|
38382
39502
|
});
|
|
38383
|
-
(
|
|
39503
|
+
setOrganizationContext(orgSlug);
|
|
38384
39504
|
const issue = await apiService.getIssue({
|
|
38385
39505
|
organizationSlug: orgSlug,
|
|
38386
39506
|
issueId: parsedIssueId
|
|
@@ -38425,7 +39545,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38425
39545
|
const existingStatus = autofixState.autofix.status;
|
|
38426
39546
|
if (isTerminalStatus(existingStatus)) {
|
|
38427
39547
|
output += `## Analysis ${getStatusDisplayName(existingStatus)}\n\n`;
|
|
38428
|
-
output += getOutputForAutofixRun(autofixState.autofix);
|
|
39548
|
+
output += autofixState.formatted?.content ? wrapSeerContent(autofixState.formatted.content, autofixState.autofix.run_id) : getOutputForAutofixRun(autofixState.autofix);
|
|
38429
39549
|
if (existingStatus !== "completed") {
|
|
38430
39550
|
output += `\n**Status**: ${existingStatus}\n`;
|
|
38431
39551
|
output += getHumanInterventionGuidance(existingStatus);
|
|
@@ -38448,7 +39568,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38448
39568
|
const status = autofixState.autofix.status;
|
|
38449
39569
|
if (isTerminalStatus(status)) {
|
|
38450
39570
|
output += `## Analysis ${getStatusDisplayName(status)}\n\n`;
|
|
38451
|
-
output += getOutputForAutofixRun(autofixState.autofix);
|
|
39571
|
+
output += autofixState.formatted?.content ? wrapSeerContent(autofixState.formatted.content, autofixState.autofix.run_id) : getOutputForAutofixRun(autofixState.autofix);
|
|
38452
39572
|
if (status !== "completed") {
|
|
38453
39573
|
output += `\n**Status**: ${status}\n`;
|
|
38454
39574
|
output += getHumanInterventionGuidance(status);
|
|
@@ -38490,7 +39610,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38490
39610
|
}
|
|
38491
39611
|
if (autofixState.autofix) {
|
|
38492
39612
|
output += `**Current Status**: ${getStatusDisplayName(autofixState.autofix.status)}\n\n`;
|
|
38493
|
-
output += getOutputForAutofixRun(autofixState.autofix);
|
|
39613
|
+
output += autofixState.formatted?.content ? wrapSeerContent(autofixState.formatted.content, autofixState.autofix.run_id) : getOutputForAutofixRun(autofixState.autofix);
|
|
38494
39614
|
}
|
|
38495
39615
|
output += `\n## Analysis Timed Out\n\n`;
|
|
38496
39616
|
output += `The analysis is taking longer than expected (>${SEER_TIMEOUT / 1e3}s).\n\n`;
|
|
@@ -38503,7 +39623,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38503
39623
|
});
|
|
38504
39624
|
|
|
38505
39625
|
//#endregion
|
|
38506
|
-
//#region ../mcp-core/dist/search-docs-
|
|
39626
|
+
//#region ../mcp-core/dist/search-docs-Tj5IpQIk.js
|
|
38507
39627
|
var search_docs_default = defineTool({
|
|
38508
39628
|
name: "search_docs",
|
|
38509
39629
|
skills: ["inspect", "docs"],
|
|
@@ -38600,7 +39720,7 @@ var search_docs_default = defineTool({
|
|
|
38600
39720
|
});
|
|
38601
39721
|
|
|
38602
39722
|
//#endregion
|
|
38603
|
-
//#region ../mcp-core/dist/get-doc-
|
|
39723
|
+
//#region ../mcp-core/dist/get-doc-D-DZcOOW.js
|
|
38604
39724
|
var get_doc_default = defineTool({
|
|
38605
39725
|
name: "get_doc",
|
|
38606
39726
|
skills: ["inspect", "docs"],
|
|
@@ -38678,7 +39798,7 @@ var get_doc_default = defineTool({
|
|
|
38678
39798
|
});
|
|
38679
39799
|
|
|
38680
39800
|
//#endregion
|
|
38681
|
-
//#region ../mcp-core/dist/config-
|
|
39801
|
+
//#region ../mcp-core/dist/config-CCjTO4AY.js
|
|
38682
39802
|
/**
|
|
38683
39803
|
* Configuration for the search-issues agent
|
|
38684
39804
|
*/
|
|
@@ -38775,7 +39895,7 @@ Use issueFields only when a requested field is not in the built-in fields list.
|
|
|
38775
39895
|
Use whoami only for natural-language me references.`;
|
|
38776
39896
|
|
|
38777
39897
|
//#endregion
|
|
38778
|
-
//#region ../mcp-core/dist/agent-
|
|
39898
|
+
//#region ../mcp-core/dist/agent-DyOsplyJ.js
|
|
38779
39899
|
const searchIssuesAgentOutputSchema = zod.z.object({
|
|
38780
39900
|
query: zod.z.string().describe("The Sentry issue search query"),
|
|
38781
39901
|
sort: zod.z.enum([
|
|
@@ -38809,7 +39929,7 @@ async function searchIssuesAgent(options) {
|
|
|
38809
39929
|
}
|
|
38810
39930
|
|
|
38811
39931
|
//#endregion
|
|
38812
|
-
//#region ../mcp-core/dist/formatters-
|
|
39932
|
+
//#region ../mcp-core/dist/formatters-CZbnEl5Q.js
|
|
38813
39933
|
/**
|
|
38814
39934
|
* Format an explanation for how the input query was translated
|
|
38815
39935
|
*/
|
|
@@ -38903,7 +40023,7 @@ function formatDate$1(dateString) {
|
|
|
38903
40023
|
}
|
|
38904
40024
|
|
|
38905
40025
|
//#endregion
|
|
38906
|
-
//#region ../mcp-core/dist/search-issues-
|
|
40026
|
+
//#region ../mcp-core/dist/search-issues-lbSTiP3S.js
|
|
38907
40027
|
const ProjectSlugOrIdSchema = zod.z.string().trim().superRefine(validateSlugOrId);
|
|
38908
40028
|
function buildIssueSearchRepairPrompt(params) {
|
|
38909
40029
|
return [
|
|
@@ -38985,7 +40105,7 @@ var search_issues_default = defineTool({
|
|
|
38985
40105
|
},
|
|
38986
40106
|
async handler(params, context$1) {
|
|
38987
40107
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
38988
|
-
(
|
|
40108
|
+
setOrganizationContext(params.organizationSlug);
|
|
38989
40109
|
if (params.projectSlugOrId) if (isNumericId(params.projectSlugOrId)) (0, __sentry_core.setTag)("project.id", params.projectSlugOrId);
|
|
38990
40110
|
else (0, __sentry_core.setTag)("project.slug", params.projectSlugOrId);
|
|
38991
40111
|
let query;
|
|
@@ -39083,7 +40203,7 @@ var search_issues_default = defineTool({
|
|
|
39083
40203
|
});
|
|
39084
40204
|
|
|
39085
40205
|
//#endregion
|
|
39086
|
-
//#region ../mcp-core/dist/config-
|
|
40206
|
+
//#region ../mcp-core/dist/config-Nif76Shh.js
|
|
39087
40207
|
const systemPrompt$1 = `You are a Sentry issue event filter translator. Your job is to:
|
|
39088
40208
|
1. Translate natural language queries into Sentry tag filters for events within a SPECIFIC issue
|
|
39089
40209
|
2. Select appropriate fields to return in the results
|
|
@@ -39416,7 +40536,7 @@ const EXAMPLE_QUERIES = [
|
|
|
39416
40536
|
];
|
|
39417
40537
|
|
|
39418
40538
|
//#endregion
|
|
39419
|
-
//#region ../mcp-core/dist/utils-
|
|
40539
|
+
//#region ../mcp-core/dist/utils-DeCBYEnS.js
|
|
39420
40540
|
/**
|
|
39421
40541
|
* Create a tool for the agent to query available tags and fields for issue events
|
|
39422
40542
|
* The tool is pre-bound with the API service and organization configured for the appropriate region
|
|
@@ -39499,7 +40619,7 @@ Received: ${params.issueUrl}`);
|
|
|
39499
40619
|
}
|
|
39500
40620
|
|
|
39501
40621
|
//#endregion
|
|
39502
|
-
//#region ../mcp-core/dist/agent-
|
|
40622
|
+
//#region ../mcp-core/dist/agent-DTdycAuW.js
|
|
39503
40623
|
const searchIssueEventsAgentOutputSchema = zod.z.object({
|
|
39504
40624
|
query: zod.z.string().describe("Sentry query filters for tags/fields (NOT including issue: prefix - handler adds that)"),
|
|
39505
40625
|
fields: zod.z.array(zod.z.string()).describe("Array of field names to return in results"),
|
|
@@ -39541,7 +40661,7 @@ async function searchIssueEventsAgent(options) {
|
|
|
39541
40661
|
}
|
|
39542
40662
|
|
|
39543
40663
|
//#endregion
|
|
39544
|
-
//#region ../mcp-core/dist/search-issue-events-
|
|
40664
|
+
//#region ../mcp-core/dist/search-issue-events-Ck9S6CNC.js
|
|
39545
40665
|
function buildIssueEventSearchRepairPrompt(params) {
|
|
39546
40666
|
return [
|
|
39547
40667
|
"Fix this Sentry issue event search request.",
|
|
@@ -39605,7 +40725,7 @@ var search_issue_events_default = defineTool({
|
|
|
39605
40725
|
issueUrl: params.issueUrl
|
|
39606
40726
|
});
|
|
39607
40727
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
39608
|
-
(
|
|
40728
|
+
setOrganizationContext(organizationSlug);
|
|
39609
40729
|
(0, __sentry_core.setTag)("issue.id", issueId);
|
|
39610
40730
|
if (params.projectSlug) (0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
39611
40731
|
await ensureIssueWithinProjectConstraint({
|
|
@@ -39694,7 +40814,7 @@ var search_issue_events_default = defineTool({
|
|
|
39694
40814
|
});
|
|
39695
40815
|
|
|
39696
40816
|
//#endregion
|
|
39697
|
-
//#region ../mcp-core/dist/formatter-
|
|
40817
|
+
//#region ../mcp-core/dist/formatter-ffKOVbDF.js
|
|
39698
40818
|
/**
|
|
39699
40819
|
* Maps a change type to its corresponding status icon.
|
|
39700
40820
|
*/
|
|
@@ -40070,7 +41190,7 @@ function formatSdkSummary(profile) {
|
|
|
40070
41190
|
}
|
|
40071
41191
|
|
|
40072
41192
|
//#endregion
|
|
40073
|
-
//#region ../mcp-core/dist/get-profile-
|
|
41193
|
+
//#region ../mcp-core/dist/get-profile-4EwZiRri.js
|
|
40074
41194
|
/**
|
|
40075
41195
|
* Resolves profile parameters from URL or explicit params.
|
|
40076
41196
|
* URL takes precedence if provided and valid.
|
|
@@ -40200,7 +41320,7 @@ var get_profile_default = defineTool({
|
|
|
40200
41320
|
(0, __sentry_core.setTag)("project.slug", String(projectSlugOrId));
|
|
40201
41321
|
(0, __sentry_core.setTag)("project.id", String(project.id));
|
|
40202
41322
|
}
|
|
40203
|
-
(
|
|
41323
|
+
setOrganizationContext(organizationSlug);
|
|
40204
41324
|
(0, __sentry_core.setTag)("transaction.name", transactionName);
|
|
40205
41325
|
if (params.compareAgainstPeriod) {
|
|
40206
41326
|
(0, __sentry_core.setTag)("baseline.period", params.compareAgainstPeriod);
|
|
@@ -40288,7 +41408,7 @@ var get_profile_default = defineTool({
|
|
|
40288
41408
|
});
|
|
40289
41409
|
|
|
40290
41410
|
//#endregion
|
|
40291
|
-
//#region ../mcp-core/dist/get-profile-details-
|
|
41411
|
+
//#region ../mcp-core/dist/get-profile-details-KNM3CXky.js
|
|
40292
41412
|
function resolveProfileDetailsParams(params) {
|
|
40293
41413
|
if (params.profileUrl) {
|
|
40294
41414
|
if (!isProfileUrl(params.profileUrl)) throw new UserInputError("Invalid profile URL. URL must point to a Sentry profile resource.");
|
|
@@ -40446,7 +41566,7 @@ var get_profile_details_default = defineTool({
|
|
|
40446
41566
|
regionUrl: params.regionUrl
|
|
40447
41567
|
});
|
|
40448
41568
|
const apiService = apiServiceFromContext(context$1, { regionUrl: regionUrl ?? void 0 });
|
|
40449
|
-
(
|
|
41569
|
+
setOrganizationContext(resolved.organizationSlug);
|
|
40450
41570
|
if (resolved.mode === "transaction") {
|
|
40451
41571
|
(0, __sentry_core.setTag)("profile.id", resolved.profileId);
|
|
40452
41572
|
const isNumericProjectInput = typeof resolved.projectSlugOrId === "number" || isNumericId(String(resolved.projectSlugOrId));
|
|
@@ -40516,7 +41636,7 @@ var get_profile_details_default = defineTool({
|
|
|
40516
41636
|
});
|
|
40517
41637
|
|
|
40518
41638
|
//#endregion
|
|
40519
|
-
//#region ../mcp-core/dist/get-agent-conversation-details-
|
|
41639
|
+
//#region ../mcp-core/dist/get-agent-conversation-details-bM0VVNAG.js
|
|
40520
41640
|
function withoutUndefined(value) {
|
|
40521
41641
|
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0));
|
|
40522
41642
|
}
|
|
@@ -40904,7 +42024,7 @@ var get_agent_conversation_details_default = defineTool({
|
|
|
40904
42024
|
},
|
|
40905
42025
|
outputSchema: aiConversationDetailsOutputSchema,
|
|
40906
42026
|
async handler(params, context$1) {
|
|
40907
|
-
(
|
|
42027
|
+
setOrganizationContext(params.organizationSlug);
|
|
40908
42028
|
(0, __sentry_core.setTag)("ai_conversation.id", params.conversationId);
|
|
40909
42029
|
if (params.start && !params.end || !params.start && params.end) throw new UserInputError("`start` and `end` must be provided together.");
|
|
40910
42030
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
@@ -40932,7 +42052,7 @@ var get_agent_conversation_details_default = defineTool({
|
|
|
40932
42052
|
});
|
|
40933
42053
|
|
|
40934
42054
|
//#endregion
|
|
40935
|
-
//#region ../mcp-core/dist/formatting-
|
|
42055
|
+
//#region ../mcp-core/dist/formatting-B1ckR5H7.js
|
|
40936
42056
|
function getSnapshotImageDisplayName(img) {
|
|
40937
42057
|
return img.display_name || img.image_file_name || "unknown";
|
|
40938
42058
|
}
|
|
@@ -41026,7 +42146,7 @@ function isPlainObject$2(value) {
|
|
|
41026
42146
|
}
|
|
41027
42147
|
|
|
41028
42148
|
//#endregion
|
|
41029
|
-
//#region ../mcp-core/dist/handlers-
|
|
42149
|
+
//#region ../mcp-core/dist/handlers-DhPeWak0.js
|
|
41030
42150
|
function fullResolutionHint({ organizationSlug, snapshotId, imageIdentifier, experimentalMode, availableToolNames, directToolNames }) {
|
|
41031
42151
|
return `- **Full Resolution**: ${formatToolCallInstruction({
|
|
41032
42152
|
toolName: "get_snapshot_image",
|
|
@@ -41081,7 +42201,7 @@ function formatImageMetadata(img) {
|
|
|
41081
42201
|
}
|
|
41082
42202
|
async function createPreviewOrNull(blob, contentType) {
|
|
41083
42203
|
try {
|
|
41084
|
-
return await
|
|
42204
|
+
return await require_blob_utils_DgVug_Di.createImagePreview(blob, contentType);
|
|
41085
42205
|
} catch {
|
|
41086
42206
|
return null;
|
|
41087
42207
|
}
|
|
@@ -41102,7 +42222,7 @@ async function fetchAndAppendImage(apiService, imageUrl, label, imageResolution,
|
|
|
41102
42222
|
});
|
|
41103
42223
|
parts.push({
|
|
41104
42224
|
type: "image",
|
|
41105
|
-
data: await
|
|
42225
|
+
data: await require_blob_utils_DgVug_Di.blobToBase64(blob),
|
|
41106
42226
|
mimeType: contentType
|
|
41107
42227
|
});
|
|
41108
42228
|
return;
|
|
@@ -41121,7 +42241,7 @@ async function fetchAndAppendImage(apiService, imageUrl, label, imageResolution,
|
|
|
41121
42241
|
});
|
|
41122
42242
|
parts.push({
|
|
41123
42243
|
type: "image",
|
|
41124
|
-
data: await
|
|
42244
|
+
data: await require_blob_utils_DgVug_Di.blobToBase64(preview.blob),
|
|
41125
42245
|
mimeType: preview.contentType
|
|
41126
42246
|
});
|
|
41127
42247
|
}
|
|
@@ -41292,7 +42412,7 @@ async function fetchSnapshotSummary(apiService, organizationSlug, snapshotId, so
|
|
|
41292
42412
|
}
|
|
41293
42413
|
|
|
41294
42414
|
//#endregion
|
|
41295
|
-
//#region ../mcp-core/dist/get-snapshot-
|
|
42415
|
+
//#region ../mcp-core/dist/get-snapshot-P1FuvUwa.js
|
|
41296
42416
|
var get_snapshot_default = defineTool({
|
|
41297
42417
|
name: "get_snapshot",
|
|
41298
42418
|
skills: ["inspect"],
|
|
@@ -41357,7 +42477,7 @@ var get_snapshot_default = defineTool({
|
|
|
41357
42477
|
},
|
|
41358
42478
|
async handler(params, context$1) {
|
|
41359
42479
|
if (!params.organizationSlug || !params.snapshotId) throw new UserInputError("Provide both organizationSlug and snapshotId. Use get_sentry_resource for snapshot URLs.");
|
|
41360
|
-
(
|
|
42480
|
+
setOrganizationContext(params.organizationSlug);
|
|
41361
42481
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
41362
42482
|
return fetchSnapshotSummary(apiService, params.organizationSlug, params.snapshotId, null, {
|
|
41363
42483
|
showUnmodified: params.showUnmodified,
|
|
@@ -41370,7 +42490,7 @@ var get_snapshot_default = defineTool({
|
|
|
41370
42490
|
});
|
|
41371
42491
|
|
|
41372
42492
|
//#endregion
|
|
41373
|
-
//#region ../mcp-core/dist/get-snapshot-image-
|
|
42493
|
+
//#region ../mcp-core/dist/get-snapshot-image-DjtwEpMj.js
|
|
41374
42494
|
var get_snapshot_image_default = defineTool({
|
|
41375
42495
|
name: "get_snapshot_image",
|
|
41376
42496
|
skills: ["inspect"],
|
|
@@ -41420,7 +42540,7 @@ var get_snapshot_image_default = defineTool({
|
|
|
41420
42540
|
},
|
|
41421
42541
|
async handler(params, context$1) {
|
|
41422
42542
|
if (!params.organizationSlug || !params.snapshotId) throw new UserInputError("Provide both organizationSlug and snapshotId. Use get_sentry_resource for snapshot URLs.");
|
|
41423
|
-
(
|
|
42543
|
+
setOrganizationContext(params.organizationSlug);
|
|
41424
42544
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
41425
42545
|
return fetchSnapshotImage(apiService, params.organizationSlug, params.snapshotId, params.imageIdentifier, params.imageResolution, {
|
|
41426
42546
|
experimentalMode: context$1.experimentalMode ?? false,
|
|
@@ -41431,7 +42551,7 @@ var get_snapshot_image_default = defineTool({
|
|
|
41431
42551
|
});
|
|
41432
42552
|
|
|
41433
42553
|
//#endregion
|
|
41434
|
-
//#region ../mcp-core/dist/get-sentry-resource-
|
|
42554
|
+
//#region ../mcp-core/dist/get-sentry-resource-BXVp2SKN.js
|
|
41435
42555
|
/** Types with full API integration. */
|
|
41436
42556
|
const FULLY_SUPPORTED_TYPES = [
|
|
41437
42557
|
"issue",
|
|
@@ -41726,7 +42846,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41726
42846
|
projectSlug: context$1.constraints.projectSlug
|
|
41727
42847
|
});
|
|
41728
42848
|
(0, __sentry_core.setTag)("resource.type", resolved.type);
|
|
41729
|
-
(
|
|
42849
|
+
setOrganizationContext(resolved.organizationSlug);
|
|
41730
42850
|
if (resolved.spanId) (0, __sentry_core.setTag)("trace.span_id", resolved.spanId);
|
|
41731
42851
|
(0, __sentry_core.getActiveSpan)()?.setAttribute("app.resource.type", resolved.type);
|
|
41732
42852
|
if (resolved.type === "release") {
|
|
@@ -41819,7 +42939,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41819
42939
|
});
|
|
41820
42940
|
|
|
41821
42941
|
//#endregion
|
|
41822
|
-
//#region ../mcp-core/dist/get-latest-base-snapshot-
|
|
42942
|
+
//#region ../mcp-core/dist/get-latest-base-snapshot-CEkWKEZJ.js
|
|
41823
42943
|
var get_latest_base_snapshot_default = defineTool({
|
|
41824
42944
|
name: "get_latest_base_snapshot",
|
|
41825
42945
|
skills: ["inspect"],
|
|
@@ -41872,7 +42992,7 @@ var get_latest_base_snapshot_default = defineTool({
|
|
|
41872
42992
|
openWorldHint: true
|
|
41873
42993
|
},
|
|
41874
42994
|
async handler(params, context$1) {
|
|
41875
|
-
(
|
|
42995
|
+
setOrganizationContext(params.organizationSlug);
|
|
41876
42996
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
41877
42997
|
const project = params.project ?? void 0;
|
|
41878
42998
|
const projectId = project && isNumericId(project) ? project : void 0;
|
|
@@ -41915,9 +43035,15 @@ var get_latest_base_snapshot_default = defineTool({
|
|
|
41915
43035
|
});
|
|
41916
43036
|
|
|
41917
43037
|
//#endregion
|
|
41918
|
-
//#region ../mcp-core/dist/search-agent-conversations-
|
|
43038
|
+
//#region ../mcp-core/dist/search-agent-conversations-BGO_38e-.js
|
|
41919
43039
|
const PREVIEW_LENGTH = 240;
|
|
41920
43040
|
const TRACE_ID_SAMPLE_SIZE = 3;
|
|
43041
|
+
const usdFormatter = new Intl.NumberFormat("en-US", {
|
|
43042
|
+
style: "currency",
|
|
43043
|
+
currency: "USD",
|
|
43044
|
+
notation: "compact",
|
|
43045
|
+
maximumSignificantDigits: 3
|
|
43046
|
+
});
|
|
41921
43047
|
const aiConversationSearchResultSchema = zod.z.object({
|
|
41922
43048
|
conversationId: zod.z.string(),
|
|
41923
43049
|
title: zod.z.string().nullable(),
|
|
@@ -41930,7 +43056,7 @@ const aiConversationSearchResultSchema = zod.z.object({
|
|
|
41930
43056
|
toolCallCount: zod.z.number(),
|
|
41931
43057
|
toolErrorCount: zod.z.number(),
|
|
41932
43058
|
totalTokens: zod.z.number(),
|
|
41933
|
-
totalCost: zod.z.
|
|
43059
|
+
totalCost: zod.z.string(),
|
|
41934
43060
|
traceCount: zod.z.number(),
|
|
41935
43061
|
sampleTraceIds: zod.z.array(zod.z.string()),
|
|
41936
43062
|
firstInputPreview: zod.z.string().nullable(),
|
|
@@ -41976,6 +43102,11 @@ function previewText(value) {
|
|
|
41976
43102
|
if (value == null || value.length <= PREVIEW_LENGTH) return value;
|
|
41977
43103
|
return `${value.slice(0, PREVIEW_LENGTH - 3)}...`;
|
|
41978
43104
|
}
|
|
43105
|
+
function formatLLMCost(cost) {
|
|
43106
|
+
if (cost === 0) return "—";
|
|
43107
|
+
if (cost > 0 && cost < .01) return "<$0.01";
|
|
43108
|
+
return usdFormatter.format(cost);
|
|
43109
|
+
}
|
|
41979
43110
|
function projectUser(user) {
|
|
41980
43111
|
if (!user) return null;
|
|
41981
43112
|
return {
|
|
@@ -42002,7 +43133,7 @@ function buildArtifact(apiService, organizationSlug, conversations, nextCursor,
|
|
|
42002
43133
|
aiCallCount: llmCalls,
|
|
42003
43134
|
toolCallCount: toolCalls,
|
|
42004
43135
|
totalTokens,
|
|
42005
|
-
totalCost,
|
|
43136
|
+
totalCost: formatLLMCost(totalCost),
|
|
42006
43137
|
startTimestamp,
|
|
42007
43138
|
endTimestamp,
|
|
42008
43139
|
traceCount,
|
|
@@ -42030,7 +43161,7 @@ var search_agent_conversations_default = defineTool({
|
|
|
42030
43161
|
"Search Sentry Agent Conversations, formerly called AI Conversations, and return one summary row per conversation.",
|
|
42031
43162
|
"",
|
|
42032
43163
|
"Use this tool to find or list Agent Conversations. Results are conversation summaries, not raw span rows.",
|
|
42033
|
-
"Each row includes title (when available), cost, tokens, call counts, previews, and other list metadata.",
|
|
43164
|
+
"Each row includes title (when available), USD cost, tokens, call counts, previews, and other list metadata.",
|
|
42034
43165
|
"Use get_agent_conversation_details with a conversationId to fetch the transcript. Use get_sentry_resource for Sentry conversation URLs.",
|
|
42035
43166
|
"",
|
|
42036
43167
|
"<examples>",
|
|
@@ -42061,7 +43192,7 @@ var search_agent_conversations_default = defineTool({
|
|
|
42061
43192
|
const requestedPeriod = params.period ?? "30d";
|
|
42062
43193
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
42063
43194
|
const organizationSlug = params.organizationSlug;
|
|
42064
|
-
(
|
|
43195
|
+
setOrganizationContext(organizationSlug);
|
|
42065
43196
|
const projectIds = await resolveProjectIds({
|
|
42066
43197
|
apiService,
|
|
42067
43198
|
organizationSlug,
|
|
@@ -42094,7 +43225,7 @@ var search_agent_conversations_default = defineTool({
|
|
|
42094
43225
|
});
|
|
42095
43226
|
|
|
42096
43227
|
//#endregion
|
|
42097
|
-
//#region ../mcp-core/dist/add-issue-note-
|
|
43228
|
+
//#region ../mcp-core/dist/add-issue-note-YI_XzMvf.js
|
|
42098
43229
|
function formatComment(comment) {
|
|
42099
43230
|
const actor = comment.user ? formatActor(comment.user) : "current user";
|
|
42100
43231
|
const text$1 = comment.data ? readString(comment.data, "text") : null;
|
|
@@ -42144,7 +43275,7 @@ var add_issue_note_default = defineTool({
|
|
|
42144
43275
|
organizationSlug: params.organizationSlug ?? context$1.constraints.organizationSlug
|
|
42145
43276
|
});
|
|
42146
43277
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
42147
|
-
(
|
|
43278
|
+
setOrganizationContext(parsed.organizationSlug);
|
|
42148
43279
|
(0, __sentry_core.setTag)("issue.id", parsed.issueId);
|
|
42149
43280
|
await ensureIssueWithinProjectConstraint({
|
|
42150
43281
|
apiService,
|
|
@@ -42170,7 +43301,7 @@ var add_issue_note_default = defineTool({
|
|
|
42170
43301
|
});
|
|
42171
43302
|
|
|
42172
43303
|
//#endregion
|
|
42173
|
-
//#region ../mcp-core/dist/onboarding-status-update-
|
|
43304
|
+
//#region ../mcp-core/dist/onboarding-status-update-BJR7w05r.js
|
|
42174
43305
|
const updateBaseSchema = zod.z.object({
|
|
42175
43306
|
status: AgenticOnboardingStageStatusUpdateSchema.describe("The stage's current status."),
|
|
42176
43307
|
runStatus: AgenticOnboardingRunStatusUpdateSchema.optional().describe("Set only when the entire onboarding run has completed or failed."),
|
|
@@ -42223,7 +43354,7 @@ var onboarding_status_update_default = defineTool({
|
|
|
42223
43354
|
},
|
|
42224
43355
|
async handler(params, context$1) {
|
|
42225
43356
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
42226
|
-
(
|
|
43357
|
+
setOrganizationContext(params.organizationSlug);
|
|
42227
43358
|
const update = AgenticOnboardingStatusUpdateSchema.parse({
|
|
42228
43359
|
schemaVersion: 1,
|
|
42229
43360
|
runToken: params.runToken,
|
|
@@ -42238,7 +43369,7 @@ var onboarding_status_update_default = defineTool({
|
|
|
42238
43369
|
});
|
|
42239
43370
|
|
|
42240
43371
|
//#endregion
|
|
42241
|
-
//#region ../mcp-core/dist/catalog-
|
|
43372
|
+
//#region ../mcp-core/dist/catalog-CZAR_B3F.js
|
|
42242
43373
|
const legacyGetAIConversationDetails = {
|
|
42243
43374
|
...get_agent_conversation_details_default,
|
|
42244
43375
|
name: "get_ai_conversation_details",
|
|
@@ -42286,6 +43417,7 @@ const catalogTools = {
|
|
|
42286
43417
|
delete_uptime_monitor: delete_uptime_monitor_default,
|
|
42287
43418
|
find_alert_rules: find_alert_rules_default,
|
|
42288
43419
|
get_alert_rule: get_alert_rule_default,
|
|
43420
|
+
get_alert_options: get_alert_options_default,
|
|
42289
43421
|
get_issue_details: get_issue_details_default,
|
|
42290
43422
|
get_event_stacktrace: get_event_stacktrace_default,
|
|
42291
43423
|
get_issue_activity: get_issue_activity_default,
|
|
@@ -42313,6 +43445,7 @@ const catalogTools = {
|
|
|
42313
43445
|
search_issue_events: search_issue_events_default,
|
|
42314
43446
|
get_profile: get_profile_default,
|
|
42315
43447
|
get_profile_details: get_profile_details_default,
|
|
43448
|
+
get_sentry_mcp_info: get_sentry_mcp_info_default,
|
|
42316
43449
|
get_sentry_resource: get_sentry_resource_default,
|
|
42317
43450
|
get_snapshot: get_snapshot_default,
|
|
42318
43451
|
get_snapshot_image: get_snapshot_image_default,
|
|
@@ -42327,7 +43460,7 @@ const catalogTools = {
|
|
|
42327
43460
|
var catalog_default = catalogTools;
|
|
42328
43461
|
|
|
42329
43462
|
//#endregion
|
|
42330
|
-
//#region ../mcp-core/dist/schema-
|
|
43463
|
+
//#region ../mcp-core/dist/schema-Bf6vaXky.js
|
|
42331
43464
|
function zodFieldMapToJsonSchema(fieldMap) {
|
|
42332
43465
|
const zodObject = Object.keys(fieldMap).length > 0 ? zod.z.object(fieldMap) : zod.z.object({});
|
|
42333
43466
|
const { $schema: _,...jsonSchema$1 } = zod.z.toJSONSchema(zodObject, {
|
|
@@ -42339,7 +43472,7 @@ function zodFieldMapToJsonSchema(fieldMap) {
|
|
|
42339
43472
|
}
|
|
42340
43473
|
|
|
42341
43474
|
//#endregion
|
|
42342
|
-
//#region ../mcp-core/dist/search
|
|
43475
|
+
//#region ../mcp-core/dist/search--TO414uy.js
|
|
42343
43476
|
function tokenize(value) {
|
|
42344
43477
|
return value.toLowerCase().split(/[^a-z0-9_]+/).map((token) => token.trim()).filter(Boolean);
|
|
42345
43478
|
}
|
|
@@ -42390,7 +43523,7 @@ function searchToolCatalog({ tools, context: context$1, query, limit }) {
|
|
|
42390
43523
|
}
|
|
42391
43524
|
|
|
42392
43525
|
//#endregion
|
|
42393
|
-
//#region ../mcp-core/dist/search-tools-
|
|
43526
|
+
//#region ../mcp-core/dist/search-tools-DD_Fpn20.js
|
|
42394
43527
|
const DEFAULT_LIMIT = 8;
|
|
42395
43528
|
const MAX_LIMIT = 20;
|
|
42396
43529
|
const toolAnnotationsOutputSchema = zod.z.object({
|
|
@@ -42472,7 +43605,7 @@ function createSearchToolsTool(getTools) {
|
|
|
42472
43605
|
}
|
|
42473
43606
|
|
|
42474
43607
|
//#endregion
|
|
42475
|
-
//#region ../mcp-core/dist/execute-tool-
|
|
43608
|
+
//#region ../mcp-core/dist/execute-tool-Z6g9XYm0.js
|
|
42476
43609
|
function setToolArgumentAttributes(span, params) {
|
|
42477
43610
|
for (const [key, value] of Object.entries(params)) {
|
|
42478
43611
|
const attributeValue = value == null || typeof value === "object" ? JSON.stringify(value) : value;
|
|
@@ -42501,6 +43634,7 @@ async function executeCatalogToolWithSpan({ tool: tool$1, params, context: conte
|
|
|
42501
43634
|
} catch (error) {
|
|
42502
43635
|
span.setStatus({ code: 2 });
|
|
42503
43636
|
if (!isExpectedToolError(error)) span.recordException(error);
|
|
43637
|
+
recordToolFailure(tool$1, error, params, context$1);
|
|
42504
43638
|
throw error;
|
|
42505
43639
|
}
|
|
42506
43640
|
});
|
|
@@ -42556,7 +43690,7 @@ function createExecuteTool(getTools) {
|
|
|
42556
43690
|
}
|
|
42557
43691
|
|
|
42558
43692
|
//#endregion
|
|
42559
|
-
//#region ../mcp-core/dist/tools-
|
|
43693
|
+
//#region ../mcp-core/dist/tools-EVTUbO4b.js
|
|
42560
43694
|
function getAllTools() {
|
|
42561
43695
|
return allTools;
|
|
42562
43696
|
}
|
|
@@ -59186,7 +60320,7 @@ function buildServer({ context: context$1, experimentalMode = false, tools: cust
|
|
|
59186
60320
|
tools: customTools
|
|
59187
60321
|
});
|
|
59188
60322
|
for (const { name: name$4, config, handler } of registrations$1) server$1.registerTool(name$4, config, handler);
|
|
59189
|
-
return (0,
|
|
60323
|
+
return (0, __sentry_core_server.wrapMcpServerWithSentry)(server$1);
|
|
59190
60324
|
}
|
|
59191
60325
|
const server = new __modelcontextprotocol_sdk_server_mcp_js.McpServer(serverInfo);
|
|
59192
60326
|
const registrations = configureServer({
|
|
@@ -59196,7 +60330,7 @@ function buildServer({ context: context$1, experimentalMode = false, tools: cust
|
|
|
59196
60330
|
tools: customTools
|
|
59197
60331
|
});
|
|
59198
60332
|
for (const { name: name$4, config, handler } of registrations) server.registerTool(name$4, config, handler);
|
|
59199
|
-
return (0,
|
|
60333
|
+
return (0, __sentry_core_server.wrapMcpServerWithSentry)(server);
|
|
59200
60334
|
}
|
|
59201
60335
|
/**
|
|
59202
60336
|
* Configures an MCP server with tools filtered by granted skills.
|
|
@@ -59263,8 +60397,8 @@ function configureServer({ server, context: context$1, experimentalMode = false,
|
|
|
59263
60397
|
if (context$1.clientFamily) (0, __sentry_core.setTag)("app.client.family", context$1.clientFamily);
|
|
59264
60398
|
if (context$1.transport) (0, __sentry_core.setTag)("app.transport", context$1.transport);
|
|
59265
60399
|
(0, __sentry_core.setTag)("app.server.mode.experimental", experimentalMode);
|
|
60400
|
+
const rawParams = params && typeof params === "object" && !Array.isArray(params) ? params : {};
|
|
59266
60401
|
try {
|
|
59267
|
-
const rawParams = params && typeof params === "object" && !Array.isArray(params) ? params : {};
|
|
59268
60402
|
const paramsWithConstraints = injectConstraintParams(rawParams, tool$1, contextWithToolAvailability);
|
|
59269
60403
|
if (activeSpan) for (const [key, value] of Object.entries(paramsWithConstraints)) {
|
|
59270
60404
|
const attributeValue = value == null || typeof value === "object" ? JSON.stringify(value) : value;
|
|
@@ -59292,6 +60426,7 @@ function configureServer({ server, context: context$1, experimentalMode = false,
|
|
|
59292
60426
|
if (isApiAuthenticationErrorDeep(error) && context$1.onUpstreamUnauthorized) try {
|
|
59293
60427
|
await context$1.onUpstreamUnauthorized();
|
|
59294
60428
|
} catch {}
|
|
60429
|
+
recordToolFailure(tool$1, error, rawParams, contextWithToolAvailability);
|
|
59295
60430
|
return {
|
|
59296
60431
|
content: [{
|
|
59297
60432
|
type: "text",
|
|
@@ -59310,111 +60445,6 @@ function configureServer({ server, context: context$1, experimentalMode = false,
|
|
|
59310
60445
|
return registrations;
|
|
59311
60446
|
}
|
|
59312
60447
|
|
|
59313
|
-
//#endregion
|
|
59314
|
-
//#region ../mcp-core/dist/sentry-D99fvngC.js
|
|
59315
|
-
const SCRUB_PATTERNS = [
|
|
59316
|
-
{
|
|
59317
|
-
pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
|
|
59318
|
-
replacement: "[REDACTED_OPENAI_KEY]",
|
|
59319
|
-
description: "OpenAI API key"
|
|
59320
|
-
},
|
|
59321
|
-
{
|
|
59322
|
-
pattern: /\bBearer\s+[a-zA-Z0-9\-._~+/]+={0,}/g,
|
|
59323
|
-
replacement: "Bearer [REDACTED_TOKEN]",
|
|
59324
|
-
description: "Bearer token"
|
|
59325
|
-
},
|
|
59326
|
-
{
|
|
59327
|
-
pattern: /\bsntrys_[a-zA-Z0-9_]+\b/g,
|
|
59328
|
-
replacement: "[REDACTED_SENTRY_TOKEN]",
|
|
59329
|
-
description: "Sentry access token"
|
|
59330
|
-
}
|
|
59331
|
-
];
|
|
59332
|
-
const MAX_SCRUB_DEPTH = 20;
|
|
59333
|
-
/**
|
|
59334
|
-
* Recursively scrub sensitive data from any value.
|
|
59335
|
-
* Returns tuple of [scrubbedValue, didScrub, descriptionsOfMatchedPatterns]
|
|
59336
|
-
*/
|
|
59337
|
-
function scrubValue(value, depth = 0) {
|
|
59338
|
-
if (depth >= MAX_SCRUB_DEPTH) return [
|
|
59339
|
-
"[MAX_DEPTH_EXCEEDED]",
|
|
59340
|
-
false,
|
|
59341
|
-
[]
|
|
59342
|
-
];
|
|
59343
|
-
if (typeof value === "string") {
|
|
59344
|
-
let scrubbed = value;
|
|
59345
|
-
let didScrub = false;
|
|
59346
|
-
const matchedDescriptions = [];
|
|
59347
|
-
for (const { pattern, replacement, description: description$73 } of SCRUB_PATTERNS) {
|
|
59348
|
-
pattern.lastIndex = 0;
|
|
59349
|
-
if (pattern.test(scrubbed)) {
|
|
59350
|
-
didScrub = true;
|
|
59351
|
-
matchedDescriptions.push(description$73);
|
|
59352
|
-
pattern.lastIndex = 0;
|
|
59353
|
-
scrubbed = scrubbed.replace(pattern, replacement);
|
|
59354
|
-
}
|
|
59355
|
-
}
|
|
59356
|
-
return [
|
|
59357
|
-
scrubbed,
|
|
59358
|
-
didScrub,
|
|
59359
|
-
matchedDescriptions
|
|
59360
|
-
];
|
|
59361
|
-
}
|
|
59362
|
-
if (Array.isArray(value)) {
|
|
59363
|
-
let arrayDidScrub = false;
|
|
59364
|
-
const arrayDescriptions = [];
|
|
59365
|
-
const scrubbedArray = value.map((item) => {
|
|
59366
|
-
const [scrubbed, didScrub, descriptions] = scrubValue(item, depth + 1);
|
|
59367
|
-
if (didScrub) {
|
|
59368
|
-
arrayDidScrub = true;
|
|
59369
|
-
arrayDescriptions.push(...descriptions);
|
|
59370
|
-
}
|
|
59371
|
-
return scrubbed;
|
|
59372
|
-
});
|
|
59373
|
-
return [
|
|
59374
|
-
scrubbedArray,
|
|
59375
|
-
arrayDidScrub,
|
|
59376
|
-
arrayDescriptions
|
|
59377
|
-
];
|
|
59378
|
-
}
|
|
59379
|
-
if (value && typeof value === "object") {
|
|
59380
|
-
let objectDidScrub = false;
|
|
59381
|
-
const objectDescriptions = [];
|
|
59382
|
-
const scrubbed = {};
|
|
59383
|
-
for (const [key, val] of Object.entries(value)) {
|
|
59384
|
-
const [scrubbedVal, didScrub, descriptions] = scrubValue(val, depth + 1);
|
|
59385
|
-
if (didScrub) {
|
|
59386
|
-
objectDidScrub = true;
|
|
59387
|
-
objectDescriptions.push(...descriptions);
|
|
59388
|
-
}
|
|
59389
|
-
scrubbed[key] = scrubbedVal;
|
|
59390
|
-
}
|
|
59391
|
-
return [
|
|
59392
|
-
scrubbed,
|
|
59393
|
-
objectDidScrub,
|
|
59394
|
-
objectDescriptions
|
|
59395
|
-
];
|
|
59396
|
-
}
|
|
59397
|
-
return [
|
|
59398
|
-
value,
|
|
59399
|
-
false,
|
|
59400
|
-
[]
|
|
59401
|
-
];
|
|
59402
|
-
}
|
|
59403
|
-
/**
|
|
59404
|
-
* Sentry beforeSend hook that scrubs sensitive data from events
|
|
59405
|
-
* and applies custom fingerprinting for specific error types.
|
|
59406
|
-
*/
|
|
59407
|
-
function sentryBeforeSend(event, hint) {
|
|
59408
|
-
const firstException = event?.exception?.values?.[0];
|
|
59409
|
-
if (firstException?.type === "AI_APICallError" && firstException.value) event.fingerprint = ["AI_APICallError", firstException.value];
|
|
59410
|
-
const [scrubbedEvent, didScrub, descriptions] = scrubValue(event);
|
|
59411
|
-
if (didScrub) {
|
|
59412
|
-
const uniqueDescriptions = [...new Set(descriptions)];
|
|
59413
|
-
console.warn(`[Sentry] Event contained sensitive data: ${uniqueDescriptions.join(", ")}`);
|
|
59414
|
-
}
|
|
59415
|
-
return scrubbedEvent;
|
|
59416
|
-
}
|
|
59417
|
-
|
|
59418
60448
|
//#endregion
|
|
59419
60449
|
//#region src/index.ts
|
|
59420
60450
|
const packageName = "@sentry/mcp-server";
|
|
@@ -59548,7 +60578,6 @@ async function main() {
|
|
|
59548
60578
|
}
|
|
59549
60579
|
__sentry_node.init({
|
|
59550
60580
|
dsn: cfg.sentryDsn,
|
|
59551
|
-
sendDefaultPii: true,
|
|
59552
60581
|
tracesSampleRate: 1,
|
|
59553
60582
|
beforeSend: sentryBeforeSend,
|
|
59554
60583
|
initialScope: { tags: {
|
|
@@ -59581,17 +60610,28 @@ async function main() {
|
|
|
59581
60610
|
}
|
|
59582
60611
|
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
59583
60612
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
59584
|
-
|
|
59585
|
-
|
|
59586
|
-
|
|
59587
|
-
|
|
59588
|
-
|
|
60613
|
+
let exiting = false;
|
|
60614
|
+
function exitAfterError(error, label) {
|
|
60615
|
+
if (exiting) {
|
|
60616
|
+
process.exit(1);
|
|
60617
|
+
return;
|
|
60618
|
+
}
|
|
60619
|
+
exiting = true;
|
|
60620
|
+
try {
|
|
60621
|
+
console.error(label, error);
|
|
60622
|
+
} catch {}
|
|
60623
|
+
try {
|
|
60624
|
+
__sentry_node.captureException(error);
|
|
60625
|
+
} catch {}
|
|
60626
|
+
const timer = setTimeout(() => process.exit(1), SENTRY_TIMEOUT);
|
|
60627
|
+
timer.unref();
|
|
60628
|
+
__sentry_node.flush(SENTRY_TIMEOUT).finally(() => process.exit(1));
|
|
60629
|
+
}
|
|
60630
|
+
process.on("uncaughtException", (error) => {
|
|
60631
|
+
exitAfterError(error, "Uncaught exception:");
|
|
59589
60632
|
});
|
|
59590
|
-
process.on("unhandledRejection",
|
|
59591
|
-
|
|
59592
|
-
__sentry_node.captureException(reason);
|
|
59593
|
-
await __sentry_node.flush(SENTRY_TIMEOUT);
|
|
59594
|
-
process.exit(1);
|
|
60633
|
+
process.on("unhandledRejection", (reason) => {
|
|
60634
|
+
exitAfterError(reason, "Unhandled rejection:");
|
|
59595
60635
|
});
|
|
59596
60636
|
const context$1 = {
|
|
59597
60637
|
accessToken: cfg.accessToken,
|
|
@@ -59612,11 +60652,8 @@ async function main() {
|
|
|
59612
60652
|
context: context$1,
|
|
59613
60653
|
experimentalMode: cli.experimental
|
|
59614
60654
|
});
|
|
59615
|
-
require_stdio.startStdio(server, context$1).catch(
|
|
59616
|
-
|
|
59617
|
-
__sentry_node.captureException(err);
|
|
59618
|
-
await __sentry_node.flush(SENTRY_TIMEOUT);
|
|
59619
|
-
process.exit(1);
|
|
60655
|
+
require_stdio.startStdio(server, context$1).catch((err) => {
|
|
60656
|
+
exitAfterError(err, "Server error:");
|
|
59620
60657
|
});
|
|
59621
60658
|
}
|
|
59622
60659
|
main().catch((err) => {
|