@sentry/mcp-server 0.38.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-BlhX8Vom.cjs → auth-CmmVlYDi.cjs} +4 -4
- package/dist/{auth-BlhX8Vom.cjs.map → auth-CmmVlYDi.cjs.map} +1 -1
- package/dist/{auth-CmWwtW3L.js → auth-CpyUfxVa.js} +4 -4
- package/dist/{auth-CmWwtW3L.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/parse.d.ts.map +1 -1
- 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-D8_wFtpA.js → device-code-flow-CARIuIzP.js} +3 -3
- package/dist/{device-code-flow-D8_wFtpA.js.map → device-code-flow-CARIuIzP.js.map} +1 -1
- package/dist/{device-code-flow-R-ZBimNL.cjs → device-code-flow-D1UFW6dK.cjs} +3 -3
- package/dist/{device-code-flow-R-ZBimNL.cjs.map → device-code-flow-D1UFW6dK.cjs.map} +1 -1
- package/dist/index.cjs +1902 -807
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1896 -801
- 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-6Nwn0wwt.js → resolve-token-CYqj4HQ5.js} +3 -3
- package/dist/{resolve-token-6Nwn0wwt.js.map → resolve-token-CYqj4HQ5.js.map} +1 -1
- package/dist/{resolve-token-D8ViFyUf.cjs → resolve-token-DKvK-YrS.cjs} +3 -3
- package/dist/{resolve-token-D8ViFyUf.cjs.map → resolve-token-DKvK-YrS.cjs.map} +1 -1
- package/dist/{stdio-BAG9vDZV.cjs → stdio-BhYLPDOA.cjs} +2 -2
- package/dist/{stdio-BAG9vDZV.cjs.map → stdio-BhYLPDOA.cjs.map} +1 -1
- package/dist/{stdio-DFJbp9zP.js → stdio-iZJ0t3f6.js} +2 -2
- package/dist/{stdio-DFJbp9zP.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-CXUk1-K3.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-CXUk1-K3.cjs.map +0 -1
- package/dist/version-Duuvuy5h.js +0 -7
- package/dist/version-Duuvuy5h.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
|
*
|
|
@@ -3531,11 +3652,27 @@ const AgenticOnboardingStageStatusUpdateSchema = zod.z.enum([
|
|
|
3531
3652
|
"skipped",
|
|
3532
3653
|
"failed"
|
|
3533
3654
|
]);
|
|
3534
|
-
const
|
|
3535
|
-
|
|
3655
|
+
const AgenticOnboardingCreateProjectExtraSchema = zod.z.object({ projectSlugs: zod.z.array(zod.z.string().trim().min(1)) }).strict();
|
|
3656
|
+
const AgenticOnboardingVerificationErrorExtraSchema = zod.z.object({ issueIds: zod.z.array(zod.z.string().trim().min(1)) }).strict();
|
|
3657
|
+
const AgenticOnboardingStageWithoutExtraSchema = AgenticOnboardingStageSchema.exclude(["create_project", "receive_verification_error"]);
|
|
3658
|
+
const AgenticOnboardingStageStateBaseSchema = zod.z.object({
|
|
3536
3659
|
status: AgenticOnboardingStageStatusSchema.nullable(),
|
|
3537
3660
|
eventNote: zod.z.string().nullable()
|
|
3538
3661
|
});
|
|
3662
|
+
const AgenticOnboardingStageStateSchema = zod.z.discriminatedUnion("stage", [
|
|
3663
|
+
AgenticOnboardingStageStateBaseSchema.extend({
|
|
3664
|
+
stage: zod.z.literal("create_project"),
|
|
3665
|
+
extra: AgenticOnboardingCreateProjectExtraSchema.nullable()
|
|
3666
|
+
}),
|
|
3667
|
+
AgenticOnboardingStageStateBaseSchema.extend({
|
|
3668
|
+
stage: zod.z.literal("receive_verification_error"),
|
|
3669
|
+
extra: AgenticOnboardingVerificationErrorExtraSchema.nullable()
|
|
3670
|
+
}),
|
|
3671
|
+
AgenticOnboardingStageStateBaseSchema.extend({
|
|
3672
|
+
stage: AgenticOnboardingStageWithoutExtraSchema,
|
|
3673
|
+
extra: zod.z.null()
|
|
3674
|
+
})
|
|
3675
|
+
]);
|
|
3539
3676
|
const AgenticOnboardingRunStatusSchema = zod.z.enum([
|
|
3540
3677
|
"active",
|
|
3541
3678
|
"completed",
|
|
@@ -3543,16 +3680,28 @@ const AgenticOnboardingRunStatusSchema = zod.z.enum([
|
|
|
3543
3680
|
"cancelled"
|
|
3544
3681
|
]);
|
|
3545
3682
|
const AgenticOnboardingRunStatusUpdateSchema = zod.z.enum(["completed", "failed"]);
|
|
3546
|
-
const
|
|
3683
|
+
const AgenticOnboardingRunTokenSchema = zod.z.string().regex(/^[A-Za-z0-9]{10}$/);
|
|
3684
|
+
const AgenticOnboardingStatusUpdateBaseSchema = zod.z.object({
|
|
3547
3685
|
schemaVersion: zod.z.literal(1),
|
|
3548
|
-
runToken:
|
|
3549
|
-
stage: AgenticOnboardingStageSchema,
|
|
3686
|
+
runToken: AgenticOnboardingRunTokenSchema,
|
|
3550
3687
|
status: AgenticOnboardingStageStatusUpdateSchema,
|
|
3551
3688
|
runStatus: AgenticOnboardingRunStatusUpdateSchema.optional(),
|
|
3552
|
-
eventNote: zod.z.string().trim().min(1).max(256).optional()
|
|
3553
|
-
projectSlugs: zod.z.array(zod.z.string().trim().min(1)).min(1).max(100).optional(),
|
|
3554
|
-
issueIds: zod.z.array(zod.z.string().trim().min(1)).min(1).max(100).optional()
|
|
3689
|
+
eventNote: zod.z.string().trim().min(1).max(256).optional()
|
|
3555
3690
|
});
|
|
3691
|
+
const AgenticOnboardingStatusUpdateSchema = zod.z.discriminatedUnion("stage", [
|
|
3692
|
+
AgenticOnboardingStatusUpdateBaseSchema.extend({
|
|
3693
|
+
stage: zod.z.literal("create_project"),
|
|
3694
|
+
extra: AgenticOnboardingCreateProjectExtraSchema.optional()
|
|
3695
|
+
}),
|
|
3696
|
+
AgenticOnboardingStatusUpdateBaseSchema.extend({
|
|
3697
|
+
stage: zod.z.literal("receive_verification_error"),
|
|
3698
|
+
extra: AgenticOnboardingVerificationErrorExtraSchema.optional()
|
|
3699
|
+
}),
|
|
3700
|
+
AgenticOnboardingStatusUpdateBaseSchema.extend({
|
|
3701
|
+
stage: AgenticOnboardingStageWithoutExtraSchema,
|
|
3702
|
+
extra: zod.z.never().optional()
|
|
3703
|
+
})
|
|
3704
|
+
]);
|
|
3556
3705
|
const AgenticOnboardingRunSchema = zod.z.object({
|
|
3557
3706
|
schemaVersion: zod.z.literal(1),
|
|
3558
3707
|
runId: zod.z.string(),
|
|
@@ -3564,13 +3713,21 @@ const AgenticOnboardingRunSchema = zod.z.object({
|
|
|
3564
3713
|
expiresAt: zod.z.string(),
|
|
3565
3714
|
continueUpdates: zod.z.boolean(),
|
|
3566
3715
|
runStatus: AgenticOnboardingRunStatusSchema,
|
|
3567
|
-
projectSlugs: zod.z.array(zod.z.string()).nullable().transform((projectSlugs) => projectSlugs ?? []),
|
|
3568
|
-
issueIds: zod.z.array(zod.z.string()).nullable().transform((issueIds) => issueIds ?? []),
|
|
3569
3716
|
stages: zod.z.array(AgenticOnboardingStageStateSchema)
|
|
3570
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();
|
|
3571
3728
|
|
|
3572
3729
|
//#endregion
|
|
3573
|
-
//#region ../mcp-core/dist/client-
|
|
3730
|
+
//#region ../mcp-core/dist/client-BXJ5ud71.js
|
|
3574
3731
|
const SENTRY_MCP_SEARCH_EVENTS_REFERRER = "api.mcp.search-events";
|
|
3575
3732
|
/**
|
|
3576
3733
|
* Mapping of common network error codes to user-friendly messages.
|
|
@@ -3591,9 +3748,6 @@ function formatWorkflowNameQuery(query) {
|
|
|
3591
3748
|
const escapedQuery = query.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
3592
3749
|
return `name:"*${escapedQuery}*"`;
|
|
3593
3750
|
}
|
|
3594
|
-
function filterAttachedIssueAlertRules(rules) {
|
|
3595
|
-
return rules.filter((rule) => (rule.detectorIds ?? []).length > 0);
|
|
3596
|
-
}
|
|
3597
3751
|
function parseStatsPeriod(statsPeriod) {
|
|
3598
3752
|
const match = /^(\d+)([smhdw])$/.exec(statsPeriod);
|
|
3599
3753
|
if (!match) throw new ApiValidationError("statsPeriod must use a supported relative time format, such as `24h`, `7d`, or `2w`.");
|
|
@@ -3611,6 +3765,24 @@ function getNextCursor(linkHeader) {
|
|
|
3611
3765
|
}
|
|
3612
3766
|
return null;
|
|
3613
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;
|
|
3614
3786
|
const TraceItemAttributeTypeSchema = zod.z.enum([
|
|
3615
3787
|
"string",
|
|
3616
3788
|
"number",
|
|
@@ -3844,6 +4016,32 @@ var SentryApiService = class {
|
|
|
3844
4016
|
if (resolutionSeconds !== void 0) queryParams.set("resolution", `${resolutionSeconds}s`);
|
|
3845
4017
|
}
|
|
3846
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
|
+
/**
|
|
3847
4045
|
* Internal method for making authenticated requests to Sentry API.
|
|
3848
4046
|
*
|
|
3849
4047
|
* Handles:
|
|
@@ -3859,7 +4057,7 @@ var SentryApiService = class {
|
|
|
3859
4057
|
* @throws {ApiError} Enhanced API errors with user-friendly messages
|
|
3860
4058
|
* @throws {Error} Network or parsing errors
|
|
3861
4059
|
*/
|
|
3862
|
-
async
|
|
4060
|
+
async requestOnce(path, options = {}, { host, allowStatuses } = {}) {
|
|
3863
4061
|
const url = host ? `${this.protocol}://${host}/api/0${path}` : `${this.apiPrefix}${path}`;
|
|
3864
4062
|
const headers = {
|
|
3865
4063
|
"Content-Type": "application/json",
|
|
@@ -4295,7 +4493,7 @@ var SentryApiService = class {
|
|
|
4295
4493
|
const queryString = queryParams.toString();
|
|
4296
4494
|
const path = `/organizations/?${queryString}`;
|
|
4297
4495
|
let host = void 0;
|
|
4298
|
-
if (this.isSaas()) host = "sentry.io";
|
|
4496
|
+
if (this.isSaas() && !this.host.endsWith(".my.sentry.io")) host = "sentry.io";
|
|
4299
4497
|
const body = await this.requestJSON(path, void 0, { host });
|
|
4300
4498
|
return OrganizationListSchema.parse(body);
|
|
4301
4499
|
}
|
|
@@ -4484,45 +4682,77 @@ var SentryApiService = class {
|
|
|
4484
4682
|
return page.rules;
|
|
4485
4683
|
}
|
|
4486
4684
|
async listIssueAlertRulesPage({ organizationSlug, projectSlug: projectSlug$1, query, cursor, limit }, opts) {
|
|
4487
|
-
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));
|
|
4488
4692
|
const targetLimit = limit ?? 100;
|
|
4489
|
-
let currentCursor = cursor;
|
|
4490
|
-
let nextCursor = null;
|
|
4491
|
-
do {
|
|
4492
|
-
const searchQuery = new URLSearchParams();
|
|
4493
|
-
searchQuery.append("projectSlug", projectSlug$1);
|
|
4494
|
-
searchQuery.set("sortBy", "-id");
|
|
4495
|
-
if (query) searchQuery.set("query", formatWorkflowNameQuery(query));
|
|
4496
|
-
if (currentCursor) searchQuery.set("cursor", currentCursor);
|
|
4497
|
-
if (limit !== void 0) searchQuery.set("per_page", String(targetLimit - rules.length));
|
|
4498
|
-
const response = await this.request(apiPath`/organizations/${organizationSlug}/workflows/` + `?${searchQuery.toString()}`, void 0, opts);
|
|
4499
|
-
const body = await this.parseJsonResponse(response);
|
|
4500
|
-
const attachedRules = filterAttachedIssueAlertRules(IssueAlertRuleListSchema.parse(body));
|
|
4501
|
-
const remaining = targetLimit - rules.length;
|
|
4502
|
-
if (attachedRules.length > remaining) {
|
|
4503
|
-
rules.push(...attachedRules.slice(0, remaining));
|
|
4504
|
-
nextCursor = null;
|
|
4505
|
-
break;
|
|
4506
|
-
}
|
|
4507
|
-
rules.push(...attachedRules);
|
|
4508
|
-
nextCursor = getNextCursor(response.headers.get("link"));
|
|
4509
|
-
currentCursor = nextCursor;
|
|
4510
|
-
} while (rules.length < targetLimit && nextCursor);
|
|
4511
4693
|
return {
|
|
4512
|
-
rules,
|
|
4513
|
-
nextCursor
|
|
4694
|
+
rules: rules.slice(0, targetLimit),
|
|
4695
|
+
nextCursor: rules.length > targetLimit ? null : getNextCursor(response.headers.get("link"))
|
|
4514
4696
|
};
|
|
4515
4697
|
}
|
|
4516
4698
|
async getIssueAlertRule({ organizationSlug, projectSlug: projectSlug$1, ruleId }, opts) {
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
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
|
+
};
|
|
4526
4756
|
}
|
|
4527
4757
|
async listMetricAlertRules(params, opts) {
|
|
4528
4758
|
const page = await this.listMetricAlertRulesPage(params, opts);
|
|
@@ -5009,6 +5239,20 @@ var SentryApiService = class {
|
|
|
5009
5239
|
const body = await this.parseJsonResponse(response);
|
|
5010
5240
|
return EventsValidationResponseSchema.parse(body);
|
|
5011
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
|
+
}
|
|
5012
5256
|
async fetchTraceItemAttributes(organizationSlug, itemType, project, statsPeriod, start, end, substringMatch, query, opts) {
|
|
5013
5257
|
const queryParams = new URLSearchParams();
|
|
5014
5258
|
queryParams.set("itemType", itemType);
|
|
@@ -5131,7 +5375,7 @@ var SentryApiService = class {
|
|
|
5131
5375
|
};
|
|
5132
5376
|
}
|
|
5133
5377
|
async getEventForIssue({ organizationSlug, issueId, eventId }, opts) {
|
|
5134
|
-
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);
|
|
5135
5379
|
const parseResult = EventSchema.safeParse(body);
|
|
5136
5380
|
if (parseResult.success) {
|
|
5137
5381
|
const rawEvent = parseResult.data;
|
|
@@ -5204,22 +5448,52 @@ var SentryApiService = class {
|
|
|
5204
5448
|
const body = await this.requestJSON(apiPath`/projects/${organizationSlug}/${projectSlug$1}/events/${eventId}/attachments/`, void 0, opts);
|
|
5205
5449
|
return EventAttachmentListSchema.parse(body);
|
|
5206
5450
|
}
|
|
5207
|
-
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) {
|
|
5208
5452
|
const attachmentsData = await this.requestJSON(apiPath`/projects/${organizationSlug}/${projectSlug$1}/events/${eventId}/attachments/`, void 0, opts);
|
|
5209
5453
|
const attachments = EventAttachmentListSchema.parse(attachmentsData);
|
|
5210
5454
|
const attachment = attachments.find((att) => att.id === attachmentId);
|
|
5211
5455
|
if (!attachment) throw new ApiNotFoundError(`Attachment with ID ${attachmentId} not found for event ${eventId}`);
|
|
5212
|
-
const
|
|
5213
|
-
|
|
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);
|
|
5214
5469
|
const contentType = downloadResponse.headers.get("content-type")?.split(";")[0].trim() || attachment.mimetype || "application/octet-stream";
|
|
5470
|
+
const bytes = new Uint8Array(await downloadResponse.arrayBuffer());
|
|
5215
5471
|
return {
|
|
5216
5472
|
attachment,
|
|
5217
5473
|
downloadUrl: downloadResponse.url,
|
|
5474
|
+
directDownloadUrl: null,
|
|
5218
5475
|
filename: attachment.name,
|
|
5219
|
-
|
|
5476
|
+
bytes,
|
|
5220
5477
|
contentType
|
|
5221
5478
|
};
|
|
5222
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
|
+
}
|
|
5223
5497
|
async getReplayDetails({ organizationSlug, replayId }, opts) {
|
|
5224
5498
|
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/replays/${replayId}/`, void 0, opts);
|
|
5225
5499
|
return zod.z.object({ data: ReplayDetailsSchema }).parse(body).data;
|
|
@@ -5243,7 +5517,7 @@ var SentryApiService = class {
|
|
|
5243
5517
|
async updateIssue({ organizationSlug, issueId, status, assignedTo, substatus, ignoreDuration, ignoreCount, ignoreWindow, ignoreUserCount, ignoreUserWindow }, opts) {
|
|
5244
5518
|
const updateData = {};
|
|
5245
5519
|
if (status !== void 0) updateData.status = status;
|
|
5246
|
-
if (assignedTo !== void 0) updateData.assignedTo = assignedTo;
|
|
5520
|
+
if (assignedTo !== void 0) updateData.assignedTo = assignedTo ?? "";
|
|
5247
5521
|
if (substatus !== void 0) updateData.substatus = substatus;
|
|
5248
5522
|
if (ignoreDuration !== void 0) updateData.ignoreDuration = ignoreDuration;
|
|
5249
5523
|
if (ignoreCount !== void 0) updateData.ignoreCount = ignoreCount;
|
|
@@ -5391,6 +5665,27 @@ var SentryApiService = class {
|
|
|
5391
5665
|
const apiUrl = apiPath`/organizations/${organizationSlug}/events/` + `?${queryParams.toString()}`;
|
|
5392
5666
|
return await this.requestJSON(apiUrl, void 0, opts);
|
|
5393
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
|
+
}
|
|
5394
5689
|
async startAutofix({ organizationSlug, issueId, eventId, instruction = "" }, opts) {
|
|
5395
5690
|
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/issues/${issueId}/autofix/`, {
|
|
5396
5691
|
method: "POST",
|
|
@@ -5402,7 +5697,7 @@ var SentryApiService = class {
|
|
|
5402
5697
|
return AutofixRunSchema.parse(body);
|
|
5403
5698
|
}
|
|
5404
5699
|
async getAutofixState({ organizationSlug, issueId }, opts) {
|
|
5405
|
-
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);
|
|
5406
5701
|
return AutofixRunStateSchema.parse(body);
|
|
5407
5702
|
}
|
|
5408
5703
|
/**
|
|
@@ -5480,7 +5775,7 @@ var SentryApiService = class {
|
|
|
5480
5775
|
const projects = Array.isArray(project) ? project : [project];
|
|
5481
5776
|
for (const projectId of projects) queryParams.append("project", projectId);
|
|
5482
5777
|
if (cursor) queryParams.set("cursor", cursor);
|
|
5483
|
-
const response = await this.request(apiPath`/organizations/${organizationSlug}/
|
|
5778
|
+
const response = await this.request(apiPath`/organizations/${organizationSlug}/agents/conversations/${conversationId}/` + `?${queryParams.toString()}`, void 0, opts);
|
|
5484
5779
|
const body = await this.parseJsonResponse(response);
|
|
5485
5780
|
const details = AIConversationDetailsResponseSchema.parse(body);
|
|
5486
5781
|
title = details.title;
|
|
@@ -5512,7 +5807,7 @@ var SentryApiService = class {
|
|
|
5512
5807
|
this.applyTimeParams(queryParams, statsPeriod, start, end);
|
|
5513
5808
|
if (limit !== void 0) queryParams.set("per_page", String(limit));
|
|
5514
5809
|
if (cursor) queryParams.set("cursor", cursor);
|
|
5515
|
-
const response = await this.request(apiPath`/organizations/${organizationSlug}/
|
|
5810
|
+
const response = await this.request(apiPath`/organizations/${organizationSlug}/agents/conversations/` + `?${queryParams.toString()}`, void 0, opts);
|
|
5516
5811
|
const body = await this.parseJsonResponse(response);
|
|
5517
5812
|
return {
|
|
5518
5813
|
conversations: AIConversationSummaryListSchema.parse(body),
|
|
@@ -5633,7 +5928,7 @@ var SentryApiService = class {
|
|
|
5633
5928
|
const blob = await response.blob();
|
|
5634
5929
|
let contentType = response.headers.get("content-type") ?? "";
|
|
5635
5930
|
if (!contentType.startsWith("image/")) {
|
|
5636
|
-
const { detectImageMimeType } = await Promise.resolve().then(() => require("./blob-utils-
|
|
5931
|
+
const { detectImageMimeType } = await Promise.resolve().then(() => require("./blob-utils-DGsI5_gF.cjs"));
|
|
5637
5932
|
contentType = await detectImageMimeType(blob) ?? contentType;
|
|
5638
5933
|
}
|
|
5639
5934
|
return {
|
|
@@ -13130,7 +13425,7 @@ var _a19;
|
|
|
13130
13425
|
_a19 = symbol19;
|
|
13131
13426
|
|
|
13132
13427
|
//#endregion
|
|
13133
|
-
//#region ../mcp-core/dist/error-handling-
|
|
13428
|
+
//#region ../mcp-core/dist/error-handling-ChAIYsge.js
|
|
13134
13429
|
/**
|
|
13135
13430
|
* Type guard to identify user input validation errors.
|
|
13136
13431
|
*/
|
|
@@ -13332,9 +13627,19 @@ async function formatErrorForUser(error, options) {
|
|
|
13332
13627
|
}
|
|
13333
13628
|
return parts.join("\n\n");
|
|
13334
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
|
+
}
|
|
13335
13640
|
|
|
13336
13641
|
//#endregion
|
|
13337
|
-
//#region ../mcp-core/dist/constraint-helpers-
|
|
13642
|
+
//#region ../mcp-core/dist/constraint-helpers-DQeAySy6.js
|
|
13338
13643
|
/**
|
|
13339
13644
|
* Determines which tool parameter keys should be filtered out of the schema
|
|
13340
13645
|
* because they will be injected from constraints.
|
|
@@ -13396,7 +13701,7 @@ function getConstraintParametersToInject(constraints, toolInputSchema) {
|
|
|
13396
13701
|
}
|
|
13397
13702
|
|
|
13398
13703
|
//#endregion
|
|
13399
|
-
//#region ../mcp-core/dist/surfaces-
|
|
13704
|
+
//#region ../mcp-core/dist/surfaces-DCc7zT-1.js
|
|
13400
13705
|
/**
|
|
13401
13706
|
* Central policy for direct MCP exposure.
|
|
13402
13707
|
*
|
|
@@ -13431,7 +13736,7 @@ function isCatalogInfrastructureToolName(toolName) {
|
|
|
13431
13736
|
}
|
|
13432
13737
|
|
|
13433
13738
|
//#endregion
|
|
13434
|
-
//#region ../mcp-core/dist/types-
|
|
13739
|
+
//#region ../mcp-core/dist/types-DzNDeR5X.js
|
|
13435
13740
|
/**
|
|
13436
13741
|
* Resolves a tool description to a string.
|
|
13437
13742
|
* Handles both static strings and dynamic description functions.
|
|
@@ -13449,7 +13754,7 @@ function isToolVisibleInMode(tool$1, experimentalMode) {
|
|
|
13449
13754
|
}
|
|
13450
13755
|
|
|
13451
13756
|
//#endregion
|
|
13452
|
-
//#region ../mcp-core/dist/availability-
|
|
13757
|
+
//#region ../mcp-core/dist/availability-KeZ7TRFd.js
|
|
13453
13758
|
function getToolPlacement({ key, experimentalMode, useDefaultSurfacePolicy }) {
|
|
13454
13759
|
if (useDefaultSurfacePolicy) return {
|
|
13455
13760
|
isCatalogTool: !isOutsideCatalogToolName(key),
|
|
@@ -13547,13 +13852,13 @@ function resolveToolDescription(tool$1, context$1) {
|
|
|
13547
13852
|
}
|
|
13548
13853
|
|
|
13549
13854
|
//#endregion
|
|
13550
|
-
//#region ../mcp-core/dist/define-
|
|
13855
|
+
//#region ../mcp-core/dist/define-CmkKwzq9.js
|
|
13551
13856
|
function defineTool(config) {
|
|
13552
13857
|
return config;
|
|
13553
13858
|
}
|
|
13554
13859
|
|
|
13555
13860
|
//#endregion
|
|
13556
|
-
//#region ../mcp-core/dist/validate-region-url-
|
|
13861
|
+
//#region ../mcp-core/dist/validate-region-url-DbvSZfG2.js
|
|
13557
13862
|
/**
|
|
13558
13863
|
* Validates that a regionUrl is valid.
|
|
13559
13864
|
* Prevents SSRF attacks by only allowing the base host itself or domains from an allowlist.
|
|
@@ -13585,7 +13890,7 @@ function validateRegionUrl(regionUrl, baseHost) {
|
|
|
13585
13890
|
}
|
|
13586
13891
|
|
|
13587
13892
|
//#endregion
|
|
13588
|
-
//#region ../mcp-core/dist/api-
|
|
13893
|
+
//#region ../mcp-core/dist/api-D4GH5wp9.js
|
|
13589
13894
|
/**
|
|
13590
13895
|
* Create a Sentry API service from server context with optional region override
|
|
13591
13896
|
* @param context - Server context containing host and access token
|
|
@@ -13611,17 +13916,35 @@ function apiServiceFromContext(context$1, opts = {}) {
|
|
|
13611
13916
|
}
|
|
13612
13917
|
|
|
13613
13918
|
//#endregion
|
|
13614
|
-
//#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
|
+
*/
|
|
13615
13935
|
/**
|
|
13616
13936
|
* Marks a tool result as structured-only. The server generates compatibility
|
|
13617
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.
|
|
13618
13941
|
*/
|
|
13619
13942
|
function structuredResult(structuredContent) {
|
|
13620
13943
|
return { structuredContent };
|
|
13621
13944
|
}
|
|
13622
13945
|
|
|
13623
13946
|
//#endregion
|
|
13624
|
-
//#region ../mcp-core/dist/whoami-
|
|
13947
|
+
//#region ../mcp-core/dist/whoami-DthGP5fH.js
|
|
13625
13948
|
const whoamiOutputSchema = zod.z.object({
|
|
13626
13949
|
user: zod.z.object({
|
|
13627
13950
|
id: zod.z.string(),
|
|
@@ -13672,7 +13995,33 @@ var whoami_default = defineTool({
|
|
|
13672
13995
|
});
|
|
13673
13996
|
|
|
13674
13997
|
//#endregion
|
|
13675
|
-
//#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
|
|
13676
14025
|
const RESULT_LIMIT$3 = 25;
|
|
13677
14026
|
const findOrganizationsOutputSchema = zod.z.object({
|
|
13678
14027
|
organizations: zod.z.array(zod.z.object({
|
|
@@ -13724,7 +14073,14 @@ var find_organizations_default = defineTool({
|
|
|
13724
14073
|
});
|
|
13725
14074
|
|
|
13726
14075
|
//#endregion
|
|
13727
|
-
//#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
|
|
13728
14084
|
const RESULT_LIMIT$2 = 25;
|
|
13729
14085
|
const findTeamsOutputSchema = zod.z.object({
|
|
13730
14086
|
teams: zod.z.array(zod.z.object({
|
|
@@ -13766,7 +14122,7 @@ var find_teams_default = defineTool({
|
|
|
13766
14122
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
13767
14123
|
const organizationSlug = params.organizationSlug;
|
|
13768
14124
|
if (!organizationSlug) throw new UserInputError("Organization slug is required. Please provide an organizationSlug parameter.");
|
|
13769
|
-
(
|
|
14125
|
+
setOrganizationContext(organizationSlug);
|
|
13770
14126
|
const teams = await apiService.listTeams(organizationSlug, {
|
|
13771
14127
|
query: params.query ?? void 0,
|
|
13772
14128
|
limit: RESULT_LIMIT$2 + 1
|
|
@@ -13782,7 +14138,7 @@ var find_teams_default = defineTool({
|
|
|
13782
14138
|
});
|
|
13783
14139
|
|
|
13784
14140
|
//#endregion
|
|
13785
|
-
//#region ../mcp-core/dist/find-projects-
|
|
14141
|
+
//#region ../mcp-core/dist/find-projects-DBOb3oe-.js
|
|
13786
14142
|
const RESULT_LIMIT$1 = 25;
|
|
13787
14143
|
const findProjectsOutputSchema = zod.z.object({
|
|
13788
14144
|
projects: zod.z.array(zod.z.object({ slug: zod.z.string() })),
|
|
@@ -13817,7 +14173,7 @@ var find_projects_default = defineTool({
|
|
|
13817
14173
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
13818
14174
|
const organizationSlug = params.organizationSlug;
|
|
13819
14175
|
if (!organizationSlug) throw new UserInputError("Organization slug is required. Please provide an organizationSlug parameter.");
|
|
13820
|
-
(
|
|
14176
|
+
setOrganizationContext(organizationSlug);
|
|
13821
14177
|
const projects = await apiService.listProjects(organizationSlug, {
|
|
13822
14178
|
query: params.query ?? void 0,
|
|
13823
14179
|
limit: RESULT_LIMIT$1 + 1
|
|
@@ -13830,7 +14186,7 @@ var find_projects_default = defineTool({
|
|
|
13830
14186
|
});
|
|
13831
14187
|
|
|
13832
14188
|
//#endregion
|
|
13833
|
-
//#region ../mcp-core/dist/find-releases-
|
|
14189
|
+
//#region ../mcp-core/dist/find-releases-BF8-U7mW.js
|
|
13834
14190
|
const RESULT_LIMIT = 25;
|
|
13835
14191
|
const findReleasesOutputSchema = zod.z.object({
|
|
13836
14192
|
releases: zod.z.array(zod.z.object({
|
|
@@ -13903,7 +14259,7 @@ var find_releases_default = defineTool({
|
|
|
13903
14259
|
async handler(params, context$1) {
|
|
13904
14260
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
13905
14261
|
const organizationSlug = params.organizationSlug;
|
|
13906
|
-
(
|
|
14262
|
+
setOrganizationContext(organizationSlug);
|
|
13907
14263
|
const releases = await apiService.listReleases({
|
|
13908
14264
|
organizationSlug,
|
|
13909
14265
|
projectSlug: params.projectSlug ?? void 0,
|
|
@@ -13938,13 +14294,13 @@ var find_releases_default = defineTool({
|
|
|
13938
14294
|
});
|
|
13939
14295
|
|
|
13940
14296
|
//#endregion
|
|
13941
|
-
//#region ../mcp-core/dist/type-guards-
|
|
14297
|
+
//#region ../mcp-core/dist/type-guards-CsRf3nQI.js
|
|
13942
14298
|
function isPlainObject$3(value) {
|
|
13943
14299
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13944
14300
|
}
|
|
13945
14301
|
|
|
13946
14302
|
//#endregion
|
|
13947
|
-
//#region ../mcp-core/dist/api-formatting-
|
|
14303
|
+
//#region ../mcp-core/dist/api-formatting-Czl92Wir.js
|
|
13948
14304
|
function formatId(value) {
|
|
13949
14305
|
return value === void 0 || value === null ? "unknown" : String(value);
|
|
13950
14306
|
}
|
|
@@ -13981,7 +14337,7 @@ function compactLines(lines) {
|
|
|
13981
14337
|
}
|
|
13982
14338
|
|
|
13983
14339
|
//#endregion
|
|
13984
|
-
//#region ../mcp-core/dist/project-constraints-
|
|
14340
|
+
//#region ../mcp-core/dist/project-constraints-B-KhJpNB.js
|
|
13985
14341
|
function projectConstraintError(resourceLabel, projectSlug$1) {
|
|
13986
14342
|
return new UserInputError(`${resourceLabel} is outside the active project constraint. Expected project "${projectSlug$1}".`);
|
|
13987
14343
|
}
|
|
@@ -13999,7 +14355,7 @@ function assertProjectListContainsConstraint({ resourceLabel, scopedProjectSlug,
|
|
|
13999
14355
|
}
|
|
14000
14356
|
|
|
14001
14357
|
//#endregion
|
|
14002
|
-
//#region ../mcp-core/dist/get-release-details-
|
|
14358
|
+
//#region ../mcp-core/dist/get-release-details-DvY_TDet.js
|
|
14003
14359
|
function formatProjects(release) {
|
|
14004
14360
|
if (!release.projects || release.projects.length === 0) return null;
|
|
14005
14361
|
return release.projects.map((project) => project.slug ?? project.name).join(", ");
|
|
@@ -14071,7 +14427,7 @@ var get_release_details_default = defineTool({
|
|
|
14071
14427
|
async handler(params, context$1) {
|
|
14072
14428
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14073
14429
|
const organizationSlug = params.organizationSlug;
|
|
14074
|
-
(
|
|
14430
|
+
setOrganizationContext(organizationSlug);
|
|
14075
14431
|
(0, __sentry_core.setTag)("release.version", params.releaseVersion);
|
|
14076
14432
|
const scopedProjectSlug = context$1.constraints.projectSlug ?? void 0;
|
|
14077
14433
|
const requestedProjectSlugOrId = params.projectSlugOrId ?? void 0;
|
|
@@ -14151,7 +14507,7 @@ var get_release_details_default = defineTool({
|
|
|
14151
14507
|
});
|
|
14152
14508
|
|
|
14153
14509
|
//#endregion
|
|
14154
|
-
//#region ../mcp-core/dist/dashboards-
|
|
14510
|
+
//#region ../mcp-core/dist/dashboards-CHADwOiv.js
|
|
14155
14511
|
function formatList(values) {
|
|
14156
14512
|
if (!values || values.length === 0) return null;
|
|
14157
14513
|
return values.map(String).join(", ");
|
|
@@ -14283,7 +14639,7 @@ async function resolveDashboardId({ apiService, organizationSlug, dashboardIdOrT
|
|
|
14283
14639
|
}
|
|
14284
14640
|
|
|
14285
14641
|
//#endregion
|
|
14286
|
-
//#region ../mcp-core/dist/find-dashboards-
|
|
14642
|
+
//#region ../mcp-core/dist/find-dashboards-oyqvVv8a.js
|
|
14287
14643
|
const PROJECT_DASHBOARD_CURSOR_PREFIX = "mcp-dashboard-project:";
|
|
14288
14644
|
const dashboardSummarySchema = zod.z.object({
|
|
14289
14645
|
id: zod.z.string(),
|
|
@@ -14442,7 +14798,7 @@ var find_dashboards_default = defineTool({
|
|
|
14442
14798
|
async handler(params, context$1) {
|
|
14443
14799
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14444
14800
|
const organizationSlug = params.organizationSlug;
|
|
14445
|
-
(
|
|
14801
|
+
setOrganizationContext(organizationSlug);
|
|
14446
14802
|
const scopedProject = await resolveDashboardProjectConstraint({
|
|
14447
14803
|
apiService,
|
|
14448
14804
|
organizationSlug,
|
|
@@ -14494,7 +14850,7 @@ var find_dashboards_default = defineTool({
|
|
|
14494
14850
|
});
|
|
14495
14851
|
|
|
14496
14852
|
//#endregion
|
|
14497
|
-
//#region ../mcp-core/dist/get-dashboard-details-
|
|
14853
|
+
//#region ../mcp-core/dist/get-dashboard-details-D_U6hOFe.js
|
|
14498
14854
|
var get_dashboard_details_default = defineTool({
|
|
14499
14855
|
name: "get_dashboard_details",
|
|
14500
14856
|
skills: ["inspect"],
|
|
@@ -14531,7 +14887,7 @@ var get_dashboard_details_default = defineTool({
|
|
|
14531
14887
|
async handler(params, context$1) {
|
|
14532
14888
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14533
14889
|
const organizationSlug = params.organizationSlug;
|
|
14534
|
-
(
|
|
14890
|
+
setOrganizationContext(organizationSlug);
|
|
14535
14891
|
const scopedProject = await resolveDashboardProjectConstraint({
|
|
14536
14892
|
apiService,
|
|
14537
14893
|
organizationSlug,
|
|
@@ -14568,7 +14924,7 @@ var get_dashboard_details_default = defineTool({
|
|
|
14568
14924
|
});
|
|
14569
14925
|
|
|
14570
14926
|
//#endregion
|
|
14571
|
-
//#region ../mcp-core/dist/find-monitors-
|
|
14927
|
+
//#region ../mcp-core/dist/find-monitors-CwXZsdiJ.js
|
|
14572
14928
|
const ENVIRONMENT_LIMIT = 5;
|
|
14573
14929
|
const monitorScheduleOutputSchema = zod.z.object({
|
|
14574
14930
|
type: zod.z.string().nullable(),
|
|
@@ -14700,7 +15056,7 @@ var find_monitors_default = defineTool({
|
|
|
14700
15056
|
async handler(params, context$1) {
|
|
14701
15057
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14702
15058
|
const organizationSlug = params.organizationSlug;
|
|
14703
|
-
(
|
|
15059
|
+
setOrganizationContext(organizationSlug);
|
|
14704
15060
|
const requestedProjectSlug = params.projectSlug && params.projectSlug !== "all" ? params.projectSlug : void 0;
|
|
14705
15061
|
if (requestedProjectSlug) assertProjectRefWithinConstraint({
|
|
14706
15062
|
resourceLabel: "Monitor list",
|
|
@@ -14746,7 +15102,7 @@ var find_monitors_default = defineTool({
|
|
|
14746
15102
|
});
|
|
14747
15103
|
|
|
14748
15104
|
//#endregion
|
|
14749
|
-
//#region ../mcp-core/dist/get-monitor-details-
|
|
15105
|
+
//#region ../mcp-core/dist/get-monitor-details-CDcHPW6x.js
|
|
14750
15106
|
function formatProject(monitor) {
|
|
14751
15107
|
if (!monitor.project) return null;
|
|
14752
15108
|
return monitor.project.slug ?? monitor.project.name ?? null;
|
|
@@ -14811,7 +15167,7 @@ var get_monitor_details_default = defineTool({
|
|
|
14811
15167
|
async handler(params, context$1) {
|
|
14812
15168
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14813
15169
|
const organizationSlug = params.organizationSlug;
|
|
14814
|
-
(
|
|
15170
|
+
setOrganizationContext(organizationSlug);
|
|
14815
15171
|
(0, __sentry_core.setTag)("monitor.slug", params.monitorSlug);
|
|
14816
15172
|
const requestedProjectSlugOrId = params.projectSlugOrId ?? void 0;
|
|
14817
15173
|
const projectSlugOrId = requestedProjectSlugOrId ?? context$1.constraints.projectSlug ?? null;
|
|
@@ -14906,7 +15262,7 @@ var get_monitor_details_default = defineTool({
|
|
|
14906
15262
|
});
|
|
14907
15263
|
|
|
14908
15264
|
//#endregion
|
|
14909
|
-
//#region ../mcp-core/dist/uptime-monitors-
|
|
15265
|
+
//#region ../mcp-core/dist/uptime-monitors-D7xvJsr1.js
|
|
14910
15266
|
/** Verified against UptimeSubscription.IntervalSeconds in getsentry/sentry. */
|
|
14911
15267
|
const UPTIME_INTERVAL_SECONDS = [
|
|
14912
15268
|
60,
|
|
@@ -15039,7 +15395,7 @@ function toUptimeMonitorSummary(monitor, webUrl) {
|
|
|
15039
15395
|
}
|
|
15040
15396
|
|
|
15041
15397
|
//#endregion
|
|
15042
|
-
//#region ../mcp-core/dist/find-uptime-monitors-
|
|
15398
|
+
//#region ../mcp-core/dist/find-uptime-monitors-B5dw0P9D.js
|
|
15043
15399
|
const findUptimeMonitorsOutputSchema = zod.z.object({
|
|
15044
15400
|
monitors: zod.z.array(uptimeMonitorListItemSchema),
|
|
15045
15401
|
hasMore: zod.z.boolean()
|
|
@@ -15082,7 +15438,7 @@ var find_uptime_monitors_default = defineTool({
|
|
|
15082
15438
|
async handler(params, context$1) {
|
|
15083
15439
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15084
15440
|
const organizationSlug = params.organizationSlug;
|
|
15085
|
-
(
|
|
15441
|
+
setOrganizationContext(organizationSlug);
|
|
15086
15442
|
const requestedProjectSlug = params.projectSlug && params.projectSlug !== "all" ? params.projectSlug : void 0;
|
|
15087
15443
|
if (requestedProjectSlug) assertProjectRefWithinConstraint({
|
|
15088
15444
|
resourceLabel: "Uptime monitor list",
|
|
@@ -15107,7 +15463,7 @@ var find_uptime_monitors_default = defineTool({
|
|
|
15107
15463
|
});
|
|
15108
15464
|
|
|
15109
15465
|
//#endregion
|
|
15110
|
-
//#region ../mcp-core/dist/get-uptime-monitor-details-
|
|
15466
|
+
//#region ../mcp-core/dist/get-uptime-monitor-details-B40FMp1m.js
|
|
15111
15467
|
function formatCheck(check, monitorEnvironment) {
|
|
15112
15468
|
const time = formatDate(check.timestamp) ?? formatDate(check.scheduledCheckTime) ?? "unknown time";
|
|
15113
15469
|
const status = check.checkStatus ?? "unknown";
|
|
@@ -15160,7 +15516,7 @@ var get_uptime_monitor_details_default = defineTool({
|
|
|
15160
15516
|
async handler(params, context$1) {
|
|
15161
15517
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15162
15518
|
const organizationSlug = params.organizationSlug;
|
|
15163
|
-
(
|
|
15519
|
+
setOrganizationContext(organizationSlug);
|
|
15164
15520
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
15165
15521
|
(0, __sentry_core.setTag)("uptime.monitor_id", params.uptimeMonitorId);
|
|
15166
15522
|
assertProjectRefWithinConstraint({
|
|
@@ -15229,7 +15585,7 @@ var get_uptime_monitor_details_default = defineTool({
|
|
|
15229
15585
|
});
|
|
15230
15586
|
|
|
15231
15587
|
//#endregion
|
|
15232
|
-
//#region ../mcp-core/dist/create-uptime-monitor-
|
|
15588
|
+
//#region ../mcp-core/dist/create-uptime-monitor-BarA-8c1.js
|
|
15233
15589
|
const createUptimeMonitorOutputSchema = zod.z.object({ monitor: uptimeMonitorSummarySchema });
|
|
15234
15590
|
var create_uptime_monitor_default = defineTool({
|
|
15235
15591
|
name: "create_uptime_monitor",
|
|
@@ -15280,7 +15636,7 @@ var create_uptime_monitor_default = defineTool({
|
|
|
15280
15636
|
async handler(params, context$1) {
|
|
15281
15637
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15282
15638
|
const organizationSlug = params.organizationSlug;
|
|
15283
|
-
(
|
|
15639
|
+
setOrganizationContext(organizationSlug);
|
|
15284
15640
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
15285
15641
|
assertProjectRefWithinConstraint({
|
|
15286
15642
|
resourceLabel: "Uptime monitor",
|
|
@@ -15310,7 +15666,7 @@ var create_uptime_monitor_default = defineTool({
|
|
|
15310
15666
|
});
|
|
15311
15667
|
|
|
15312
15668
|
//#endregion
|
|
15313
|
-
//#region ../mcp-core/dist/update-uptime-monitor-
|
|
15669
|
+
//#region ../mcp-core/dist/update-uptime-monitor-Borxg5io.js
|
|
15314
15670
|
const updateUptimeMonitorOutputSchema = zod.z.object({ monitor: uptimeMonitorSummarySchema });
|
|
15315
15671
|
function hasDefinedUpdate(value) {
|
|
15316
15672
|
return value !== void 0;
|
|
@@ -15367,7 +15723,7 @@ var update_uptime_monitor_default = defineTool({
|
|
|
15367
15723
|
async handler(params, context$1) {
|
|
15368
15724
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15369
15725
|
const organizationSlug = params.organizationSlug;
|
|
15370
|
-
(
|
|
15726
|
+
setOrganizationContext(organizationSlug);
|
|
15371
15727
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
15372
15728
|
(0, __sentry_core.setTag)("uptime.monitor_id", params.uptimeMonitorId);
|
|
15373
15729
|
assertProjectRefWithinConstraint({
|
|
@@ -15401,7 +15757,7 @@ var update_uptime_monitor_default = defineTool({
|
|
|
15401
15757
|
});
|
|
15402
15758
|
|
|
15403
15759
|
//#endregion
|
|
15404
|
-
//#region ../mcp-core/dist/delete-uptime-monitor-
|
|
15760
|
+
//#region ../mcp-core/dist/delete-uptime-monitor-CpzZ4G3P.js
|
|
15405
15761
|
const deleteUptimeMonitorOutputSchema = zod.z.object({
|
|
15406
15762
|
success: zod.z.literal(true),
|
|
15407
15763
|
uptimeMonitorId: zod.z.string(),
|
|
@@ -15438,7 +15794,7 @@ var delete_uptime_monitor_default = defineTool({
|
|
|
15438
15794
|
async handler(params, context$1) {
|
|
15439
15795
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15440
15796
|
const organizationSlug = params.organizationSlug;
|
|
15441
|
-
(
|
|
15797
|
+
setOrganizationContext(organizationSlug);
|
|
15442
15798
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
15443
15799
|
(0, __sentry_core.setTag)("uptime.monitor_id", params.uptimeMonitorId);
|
|
15444
15800
|
assertProjectRefWithinConstraint({
|
|
@@ -15460,12 +15816,12 @@ var delete_uptime_monitor_default = defineTool({
|
|
|
15460
15816
|
});
|
|
15461
15817
|
|
|
15462
15818
|
//#endregion
|
|
15463
|
-
//#region ../mcp-core/dist/find-alert-rules-
|
|
15819
|
+
//#region ../mcp-core/dist/find-alert-rules-Dc55EgzE.js
|
|
15464
15820
|
const AlertRuleKind$1 = zod.z.enum([
|
|
15465
15821
|
"all",
|
|
15466
15822
|
"issue",
|
|
15467
15823
|
"metric"
|
|
15468
|
-
]).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.");
|
|
15469
15825
|
const issueAlertRuleSummarySchema = zod.z.object({
|
|
15470
15826
|
id: zod.z.string(),
|
|
15471
15827
|
name: zod.z.string(),
|
|
@@ -15501,9 +15857,10 @@ const findAlertRulesOutputSchema = zod.z.object({
|
|
|
15501
15857
|
pagination: zod.z.object({
|
|
15502
15858
|
issue: paginationStateSchema.nullable(),
|
|
15503
15859
|
metric: paginationStateSchema.nullable()
|
|
15504
|
-
})
|
|
15860
|
+
}),
|
|
15861
|
+
warnings: zod.z.array(zod.z.string()).optional()
|
|
15505
15862
|
});
|
|
15506
|
-
function getIssueAlertRuleFrequency
|
|
15863
|
+
function getIssueAlertRuleFrequency(rule) {
|
|
15507
15864
|
if (typeof rule.frequency === "number") return rule.frequency;
|
|
15508
15865
|
const frequency = rule.config.frequency;
|
|
15509
15866
|
return typeof frequency === "number" ? frequency : null;
|
|
@@ -15524,7 +15881,7 @@ var find_alert_rules_default = defineTool({
|
|
|
15524
15881
|
"Find Sentry alert rules.",
|
|
15525
15882
|
"",
|
|
15526
15883
|
"Use this tool when you need to:",
|
|
15527
|
-
"- List
|
|
15884
|
+
"- List Alerts (workflows) for an organization or project, including Alerts without connected sources",
|
|
15528
15885
|
"- List metric alert rules for an organization or project",
|
|
15529
15886
|
"- Find an alert rule ID by name before inspecting it",
|
|
15530
15887
|
"- Check alert conditions, queries, triggers, actions, owner, or environment",
|
|
@@ -15536,8 +15893,8 @@ var find_alert_rules_default = defineTool({
|
|
|
15536
15893
|
"</examples>",
|
|
15537
15894
|
"",
|
|
15538
15895
|
"<hints>",
|
|
15539
|
-
"-
|
|
15540
|
-
"-
|
|
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.",
|
|
15541
15898
|
"- Issue and metric alert rules have independent pagination state. Reuse a nextCursor only with its matching kind.",
|
|
15542
15899
|
"</hints>"
|
|
15543
15900
|
].join("\n"),
|
|
@@ -15564,15 +15921,14 @@ var find_alert_rules_default = defineTool({
|
|
|
15564
15921
|
project: { slug: requestedProjectSlug }
|
|
15565
15922
|
});
|
|
15566
15923
|
const projectSlug$1 = context$1.constraints.projectSlug ?? requestedProjectSlug;
|
|
15567
|
-
if (params.kind === "issue" && !projectSlug$1) throw new UserInputError("projectSlug is required when searching issue alert rules.");
|
|
15568
15924
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15569
15925
|
const organizationSlug = params.organizationSlug;
|
|
15570
|
-
(
|
|
15926
|
+
setOrganizationContext(organizationSlug);
|
|
15571
15927
|
if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
|
|
15572
|
-
const includeIssue = params.kind !== "metric"
|
|
15928
|
+
const includeIssue = params.kind !== "metric";
|
|
15573
15929
|
const includeMetric = params.kind !== "issue";
|
|
15574
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.");
|
|
15575
|
-
const issuePage = includeIssue
|
|
15931
|
+
const issuePage = includeIssue ? await apiService.listIssueAlertRulesPage({
|
|
15576
15932
|
organizationSlug,
|
|
15577
15933
|
projectSlug: projectSlug$1,
|
|
15578
15934
|
query: params.query ?? void 0,
|
|
@@ -15582,16 +15938,18 @@ var find_alert_rules_default = defineTool({
|
|
|
15582
15938
|
rules: [],
|
|
15583
15939
|
nextCursor: null
|
|
15584
15940
|
};
|
|
15941
|
+
const warnings = [];
|
|
15585
15942
|
const metricPage = includeMetric ? await apiService.listMetricAlertRulesPage({
|
|
15586
15943
|
organizationSlug,
|
|
15587
15944
|
projectSlug: projectSlug$1,
|
|
15588
15945
|
query: params.query ?? void 0,
|
|
15589
15946
|
cursor: params.cursor ?? void 0,
|
|
15590
15947
|
limit: params.limit
|
|
15591
|
-
})
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
|
|
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;
|
|
15595
15953
|
return structuredResult({
|
|
15596
15954
|
issueRules: issuePage.rules.map((rule) => ({
|
|
15597
15955
|
id: String(rule.id),
|
|
@@ -15599,7 +15957,7 @@ var find_alert_rules_default = defineTool({
|
|
|
15599
15957
|
status: getIssueAlertRuleStatus(rule),
|
|
15600
15958
|
actionMatch: rule.actionMatch ?? null,
|
|
15601
15959
|
filterMatch: rule.filterMatch ?? null,
|
|
15602
|
-
frequencyMinutes: getIssueAlertRuleFrequency
|
|
15960
|
+
frequencyMinutes: getIssueAlertRuleFrequency(rule),
|
|
15603
15961
|
environment: rule.environment ?? null,
|
|
15604
15962
|
owner: getOwner(rule.owner),
|
|
15605
15963
|
dateCreated: formatDate(rule.dateCreated),
|
|
@@ -15607,7 +15965,7 @@ var find_alert_rules_default = defineTool({
|
|
|
15607
15965
|
lastTriggered: formatDate(rule.lastTriggered),
|
|
15608
15966
|
webUrl: apiService.getIssueAlertRuleUrl(organizationSlug, rule.id)
|
|
15609
15967
|
})),
|
|
15610
|
-
metricRules: metricPage
|
|
15968
|
+
metricRules: (metricPage?.rules ?? []).map((rule) => ({
|
|
15611
15969
|
id: String(rule.id),
|
|
15612
15970
|
name: rule.name,
|
|
15613
15971
|
status: rule.status ?? null,
|
|
@@ -15623,14 +15981,184 @@ var find_alert_rules_default = defineTool({
|
|
|
15623
15981
|
})),
|
|
15624
15982
|
pagination: {
|
|
15625
15983
|
issue: includeIssue ? { nextCursor: issuePage.nextCursor } : null,
|
|
15626
|
-
metric:
|
|
15627
|
-
}
|
|
15984
|
+
metric: metricPage ? { nextCursor: metricPage.nextCursor } : null
|
|
15985
|
+
},
|
|
15986
|
+
...warnings.length > 0 ? { warnings } : {}
|
|
15628
15987
|
});
|
|
15629
15988
|
}
|
|
15630
15989
|
});
|
|
15631
15990
|
|
|
15632
15991
|
//#endregion
|
|
15633
|
-
//#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
|
|
15634
16162
|
const NUMERIC_ID_PATTERN = /^\d+$/;
|
|
15635
16163
|
const COMPONENT_DETAIL_SKIP_KEYS = new Set([
|
|
15636
16164
|
"id",
|
|
@@ -15758,40 +16286,6 @@ function formatComponentSummary(label, components, headingLevel) {
|
|
|
15758
16286
|
if (components.length > 5) lines.push(`- ...and ${components.length - 5} more`);
|
|
15759
16287
|
return lines;
|
|
15760
16288
|
}
|
|
15761
|
-
function getIssueAlertRuleFrequency(rule) {
|
|
15762
|
-
if (rule.frequency !== void 0 && rule.frequency !== null) return rule.frequency;
|
|
15763
|
-
const frequency = rule.config.frequency;
|
|
15764
|
-
return typeof frequency === "number" ? frequency : null;
|
|
15765
|
-
}
|
|
15766
|
-
function formatIssueAlertRule(rule, projectSlug$1, options = {}) {
|
|
15767
|
-
const headingLevel = options.headingLevel ?? 2;
|
|
15768
|
-
const includeComponents = options.includeComponents ?? true;
|
|
15769
|
-
const heading = "#".repeat(Math.min(headingLevel, 6));
|
|
15770
|
-
const owner = rule.owner ? formatActor(rule.owner) : null;
|
|
15771
|
-
const frequency = getIssueAlertRuleFrequency(rule);
|
|
15772
|
-
const lines = compactLines([
|
|
15773
|
-
`${heading} ${rule.name}`,
|
|
15774
|
-
"",
|
|
15775
|
-
`**Kind**: Issue Alert`,
|
|
15776
|
-
`**ID**: ${formatId(rule.id)}`,
|
|
15777
|
-
`**Project**: ${projectSlug$1}`,
|
|
15778
|
-
rule.status ? `**Status**: ${rule.status}` : rule.enabled !== void 0 ? `**Status**: ${rule.enabled ? "enabled" : "disabled"}` : null,
|
|
15779
|
-
rule.actionMatch ? `**Action Match**: ${rule.actionMatch}` : null,
|
|
15780
|
-
rule.filterMatch ? `**Filter Match**: ${rule.filterMatch}` : null,
|
|
15781
|
-
frequency !== null ? `**Frequency**: ${frequency} minutes` : null,
|
|
15782
|
-
rule.environment ? `**Environment**: ${rule.environment}` : null,
|
|
15783
|
-
owner ? `**Owner**: ${owner}` : null,
|
|
15784
|
-
formatDate(rule.dateCreated) ? `**Created**: ${formatDate(rule.dateCreated)}` : null,
|
|
15785
|
-
formatDate(rule.dateUpdated) ? `**Updated**: ${formatDate(rule.dateUpdated)}` : null,
|
|
15786
|
-
formatDate(rule.lastTriggered) ? `**Last Triggered**: ${formatDate(rule.lastTriggered)}` : null,
|
|
15787
|
-
options.url ? `**URL**: ${options.url}` : null
|
|
15788
|
-
]);
|
|
15789
|
-
if (includeComponents) {
|
|
15790
|
-
const workflowTriggers = rule.triggers ? [rule.triggers] : [];
|
|
15791
|
-
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));
|
|
15792
|
-
}
|
|
15793
|
-
return lines.join("\n");
|
|
15794
|
-
}
|
|
15795
16289
|
function formatMetricAlertRule(rule, options = {}) {
|
|
15796
16290
|
const headingLevel = options.headingLevel ?? 2;
|
|
15797
16291
|
const includeComponents = options.includeComponents ?? true;
|
|
@@ -15817,14 +16311,16 @@ function formatMetricAlertRule(rule, options = {}) {
|
|
|
15817
16311
|
if (includeComponents) lines.push(...formatComponentSummary("Triggers", rule.triggers, headingLevel + 1));
|
|
15818
16312
|
return lines.join("\n");
|
|
15819
16313
|
}
|
|
16314
|
+
/** Resolve case-insensitive names only when the search results are complete. */
|
|
15820
16315
|
async function findExactIssueAlertRuleMatches(apiService, params) {
|
|
15821
|
-
const
|
|
16316
|
+
const page = await apiService.listIssueAlertRulesPage({
|
|
15822
16317
|
organizationSlug: params.organizationSlug,
|
|
15823
16318
|
projectSlug: params.projectSlug,
|
|
15824
16319
|
query: params.ruleName,
|
|
15825
16320
|
limit: 100
|
|
15826
16321
|
});
|
|
15827
|
-
|
|
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());
|
|
15828
16324
|
}
|
|
15829
16325
|
async function findExactMetricAlertRuleMatches(apiService, params) {
|
|
15830
16326
|
const rules = await apiService.listMetricAlertRules({
|
|
@@ -15856,7 +16352,7 @@ async function resolveIssueAlertRule(apiService, params) {
|
|
|
15856
16352
|
ruleId: matches[0].id
|
|
15857
16353
|
});
|
|
15858
16354
|
if (matches.length > 1) throw new UserInputError(`Multiple issue alert rules named "${params.ruleIdOrName}" were found. Retry with the numeric rule ID.`);
|
|
15859
|
-
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}` : ""}.`);
|
|
15860
16356
|
}
|
|
15861
16357
|
async function resolveMetricAlertRule(apiService, params) {
|
|
15862
16358
|
if (isNumericAlertRuleId(params.ruleIdOrName)) try {
|
|
@@ -15881,7 +16377,7 @@ async function resolveMetricAlertRule(apiService, params) {
|
|
|
15881
16377
|
}
|
|
15882
16378
|
|
|
15883
16379
|
//#endregion
|
|
15884
|
-
//#region ../mcp-core/dist/get-alert-rule-
|
|
16380
|
+
//#region ../mcp-core/dist/get-alert-rule-DOk7Olu5.js
|
|
15885
16381
|
const AlertRuleKind = zod.z.enum([
|
|
15886
16382
|
"all",
|
|
15887
16383
|
"issue",
|
|
@@ -15913,7 +16409,8 @@ var get_alert_rule_default = defineTool({
|
|
|
15913
16409
|
"<hints>",
|
|
15914
16410
|
"- Use `kind='issue'` or `kind='metric'` for numeric IDs because issue and metric alerts use separate endpoints.",
|
|
15915
16411
|
"- With `kind='all'`, a digit-only `ruleIdOrName` is treated as an exact alert rule name.",
|
|
15916
|
-
"- 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.",
|
|
15917
16414
|
"</hints>"
|
|
15918
16415
|
].join("\n"),
|
|
15919
16416
|
inputSchema: {
|
|
@@ -15936,22 +16433,22 @@ var get_alert_rule_default = defineTool({
|
|
|
15936
16433
|
project: { slug: requestedProjectSlug }
|
|
15937
16434
|
});
|
|
15938
16435
|
const projectSlug$1 = context$1.constraints.projectSlug ?? requestedProjectSlug;
|
|
15939
|
-
if (params.kind === "issue" && !projectSlug$1) throw new UserInputError("projectSlug is required when inspecting an issue alert rule.");
|
|
15940
16436
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15941
16437
|
const organizationSlug = params.organizationSlug;
|
|
15942
|
-
(
|
|
16438
|
+
setOrganizationContext(organizationSlug);
|
|
15943
16439
|
if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
|
|
16440
|
+
const warnings = [];
|
|
15944
16441
|
let match;
|
|
15945
16442
|
if (params.kind === "issue") {
|
|
15946
16443
|
const rule = await resolveIssueAlertRule(apiService, {
|
|
15947
16444
|
organizationSlug,
|
|
15948
|
-
projectSlug: projectSlug$1
|
|
16445
|
+
projectSlug: projectSlug$1,
|
|
15949
16446
|
ruleIdOrName: params.ruleIdOrName
|
|
15950
16447
|
});
|
|
15951
16448
|
match = {
|
|
15952
16449
|
kind: "issue",
|
|
15953
16450
|
rule,
|
|
15954
|
-
projectSlug: projectSlug$1
|
|
16451
|
+
projectSlug: projectSlug$1
|
|
15955
16452
|
};
|
|
15956
16453
|
} else if (params.kind === "metric") {
|
|
15957
16454
|
const rule = await resolveMetricAlertRule(apiService, {
|
|
@@ -15967,31 +16464,34 @@ var get_alert_rule_default = defineTool({
|
|
|
15967
16464
|
};
|
|
15968
16465
|
} else {
|
|
15969
16466
|
const matches = [];
|
|
15970
|
-
|
|
15971
|
-
|
|
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({
|
|
15972
16479
|
organizationSlug,
|
|
15973
16480
|
projectSlug: projectSlug$1,
|
|
15974
16481
|
query: params.ruleIdOrName,
|
|
15975
16482
|
limit: 100
|
|
15976
16483
|
});
|
|
15977
|
-
|
|
15978
|
-
|
|
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",
|
|
15979
16487
|
rule,
|
|
15980
16488
|
projectSlug: projectSlug$1
|
|
15981
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.");
|
|
15982
16493
|
}
|
|
15983
|
-
|
|
15984
|
-
organizationSlug,
|
|
15985
|
-
projectSlug: projectSlug$1,
|
|
15986
|
-
query: params.ruleIdOrName,
|
|
15987
|
-
limit: 100
|
|
15988
|
-
});
|
|
15989
|
-
matches.push(...metricRules.filter((rule) => rule.name.toLowerCase() === params.ruleIdOrName.toLowerCase()).map((rule) => ({
|
|
15990
|
-
kind: "metric",
|
|
15991
|
-
rule,
|
|
15992
|
-
projectSlug: projectSlug$1
|
|
15993
|
-
})));
|
|
15994
|
-
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(" ")}` : ""}`);
|
|
15995
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.`);
|
|
15996
16496
|
const [found] = matches;
|
|
15997
16497
|
match = found.kind === "issue" ? {
|
|
@@ -16010,9 +16510,13 @@ var get_alert_rule_default = defineTool({
|
|
|
16010
16510
|
};
|
|
16011
16511
|
if (match.kind === "metric") assertMetricAlertRuleWithinProject(match.rule, match.projectSlug);
|
|
16012
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
|
+
});
|
|
16013
16517
|
const scopeLabel = projectSlug$1 ? `${organizationSlug}/${projectSlug$1}` : organizationSlug;
|
|
16014
16518
|
let output = `# Alert Rule in **${scopeLabel}**\n\n`;
|
|
16015
|
-
output +=
|
|
16519
|
+
output += formatMetricAlertRule(match.rule, { url: apiService.getMetricAlertRuleUrl(organizationSlug, match.rule.id) });
|
|
16016
16520
|
output += "\n\n## Response Notes\n\n";
|
|
16017
16521
|
output += "- Use these details to inspect alert conditions, filters, routing, and notification actions before changing the rule in Sentry.\n";
|
|
16018
16522
|
return output;
|
|
@@ -16020,7 +16524,203 @@ var get_alert_rule_default = defineTool({
|
|
|
16020
16524
|
});
|
|
16021
16525
|
|
|
16022
16526
|
//#endregion
|
|
16023
|
-
//#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
|
|
16024
16724
|
function formatArgumentValue(value) {
|
|
16025
16725
|
if (typeof value === "string") return `'${value.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
|
|
16026
16726
|
if (Array.isArray(value) || typeof value === "object") return JSON.stringify(value);
|
|
@@ -16073,7 +16773,7 @@ function formatAvailableToolCallInstruction({ toolName, experimentalMode, purpos
|
|
|
16073
16773
|
}
|
|
16074
16774
|
|
|
16075
16775
|
//#endregion
|
|
16076
|
-
//#region ../mcp-core/dist/ai-conversation-actions-
|
|
16776
|
+
//#region ../mcp-core/dist/ai-conversation-actions-CLccuTm5.js
|
|
16077
16777
|
const MAX_SUGGESTED_ACTIONS = 3;
|
|
16078
16778
|
function formatInlineCode$1(value) {
|
|
16079
16779
|
const backtickRuns = value.match(/`+/g) ?? [];
|
|
@@ -16084,8 +16784,8 @@ function formatInlineCode$1(value) {
|
|
|
16084
16784
|
}
|
|
16085
16785
|
/** Builds transcript actions that match the session's direct or catalog surface. */
|
|
16086
16786
|
function getAIConversationSuggestedActions({ organizationSlug, aiConversations, experimentalMode, availableToolNames, directToolNames }) {
|
|
16087
|
-
if (aiConversations.length === 0 || !isToolAvailableInSession("
|
|
16088
|
-
const targetIsDirect = directToolNames ? directToolNames.has("
|
|
16787
|
+
if (aiConversations.length === 0 || !isToolAvailableInSession("get_agent_conversation_details", availableToolNames)) return [];
|
|
16788
|
+
const targetIsDirect = directToolNames ? directToolNames.has("get_agent_conversation_details") : isTopLevelToolName("get_agent_conversation_details", experimentalMode);
|
|
16089
16789
|
const executeToolIsDirect = directToolNames ? directToolNames.has("execute_sentry_tool") : isTopLevelToolName("execute_sentry_tool", experimentalMode);
|
|
16090
16790
|
const useCatalogGateway = !targetIsDirect && executeToolIsDirect && isToolAvailableInSession("execute_sentry_tool", availableToolNames);
|
|
16091
16791
|
if (!targetIsDirect && !useCatalogGateway) return [];
|
|
@@ -16096,17 +16796,17 @@ function getAIConversationSuggestedActions({ organizationSlug, aiConversations,
|
|
|
16096
16796
|
};
|
|
16097
16797
|
return targetIsDirect ? {
|
|
16098
16798
|
type: "tool_call",
|
|
16099
|
-
toolName: "
|
|
16799
|
+
toolName: "get_agent_conversation_details",
|
|
16100
16800
|
arguments: targetArguments,
|
|
16101
|
-
reason: "Fetch the full transcript for this
|
|
16801
|
+
reason: "Fetch the full transcript for this agent conversation."
|
|
16102
16802
|
} : {
|
|
16103
16803
|
type: "tool_call",
|
|
16104
16804
|
toolName: "execute_sentry_tool",
|
|
16105
16805
|
arguments: {
|
|
16106
|
-
name: "
|
|
16806
|
+
name: "get_agent_conversation_details",
|
|
16107
16807
|
arguments: targetArguments
|
|
16108
16808
|
},
|
|
16109
|
-
reason: "Fetch the full transcript for this
|
|
16809
|
+
reason: "Fetch the full transcript for this agent conversation."
|
|
16110
16810
|
};
|
|
16111
16811
|
});
|
|
16112
16812
|
}
|
|
@@ -16119,185 +16819,15 @@ function formatAIConversationActionInstructions({ organizationSlug, aiConversati
|
|
|
16119
16819
|
availableToolNames,
|
|
16120
16820
|
directToolNames
|
|
16121
16821
|
});
|
|
16122
|
-
if (actions.length === 0) return ["
|
|
16822
|
+
if (actions.length === 0) return ["Agent conversation detail lookup is not available in this session."];
|
|
16123
16823
|
return actions.map((action) => `Use the Sentry tool ${formatInlineCode$1(formatToolCall({
|
|
16124
16824
|
toolName: action.toolName,
|
|
16125
16825
|
arguments: action.arguments
|
|
16126
16826
|
}))} to fetch the full transcript.`);
|
|
16127
16827
|
}
|
|
16128
|
-
/**
|
|
16129
|
-
* Adds concrete transcript follow-ups to otherwise markdown-first results.
|
|
16130
|
-
* The markdown remains the compatibility path for clients that do not read
|
|
16131
|
-
* structured content.
|
|
16132
|
-
*/
|
|
16133
|
-
function addAIConversationSuggestedActions({ markdown, organizationSlug, aiConversations, experimentalMode, availableToolNames, directToolNames }) {
|
|
16134
|
-
const suggestedActions = getAIConversationSuggestedActions({
|
|
16135
|
-
organizationSlug,
|
|
16136
|
-
aiConversations,
|
|
16137
|
-
experimentalMode,
|
|
16138
|
-
availableToolNames,
|
|
16139
|
-
directToolNames
|
|
16140
|
-
});
|
|
16141
|
-
if (suggestedActions.length === 0) return markdown;
|
|
16142
|
-
return {
|
|
16143
|
-
content: [{
|
|
16144
|
-
type: "text",
|
|
16145
|
-
text: markdown
|
|
16146
|
-
}],
|
|
16147
|
-
structuredContent: { suggestedActions }
|
|
16148
|
-
};
|
|
16149
|
-
}
|
|
16150
16828
|
|
|
16151
16829
|
//#endregion
|
|
16152
|
-
//#region ../mcp-core/dist/
|
|
16153
|
-
/**
|
|
16154
|
-
* Enhances a 404 error with parameter context to help users understand what went wrong.
|
|
16155
|
-
* This is optional - tools can use this when they want to provide extra context.
|
|
16156
|
-
*
|
|
16157
|
-
* @example
|
|
16158
|
-
* ```typescript
|
|
16159
|
-
* try {
|
|
16160
|
-
* const issue = await apiService.getIssue({ organizationSlug, issueId });
|
|
16161
|
-
* } catch (error) {
|
|
16162
|
-
* if (error instanceof ApiNotFoundError) {
|
|
16163
|
-
* throw enhanceNotFoundError(error, { organizationSlug, issueId });
|
|
16164
|
-
* }
|
|
16165
|
-
* throw error;
|
|
16166
|
-
* }
|
|
16167
|
-
* ```
|
|
16168
|
-
*/
|
|
16169
|
-
function enhanceNotFoundError(error, params) {
|
|
16170
|
-
const paramsList = [];
|
|
16171
|
-
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null && value !== "") paramsList.push(`${key}: '${value}'`);
|
|
16172
|
-
if (paramsList.length > 0) {
|
|
16173
|
-
const enhancedMessage = `${error.message}\nPlease verify these parameters are correct:\n${paramsList.map((p) => ` - ${p}`).join("\n")}`;
|
|
16174
|
-
return new ApiNotFoundError(enhancedMessage, error.detail, error.responseBody);
|
|
16175
|
-
}
|
|
16176
|
-
return error;
|
|
16177
|
-
}
|
|
16178
|
-
|
|
16179
|
-
//#endregion
|
|
16180
|
-
//#region ../mcp-core/dist/url-scope-CRM5sNo7.js
|
|
16181
|
-
function resolveScopedOrganizationSlug({ resourceLabel, scopedOrganizationSlug, urlOrganizationSlug }) {
|
|
16182
|
-
if (!scopedOrganizationSlug) return urlOrganizationSlug;
|
|
16183
|
-
if (scopedOrganizationSlug !== urlOrganizationSlug) throw new UserInputError(`${resourceLabel} URL is outside the active organization constraint. Expected organization "${scopedOrganizationSlug}" but got "${urlOrganizationSlug}".`);
|
|
16184
|
-
return scopedOrganizationSlug;
|
|
16185
|
-
}
|
|
16186
|
-
function resolveScopedProjectSlug({ resourceLabel, scopedProjectSlug, urlProjectSlug }) {
|
|
16187
|
-
if (!scopedProjectSlug) return urlProjectSlug;
|
|
16188
|
-
if (scopedProjectSlug !== urlProjectSlug) throw new UserInputError(`${resourceLabel} URL is outside the active project constraint. Expected project "${scopedProjectSlug}" but got "${urlProjectSlug}".`);
|
|
16189
|
-
return scopedProjectSlug;
|
|
16190
|
-
}
|
|
16191
|
-
function assertScopedProjectSlug({ resourceLabel, scopedProjectSlug, actualProjectSlug }) {
|
|
16192
|
-
if (!scopedProjectSlug) return actualProjectSlug;
|
|
16193
|
-
if (scopedProjectSlug !== actualProjectSlug) throw new UserInputError(`${resourceLabel} is outside the active project constraint. Expected project "${scopedProjectSlug}".`);
|
|
16194
|
-
return actualProjectSlug;
|
|
16195
|
-
}
|
|
16196
|
-
function resolveScopedProjectSlugOrId({ resourceLabel, scopedProjectSlugOrId, urlProjectSlug }) {
|
|
16197
|
-
if (scopedProjectSlugOrId == null || typeof scopedProjectSlugOrId === "string" && scopedProjectSlugOrId.trim() === "") return urlProjectSlug;
|
|
16198
|
-
if (typeof scopedProjectSlugOrId === "number" || isNumericId(String(scopedProjectSlugOrId))) return urlProjectSlug;
|
|
16199
|
-
if (scopedProjectSlugOrId !== urlProjectSlug) throw new UserInputError(`${resourceLabel} URL is outside the active project constraint. Expected project "${scopedProjectSlugOrId}" but got "${urlProjectSlug}".`);
|
|
16200
|
-
return scopedProjectSlugOrId;
|
|
16201
|
-
}
|
|
16202
|
-
|
|
16203
|
-
//#endregion
|
|
16204
|
-
//#region ../mcp-core/dist/issue-helpers-0Dnme3Ym.js
|
|
16205
|
-
/**
|
|
16206
|
-
* Extracts the Sentry issue ID and organization slug from a full URL
|
|
16207
|
-
*
|
|
16208
|
-
* @param url - A full Sentry issue URL
|
|
16209
|
-
* @returns Object containing the numeric issue ID and organization slug (if found)
|
|
16210
|
-
* @throws Error if the input is invalid
|
|
16211
|
-
*/
|
|
16212
|
-
function extractIssueId(url) {
|
|
16213
|
-
if (!url || typeof url !== "string") throw new UserInputError("Invalid Sentry issue URL. URL must be a non-empty string.");
|
|
16214
|
-
if (!url.startsWith("http://") && !url.startsWith("https://")) throw new UserInputError("Invalid Sentry issue URL. Must start with http:// or https://");
|
|
16215
|
-
let parsedUrl;
|
|
16216
|
-
try {
|
|
16217
|
-
parsedUrl = new URL(url);
|
|
16218
|
-
} catch (error) {
|
|
16219
|
-
throw new UserInputError(`Invalid Sentry issue URL. Unable to parse URL: ${url}`);
|
|
16220
|
-
}
|
|
16221
|
-
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
16222
|
-
if (pathParts.length < 2 || !pathParts.includes("issues")) throw new UserInputError("Invalid Sentry issue URL. Path must contain '/issues/{issue_id}'");
|
|
16223
|
-
const issueId = pathParts[pathParts.indexOf("issues") + 1];
|
|
16224
|
-
if (!issueId) throw new UserInputError("Unable to determine issue ID from URL.");
|
|
16225
|
-
let organizationSlug;
|
|
16226
|
-
if (pathParts.includes("organizations")) organizationSlug = pathParts[pathParts.indexOf("organizations") + 1];
|
|
16227
|
-
else if (pathParts.length > 1 && pathParts[0] !== "issues") organizationSlug = pathParts[0];
|
|
16228
|
-
else {
|
|
16229
|
-
const hostParts = parsedUrl.hostname.split(".");
|
|
16230
|
-
if (hostParts.length > 2 && hostParts[0] !== "www") organizationSlug = hostParts[0];
|
|
16231
|
-
}
|
|
16232
|
-
if (!organizationSlug) throw new UserInputError("Invalid Sentry issue URL. Could not determine organization.");
|
|
16233
|
-
return {
|
|
16234
|
-
issueId,
|
|
16235
|
-
organizationSlug
|
|
16236
|
-
};
|
|
16237
|
-
}
|
|
16238
|
-
/**
|
|
16239
|
-
* Sometimes the LLM will pass in a funky issue shortId. For example it might pass
|
|
16240
|
-
* in "CLOUDFLARE-MCP-41." instead of "CLOUDFLARE-MCP-41". This function attempts to
|
|
16241
|
-
* fix common issues.
|
|
16242
|
-
*
|
|
16243
|
-
* @param issueId - The issue ID to parse
|
|
16244
|
-
* @returns The parsed issue ID
|
|
16245
|
-
*/
|
|
16246
|
-
function parseIssueId(issueId) {
|
|
16247
|
-
if (!issueId.trim()) throw new UserInputError("Issue ID cannot be empty");
|
|
16248
|
-
let finalIssueId = issueId;
|
|
16249
|
-
finalIssueId = finalIssueId.replace(/[^\w-]/g, "");
|
|
16250
|
-
if (!finalIssueId) throw new UserInputError("Issue ID cannot be empty after removing special characters");
|
|
16251
|
-
const validFormatRegex = /^(\d+|[A-Za-z0-9][\w-]*-[A-Za-z0-9]+)$/;
|
|
16252
|
-
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").`);
|
|
16253
|
-
return finalIssueId;
|
|
16254
|
-
}
|
|
16255
|
-
/**
|
|
16256
|
-
* Parses issue parameters from a variety of formats.
|
|
16257
|
-
*
|
|
16258
|
-
* @param params - Object containing issue URL, issue ID, and organization slug
|
|
16259
|
-
* @returns Object containing the parsed organization slug and issue ID
|
|
16260
|
-
* @throws Error if the input is invalid
|
|
16261
|
-
*/
|
|
16262
|
-
function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
|
|
16263
|
-
if (issueUrl) {
|
|
16264
|
-
const resolved = extractIssueId(issueUrl);
|
|
16265
|
-
if (!resolved) throw new Error("Invalid Sentry issue URL. Path should contain '/issues/{issue_id}'");
|
|
16266
|
-
return {
|
|
16267
|
-
organizationSlug: resolveScopedOrganizationSlug({
|
|
16268
|
-
resourceLabel: "Issue",
|
|
16269
|
-
scopedOrganizationSlug: organizationSlug,
|
|
16270
|
-
urlOrganizationSlug: resolved.organizationSlug
|
|
16271
|
-
}),
|
|
16272
|
-
issueId: parseIssueId(resolved.issueId)
|
|
16273
|
-
};
|
|
16274
|
-
}
|
|
16275
|
-
if (!organizationSlug) throw new UserInputError("Organization slug is required");
|
|
16276
|
-
if (issueId) return {
|
|
16277
|
-
organizationSlug,
|
|
16278
|
-
issueId: parseIssueId(issueId)
|
|
16279
|
-
};
|
|
16280
|
-
throw new UserInputError("Either issueId or issueUrl must be provided");
|
|
16281
|
-
}
|
|
16282
|
-
|
|
16283
|
-
//#endregion
|
|
16284
|
-
//#region ../mcp-core/dist/code-location-DW_YNpMG.js
|
|
16285
|
-
/** Formats a verified source location for the issue-details response. */
|
|
16286
|
-
function formatCodeLocation(codeLocation) {
|
|
16287
|
-
const output = ["## Code Location", ""];
|
|
16288
|
-
if (codeLocation.repository) output.push(`**Repository**: ${codeLocation.repository}`);
|
|
16289
|
-
if (codeLocation.path) output.push(`**Path**: ${codeLocation.path}`);
|
|
16290
|
-
if (codeLocation.line !== void 0) output.push(`**Line**: ${codeLocation.line}`);
|
|
16291
|
-
output.push(`**Source**: ${codeLocation.url}`, "");
|
|
16292
|
-
return `${output.join("\n")}\n`;
|
|
16293
|
-
}
|
|
16294
|
-
/** Selects Sentry's most relevant application frame: the last in-app frame. */
|
|
16295
|
-
function findMostRelevantInAppFrame(frames) {
|
|
16296
|
-
return frames.findLast((frame) => frame.inApp === true);
|
|
16297
|
-
}
|
|
16298
|
-
|
|
16299
|
-
//#endregion
|
|
16300
|
-
//#region ../mcp-core/dist/seer-BoTKAK7k.js
|
|
16830
|
+
//#region ../mcp-core/dist/seer-DqLgmvV9.js
|
|
16301
16831
|
const SEER_POLLING_INTERVAL = 5e3;
|
|
16302
16832
|
const SEER_TIMEOUT = 5 * 60 * 1e3;
|
|
16303
16833
|
const SEER_MAX_RETRIES = 3;
|
|
@@ -16362,6 +16892,19 @@ function wrapSeerAnalysisOutput({ output, runId, step, includeProvenanceTags })
|
|
|
16362
16892
|
const attrs = [runId === void 0 ? null : `run_id="${escapeXmlAttribute(runId)}"`, `step="${escapeXmlAttribute(step)}"`].filter(Boolean);
|
|
16363
16893
|
return `<seer_analysis ${attrs.join(" ")}>\n${output.trimEnd()}\n</seer_analysis>\n`;
|
|
16364
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
|
+
}
|
|
16365
16908
|
const RootCauseArtifactDataSchema = zod.z.object({
|
|
16366
16909
|
one_line_description: zod.z.string().optional(),
|
|
16367
16910
|
five_whys: zod.z.array(zod.z.string()).default([]),
|
|
@@ -16462,7 +17005,7 @@ function getActiveAutofixTodo(autofix) {
|
|
|
16462
17005
|
}
|
|
16463
17006
|
|
|
16464
17007
|
//#endregion
|
|
16465
|
-
//#region ../mcp-core/dist/user-formatting-
|
|
17008
|
+
//#region ../mcp-core/dist/user-formatting-CTX3nhjo.js
|
|
16466
17009
|
function formatUserGeoSummary(value) {
|
|
16467
17010
|
if (!isPlainObject$3(value)) return null;
|
|
16468
17011
|
const parts = [
|
|
@@ -16476,7 +17019,7 @@ function formatUserGeoSummary(value) {
|
|
|
16476
17019
|
}
|
|
16477
17020
|
|
|
16478
17021
|
//#endregion
|
|
16479
|
-
//#region ../mcp-core/dist/formatting-
|
|
17022
|
+
//#region ../mcp-core/dist/formatting-31tlKXsb.js
|
|
16480
17023
|
/**
|
|
16481
17024
|
* Convert Seer fixability score to actionability label.
|
|
16482
17025
|
* Thresholds match Sentry core: src/sentry/seer/autofix/constants.py
|
|
@@ -16570,6 +17113,29 @@ function formatFrameHeader(frame, frameIndex, platform) {
|
|
|
16570
17113
|
}
|
|
16571
17114
|
}
|
|
16572
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
|
+
/**
|
|
16573
17139
|
* Formats a Sentry event into a structured markdown output.
|
|
16574
17140
|
* Includes error messages, stack traces, request info, and contextual data.
|
|
16575
17141
|
*
|
|
@@ -17511,14 +18077,17 @@ function formatSeerSummary(autofixState) {
|
|
|
17511
18077
|
parts.push(`**Status:** ${getStatusDisplayName(autofix.status)}`);
|
|
17512
18078
|
parts.push("");
|
|
17513
18079
|
}
|
|
17514
|
-
|
|
17515
|
-
|
|
17516
|
-
|
|
17517
|
-
|
|
17518
|
-
|
|
17519
|
-
|
|
17520
|
-
|
|
17521
|
-
|
|
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
|
+
}
|
|
17522
18091
|
if (autofix.status === "error") {
|
|
17523
18092
|
parts.push("");
|
|
17524
18093
|
parts.push("**Status:** Analysis failed.");
|
|
@@ -17537,7 +18106,7 @@ function formatSeerSummary(autofixState) {
|
|
|
17537
18106
|
*/
|
|
17538
18107
|
function formatIssueOutput({ organizationSlug, issue, event, apiService, autofixState, performanceTrace, externalIssues, relatedReplayIds, aiConversations, codeLocation, experimentalMode, availableToolNames, directToolNames }) {
|
|
17539
18108
|
let output = `# Issue ${issue.shortId} in **${organizationSlug}**\n\n`;
|
|
17540
|
-
const isPerformanceIssue = issue
|
|
18109
|
+
const isPerformanceIssue = isPerformanceIssueType(issue);
|
|
17541
18110
|
if (isPerformanceIssue && issue.metadata) {
|
|
17542
18111
|
const issueTitle = issue.metadata.title || issue.title;
|
|
17543
18112
|
output += `**Description**: ${issueTitle}\n`;
|
|
@@ -17600,13 +18169,26 @@ function formatIssueOutput({ organizationSlug, issue, event, apiService, autofix
|
|
|
17600
18169
|
}
|
|
17601
18170
|
output += `**Event ID**: ${event.id}\n`;
|
|
17602
18171
|
output += `**Type**: ${event.type}\n`;
|
|
17603
|
-
|
|
18172
|
+
const isSharedFormatterType = usesSharedFormatterBody(event);
|
|
18173
|
+
if (isSharedFormatterType) {
|
|
17604
18174
|
const typedEvent = event;
|
|
17605
18175
|
if (typedEvent.dateCreated) output += `**Occurred At**: ${new Date(typedEvent.dateCreated).toISOString()}\n`;
|
|
17606
18176
|
}
|
|
17607
18177
|
if (event.message) output += `**Message**:\n${event.message}\n`;
|
|
17608
18178
|
output += "\n";
|
|
17609
|
-
|
|
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, {
|
|
17610
18192
|
performanceTrace,
|
|
17611
18193
|
replaySummary: {
|
|
17612
18194
|
apiService,
|
|
@@ -17735,10 +18317,10 @@ function formatAIConversationResponseNote({ aiConversations, organizationSlug, e
|
|
|
17735
18317
|
if (aiConversations.length === 1) {
|
|
17736
18318
|
const [conversation] = aiConversations;
|
|
17737
18319
|
const spanSuffix = conversation.spanId ? ` Matching span: \`${conversation.spanId}\`.` : "";
|
|
17738
|
-
return `-
|
|
18320
|
+
return `- Agent conversation found in this trace: \`${conversation.conversationId}\`.${spanSuffix}\n${instructions.map((instruction) => `- ${instruction}`).join("\n")}\n`;
|
|
17739
18321
|
}
|
|
17740
18322
|
const conversationIds = aiConversations.map((conversation) => `\`${conversation.conversationId}\``).join(", ");
|
|
17741
|
-
return `- Multiple
|
|
18323
|
+
return `- Multiple agent conversations were found in this trace: ${conversationIds}.\n${instructions.map((instruction) => `- ${instruction}`).join("\n")}\n`;
|
|
17742
18324
|
}
|
|
17743
18325
|
const MAX_DISPLAY_REPLAYS = 5;
|
|
17744
18326
|
function formatIssueReplayOutput({ apiService, organizationSlug, event, relatedReplayIds, experimentalMode, availableToolNames, directToolNames }) {
|
|
@@ -17824,7 +18406,111 @@ function stripReplayMetadata(event) {
|
|
|
17824
18406
|
}
|
|
17825
18407
|
|
|
17826
18408
|
//#endregion
|
|
17827
|
-
//#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
|
|
17828
18514
|
function assertIssueWithinProjectConstraint({ issue, projectSlug: projectSlug$1, resourceLabel = "Issue" }) {
|
|
17829
18515
|
assertScopedProjectSlug({
|
|
17830
18516
|
resourceLabel,
|
|
@@ -17846,7 +18532,7 @@ async function ensureIssueWithinProjectConstraint({ apiService, organizationSlug
|
|
|
17846
18532
|
}
|
|
17847
18533
|
|
|
17848
18534
|
//#endregion
|
|
17849
|
-
//#region ../mcp-core/dist/code-location-
|
|
18535
|
+
//#region ../mcp-core/dist/code-location-Dh_XFzfu.js
|
|
17850
18536
|
const CODE_LOCATION_TIMEOUT_MS = 3e3;
|
|
17851
18537
|
/** Resolves a verified source location, omitting optional enrichment failures. */
|
|
17852
18538
|
async function resolveCodeLocation({ apiService, organizationSlug, projectSlug: projectSlug$1, event }) {
|
|
@@ -17949,10 +18635,174 @@ function getString$1(value) {
|
|
|
17949
18635
|
}
|
|
17950
18636
|
|
|
17951
18637
|
//#endregion
|
|
17952
|
-
//#region ../mcp-core/dist/get-issue-details-
|
|
18638
|
+
//#region ../mcp-core/dist/get-issue-details-t289hNuc.js
|
|
18639
|
+
const MAX_RELATED_REPLAYS = 5;
|
|
17953
18640
|
const MAX_AI_CONVERSATION_MATCHES = 3;
|
|
17954
18641
|
const AI_CONVERSATION_LOOKUP_WINDOW_MS = 24 * 60 * 60 * 1e3;
|
|
17955
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
|
+
}
|
|
17956
18806
|
var get_issue_details_default = defineTool({
|
|
17957
18807
|
name: "get_issue_details",
|
|
17958
18808
|
skills: [
|
|
@@ -18019,7 +18869,7 @@ var get_issue_details_default = defineTool({
|
|
|
18019
18869
|
const orgSlug$1 = params.organizationSlug;
|
|
18020
18870
|
const eventId = params.eventId;
|
|
18021
18871
|
if (!orgSlug$1) throw new UserInputError("`organizationSlug` is required when providing `eventId`");
|
|
18022
|
-
(
|
|
18872
|
+
setOrganizationContext(orgSlug$1);
|
|
18023
18873
|
let issue$1;
|
|
18024
18874
|
if (params.issueId) issue$1 = await apiService.getIssue({
|
|
18025
18875
|
organizationSlug: orgSlug$1,
|
|
@@ -18030,7 +18880,7 @@ var get_issue_details_default = defineTool({
|
|
|
18030
18880
|
organizationSlug: orgSlug$1,
|
|
18031
18881
|
query: eventId
|
|
18032
18882
|
});
|
|
18033
|
-
if (!found)
|
|
18883
|
+
if (!found) throw new UserInputError(`No issue found for Event ID: ${eventId}`);
|
|
18034
18884
|
issue$1 = found;
|
|
18035
18885
|
}
|
|
18036
18886
|
assertIssueWithinProjectConstraint({
|
|
@@ -18039,12 +18889,12 @@ var get_issue_details_default = defineTool({
|
|
|
18039
18889
|
});
|
|
18040
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({
|
|
18041
18891
|
organizationSlug: orgSlug$1,
|
|
18042
|
-
issueId: issue$1.
|
|
18892
|
+
issueId: String(issue$1.id),
|
|
18043
18893
|
eventId
|
|
18044
18894
|
}).catch((error) => {
|
|
18045
18895
|
if (error instanceof ApiNotFoundError) throw enhanceNotFoundError(error, {
|
|
18046
18896
|
organizationSlug: orgSlug$1,
|
|
18047
|
-
issueId: issue$1.
|
|
18897
|
+
issueId: String(issue$1.id),
|
|
18048
18898
|
eventId
|
|
18049
18899
|
});
|
|
18050
18900
|
throw error;
|
|
@@ -18062,25 +18912,31 @@ var get_issue_details_default = defineTool({
|
|
|
18062
18912
|
issue: issue$1,
|
|
18063
18913
|
seerEnabled: isSeerGranted(context$1)
|
|
18064
18914
|
})]);
|
|
18065
|
-
|
|
18066
|
-
|
|
18067
|
-
organizationSlug: orgSlug$1,
|
|
18068
|
-
issue: issue$1,
|
|
18069
|
-
event: event$1,
|
|
18070
|
-
apiService,
|
|
18071
|
-
autofixState: autofixState$1,
|
|
18072
|
-
performanceTrace: performanceTrace$1,
|
|
18073
|
-
externalIssues: externalIssues$1,
|
|
18074
|
-
relatedReplayIds: relatedReplayIds$1,
|
|
18075
|
-
aiConversations: aiConversations$1,
|
|
18076
|
-
codeLocation: codeLocation$1,
|
|
18077
|
-
experimentalMode: context$1.experimentalMode,
|
|
18078
|
-
availableToolNames: context$1.availableToolNames,
|
|
18079
|
-
directToolNames: context$1.directToolNames
|
|
18080
|
-
}),
|
|
18915
|
+
const body$1 = parseFormattedBody(event$1);
|
|
18916
|
+
if (body$1) return structuredResult(buildIssueDetailsPayload({
|
|
18081
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,
|
|
18082
18925
|
aiConversations: aiConversations$1,
|
|
18083
|
-
|
|
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,
|
|
18084
18940
|
availableToolNames: context$1.availableToolNames,
|
|
18085
18941
|
directToolNames: context$1.directToolNames
|
|
18086
18942
|
});
|
|
@@ -18092,7 +18948,7 @@ var get_issue_details_default = defineTool({
|
|
|
18092
18948
|
issueId: params.issueId,
|
|
18093
18949
|
issueUrl: params.issueUrl
|
|
18094
18950
|
});
|
|
18095
|
-
(
|
|
18951
|
+
setOrganizationContext(orgSlug);
|
|
18096
18952
|
let issue;
|
|
18097
18953
|
try {
|
|
18098
18954
|
issue = await apiService.getIssue({
|
|
@@ -18112,7 +18968,7 @@ var get_issue_details_default = defineTool({
|
|
|
18112
18968
|
});
|
|
18113
18969
|
const [{ event, performanceTrace, aiConversations, codeLocation }, { autofixState, externalIssues, relatedReplayIds }] = await Promise.all([apiService.getLatestEventForIssue({
|
|
18114
18970
|
organizationSlug: orgSlug,
|
|
18115
|
-
issueId: issue.
|
|
18971
|
+
issueId: String(issue.id)
|
|
18116
18972
|
}).then(async (event$1) => ({
|
|
18117
18973
|
event: event$1,
|
|
18118
18974
|
...await fetchEventEnrichment({
|
|
@@ -18127,25 +18983,31 @@ var get_issue_details_default = defineTool({
|
|
|
18127
18983
|
issue,
|
|
18128
18984
|
seerEnabled: isSeerGranted(context$1)
|
|
18129
18985
|
})]);
|
|
18130
|
-
|
|
18131
|
-
|
|
18132
|
-
organizationSlug: orgSlug,
|
|
18133
|
-
issue,
|
|
18134
|
-
event,
|
|
18135
|
-
apiService,
|
|
18136
|
-
autofixState,
|
|
18137
|
-
performanceTrace,
|
|
18138
|
-
externalIssues,
|
|
18139
|
-
relatedReplayIds,
|
|
18140
|
-
aiConversations,
|
|
18141
|
-
codeLocation,
|
|
18142
|
-
experimentalMode: context$1.experimentalMode,
|
|
18143
|
-
availableToolNames: context$1.availableToolNames,
|
|
18144
|
-
directToolNames: context$1.directToolNames
|
|
18145
|
-
}),
|
|
18986
|
+
const body = parseFormattedBody(event);
|
|
18987
|
+
if (body) return structuredResult(buildIssueDetailsPayload({
|
|
18146
18988
|
organizationSlug: orgSlug,
|
|
18989
|
+
issue,
|
|
18990
|
+
event,
|
|
18991
|
+
body,
|
|
18992
|
+
apiService,
|
|
18993
|
+
autofixState,
|
|
18994
|
+
externalIssues,
|
|
18995
|
+
relatedReplayIds,
|
|
18147
18996
|
aiConversations,
|
|
18148
|
-
|
|
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,
|
|
18149
19011
|
availableToolNames: context$1.availableToolNames,
|
|
18150
19012
|
directToolNames: context$1.directToolNames
|
|
18151
19013
|
});
|
|
@@ -18193,7 +19055,7 @@ async function fetchIssueEnrichmentData({ apiService, organizationSlug, issue, s
|
|
|
18193
19055
|
}),
|
|
18194
19056
|
apiService.getIssueExternalLinks({
|
|
18195
19057
|
organizationSlug,
|
|
18196
|
-
issueId
|
|
19058
|
+
issueId
|
|
18197
19059
|
}).catch(() => void 0),
|
|
18198
19060
|
apiService.listReplayIdsForIssue({
|
|
18199
19061
|
organizationSlug,
|
|
@@ -18223,7 +19085,7 @@ async function maybeFetchAutofixState({ apiService, organizationSlug, issue, see
|
|
|
18223
19085
|
if (!seerEnabled) return void 0;
|
|
18224
19086
|
return apiService.getAutofixState({
|
|
18225
19087
|
organizationSlug,
|
|
18226
|
-
issueId: issue.
|
|
19088
|
+
issueId: String(issue.id)
|
|
18227
19089
|
}).catch(() => void 0);
|
|
18228
19090
|
}
|
|
18229
19091
|
async function maybeFetchPerformanceTrace({ apiService, organizationSlug, event }) {
|
|
@@ -18323,7 +19185,7 @@ function getReplayDataSource(issue) {
|
|
|
18323
19185
|
}
|
|
18324
19186
|
|
|
18325
19187
|
//#endregion
|
|
18326
|
-
//#region ../mcp-core/dist/event-stacktrace-
|
|
19188
|
+
//#region ../mcp-core/dist/event-stacktrace-WES63IMe.js
|
|
18327
19189
|
/**
|
|
18328
19190
|
* Fetches an issue event and formats the selected thread stacktrace.
|
|
18329
19191
|
*/
|
|
@@ -18402,7 +19264,7 @@ function selectUnique(threads, predicate, notFoundMessage, ambiguousMessage) {
|
|
|
18402
19264
|
}
|
|
18403
19265
|
|
|
18404
19266
|
//#endregion
|
|
18405
|
-
//#region ../mcp-core/dist/get-event-stacktrace-
|
|
19267
|
+
//#region ../mcp-core/dist/get-event-stacktrace-CDGRtbOg.js
|
|
18406
19268
|
var get_event_stacktrace_default = defineTool({
|
|
18407
19269
|
name: "get_event_stacktrace",
|
|
18408
19270
|
skills: [
|
|
@@ -18445,7 +19307,7 @@ var get_event_stacktrace_default = defineTool({
|
|
|
18445
19307
|
},
|
|
18446
19308
|
async handler(params, context$1) {
|
|
18447
19309
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
18448
|
-
(
|
|
19310
|
+
setOrganizationContext(params.organizationSlug);
|
|
18449
19311
|
(0, __sentry_core.setTag)("issue.id", params.issueId);
|
|
18450
19312
|
try {
|
|
18451
19313
|
await ensureIssueWithinProjectConstraint({
|
|
@@ -18473,7 +19335,7 @@ var get_event_stacktrace_default = defineTool({
|
|
|
18473
19335
|
});
|
|
18474
19336
|
|
|
18475
19337
|
//#endregion
|
|
18476
|
-
//#region ../mcp-core/dist/get-issue-activity-
|
|
19338
|
+
//#region ../mcp-core/dist/get-issue-activity-DA97QQfR.js
|
|
18477
19339
|
function getActivityText(activity) {
|
|
18478
19340
|
const data = activity.data;
|
|
18479
19341
|
if (!data) return null;
|
|
@@ -18523,7 +19385,7 @@ var get_issue_activity_default = defineTool({
|
|
|
18523
19385
|
organizationSlug: params.organizationSlug ?? context$1.constraints.organizationSlug
|
|
18524
19386
|
});
|
|
18525
19387
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
18526
|
-
(
|
|
19388
|
+
setOrganizationContext(parsed.organizationSlug);
|
|
18527
19389
|
(0, __sentry_core.setTag)("issue.id", parsed.issueId);
|
|
18528
19390
|
await ensureIssueWithinProjectConstraint({
|
|
18529
19391
|
apiService,
|
|
@@ -18566,7 +19428,7 @@ var get_issue_activity_default = defineTool({
|
|
|
18566
19428
|
});
|
|
18567
19429
|
|
|
18568
19430
|
//#endregion
|
|
18569
|
-
//#region ../mcp-core/dist/breadcrumbs-
|
|
19431
|
+
//#region ../mcp-core/dist/breadcrumbs-uFW9kNaP.js
|
|
18570
19432
|
/**
|
|
18571
19433
|
* Fetches breadcrumbs from an issue event and formats them.
|
|
18572
19434
|
* Defaults to the latest event when eventId is omitted.
|
|
@@ -18630,7 +19492,7 @@ function cleanAndTruncate(str, maxLen) {
|
|
|
18630
19492
|
}
|
|
18631
19493
|
|
|
18632
19494
|
//#endregion
|
|
18633
|
-
//#region ../mcp-core/dist/get-issue-breadcrumbs-
|
|
19495
|
+
//#region ../mcp-core/dist/get-issue-breadcrumbs-D-UCFqx1.js
|
|
18634
19496
|
var get_issue_breadcrumbs_default = defineTool({
|
|
18635
19497
|
name: "get_issue_breadcrumbs",
|
|
18636
19498
|
skills: ["inspect", "triage"],
|
|
@@ -18670,7 +19532,7 @@ var get_issue_breadcrumbs_default = defineTool({
|
|
|
18670
19532
|
organizationSlug: params.organizationSlug ?? context$1.constraints.organizationSlug
|
|
18671
19533
|
});
|
|
18672
19534
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
18673
|
-
(
|
|
19535
|
+
setOrganizationContext(parsed.organizationSlug);
|
|
18674
19536
|
(0, __sentry_core.setTag)("issue.id", parsed.issueId);
|
|
18675
19537
|
try {
|
|
18676
19538
|
await ensureIssueWithinProjectConstraint({
|
|
@@ -18692,7 +19554,7 @@ var get_issue_breadcrumbs_default = defineTool({
|
|
|
18692
19554
|
});
|
|
18693
19555
|
|
|
18694
19556
|
//#endregion
|
|
18695
|
-
//#region ../mcp-core/dist/get-issue-tag-values-
|
|
19557
|
+
//#region ../mcp-core/dist/get-issue-tag-values-CyHuVJ-4.js
|
|
18696
19558
|
const getIssueTagValuesOutputSchema = zod.z.object({ tag: zod.z.object({
|
|
18697
19559
|
key: zod.z.string(),
|
|
18698
19560
|
name: zod.z.string(),
|
|
@@ -18773,7 +19635,7 @@ var get_issue_tag_values_default = defineTool({
|
|
|
18773
19635
|
issueId: params.issueId,
|
|
18774
19636
|
issueUrl: params.issueUrl
|
|
18775
19637
|
});
|
|
18776
|
-
(
|
|
19638
|
+
setOrganizationContext(orgSlug);
|
|
18777
19639
|
await ensureIssueWithinProjectConstraint({
|
|
18778
19640
|
apiService,
|
|
18779
19641
|
organizationSlug: orgSlug,
|
|
@@ -18810,7 +19672,7 @@ var get_issue_tag_values_default = defineTool({
|
|
|
18810
19672
|
});
|
|
18811
19673
|
|
|
18812
19674
|
//#endregion
|
|
18813
|
-
//#region ../mcp-core/dist/get-issue-user-reports-
|
|
19675
|
+
//#region ../mcp-core/dist/get-issue-user-reports-DhU4yW1i.js
|
|
18814
19676
|
function getReporter(report) {
|
|
18815
19677
|
const userId = report.user?.id?.trim();
|
|
18816
19678
|
const userIdReporter = userId && !["none", "null"].includes(userId.toLowerCase()) ? `user:${userId}` : null;
|
|
@@ -18863,7 +19725,7 @@ var get_issue_user_reports_default = defineTool({
|
|
|
18863
19725
|
organizationSlug: params.organizationSlug ?? context$1.constraints.organizationSlug
|
|
18864
19726
|
});
|
|
18865
19727
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
18866
|
-
(
|
|
19728
|
+
setOrganizationContext(parsed.organizationSlug);
|
|
18867
19729
|
(0, __sentry_core.setTag)("issue.id", parsed.issueId);
|
|
18868
19730
|
await ensureIssueWithinProjectConstraint({
|
|
18869
19731
|
apiService,
|
|
@@ -22398,7 +23260,7 @@ function createAnthropic(options = {}) {
|
|
|
22398
23260
|
var anthropic = createAnthropic();
|
|
22399
23261
|
|
|
22400
23262
|
//#endregion
|
|
22401
|
-
//#region ../mcp-core/dist/anthropic-provider-
|
|
23263
|
+
//#region ../mcp-core/dist/anthropic-provider-NqnQSpoe.js
|
|
22402
23264
|
const DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-5";
|
|
22403
23265
|
let configuredBaseUrl$2;
|
|
22404
23266
|
/**
|
|
@@ -27051,7 +27913,7 @@ function createOpenAI(options = {}) {
|
|
|
27051
27913
|
var openai = createOpenAI();
|
|
27052
27914
|
|
|
27053
27915
|
//#endregion
|
|
27054
|
-
//#region ../mcp-core/dist/azure-openai-provider-
|
|
27916
|
+
//#region ../mcp-core/dist/azure-openai-provider-BcsSfFBw.js
|
|
27055
27917
|
const DEFAULT_OPENAI_MODEL$1 = "gpt-5";
|
|
27056
27918
|
let configuredBaseUrl$1;
|
|
27057
27919
|
function setAzureOpenAIBaseUrl(baseUrl) {
|
|
@@ -27109,7 +27971,7 @@ function getAzureOpenAIModel(model) {
|
|
|
27109
27971
|
}
|
|
27110
27972
|
|
|
27111
27973
|
//#endregion
|
|
27112
|
-
//#region ../mcp-core/dist/openai-provider-
|
|
27974
|
+
//#region ../mcp-core/dist/openai-provider-DNtIUzcM.js
|
|
27113
27975
|
const DEFAULT_OPENAI_MODEL = "gpt-5";
|
|
27114
27976
|
let configuredBaseUrl;
|
|
27115
27977
|
/**
|
|
@@ -27149,7 +28011,7 @@ function getOpenAIModel(model) {
|
|
|
27149
28011
|
}
|
|
27150
28012
|
|
|
27151
28013
|
//#endregion
|
|
27152
|
-
//#region ../mcp-core/dist/openrouter-provider-
|
|
28014
|
+
//#region ../mcp-core/dist/openrouter-provider-Bq38hmFY.js
|
|
27153
28015
|
const DEFAULT_OPENROUTER_MODEL = "openai/gpt-5.6-luna";
|
|
27154
28016
|
const DEFAULT_OPENROUTER_REASONING_EFFORT = "high";
|
|
27155
28017
|
const OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1";
|
|
@@ -27201,7 +28063,7 @@ function getOpenRouterProviderOptions() {
|
|
|
27201
28063
|
}
|
|
27202
28064
|
|
|
27203
28065
|
//#endregion
|
|
27204
|
-
//#region ../mcp-core/dist/provider-factory-
|
|
28066
|
+
//#region ../mcp-core/dist/provider-factory-BNDtCneN.js
|
|
27205
28067
|
let configuredProvider;
|
|
27206
28068
|
/**
|
|
27207
28069
|
* Configure the embedded agent provider explicitly.
|
|
@@ -27346,7 +28208,7 @@ function getResolvedProviderType() {
|
|
|
27346
28208
|
}
|
|
27347
28209
|
|
|
27348
28210
|
//#endregion
|
|
27349
|
-
//#region ../mcp-core/dist/resolve-region-url-
|
|
28211
|
+
//#region ../mcp-core/dist/resolve-region-url-DgkcX4pA.js
|
|
27350
28212
|
const regionUrlCache = /* @__PURE__ */ new WeakMap();
|
|
27351
28213
|
function getRegionUrlCache(context$1) {
|
|
27352
28214
|
let cache = regionUrlCache.get(context$1);
|
|
@@ -27385,7 +28247,7 @@ async function resolveRegionUrlForOrganization({ context: context$1, organizatio
|
|
|
27385
28247
|
}
|
|
27386
28248
|
|
|
27387
28249
|
//#endregion
|
|
27388
|
-
//#region ../mcp-core/dist/semantic-display-
|
|
28250
|
+
//#region ../mcp-core/dist/semantic-display-C9x4ir1O.js
|
|
27389
28251
|
const SPAN_LABEL_MAX_LENGTH = 160;
|
|
27390
28252
|
const SPAN_METADATA_MAX_LENGTH = 64;
|
|
27391
28253
|
const SPAN_ATTRIBUTE_MAX_LENGTH = 2048;
|
|
@@ -27773,7 +28635,7 @@ function formatDisplayPart(value, maxLength) {
|
|
|
27773
28635
|
}
|
|
27774
28636
|
|
|
27775
28637
|
//#endregion
|
|
27776
|
-
//#region ../mcp-core/dist/get-trace-details-
|
|
28638
|
+
//#region ../mcp-core/dist/get-trace-details-DIFsJzLU.js
|
|
27777
28639
|
const MAX_TRACE_FETCH_LIMIT = 1e3;
|
|
27778
28640
|
const MAX_FOCUSED_TRACE_FETCH_LIMIT = 1e4;
|
|
27779
28641
|
const MIN_TRACE_FETCH_LIMIT = 50;
|
|
@@ -27847,7 +28709,7 @@ var get_trace_details_default = defineTool({
|
|
|
27847
28709
|
regionUrl: params.regionUrl
|
|
27848
28710
|
});
|
|
27849
28711
|
const apiService = apiServiceFromContext(context$1, { regionUrl: regionUrl ?? void 0 });
|
|
27850
|
-
(
|
|
28712
|
+
setOrganizationContext(params.organizationSlug);
|
|
27851
28713
|
(0, __sentry_core.setTag)("trace.id", params.traceId);
|
|
27852
28714
|
if (params.spanId) (0, __sentry_core.setTag)("trace.span_id", params.spanId);
|
|
27853
28715
|
if (context$1.constraints.projectSlug) (0, __sentry_core.setTag)("project.slug", context$1.constraints.projectSlug);
|
|
@@ -27887,14 +28749,7 @@ var get_trace_details_default = defineTool({
|
|
|
27887
28749
|
directToolNames: context$1.directToolNames,
|
|
27888
28750
|
aiConversations
|
|
27889
28751
|
});
|
|
27890
|
-
return
|
|
27891
|
-
markdown,
|
|
27892
|
-
organizationSlug: params.organizationSlug,
|
|
27893
|
-
aiConversations,
|
|
27894
|
-
experimentalMode: context$1.experimentalMode ?? false,
|
|
27895
|
-
availableToolNames: context$1.availableToolNames,
|
|
27896
|
-
directToolNames: context$1.directToolNames
|
|
27897
|
-
});
|
|
28752
|
+
return markdown;
|
|
27898
28753
|
}
|
|
27899
28754
|
});
|
|
27900
28755
|
function isTraceSpanNode(node) {
|
|
@@ -28453,7 +29308,7 @@ function formatAIConversationSection({ aiConversations, organizationSlug, experi
|
|
|
28453
29308
|
availableToolNames,
|
|
28454
29309
|
directToolNames
|
|
28455
29310
|
});
|
|
28456
|
-
const lines = ["##
|
|
29311
|
+
const lines = ["## Agent Conversations", ""];
|
|
28457
29312
|
if (aiConversations.length === 1) {
|
|
28458
29313
|
const [conversation] = aiConversations;
|
|
28459
29314
|
lines.push(`**Conversation ID**: \`${conversation.conversationId}\``);
|
|
@@ -28533,7 +29388,7 @@ function buildTraceNextSteps({ organizationSlug, traceId, spanFocused = false, e
|
|
|
28533
29388
|
}
|
|
28534
29389
|
|
|
28535
29390
|
//#endregion
|
|
28536
|
-
//#region ../mcp-core/dist/get-span-details-
|
|
29391
|
+
//#region ../mcp-core/dist/get-span-details-CC9cxfpa.js
|
|
28537
29392
|
var get_span_details_default = defineTool({
|
|
28538
29393
|
name: "get_span_details",
|
|
28539
29394
|
skills: ["inspect"],
|
|
@@ -28574,7 +29429,7 @@ var get_span_details_default = defineTool({
|
|
|
28574
29429
|
});
|
|
28575
29430
|
|
|
28576
29431
|
//#endregion
|
|
28577
|
-
//#region ../mcp-core/dist/url-helpers-
|
|
29432
|
+
//#region ../mcp-core/dist/url-helpers-DtpSKjOI.js
|
|
28578
29433
|
/**
|
|
28579
29434
|
* Parses a Sentry URL and extracts resource type and identifiers.
|
|
28580
29435
|
*
|
|
@@ -28837,7 +29692,7 @@ function isProfileUrl(url) {
|
|
|
28837
29692
|
}
|
|
28838
29693
|
|
|
28839
29694
|
//#endregion
|
|
28840
|
-
//#region ../mcp-core/dist/get-replay-details-
|
|
29695
|
+
//#region ../mcp-core/dist/get-replay-details-BM6gDmGp.js
|
|
28841
29696
|
const MAX_ACTIVITY_EVENTS = 6;
|
|
28842
29697
|
const MAX_RELATED_ERRORS = 3;
|
|
28843
29698
|
const MAX_RELATED_TRACES = 2;
|
|
@@ -28889,7 +29744,7 @@ var get_replay_details_default = defineTool({
|
|
|
28889
29744
|
regionUrl: params.regionUrl
|
|
28890
29745
|
});
|
|
28891
29746
|
const apiService = apiServiceFromContext(context$1, { regionUrl: regionUrl ?? void 0 });
|
|
28892
|
-
(
|
|
29747
|
+
setOrganizationContext(resolved.organizationSlug);
|
|
28893
29748
|
(0, __sentry_core.setTag)("replay.id", resolved.replayId);
|
|
28894
29749
|
const replay = await apiService.getReplayDetails({
|
|
28895
29750
|
organizationSlug: resolved.organizationSlug,
|
|
@@ -29174,7 +30029,44 @@ function quoteDetail(value) {
|
|
|
29174
30029
|
}
|
|
29175
30030
|
|
|
29176
30031
|
//#endregion
|
|
29177
|
-
//#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
|
+
}
|
|
29178
30070
|
var get_event_attachment_default = defineTool({
|
|
29179
30071
|
name: "get_event_attachment",
|
|
29180
30072
|
skills: ["inspect"],
|
|
@@ -29222,7 +30114,7 @@ var get_event_attachment_default = defineTool({
|
|
|
29222
30114
|
},
|
|
29223
30115
|
async handler(params, context$1) {
|
|
29224
30116
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
29225
|
-
(
|
|
30117
|
+
setOrganizationContext(params.organizationSlug);
|
|
29226
30118
|
if (params.attachmentId) {
|
|
29227
30119
|
const attachment = await apiService.getEventAttachment({
|
|
29228
30120
|
organizationSlug: params.organizationSlug,
|
|
@@ -29230,12 +30122,19 @@ var get_event_attachment_default = defineTool({
|
|
|
29230
30122
|
eventId: params.eventId,
|
|
29231
30123
|
attachmentId: params.attachmentId
|
|
29232
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);
|
|
29233
30131
|
const contentParts = [];
|
|
29234
30132
|
const effectiveMimeType = attachment.contentType;
|
|
29235
30133
|
const isBinary = !effectiveMimeType.startsWith("text/");
|
|
29236
|
-
|
|
30134
|
+
const isEmpty = attachment.bytes.length === 0;
|
|
30135
|
+
if (isBinary && !isEmpty) {
|
|
29237
30136
|
const isImage = effectiveMimeType.startsWith("image/");
|
|
29238
|
-
const base64 =
|
|
30137
|
+
const base64 = require_blob_utils_DgVug_Di.bytesToBase64(attachment.bytes);
|
|
29239
30138
|
if (isImage) {
|
|
29240
30139
|
const image = {
|
|
29241
30140
|
type: "image",
|
|
@@ -29264,11 +30163,15 @@ var get_event_attachment_default = defineTool({
|
|
|
29264
30163
|
output$1 += `**MIME Type:** ${effectiveMimeType}\n`;
|
|
29265
30164
|
output$1 += `**Created:** ${attachment.attachment.dateCreated}\n\n`;
|
|
29266
30165
|
output$1 += `**Download URL:** ${attachment.downloadUrl}\n\n`;
|
|
29267
|
-
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) {
|
|
29268
30171
|
output$1 += `## Binary Content\n\n`;
|
|
29269
30172
|
output$1 += `The attachment is included as a resource and accessible through your client.\n`;
|
|
29270
30173
|
} else {
|
|
29271
|
-
const textContent =
|
|
30174
|
+
const textContent = new TextDecoder().decode(attachment.bytes);
|
|
29272
30175
|
output$1 += `## File Content\n\n`;
|
|
29273
30176
|
output$1 += `\`\`\`\n${textContent}\n\`\`\`\n\n`;
|
|
29274
30177
|
}
|
|
@@ -29319,7 +30222,7 @@ var get_event_attachment_default = defineTool({
|
|
|
29319
30222
|
});
|
|
29320
30223
|
|
|
29321
30224
|
//#endregion
|
|
29322
|
-
//#region ../mcp-core/dist/formatting-
|
|
30225
|
+
//#region ../mcp-core/dist/formatting-BG8yQUmg.js
|
|
29323
30226
|
/**
|
|
29324
30227
|
* Helper function to format assignedTo field for display
|
|
29325
30228
|
*/
|
|
@@ -29331,7 +30234,7 @@ function formatAssignedTo(assignedTo) {
|
|
|
29331
30234
|
}
|
|
29332
30235
|
|
|
29333
30236
|
//#endregion
|
|
29334
|
-
//#region ../mcp-core/dist/update-issue-
|
|
30237
|
+
//#region ../mcp-core/dist/update-issue-BH3fTM71.js
|
|
29335
30238
|
function pluralize(value, noun) {
|
|
29336
30239
|
return `${value} ${noun}${value === 1 ? "" : "s"}`;
|
|
29337
30240
|
}
|
|
@@ -29470,7 +30373,9 @@ function buildNoChangesOutput(params) {
|
|
|
29470
30373
|
return output;
|
|
29471
30374
|
}
|
|
29472
30375
|
function isAssigneeAlreadySet(issue, requestedAssignee, currentUserId) {
|
|
29473
|
-
if (
|
|
30376
|
+
if (requestedAssignee === void 0) return false;
|
|
30377
|
+
if (requestedAssignee === null) return !issue.assignedTo;
|
|
30378
|
+
if (!issue.assignedTo) return false;
|
|
29474
30379
|
if (typeof issue.assignedTo === "string") return issue.assignedTo === requestedAssignee;
|
|
29475
30380
|
if (requestedAssignee === "me") return issue.assignedTo.type === "user" && currentUserId !== void 0 && String(issue.assignedTo.id) === currentUserId;
|
|
29476
30381
|
if (requestedAssignee.startsWith("user:")) return issue.assignedTo.type === "user" && String(issue.assignedTo.id) === requestedAssignee.slice(5);
|
|
@@ -29595,12 +30500,13 @@ var update_issue_default = defineTool({
|
|
|
29595
30500
|
description: [
|
|
29596
30501
|
"Update a Sentry issue's status or assignment.",
|
|
29597
30502
|
"",
|
|
29598
|
-
"Use this to resolve, reopen, assign, or ignore an issue.",
|
|
30503
|
+
"Use this to resolve, reopen, assign, unassign, or ignore an issue.",
|
|
29599
30504
|
"",
|
|
29600
30505
|
"<examples>",
|
|
29601
30506
|
"```",
|
|
29602
30507
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', status='resolved')",
|
|
29603
30508
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', assignedTo='user:123456')",
|
|
30509
|
+
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', assignedTo=null)",
|
|
29604
30510
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', status='ignored')",
|
|
29605
30511
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', status='ignored', ignoreMode='forever')",
|
|
29606
30512
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', status='ignored', ignoreMode='untilOccurrenceCount', ignoreCount=100, ignoreWindowMinutes=60)",
|
|
@@ -29611,7 +30517,7 @@ var update_issue_default = defineTool({
|
|
|
29611
30517
|
"<hints>",
|
|
29612
30518
|
"- Provide `issueUrl` or `organizationSlug` + `issueId`.",
|
|
29613
30519
|
"- At least one of `status` or `assignedTo` is required.",
|
|
29614
|
-
"- `assignedTo`
|
|
30520
|
+
"- Omit `assignedTo` to leave assignment unchanged. Pass `null` to unassign; otherwise use `user:ID` or `team:ID_OR_SLUG`.",
|
|
29615
30521
|
"- Use `execute_sentry_tool(name='whoami', arguments={})` to find your user ID for self-assignment.",
|
|
29616
30522
|
"- Status values: `resolved`, `resolvedInNextRelease`, `unresolved`, `ignored`.",
|
|
29617
30523
|
"- `status='ignored'` defaults to `ignoreMode='untilEscalating'`.",
|
|
@@ -29646,13 +30552,13 @@ var update_issue_default = defineTool({
|
|
|
29646
30552
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
29647
30553
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
29648
30554
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
29649
|
-
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");
|
|
29650
30556
|
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
29651
30557
|
organizationSlug: params.organizationSlug,
|
|
29652
30558
|
issueId: params.issueId,
|
|
29653
30559
|
issueUrl: params.issueUrl
|
|
29654
30560
|
});
|
|
29655
|
-
(
|
|
30561
|
+
setOrganizationContext(orgSlug);
|
|
29656
30562
|
const currentIssue = await apiService.getIssue({
|
|
29657
30563
|
organizationSlug: orgSlug,
|
|
29658
30564
|
issueId: parsedIssueId
|
|
@@ -29680,7 +30586,7 @@ var update_issue_default = defineTool({
|
|
|
29680
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.");
|
|
29681
30587
|
}
|
|
29682
30588
|
const requestedIssueUrl = apiService.getIssueUrl(orgSlug, currentIssue.shortId);
|
|
29683
|
-
if (
|
|
30589
|
+
if (updateStatus === void 0 && updateAssignedTo === void 0 && updateIgnore === void 0) {
|
|
29684
30590
|
const commentResult$1 = await tryPostReasonComment(apiService, orgSlug, parsedIssueId, params.reason);
|
|
29685
30591
|
return buildNoChangesOutput({
|
|
29686
30592
|
issue: currentIssue,
|
|
@@ -29715,7 +30621,7 @@ var update_issue_default = defineTool({
|
|
|
29715
30621
|
if (statusChanged) output += `**Status**: ${currentStatusDisplay} → **${updatedStatusDisplay}**\n`;
|
|
29716
30622
|
if (updatedIgnoreState && (statusChanged || ignoreBehaviorChanged) && (ignoreBehaviorChanged || params.status === "ignored")) if (currentIgnoreState && ignoreBehaviorChanged) output += `**Ignore Behavior**: ${currentIgnoreState.behavior} → **${updatedIgnoreState.behavior}**\n`;
|
|
29717
30623
|
else output += `**Ignore Behavior**: **${updatedIgnoreState.behavior}**\n`;
|
|
29718
|
-
if (updateAssignedTo && assignmentChanged) {
|
|
30624
|
+
if (updateAssignedTo !== void 0 && assignmentChanged) {
|
|
29719
30625
|
const oldAssignee = formatAssignedTo(currentIssue.assignedTo ?? null);
|
|
29720
30626
|
const newAssignee = params.assignedTo === "me" ? "You" : formatAssignedTo(updatedIssue.assignedTo ?? null);
|
|
29721
30627
|
output += `**Assigned To**: ${oldAssignee} → **${newAssignee}**\n`;
|
|
@@ -29737,7 +30643,7 @@ var update_issue_default = defineTool({
|
|
|
29737
30643
|
});
|
|
29738
30644
|
|
|
29739
30645
|
//#endregion
|
|
29740
|
-
//#region ../mcp-core/dist/provider-fallback-
|
|
30646
|
+
//#region ../mcp-core/dist/provider-fallback-B4jxYMQu.js
|
|
29741
30647
|
/**
|
|
29742
30648
|
* Run an optional embedded-agent rewrite and fall back to the caller's direct
|
|
29743
30649
|
* behavior when the agent cannot complete the rewrite.
|
|
@@ -29777,7 +30683,126 @@ async function withProviderFallback({ operation, fallback, onFallback, run }) {
|
|
|
29777
30683
|
}
|
|
29778
30684
|
|
|
29779
30685
|
//#endregion
|
|
29780
|
-
//#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
|
|
29781
30806
|
/**
|
|
29782
30807
|
* Resolve the underlying provider failure from an AI SDK error.
|
|
29783
30808
|
*
|
|
@@ -29869,6 +30894,13 @@ async function callEmbeddedAgent({ system, prompt, tools, schema }) {
|
|
|
29869
30894
|
});
|
|
29870
30895
|
throw new UserInputError("The AI was unable to process your query. Please try rephrasing.");
|
|
29871
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
|
+
}
|
|
29872
30904
|
const providerError = resolveProviderApiCallError(error);
|
|
29873
30905
|
if (providerError) throw toLLMProviderError(providerError, error);
|
|
29874
30906
|
if (RetryError.isInstance(error)) throw new LLMProviderError(`The AI provider is currently unavailable: ${error.message}. Please try again later.`, { cause: error });
|
|
@@ -29965,7 +30997,7 @@ function rescueFromText(text$1, schema) {
|
|
|
29965
30997
|
}
|
|
29966
30998
|
|
|
29967
30999
|
//#endregion
|
|
29968
|
-
//#region ../mcp-core/dist/utils-
|
|
31000
|
+
//#region ../mcp-core/dist/utils-_7jC6e0y.js
|
|
29969
31001
|
/**
|
|
29970
31002
|
* Standard response schema for all embedded agent tools.
|
|
29971
31003
|
* Tools return either an error message or the result data, never both.
|
|
@@ -30084,7 +31116,7 @@ function agentTool(config) {
|
|
|
30084
31116
|
}
|
|
30085
31117
|
|
|
30086
31118
|
//#endregion
|
|
30087
|
-
//#region ../mcp-core/dist/dataset-fields-
|
|
31119
|
+
//#region ../mcp-core/dist/dataset-fields-nUaj8nt3.js
|
|
30088
31120
|
const REPLAY_EXCLUDED_TAGS = new Set([
|
|
30089
31121
|
"browser",
|
|
30090
31122
|
"device",
|
|
@@ -30583,7 +31615,7 @@ function getReplayCommonPatterns(availableFields) {
|
|
|
30583
31615
|
}
|
|
30584
31616
|
|
|
30585
31617
|
//#endregion
|
|
30586
|
-
//#region ../mcp-core/dist/otel-semantics-
|
|
31618
|
+
//#region ../mcp-core/dist/otel-semantics-D9c5D-bO.js
|
|
30587
31619
|
var namespace$72 = "android";
|
|
30588
31620
|
var description$72 = "The Android platform on which the Android application is running.\n";
|
|
30589
31621
|
var attributes$72 = {
|
|
@@ -35605,7 +36637,7 @@ function createOtelLookupTool(options) {
|
|
|
35605
36637
|
}
|
|
35606
36638
|
|
|
35607
36639
|
//#endregion
|
|
35608
|
-
//#region ../mcp-core/dist/whoami-
|
|
36640
|
+
//#region ../mcp-core/dist/whoami-B81Oqo48.js
|
|
35609
36641
|
/**
|
|
35610
36642
|
* Get the current authenticated user's information from Sentry API
|
|
35611
36643
|
*/
|
|
@@ -35634,7 +36666,7 @@ function createWhoamiTool(options) {
|
|
|
35634
36666
|
}
|
|
35635
36667
|
|
|
35636
36668
|
//#endregion
|
|
35637
|
-
//#region ../mcp-core/dist/utils-
|
|
36669
|
+
//#region ../mcp-core/dist/utils-DNoGJro2.js
|
|
35638
36670
|
const DEFAULT_MAX_VALUE_LENGTH = 200;
|
|
35639
36671
|
const DEFAULT_MAX_ARRAY_ITEMS = 20;
|
|
35640
36672
|
const SENTRY_SEARCH_TOKEN_PATTERN = /(^|\s)!?([A-Za-z_][A-Za-z0-9_.[\],-]*):(?=\S)(?!\/\/)/g;
|
|
@@ -36095,7 +37127,7 @@ function createDatasetAttributesTool(options) {
|
|
|
36095
37127
|
attributeTypes: zod.z.array(traceItemAttributeTypeSchema).min(1).optional().describe("Optional attribute types to list. Use ['string','number','boolean'] when unsure.")
|
|
36096
37128
|
}),
|
|
36097
37129
|
execute: async ({ dataset, substringMatch, query, attributeTypes }) => {
|
|
36098
|
-
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"));
|
|
36099
37131
|
const normalizedDataset = require_constants.normalizeEventsDataset(dataset);
|
|
36100
37132
|
const attributeTimeParams = { statsPeriod: "14d" };
|
|
36101
37133
|
const { attributes: customAttributes, fieldTypes } = await fetchCustomAttributes(apiService, organizationSlug, dataset, projectId, attributeTimeParams, {
|
|
@@ -36185,14 +37217,18 @@ function createValidateEventsSearchTool(options) {
|
|
|
36185
37217
|
}
|
|
36186
37218
|
|
|
36187
37219
|
//#endregion
|
|
36188
|
-
//#region ../mcp-core/dist/agent-
|
|
37220
|
+
//#region ../mcp-core/dist/agent-D-RH-_8n.js
|
|
36189
37221
|
const SEARCH_EVENTS_DATASETS$1 = [...require_constants.PUBLIC_EVENTS_DATASETS, "replays"];
|
|
36190
37222
|
const searchEventsAgentOutputSchema = zod.z.object({
|
|
36191
37223
|
dataset: zod.z.enum(SEARCH_EVENTS_DATASETS$1).describe("Which dataset to use for the query"),
|
|
36192
37224
|
query: zod.z.string().describe("The Sentry query string for filtering results"),
|
|
36193
37225
|
fields: zod.z.array(zod.z.string()).describe("Array of field names to return in results."),
|
|
36194
37226
|
sort: zod.z.string().describe("Sort parameter for results."),
|
|
36195
|
-
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."),
|
|
36196
37232
|
timeRange: zod.z.union([
|
|
36197
37233
|
zod.z.object({ statsPeriod: zod.z.string().describe("Relative time period like '1h', '24h', '7d'") }),
|
|
36198
37234
|
zod.z.object({
|
|
@@ -36204,10 +37240,44 @@ const searchEventsAgentOutputSchema = zod.z.object({
|
|
|
36204
37240
|
explanation: zod.z.string().default("").describe("Brief explanation of how you translated this query.")
|
|
36205
37241
|
}).refine((data) => {
|
|
36206
37242
|
if (data.dataset === "replays") return true;
|
|
37243
|
+
if (data.timeSeries) return true;
|
|
36207
37244
|
if (!data.sort || !data.fields || data.fields.length === 0) return true;
|
|
36208
37245
|
const sortField = data.sort.startsWith("-") ? data.sort.substring(1) : data.sort;
|
|
36209
37246
|
return data.fields.includes(sortField);
|
|
36210
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
|
+
}
|
|
36211
37281
|
/**
|
|
36212
37282
|
* Search events agent - single entry point for translating natural language queries to Sentry search syntax
|
|
36213
37283
|
* This returns both the translated query result AND the tool calls made by the agent
|
|
@@ -36235,8 +37305,9 @@ async function searchEventsAgent(options) {
|
|
|
36235
37305
|
projectId: options.projectId
|
|
36236
37306
|
});
|
|
36237
37307
|
const whoamiTool = createWhoamiTool({ apiService: options.apiService });
|
|
37308
|
+
const environmentNames = options.environmentNames ?? await fetchEnvironmentNames(options);
|
|
36238
37309
|
return await callEmbeddedAgent({
|
|
36239
|
-
system:
|
|
37310
|
+
system: buildSystemPromptWithEnvironments(require_config_B_l88mOS.systemPrompt, environmentNames),
|
|
36240
37311
|
prompt: options.query,
|
|
36241
37312
|
tools: {
|
|
36242
37313
|
datasetAttributes: datasetAttributesTool,
|
|
@@ -36250,7 +37321,7 @@ async function searchEventsAgent(options) {
|
|
|
36250
37321
|
}
|
|
36251
37322
|
|
|
36252
37323
|
//#endregion
|
|
36253
|
-
//#region ../mcp-core/dist/analyzer-
|
|
37324
|
+
//#region ../mcp-core/dist/analyzer-BuS9K0e5.js
|
|
36254
37325
|
/**
|
|
36255
37326
|
* Analyzes flamegraph data to extract hot paths (most CPU-intensive call stacks).
|
|
36256
37327
|
*
|
|
@@ -36509,7 +37580,7 @@ function hasProfileData(flamegraph) {
|
|
|
36509
37580
|
}
|
|
36510
37581
|
|
|
36511
37582
|
//#endregion
|
|
36512
|
-
//#region ../mcp-core/dist/formatters-
|
|
37583
|
+
//#region ../mcp-core/dist/formatters-DsABISrU.js
|
|
36513
37584
|
/**
|
|
36514
37585
|
* Format an explanation for how the input query was translated
|
|
36515
37586
|
*/
|
|
@@ -36974,9 +38045,47 @@ function formatTraceMetricsResults(params) {
|
|
|
36974
38045
|
output += "- Switch between samples and aggregates in Sentry for deeper analysis\n";
|
|
36975
38046
|
return output;
|
|
36976
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
|
+
}
|
|
36977
38086
|
|
|
36978
38087
|
//#endregion
|
|
36979
|
-
//#region ../mcp-core/dist/replays-
|
|
38088
|
+
//#region ../mcp-core/dist/replays-DQeYjWub.js
|
|
36980
38089
|
const DEFAULT_REPLAY_SORT = "-started_at";
|
|
36981
38090
|
const DEFAULT_REPLAY_STATS_PERIOD = "14d";
|
|
36982
38091
|
const REPLAY_SORT_FIELDS = [
|
|
@@ -37101,14 +38210,14 @@ function formatReplayEnvironment(environment) {
|
|
|
37101
38210
|
}
|
|
37102
38211
|
|
|
37103
38212
|
//#endregion
|
|
37104
|
-
//#region ../mcp-core/dist/search-events-
|
|
38213
|
+
//#region ../mcp-core/dist/search-events-BFGK2Xtv.js
|
|
37105
38214
|
const SEARCH_EVENTS_DATASETS = [...require_constants.PUBLIC_EVENTS_DATASETS, "replays"];
|
|
37106
38215
|
const DEFAULT_EVENTS_SORT = "-timestamp";
|
|
37107
38216
|
function defaultSortForDataset(dataset) {
|
|
37108
38217
|
return dataset === "replays" ? DEFAULT_REPLAY_SORT : DEFAULT_EVENTS_SORT;
|
|
37109
38218
|
}
|
|
37110
38219
|
function defaultFieldsForDataset(dataset) {
|
|
37111
|
-
return
|
|
38220
|
+
return require_config_B_l88mOS.RECOMMENDED_FIELDS[require_constants.normalizeEventsDataset(dataset)].basic;
|
|
37112
38221
|
}
|
|
37113
38222
|
function resolveEventFields({ dataset, explicitFields, agentFields, trustExplicitFields }) {
|
|
37114
38223
|
if (trustExplicitFields && explicitFields && explicitFields.length > 0) return explicitFields;
|
|
@@ -37131,7 +38240,7 @@ function augmentFieldsWithSort(fields, sort) {
|
|
|
37131
38240
|
return fields;
|
|
37132
38241
|
}
|
|
37133
38242
|
function buildRequestFields(dataset, fields) {
|
|
37134
|
-
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;
|
|
37135
38244
|
}
|
|
37136
38245
|
function isTraceItemDataset(dataset) {
|
|
37137
38246
|
return dataset === "spans" || dataset === "logs" || dataset === "metrics";
|
|
@@ -37158,6 +38267,42 @@ function appendSearchFilter(query, filter$1) {
|
|
|
37158
38267
|
if (tokenizeSearchQuery(trimmedQuery).includes(filter$1)) return trimmedQuery;
|
|
37159
38268
|
return [trimmedQuery, filter$1].filter(Boolean).join(" ");
|
|
37160
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
|
+
}
|
|
37161
38306
|
function applyEnvironmentToEventsQuery(dataset, query, environment) {
|
|
37162
38307
|
if (dataset === "replays") return query;
|
|
37163
38308
|
return appendSearchFilter(query, formatEnvironmentFilter(environment));
|
|
@@ -37249,11 +38394,12 @@ var search_events_default = defineTool({
|
|
|
37249
38394
|
description: [
|
|
37250
38395
|
"Search Sentry events and replays. Use for event counts/statistics.",
|
|
37251
38396
|
"",
|
|
37252
|
-
"`query`
|
|
38397
|
+
"`query` is natural language or Sentry search syntax; a configured agent fixes dataset, query, fields, and sort.",
|
|
37253
38398
|
"",
|
|
37254
|
-
"Supports
|
|
38399
|
+
"Supports THREE query types:",
|
|
37255
38400
|
"1. AGGREGATIONS (counts, sums, averages): 'how many errors', 'total tokens'",
|
|
37256
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'",
|
|
37257
38403
|
"",
|
|
37258
38404
|
"Datasets:",
|
|
37259
38405
|
"- errors: Exception/crash events with stack traces, usually grouped into issues",
|
|
@@ -37270,15 +38416,14 @@ var search_events_default = defineTool({
|
|
|
37270
38416
|
"",
|
|
37271
38417
|
"<examples>",
|
|
37272
38418
|
"search_events(organizationSlug='my-org', query='how many errors today')",
|
|
37273
|
-
"search_events(organizationSlug='my-org', dataset='errors', query='level:error')",
|
|
37274
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')",
|
|
37275
38421
|
"search_events(organizationSlug='my-org', dataset='spans', query='span.op:db', sort='-span.duration')",
|
|
37276
38422
|
"search_events(organizationSlug='my-org', dataset='replays', query='count_errors:>0', sort='-count_errors')",
|
|
37277
38423
|
"</examples>",
|
|
37278
38424
|
"",
|
|
37279
38425
|
"<hints>",
|
|
37280
|
-
"-
|
|
37281
|
-
"- 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.",
|
|
37282
38427
|
"- Use fields with aggregate functions like count(), avg(), sum() for statistics",
|
|
37283
38428
|
"- Sort by -count() for most common, -timestamp for newest",
|
|
37284
38429
|
"</hints>"
|
|
@@ -37301,10 +38446,22 @@ var search_events_default = defineTool({
|
|
|
37301
38446
|
destructiveHint: false,
|
|
37302
38447
|
openWorldHint: true
|
|
37303
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
|
+
},
|
|
37304
38461
|
async handler(params, context$1) {
|
|
37305
38462
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37306
38463
|
const organizationSlug = params.organizationSlug;
|
|
37307
|
-
(
|
|
38464
|
+
setOrganizationContext(organizationSlug);
|
|
37308
38465
|
if (params.projectSlug) (0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
37309
38466
|
const inputDataset = params.dataset ?? "errors";
|
|
37310
38467
|
const hasStructuredQuery = looksLikeSentrySearchSyntax(params.query);
|
|
@@ -37325,6 +38482,7 @@ var search_events_default = defineTool({
|
|
|
37325
38482
|
let timeParams;
|
|
37326
38483
|
let explanation;
|
|
37327
38484
|
let environment = params.environment;
|
|
38485
|
+
let timeSeries = null;
|
|
37328
38486
|
const explicitSort = params.sort?.trim() || void 0;
|
|
37329
38487
|
const hasExplicitDataset = params.dataset !== void 0;
|
|
37330
38488
|
const hasExplicitFields = hasFields(params.fields);
|
|
@@ -37335,7 +38493,15 @@ var search_events_default = defineTool({
|
|
|
37335
38493
|
const environmentFilter = formatEnvironmentFilter(params.environment);
|
|
37336
38494
|
const explicitStructuredTraceQuery = shouldTrustStructuredTraceSearch ? appendSearchFilter(params.query ?? "", environmentFilter) : params.query ?? "";
|
|
37337
38495
|
const canRunWithoutAgent = shouldTrustStructuredTraceSearch && hasExplicitFields && hasExplicitSort;
|
|
37338
|
-
|
|
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) {
|
|
37339
38505
|
const parsed = await withProviderFallback({
|
|
37340
38506
|
operation: "search_events.rewrite",
|
|
37341
38507
|
fallback: () => ({
|
|
@@ -37344,6 +38510,7 @@ var search_events_default = defineTool({
|
|
|
37344
38510
|
fields: inputDataset === "replays" ? [] : params.fields ?? defaultFieldsForDataset(inputDataset),
|
|
37345
38511
|
sort: explicitSort || defaultSortForDataset(inputDataset),
|
|
37346
38512
|
environment: params.environment ?? null,
|
|
38513
|
+
timeSeries: null,
|
|
37347
38514
|
timeRange: { statsPeriod: params.period ?? "14d" },
|
|
37348
38515
|
explanation: ""
|
|
37349
38516
|
}),
|
|
@@ -37358,11 +38525,13 @@ var search_events_default = defineTool({
|
|
|
37358
38525
|
}),
|
|
37359
38526
|
organizationSlug,
|
|
37360
38527
|
apiService,
|
|
37361
|
-
projectId
|
|
38528
|
+
projectId,
|
|
38529
|
+
environmentNames
|
|
37362
38530
|
})).result
|
|
37363
38531
|
});
|
|
37364
38532
|
const shouldTrustExplicitSearchParams = shouldTrustStructuredTraceSearch || hasStructuredQuery && parsed.dataset === inputDataset;
|
|
37365
|
-
|
|
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).`);
|
|
37366
38535
|
dataset = shouldTrustStructuredTraceSearch ? inputDataset : parsed.dataset;
|
|
37367
38536
|
sentryQuery = shouldTrustStructuredTraceSearch ? choosePreservingRepairedQuery({
|
|
37368
38537
|
originalQuery: params.query ?? "",
|
|
@@ -37387,6 +38556,9 @@ var search_events_default = defineTool({
|
|
|
37387
38556
|
timeParams = { statsPeriod: params.period ?? "14d" };
|
|
37388
38557
|
fields = dataset === "replays" ? [] : params.fields ?? defaultFieldsForDataset(dataset);
|
|
37389
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;
|
|
37390
38562
|
if (dataset === "replays") {
|
|
37391
38563
|
const replaySort = sortParam || DEFAULT_REPLAY_SORT;
|
|
37392
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.`);
|
|
@@ -37409,7 +38581,7 @@ var search_events_default = defineTool({
|
|
|
37409
38581
|
...replayTimeParams
|
|
37410
38582
|
});
|
|
37411
38583
|
(0, __sentry_core.getActiveSpan)()?.setAttribute("gen_ai.tool.call.result.count", replays.length);
|
|
37412
|
-
|
|
38584
|
+
const replayOutput = formatReplayResults({
|
|
37413
38585
|
replays,
|
|
37414
38586
|
inputQuery: params.query || sentryQuery || "recent replays",
|
|
37415
38587
|
includeExplanation: params.includeExplanation,
|
|
@@ -37432,6 +38604,30 @@ var search_events_default = defineTool({
|
|
|
37432
38604
|
availableToolNames: context$1.availableToolNames,
|
|
37433
38605
|
directToolNames: context$1.directToolNames
|
|
37434
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
|
+
}));
|
|
37435
38631
|
}
|
|
37436
38632
|
fields = augmentFieldsWithSort(fields, sortParam);
|
|
37437
38633
|
const requestFields = buildRequestFields(dataset, fields);
|
|
@@ -37502,17 +38698,17 @@ var search_events_default = defineTool({
|
|
|
37502
38698
|
directToolNames: context$1.directToolNames
|
|
37503
38699
|
};
|
|
37504
38700
|
switch (dataset) {
|
|
37505
|
-
case "errors": return formatErrorResults(formatParams);
|
|
37506
|
-
case "logs": return formatLogResults(formatParams);
|
|
37507
|
-
case "spans": return formatSpanResults(formatParams);
|
|
37508
|
-
case "profiles": return formatProfileResults(formatParams);
|
|
37509
|
-
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));
|
|
37510
38706
|
}
|
|
37511
38707
|
}
|
|
37512
38708
|
});
|
|
37513
38709
|
|
|
37514
38710
|
//#endregion
|
|
37515
|
-
//#region ../mcp-core/dist/create-team-
|
|
38711
|
+
//#region ../mcp-core/dist/create-team-CgnBfkV1.js
|
|
37516
38712
|
const createTeamOutputSchema = zod.z.object({ team: zod.z.object({
|
|
37517
38713
|
id: zod.z.string(),
|
|
37518
38714
|
slug: zod.z.string(),
|
|
@@ -37557,7 +38753,7 @@ var create_team_default = defineTool({
|
|
|
37557
38753
|
async handler(params, context$1) {
|
|
37558
38754
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37559
38755
|
const organizationSlug = params.organizationSlug;
|
|
37560
|
-
(
|
|
38756
|
+
setOrganizationContext(organizationSlug);
|
|
37561
38757
|
const team = await apiService.createTeam({
|
|
37562
38758
|
organizationSlug,
|
|
37563
38759
|
name: params.name
|
|
@@ -37571,7 +38767,7 @@ var create_team_default = defineTool({
|
|
|
37571
38767
|
});
|
|
37572
38768
|
|
|
37573
38769
|
//#endregion
|
|
37574
|
-
//#region ../mcp-core/dist/create-project-
|
|
38770
|
+
//#region ../mcp-core/dist/create-project-BHO4uN-y.js
|
|
37575
38771
|
function getUsableClientKey(clientKeys) {
|
|
37576
38772
|
return clientKeys.find((key) => key.name === "Default" && key.isActive && key.dsn.public) ?? clientKeys.find((key) => key.isActive && key.dsn.public);
|
|
37577
38773
|
}
|
|
@@ -37667,7 +38863,7 @@ var create_project_default = defineTool({
|
|
|
37667
38863
|
async handler(params, context$1) {
|
|
37668
38864
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37669
38865
|
const organizationSlug = params.organizationSlug;
|
|
37670
|
-
(
|
|
38866
|
+
setOrganizationContext(organizationSlug);
|
|
37671
38867
|
(0, __sentry_core.setTag)("team.slug", params.teamSlug);
|
|
37672
38868
|
const repositoryMatch = params.repository ? findRepositoryMatch(await apiService.listRepos({ organizationSlug }), params.repository) : null;
|
|
37673
38869
|
const project = await apiService.createProject({
|
|
@@ -37727,7 +38923,7 @@ var create_project_default = defineTool({
|
|
|
37727
38923
|
});
|
|
37728
38924
|
|
|
37729
38925
|
//#endregion
|
|
37730
|
-
//#region ../mcp-core/dist/update-project-
|
|
38926
|
+
//#region ../mcp-core/dist/update-project-CQdb0Elv.js
|
|
37731
38927
|
const updateProjectOutputSchema = zod.z.object({ project: zod.z.object({
|
|
37732
38928
|
id: zod.z.string(),
|
|
37733
38929
|
slug: zod.z.string(),
|
|
@@ -37788,7 +38984,7 @@ var update_project_default = defineTool({
|
|
|
37788
38984
|
async handler(params, context$1) {
|
|
37789
38985
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37790
38986
|
const organizationSlug = params.organizationSlug;
|
|
37791
|
-
(
|
|
38987
|
+
setOrganizationContext(organizationSlug);
|
|
37792
38988
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
37793
38989
|
const hasProjectUpdates = params.name || params.slug || params.platform;
|
|
37794
38990
|
if (!hasProjectUpdates) throw new UserInputError("At least one project metadata field is required: `name`, `slug`, or `platform`.");
|
|
@@ -37816,7 +39012,7 @@ var update_project_default = defineTool({
|
|
|
37816
39012
|
});
|
|
37817
39013
|
|
|
37818
39014
|
//#endregion
|
|
37819
|
-
//#region ../mcp-core/dist/add-team-to-project-
|
|
39015
|
+
//#region ../mcp-core/dist/add-team-to-project-CNjkc5mL.js
|
|
37820
39016
|
const assignedTeamSchema$1 = zod.z.object({
|
|
37821
39017
|
id: zod.z.string(),
|
|
37822
39018
|
slug: zod.z.string(),
|
|
@@ -37874,7 +39070,7 @@ var add_team_to_project_default = defineTool({
|
|
|
37874
39070
|
async handler(params, context$1) {
|
|
37875
39071
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37876
39072
|
const organizationSlug = params.organizationSlug;
|
|
37877
|
-
(
|
|
39073
|
+
setOrganizationContext(organizationSlug);
|
|
37878
39074
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
37879
39075
|
(0, __sentry_core.setTag)("team.slug", params.teamSlug);
|
|
37880
39076
|
const currentTeams = await apiService.listProjectTeams({
|
|
@@ -37903,7 +39099,7 @@ var add_team_to_project_default = defineTool({
|
|
|
37903
39099
|
});
|
|
37904
39100
|
|
|
37905
39101
|
//#endregion
|
|
37906
|
-
//#region ../mcp-core/dist/remove-team-from-project-
|
|
39102
|
+
//#region ../mcp-core/dist/remove-team-from-project-CM2_RkK5.js
|
|
37907
39103
|
const assignedTeamSchema = zod.z.object({
|
|
37908
39104
|
id: zod.z.string(),
|
|
37909
39105
|
slug: zod.z.string(),
|
|
@@ -37962,7 +39158,7 @@ var remove_team_from_project_default = defineTool({
|
|
|
37962
39158
|
async handler(params, context$1) {
|
|
37963
39159
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37964
39160
|
const organizationSlug = params.organizationSlug;
|
|
37965
|
-
(
|
|
39161
|
+
setOrganizationContext(organizationSlug);
|
|
37966
39162
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
37967
39163
|
(0, __sentry_core.setTag)("team.slug", params.teamSlug);
|
|
37968
39164
|
const currentTeams = await apiService.listProjectTeams({
|
|
@@ -37989,7 +39185,7 @@ var remove_team_from_project_default = defineTool({
|
|
|
37989
39185
|
});
|
|
37990
39186
|
|
|
37991
39187
|
//#endregion
|
|
37992
|
-
//#region ../mcp-core/dist/create-dsn-
|
|
39188
|
+
//#region ../mcp-core/dist/create-dsn-BtFKEMq7.js
|
|
37993
39189
|
const createDsnOutputSchema = zod.z.object({ dsn: zod.z.object({
|
|
37994
39190
|
id: zod.z.string(),
|
|
37995
39191
|
name: zod.z.string(),
|
|
@@ -38038,7 +39234,7 @@ var create_dsn_default = defineTool({
|
|
|
38038
39234
|
async handler(params, context$1) {
|
|
38039
39235
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
38040
39236
|
const organizationSlug = params.organizationSlug;
|
|
38041
|
-
(
|
|
39237
|
+
setOrganizationContext(organizationSlug);
|
|
38042
39238
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
38043
39239
|
const clientKey = await apiService.createClientKey({
|
|
38044
39240
|
organizationSlug,
|
|
@@ -38054,7 +39250,7 @@ var create_dsn_default = defineTool({
|
|
|
38054
39250
|
});
|
|
38055
39251
|
|
|
38056
39252
|
//#endregion
|
|
38057
|
-
//#region ../mcp-core/dist/find-dsns-
|
|
39253
|
+
//#region ../mcp-core/dist/find-dsns-CqiIxv7u.js
|
|
38058
39254
|
const findDsnsOutputSchema = zod.z.object({ dsns: zod.z.array(zod.z.object({
|
|
38059
39255
|
id: zod.z.string(),
|
|
38060
39256
|
name: zod.z.string(),
|
|
@@ -38089,7 +39285,7 @@ var find_dsns_default = defineTool({
|
|
|
38089
39285
|
async handler(params, context$1) {
|
|
38090
39286
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
38091
39287
|
const organizationSlug = params.organizationSlug;
|
|
38092
|
-
(
|
|
39288
|
+
setOrganizationContext(organizationSlug);
|
|
38093
39289
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
38094
39290
|
const clientKeys = await apiService.listClientKeys({
|
|
38095
39291
|
organizationSlug,
|
|
@@ -38104,7 +39300,7 @@ var find_dsns_default = defineTool({
|
|
|
38104
39300
|
});
|
|
38105
39301
|
|
|
38106
39302
|
//#endregion
|
|
38107
|
-
//#region ../mcp-core/dist/update-dsn-
|
|
39303
|
+
//#region ../mcp-core/dist/update-dsn-DP7ljBh8.js
|
|
38108
39304
|
var update_dsn_default = defineTool({
|
|
38109
39305
|
name: "update_dsn",
|
|
38110
39306
|
skills: ["project-management"],
|
|
@@ -38168,7 +39364,7 @@ var update_dsn_default = defineTool({
|
|
|
38168
39364
|
async handler(params, context$1) {
|
|
38169
39365
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
38170
39366
|
const organizationSlug = params.organizationSlug;
|
|
38171
|
-
(
|
|
39367
|
+
setOrganizationContext(organizationSlug);
|
|
38172
39368
|
(0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
38173
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;
|
|
38174
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.");
|
|
@@ -38238,57 +39434,7 @@ var update_dsn_default = defineTool({
|
|
|
38238
39434
|
});
|
|
38239
39435
|
|
|
38240
39436
|
//#endregion
|
|
38241
|
-
//#region ../mcp-core/dist/
|
|
38242
|
-
/**
|
|
38243
|
-
* Fetch with timeout using AbortController
|
|
38244
|
-
* @param url - The URL to fetch
|
|
38245
|
-
* @param options - Standard fetch options
|
|
38246
|
-
* @param timeoutMs - Timeout in milliseconds (default: 30000)
|
|
38247
|
-
* @returns Promise<Response>
|
|
38248
|
-
* @throws Error if request times out
|
|
38249
|
-
*/
|
|
38250
|
-
async function fetchWithTimeout(url, options = {}, timeoutMs = 3e4) {
|
|
38251
|
-
const controller = new AbortController();
|
|
38252
|
-
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
38253
|
-
try {
|
|
38254
|
-
const response = await fetch(url, {
|
|
38255
|
-
...options,
|
|
38256
|
-
signal: controller.signal
|
|
38257
|
-
});
|
|
38258
|
-
return response;
|
|
38259
|
-
} catch (error) {
|
|
38260
|
-
if (error instanceof Error && error.name === "AbortError") throw new Error(`Request timeout after ${timeoutMs}ms`);
|
|
38261
|
-
throw error;
|
|
38262
|
-
} finally {
|
|
38263
|
-
clearTimeout(timeoutId);
|
|
38264
|
-
}
|
|
38265
|
-
}
|
|
38266
|
-
/**
|
|
38267
|
-
* Retry a function with exponential backoff
|
|
38268
|
-
* @param fn - The async function to retry
|
|
38269
|
-
* @param options - Retry options
|
|
38270
|
-
* @param options.maxRetries - Maximum number of retries (default: 3)
|
|
38271
|
-
* @param options.initialDelay - Initial delay in milliseconds (default: 1000)
|
|
38272
|
-
* @param options.shouldRetry - Predicate to determine if error should be retried (default: always retry)
|
|
38273
|
-
* @returns Promise with the function result
|
|
38274
|
-
* @throws The last error if all retries are exhausted
|
|
38275
|
-
*/
|
|
38276
|
-
async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, shouldRetry = (error) => true } = {}) {
|
|
38277
|
-
let lastError;
|
|
38278
|
-
let delay$1 = initialDelay;
|
|
38279
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) try {
|
|
38280
|
-
return await fn();
|
|
38281
|
-
} catch (error) {
|
|
38282
|
-
lastError = error;
|
|
38283
|
-
if (attempt === maxRetries || !shouldRetry(error)) throw error;
|
|
38284
|
-
await new Promise((resolve$1) => setTimeout(resolve$1, delay$1));
|
|
38285
|
-
delay$1 = Math.min(delay$1 * 2, 3e4);
|
|
38286
|
-
}
|
|
38287
|
-
throw lastError;
|
|
38288
|
-
}
|
|
38289
|
-
|
|
38290
|
-
//#endregion
|
|
38291
|
-
//#region ../mcp-core/dist/analyze-issue-with-seer-D9pdpxPy.js
|
|
39437
|
+
//#region ../mcp-core/dist/analyze-issue-with-seer-Bh4zPWGl.js
|
|
38292
39438
|
var analyze_issue_with_seer_default = defineTool({
|
|
38293
39439
|
name: "analyze_issue_with_seer",
|
|
38294
39440
|
skills: ["seer"],
|
|
@@ -38354,7 +39500,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38354
39500
|
issueId: params.issueId,
|
|
38355
39501
|
issueUrl: params.issueUrl
|
|
38356
39502
|
});
|
|
38357
|
-
(
|
|
39503
|
+
setOrganizationContext(orgSlug);
|
|
38358
39504
|
const issue = await apiService.getIssue({
|
|
38359
39505
|
organizationSlug: orgSlug,
|
|
38360
39506
|
issueId: parsedIssueId
|
|
@@ -38399,7 +39545,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38399
39545
|
const existingStatus = autofixState.autofix.status;
|
|
38400
39546
|
if (isTerminalStatus(existingStatus)) {
|
|
38401
39547
|
output += `## Analysis ${getStatusDisplayName(existingStatus)}\n\n`;
|
|
38402
|
-
output += getOutputForAutofixRun(autofixState.autofix);
|
|
39548
|
+
output += autofixState.formatted?.content ? wrapSeerContent(autofixState.formatted.content, autofixState.autofix.run_id) : getOutputForAutofixRun(autofixState.autofix);
|
|
38403
39549
|
if (existingStatus !== "completed") {
|
|
38404
39550
|
output += `\n**Status**: ${existingStatus}\n`;
|
|
38405
39551
|
output += getHumanInterventionGuidance(existingStatus);
|
|
@@ -38422,7 +39568,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38422
39568
|
const status = autofixState.autofix.status;
|
|
38423
39569
|
if (isTerminalStatus(status)) {
|
|
38424
39570
|
output += `## Analysis ${getStatusDisplayName(status)}\n\n`;
|
|
38425
|
-
output += getOutputForAutofixRun(autofixState.autofix);
|
|
39571
|
+
output += autofixState.formatted?.content ? wrapSeerContent(autofixState.formatted.content, autofixState.autofix.run_id) : getOutputForAutofixRun(autofixState.autofix);
|
|
38426
39572
|
if (status !== "completed") {
|
|
38427
39573
|
output += `\n**Status**: ${status}\n`;
|
|
38428
39574
|
output += getHumanInterventionGuidance(status);
|
|
@@ -38464,7 +39610,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38464
39610
|
}
|
|
38465
39611
|
if (autofixState.autofix) {
|
|
38466
39612
|
output += `**Current Status**: ${getStatusDisplayName(autofixState.autofix.status)}\n\n`;
|
|
38467
|
-
output += getOutputForAutofixRun(autofixState.autofix);
|
|
39613
|
+
output += autofixState.formatted?.content ? wrapSeerContent(autofixState.formatted.content, autofixState.autofix.run_id) : getOutputForAutofixRun(autofixState.autofix);
|
|
38468
39614
|
}
|
|
38469
39615
|
output += `\n## Analysis Timed Out\n\n`;
|
|
38470
39616
|
output += `The analysis is taking longer than expected (>${SEER_TIMEOUT / 1e3}s).\n\n`;
|
|
@@ -38477,7 +39623,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38477
39623
|
});
|
|
38478
39624
|
|
|
38479
39625
|
//#endregion
|
|
38480
|
-
//#region ../mcp-core/dist/search-docs-
|
|
39626
|
+
//#region ../mcp-core/dist/search-docs-Tj5IpQIk.js
|
|
38481
39627
|
var search_docs_default = defineTool({
|
|
38482
39628
|
name: "search_docs",
|
|
38483
39629
|
skills: ["inspect", "docs"],
|
|
@@ -38574,7 +39720,7 @@ var search_docs_default = defineTool({
|
|
|
38574
39720
|
});
|
|
38575
39721
|
|
|
38576
39722
|
//#endregion
|
|
38577
|
-
//#region ../mcp-core/dist/get-doc-
|
|
39723
|
+
//#region ../mcp-core/dist/get-doc-D-DZcOOW.js
|
|
38578
39724
|
var get_doc_default = defineTool({
|
|
38579
39725
|
name: "get_doc",
|
|
38580
39726
|
skills: ["inspect", "docs"],
|
|
@@ -38652,7 +39798,7 @@ var get_doc_default = defineTool({
|
|
|
38652
39798
|
});
|
|
38653
39799
|
|
|
38654
39800
|
//#endregion
|
|
38655
|
-
//#region ../mcp-core/dist/config-
|
|
39801
|
+
//#region ../mcp-core/dist/config-CCjTO4AY.js
|
|
38656
39802
|
/**
|
|
38657
39803
|
* Configuration for the search-issues agent
|
|
38658
39804
|
*/
|
|
@@ -38749,7 +39895,7 @@ Use issueFields only when a requested field is not in the built-in fields list.
|
|
|
38749
39895
|
Use whoami only for natural-language me references.`;
|
|
38750
39896
|
|
|
38751
39897
|
//#endregion
|
|
38752
|
-
//#region ../mcp-core/dist/agent-
|
|
39898
|
+
//#region ../mcp-core/dist/agent-DyOsplyJ.js
|
|
38753
39899
|
const searchIssuesAgentOutputSchema = zod.z.object({
|
|
38754
39900
|
query: zod.z.string().describe("The Sentry issue search query"),
|
|
38755
39901
|
sort: zod.z.enum([
|
|
@@ -38783,7 +39929,7 @@ async function searchIssuesAgent(options) {
|
|
|
38783
39929
|
}
|
|
38784
39930
|
|
|
38785
39931
|
//#endregion
|
|
38786
|
-
//#region ../mcp-core/dist/formatters-
|
|
39932
|
+
//#region ../mcp-core/dist/formatters-CZbnEl5Q.js
|
|
38787
39933
|
/**
|
|
38788
39934
|
* Format an explanation for how the input query was translated
|
|
38789
39935
|
*/
|
|
@@ -38877,7 +40023,7 @@ function formatDate$1(dateString) {
|
|
|
38877
40023
|
}
|
|
38878
40024
|
|
|
38879
40025
|
//#endregion
|
|
38880
|
-
//#region ../mcp-core/dist/search-issues-
|
|
40026
|
+
//#region ../mcp-core/dist/search-issues-lbSTiP3S.js
|
|
38881
40027
|
const ProjectSlugOrIdSchema = zod.z.string().trim().superRefine(validateSlugOrId);
|
|
38882
40028
|
function buildIssueSearchRepairPrompt(params) {
|
|
38883
40029
|
return [
|
|
@@ -38959,7 +40105,7 @@ var search_issues_default = defineTool({
|
|
|
38959
40105
|
},
|
|
38960
40106
|
async handler(params, context$1) {
|
|
38961
40107
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
38962
|
-
(
|
|
40108
|
+
setOrganizationContext(params.organizationSlug);
|
|
38963
40109
|
if (params.projectSlugOrId) if (isNumericId(params.projectSlugOrId)) (0, __sentry_core.setTag)("project.id", params.projectSlugOrId);
|
|
38964
40110
|
else (0, __sentry_core.setTag)("project.slug", params.projectSlugOrId);
|
|
38965
40111
|
let query;
|
|
@@ -39057,7 +40203,7 @@ var search_issues_default = defineTool({
|
|
|
39057
40203
|
});
|
|
39058
40204
|
|
|
39059
40205
|
//#endregion
|
|
39060
|
-
//#region ../mcp-core/dist/config-
|
|
40206
|
+
//#region ../mcp-core/dist/config-Nif76Shh.js
|
|
39061
40207
|
const systemPrompt$1 = `You are a Sentry issue event filter translator. Your job is to:
|
|
39062
40208
|
1. Translate natural language queries into Sentry tag filters for events within a SPECIFIC issue
|
|
39063
40209
|
2. Select appropriate fields to return in the results
|
|
@@ -39390,7 +40536,7 @@ const EXAMPLE_QUERIES = [
|
|
|
39390
40536
|
];
|
|
39391
40537
|
|
|
39392
40538
|
//#endregion
|
|
39393
|
-
//#region ../mcp-core/dist/utils-
|
|
40539
|
+
//#region ../mcp-core/dist/utils-DeCBYEnS.js
|
|
39394
40540
|
/**
|
|
39395
40541
|
* Create a tool for the agent to query available tags and fields for issue events
|
|
39396
40542
|
* The tool is pre-bound with the API service and organization configured for the appropriate region
|
|
@@ -39473,7 +40619,7 @@ Received: ${params.issueUrl}`);
|
|
|
39473
40619
|
}
|
|
39474
40620
|
|
|
39475
40621
|
//#endregion
|
|
39476
|
-
//#region ../mcp-core/dist/agent-
|
|
40622
|
+
//#region ../mcp-core/dist/agent-DTdycAuW.js
|
|
39477
40623
|
const searchIssueEventsAgentOutputSchema = zod.z.object({
|
|
39478
40624
|
query: zod.z.string().describe("Sentry query filters for tags/fields (NOT including issue: prefix - handler adds that)"),
|
|
39479
40625
|
fields: zod.z.array(zod.z.string()).describe("Array of field names to return in results"),
|
|
@@ -39515,7 +40661,7 @@ async function searchIssueEventsAgent(options) {
|
|
|
39515
40661
|
}
|
|
39516
40662
|
|
|
39517
40663
|
//#endregion
|
|
39518
|
-
//#region ../mcp-core/dist/search-issue-events-
|
|
40664
|
+
//#region ../mcp-core/dist/search-issue-events-Ck9S6CNC.js
|
|
39519
40665
|
function buildIssueEventSearchRepairPrompt(params) {
|
|
39520
40666
|
return [
|
|
39521
40667
|
"Fix this Sentry issue event search request.",
|
|
@@ -39579,7 +40725,7 @@ var search_issue_events_default = defineTool({
|
|
|
39579
40725
|
issueUrl: params.issueUrl
|
|
39580
40726
|
});
|
|
39581
40727
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
39582
|
-
(
|
|
40728
|
+
setOrganizationContext(organizationSlug);
|
|
39583
40729
|
(0, __sentry_core.setTag)("issue.id", issueId);
|
|
39584
40730
|
if (params.projectSlug) (0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
39585
40731
|
await ensureIssueWithinProjectConstraint({
|
|
@@ -39668,7 +40814,7 @@ var search_issue_events_default = defineTool({
|
|
|
39668
40814
|
});
|
|
39669
40815
|
|
|
39670
40816
|
//#endregion
|
|
39671
|
-
//#region ../mcp-core/dist/formatter-
|
|
40817
|
+
//#region ../mcp-core/dist/formatter-ffKOVbDF.js
|
|
39672
40818
|
/**
|
|
39673
40819
|
* Maps a change type to its corresponding status icon.
|
|
39674
40820
|
*/
|
|
@@ -40044,7 +41190,7 @@ function formatSdkSummary(profile) {
|
|
|
40044
41190
|
}
|
|
40045
41191
|
|
|
40046
41192
|
//#endregion
|
|
40047
|
-
//#region ../mcp-core/dist/get-profile-
|
|
41193
|
+
//#region ../mcp-core/dist/get-profile-4EwZiRri.js
|
|
40048
41194
|
/**
|
|
40049
41195
|
* Resolves profile parameters from URL or explicit params.
|
|
40050
41196
|
* URL takes precedence if provided and valid.
|
|
@@ -40174,7 +41320,7 @@ var get_profile_default = defineTool({
|
|
|
40174
41320
|
(0, __sentry_core.setTag)("project.slug", String(projectSlugOrId));
|
|
40175
41321
|
(0, __sentry_core.setTag)("project.id", String(project.id));
|
|
40176
41322
|
}
|
|
40177
|
-
(
|
|
41323
|
+
setOrganizationContext(organizationSlug);
|
|
40178
41324
|
(0, __sentry_core.setTag)("transaction.name", transactionName);
|
|
40179
41325
|
if (params.compareAgainstPeriod) {
|
|
40180
41326
|
(0, __sentry_core.setTag)("baseline.period", params.compareAgainstPeriod);
|
|
@@ -40262,7 +41408,7 @@ var get_profile_default = defineTool({
|
|
|
40262
41408
|
});
|
|
40263
41409
|
|
|
40264
41410
|
//#endregion
|
|
40265
|
-
//#region ../mcp-core/dist/get-profile-details-
|
|
41411
|
+
//#region ../mcp-core/dist/get-profile-details-KNM3CXky.js
|
|
40266
41412
|
function resolveProfileDetailsParams(params) {
|
|
40267
41413
|
if (params.profileUrl) {
|
|
40268
41414
|
if (!isProfileUrl(params.profileUrl)) throw new UserInputError("Invalid profile URL. URL must point to a Sentry profile resource.");
|
|
@@ -40420,7 +41566,7 @@ var get_profile_details_default = defineTool({
|
|
|
40420
41566
|
regionUrl: params.regionUrl
|
|
40421
41567
|
});
|
|
40422
41568
|
const apiService = apiServiceFromContext(context$1, { regionUrl: regionUrl ?? void 0 });
|
|
40423
|
-
(
|
|
41569
|
+
setOrganizationContext(resolved.organizationSlug);
|
|
40424
41570
|
if (resolved.mode === "transaction") {
|
|
40425
41571
|
(0, __sentry_core.setTag)("profile.id", resolved.profileId);
|
|
40426
41572
|
const isNumericProjectInput = typeof resolved.projectSlugOrId === "number" || isNumericId(String(resolved.projectSlugOrId));
|
|
@@ -40490,7 +41636,7 @@ var get_profile_details_default = defineTool({
|
|
|
40490
41636
|
});
|
|
40491
41637
|
|
|
40492
41638
|
//#endregion
|
|
40493
|
-
//#region ../mcp-core/dist/get-
|
|
41639
|
+
//#region ../mcp-core/dist/get-agent-conversation-details-bM0VVNAG.js
|
|
40494
41640
|
function withoutUndefined(value) {
|
|
40495
41641
|
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0));
|
|
40496
41642
|
}
|
|
@@ -40850,8 +41996,8 @@ function buildConversationArtifact(apiService, organizationSlug, conversationId,
|
|
|
40850
41996
|
timeline
|
|
40851
41997
|
});
|
|
40852
41998
|
}
|
|
40853
|
-
var
|
|
40854
|
-
name: "
|
|
41999
|
+
var get_agent_conversation_details_default = defineTool({
|
|
42000
|
+
name: "get_agent_conversation_details",
|
|
40855
42001
|
skills: [
|
|
40856
42002
|
"inspect",
|
|
40857
42003
|
"triage",
|
|
@@ -40859,13 +42005,13 @@ var get_ai_conversation_details_default = defineTool({
|
|
|
40859
42005
|
],
|
|
40860
42006
|
requiredScopes: ["event:read", "project:read"],
|
|
40861
42007
|
description: [
|
|
40862
|
-
"Fetch the chronological transcript and debugging details for one AI conversation.",
|
|
42008
|
+
"Fetch the chronological transcript and debugging details for one agent conversation, formerly called an AI conversation.",
|
|
40863
42009
|
"",
|
|
40864
|
-
"Returns a timeline of user messages, assistant messages, and tool calls, with trace/span IDs for deeper debugging. To discover or list conversations, use
|
|
42010
|
+
"Returns a timeline of user messages, assistant messages, and tool calls, with trace/span IDs for deeper debugging. To discover or list conversations, use search_agent_conversations."
|
|
40865
42011
|
].join("\n"),
|
|
40866
42012
|
inputSchema: {
|
|
40867
42013
|
organizationSlug: ParamOrganizationSlug,
|
|
40868
|
-
conversationId: zod.z.string().trim().describe("The
|
|
42014
|
+
conversationId: zod.z.string().trim().describe("The agent conversation ID from gen_ai.conversation.id."),
|
|
40869
42015
|
project: zod.z.string().trim().optional().describe("Numeric project ID to scope the query. Falls back to context constraint or all projects."),
|
|
40870
42016
|
start: zod.z.string().trim().optional().describe("Explicit start time for the conversation lookup window."),
|
|
40871
42017
|
end: zod.z.string().trim().optional().describe("Explicit end time for the conversation lookup window."),
|
|
@@ -40878,7 +42024,7 @@ var get_ai_conversation_details_default = defineTool({
|
|
|
40878
42024
|
},
|
|
40879
42025
|
outputSchema: aiConversationDetailsOutputSchema,
|
|
40880
42026
|
async handler(params, context$1) {
|
|
40881
|
-
(
|
|
42027
|
+
setOrganizationContext(params.organizationSlug);
|
|
40882
42028
|
(0, __sentry_core.setTag)("ai_conversation.id", params.conversationId);
|
|
40883
42029
|
if (params.start && !params.end || !params.start && params.end) throw new UserInputError("`start` and `end` must be provided together.");
|
|
40884
42030
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
@@ -40906,7 +42052,7 @@ var get_ai_conversation_details_default = defineTool({
|
|
|
40906
42052
|
});
|
|
40907
42053
|
|
|
40908
42054
|
//#endregion
|
|
40909
|
-
//#region ../mcp-core/dist/formatting-
|
|
42055
|
+
//#region ../mcp-core/dist/formatting-B1ckR5H7.js
|
|
40910
42056
|
function getSnapshotImageDisplayName(img) {
|
|
40911
42057
|
return img.display_name || img.image_file_name || "unknown";
|
|
40912
42058
|
}
|
|
@@ -41000,7 +42146,7 @@ function isPlainObject$2(value) {
|
|
|
41000
42146
|
}
|
|
41001
42147
|
|
|
41002
42148
|
//#endregion
|
|
41003
|
-
//#region ../mcp-core/dist/handlers-
|
|
42149
|
+
//#region ../mcp-core/dist/handlers-DhPeWak0.js
|
|
41004
42150
|
function fullResolutionHint({ organizationSlug, snapshotId, imageIdentifier, experimentalMode, availableToolNames, directToolNames }) {
|
|
41005
42151
|
return `- **Full Resolution**: ${formatToolCallInstruction({
|
|
41006
42152
|
toolName: "get_snapshot_image",
|
|
@@ -41055,7 +42201,7 @@ function formatImageMetadata(img) {
|
|
|
41055
42201
|
}
|
|
41056
42202
|
async function createPreviewOrNull(blob, contentType) {
|
|
41057
42203
|
try {
|
|
41058
|
-
return await
|
|
42204
|
+
return await require_blob_utils_DgVug_Di.createImagePreview(blob, contentType);
|
|
41059
42205
|
} catch {
|
|
41060
42206
|
return null;
|
|
41061
42207
|
}
|
|
@@ -41076,7 +42222,7 @@ async function fetchAndAppendImage(apiService, imageUrl, label, imageResolution,
|
|
|
41076
42222
|
});
|
|
41077
42223
|
parts.push({
|
|
41078
42224
|
type: "image",
|
|
41079
|
-
data: await
|
|
42225
|
+
data: await require_blob_utils_DgVug_Di.blobToBase64(blob),
|
|
41080
42226
|
mimeType: contentType
|
|
41081
42227
|
});
|
|
41082
42228
|
return;
|
|
@@ -41095,7 +42241,7 @@ async function fetchAndAppendImage(apiService, imageUrl, label, imageResolution,
|
|
|
41095
42241
|
});
|
|
41096
42242
|
parts.push({
|
|
41097
42243
|
type: "image",
|
|
41098
|
-
data: await
|
|
42244
|
+
data: await require_blob_utils_DgVug_Di.blobToBase64(preview.blob),
|
|
41099
42245
|
mimeType: preview.contentType
|
|
41100
42246
|
});
|
|
41101
42247
|
}
|
|
@@ -41266,7 +42412,7 @@ async function fetchSnapshotSummary(apiService, organizationSlug, snapshotId, so
|
|
|
41266
42412
|
}
|
|
41267
42413
|
|
|
41268
42414
|
//#endregion
|
|
41269
|
-
//#region ../mcp-core/dist/get-snapshot-
|
|
42415
|
+
//#region ../mcp-core/dist/get-snapshot-P1FuvUwa.js
|
|
41270
42416
|
var get_snapshot_default = defineTool({
|
|
41271
42417
|
name: "get_snapshot",
|
|
41272
42418
|
skills: ["inspect"],
|
|
@@ -41331,7 +42477,7 @@ var get_snapshot_default = defineTool({
|
|
|
41331
42477
|
},
|
|
41332
42478
|
async handler(params, context$1) {
|
|
41333
42479
|
if (!params.organizationSlug || !params.snapshotId) throw new UserInputError("Provide both organizationSlug and snapshotId. Use get_sentry_resource for snapshot URLs.");
|
|
41334
|
-
(
|
|
42480
|
+
setOrganizationContext(params.organizationSlug);
|
|
41335
42481
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
41336
42482
|
return fetchSnapshotSummary(apiService, params.organizationSlug, params.snapshotId, null, {
|
|
41337
42483
|
showUnmodified: params.showUnmodified,
|
|
@@ -41344,7 +42490,7 @@ var get_snapshot_default = defineTool({
|
|
|
41344
42490
|
});
|
|
41345
42491
|
|
|
41346
42492
|
//#endregion
|
|
41347
|
-
//#region ../mcp-core/dist/get-snapshot-image-
|
|
42493
|
+
//#region ../mcp-core/dist/get-snapshot-image-DjtwEpMj.js
|
|
41348
42494
|
var get_snapshot_image_default = defineTool({
|
|
41349
42495
|
name: "get_snapshot_image",
|
|
41350
42496
|
skills: ["inspect"],
|
|
@@ -41394,7 +42540,7 @@ var get_snapshot_image_default = defineTool({
|
|
|
41394
42540
|
},
|
|
41395
42541
|
async handler(params, context$1) {
|
|
41396
42542
|
if (!params.organizationSlug || !params.snapshotId) throw new UserInputError("Provide both organizationSlug and snapshotId. Use get_sentry_resource for snapshot URLs.");
|
|
41397
|
-
(
|
|
42543
|
+
setOrganizationContext(params.organizationSlug);
|
|
41398
42544
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
41399
42545
|
return fetchSnapshotImage(apiService, params.organizationSlug, params.snapshotId, params.imageIdentifier, params.imageResolution, {
|
|
41400
42546
|
experimentalMode: context$1.experimentalMode ?? false,
|
|
@@ -41405,7 +42551,7 @@ var get_snapshot_image_default = defineTool({
|
|
|
41405
42551
|
});
|
|
41406
42552
|
|
|
41407
42553
|
//#endregion
|
|
41408
|
-
//#region ../mcp-core/dist/get-sentry-resource-
|
|
42554
|
+
//#region ../mcp-core/dist/get-sentry-resource-BXVp2SKN.js
|
|
41409
42555
|
/** Types with full API integration. */
|
|
41410
42556
|
const FULLY_SUPPORTED_TYPES = [
|
|
41411
42557
|
"issue",
|
|
@@ -41480,7 +42626,7 @@ function resolveFromParsedUrl(parsed, params) {
|
|
|
41480
42626
|
});
|
|
41481
42627
|
if (detectedType === "unknown") {
|
|
41482
42628
|
if (parsed.transaction) throw new UserInputError(`Detected a performance summary URL for transaction "${parsed.transaction}". Use \`search_events\` to find traces and performance data for this transaction.`);
|
|
41483
|
-
throw new UserInputError("Could not determine resource type from URL. Supported URL patterns: issues, events, traces,
|
|
42629
|
+
throw new UserInputError("Could not determine resource type from URL. Supported URL patterns: issues, events, traces, agent conversations, profiles, replays, monitors, and releases.");
|
|
41484
42630
|
}
|
|
41485
42631
|
if (params.resourceType && params.resourceType !== detectedType) {
|
|
41486
42632
|
if (params.resourceType === "trace" && detectedType === "span") {
|
|
@@ -41525,7 +42671,7 @@ function resolveFromParsedUrl(parsed, params) {
|
|
|
41525
42671
|
spanId: parsed.spanId
|
|
41526
42672
|
};
|
|
41527
42673
|
case "ai_conversation":
|
|
41528
|
-
if (!parsed.conversationId) throw new UserInputError("Could not extract
|
|
42674
|
+
if (!parsed.conversationId) throw new UserInputError("Could not extract agent conversation ID from URL.");
|
|
41529
42675
|
return {
|
|
41530
42676
|
type: "ai_conversation",
|
|
41531
42677
|
organizationSlug,
|
|
@@ -41645,7 +42791,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41645
42791
|
fallbackInstruction: "Full-resolution snapshot image bytes are not available in this session",
|
|
41646
42792
|
purpose: "for full-resolution image bytes"
|
|
41647
42793
|
});
|
|
41648
|
-
const supportedResources = monitorResourcesAvailable ? "issues, events, traces, spans,
|
|
42794
|
+
const supportedResources = monitorResourcesAvailable ? "issues, events, traces, spans, agent conversations, replays, monitors, preprod snapshots, and snapshot images." : "issues, events, traces, spans, agent conversations, replays, preprod snapshots, and snapshot images.";
|
|
41649
42795
|
const resourceIds = [...monitorResourcesAvailable ? ["- monitor: <monitorSlug>"] : [], "- snapshot: <snapshotId>"];
|
|
41650
42796
|
return [
|
|
41651
42797
|
"Fetch a Sentry resource by URL, or by resourceType plus resourceId.",
|
|
@@ -41654,7 +42800,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41654
42800
|
`Supports ${supportedResources}`,
|
|
41655
42801
|
"Trace lookups return a condensed overview by default.",
|
|
41656
42802
|
"",
|
|
41657
|
-
"
|
|
42803
|
+
"Agent Conversations: A conversation is a set of spans sharing the same gen_ai.conversation.id. Use resourceType='ai_conversation' with a conversation ID, or pass a Sentry conversation URL, to fetch the transcript/details. To discover or list conversations, use search_agent_conversations. Conversations are NOT issues — do not use search_issues for conversation queries.",
|
|
41658
42804
|
"",
|
|
41659
42805
|
"For preprod snapshot URLs (matching 'sentry.io/preprod/snapshots/'):",
|
|
41660
42806
|
"- Without ?selectedSnapshot=: returns the snapshot diff summary (changed, added, removed images)",
|
|
@@ -41683,7 +42829,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41683
42829
|
"monitor",
|
|
41684
42830
|
"snapshot"
|
|
41685
42831
|
]).optional().describe("Resource type. With a URL, can override a span-focused trace URL with `trace`. Use `monitor` with a monitor slug only when inspect monitor tools are available or `snapshot` with a snapshot artifact ID."),
|
|
41686
|
-
resourceId: zod.z.string().trim().optional().describe("Resource identifier: issue shortId (e.g., 'PROJECT-123'), event ID, trace ID,
|
|
42832
|
+
resourceId: zod.z.string().trim().optional().describe("Resource identifier: issue shortId (e.g., 'PROJECT-123'), event ID, trace ID, agent conversation ID, replay ID, monitor slug when inspect monitor tools are available, or snapshot artifact ID. Required when not using a URL."),
|
|
41687
42833
|
organizationSlug: ParamOrganizationSlug.optional()
|
|
41688
42834
|
},
|
|
41689
42835
|
annotations: {
|
|
@@ -41700,7 +42846,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41700
42846
|
projectSlug: context$1.constraints.projectSlug
|
|
41701
42847
|
});
|
|
41702
42848
|
(0, __sentry_core.setTag)("resource.type", resolved.type);
|
|
41703
|
-
(
|
|
42849
|
+
setOrganizationContext(resolved.organizationSlug);
|
|
41704
42850
|
if (resolved.spanId) (0, __sentry_core.setTag)("trace.span_id", resolved.spanId);
|
|
41705
42851
|
(0, __sentry_core.getActiveSpan)()?.setAttribute("app.resource.type", resolved.type);
|
|
41706
42852
|
if (resolved.type === "release") {
|
|
@@ -41730,7 +42876,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41730
42876
|
spanId: resolved.spanId,
|
|
41731
42877
|
regionUrl: context$1.constraints.regionUrl ?? null
|
|
41732
42878
|
}, context$1);
|
|
41733
|
-
case "ai_conversation": return
|
|
42879
|
+
case "ai_conversation": return get_agent_conversation_details_default.handler({
|
|
41734
42880
|
organizationSlug: resolved.organizationSlug,
|
|
41735
42881
|
conversationId: resolved.conversationId,
|
|
41736
42882
|
project: resolved.projectSlugOrId,
|
|
@@ -41793,7 +42939,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41793
42939
|
});
|
|
41794
42940
|
|
|
41795
42941
|
//#endregion
|
|
41796
|
-
//#region ../mcp-core/dist/get-latest-base-snapshot-
|
|
42942
|
+
//#region ../mcp-core/dist/get-latest-base-snapshot-CEkWKEZJ.js
|
|
41797
42943
|
var get_latest_base_snapshot_default = defineTool({
|
|
41798
42944
|
name: "get_latest_base_snapshot",
|
|
41799
42945
|
skills: ["inspect"],
|
|
@@ -41846,7 +42992,7 @@ var get_latest_base_snapshot_default = defineTool({
|
|
|
41846
42992
|
openWorldHint: true
|
|
41847
42993
|
},
|
|
41848
42994
|
async handler(params, context$1) {
|
|
41849
|
-
(
|
|
42995
|
+
setOrganizationContext(params.organizationSlug);
|
|
41850
42996
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
41851
42997
|
const project = params.project ?? void 0;
|
|
41852
42998
|
const projectId = project && isNumericId(project) ? project : void 0;
|
|
@@ -41889,9 +43035,15 @@ var get_latest_base_snapshot_default = defineTool({
|
|
|
41889
43035
|
});
|
|
41890
43036
|
|
|
41891
43037
|
//#endregion
|
|
41892
|
-
//#region ../mcp-core/dist/search-
|
|
43038
|
+
//#region ../mcp-core/dist/search-agent-conversations-BGO_38e-.js
|
|
41893
43039
|
const PREVIEW_LENGTH = 240;
|
|
41894
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
|
+
});
|
|
41895
43047
|
const aiConversationSearchResultSchema = zod.z.object({
|
|
41896
43048
|
conversationId: zod.z.string(),
|
|
41897
43049
|
title: zod.z.string().nullable(),
|
|
@@ -41904,7 +43056,7 @@ const aiConversationSearchResultSchema = zod.z.object({
|
|
|
41904
43056
|
toolCallCount: zod.z.number(),
|
|
41905
43057
|
toolErrorCount: zod.z.number(),
|
|
41906
43058
|
totalTokens: zod.z.number(),
|
|
41907
|
-
totalCost: zod.z.
|
|
43059
|
+
totalCost: zod.z.string(),
|
|
41908
43060
|
traceCount: zod.z.number(),
|
|
41909
43061
|
sampleTraceIds: zod.z.array(zod.z.string()),
|
|
41910
43062
|
firstInputPreview: zod.z.string().nullable(),
|
|
@@ -41950,6 +43102,11 @@ function previewText(value) {
|
|
|
41950
43102
|
if (value == null || value.length <= PREVIEW_LENGTH) return value;
|
|
41951
43103
|
return `${value.slice(0, PREVIEW_LENGTH - 3)}...`;
|
|
41952
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
|
+
}
|
|
41953
43110
|
function projectUser(user) {
|
|
41954
43111
|
if (!user) return null;
|
|
41955
43112
|
return {
|
|
@@ -41976,7 +43133,7 @@ function buildArtifact(apiService, organizationSlug, conversations, nextCursor,
|
|
|
41976
43133
|
aiCallCount: llmCalls,
|
|
41977
43134
|
toolCallCount: toolCalls,
|
|
41978
43135
|
totalTokens,
|
|
41979
|
-
totalCost,
|
|
43136
|
+
totalCost: formatLLMCost(totalCost),
|
|
41980
43137
|
startTimestamp,
|
|
41981
43138
|
endTimestamp,
|
|
41982
43139
|
traceCount,
|
|
@@ -41992,8 +43149,8 @@ function buildArtifact(apiService, organizationSlug, conversations, nextCursor,
|
|
|
41992
43149
|
})
|
|
41993
43150
|
};
|
|
41994
43151
|
}
|
|
41995
|
-
var
|
|
41996
|
-
name: "
|
|
43152
|
+
var search_agent_conversations_default = defineTool({
|
|
43153
|
+
name: "search_agent_conversations",
|
|
41997
43154
|
skills: [
|
|
41998
43155
|
"inspect",
|
|
41999
43156
|
"triage",
|
|
@@ -42001,15 +43158,15 @@ var search_ai_conversations_default = defineTool({
|
|
|
42001
43158
|
],
|
|
42002
43159
|
requiredScopes: ["event:read", "project:read"],
|
|
42003
43160
|
description: [
|
|
42004
|
-
"Search Sentry AI Conversations and return one summary row per conversation.",
|
|
43161
|
+
"Search Sentry Agent Conversations, formerly called AI Conversations, and return one summary row per conversation.",
|
|
42005
43162
|
"",
|
|
42006
|
-
"Use this tool to find or list
|
|
42007
|
-
"Each row includes title (when available), cost, tokens, call counts, previews, and other list metadata.",
|
|
42008
|
-
"Use
|
|
43163
|
+
"Use this tool to find or list Agent Conversations. Results are conversation summaries, not raw span rows.",
|
|
43164
|
+
"Each row includes title (when available), USD cost, tokens, call counts, previews, and other list metadata.",
|
|
43165
|
+
"Use get_agent_conversation_details with a conversationId to fetch the transcript. Use get_sentry_resource for Sentry conversation URLs.",
|
|
42009
43166
|
"",
|
|
42010
43167
|
"<examples>",
|
|
42011
|
-
"
|
|
42012
|
-
"
|
|
43168
|
+
"search_agent_conversations(organizationSlug='my-org', query='failed conversations', period='7d')",
|
|
43169
|
+
"search_agent_conversations(organizationSlug='my-org', query='checkout', project='backend')",
|
|
42013
43170
|
"</examples>"
|
|
42014
43171
|
].join("\n"),
|
|
42015
43172
|
inputSchema: {
|
|
@@ -42035,7 +43192,7 @@ var search_ai_conversations_default = defineTool({
|
|
|
42035
43192
|
const requestedPeriod = params.period ?? "30d";
|
|
42036
43193
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
42037
43194
|
const organizationSlug = params.organizationSlug;
|
|
42038
|
-
(
|
|
43195
|
+
setOrganizationContext(organizationSlug);
|
|
42039
43196
|
const projectIds = await resolveProjectIds({
|
|
42040
43197
|
apiService,
|
|
42041
43198
|
organizationSlug,
|
|
@@ -42068,7 +43225,7 @@ var search_ai_conversations_default = defineTool({
|
|
|
42068
43225
|
});
|
|
42069
43226
|
|
|
42070
43227
|
//#endregion
|
|
42071
|
-
//#region ../mcp-core/dist/add-issue-note-
|
|
43228
|
+
//#region ../mcp-core/dist/add-issue-note-YI_XzMvf.js
|
|
42072
43229
|
function formatComment(comment) {
|
|
42073
43230
|
const actor = comment.user ? formatActor(comment.user) : "current user";
|
|
42074
43231
|
const text$1 = comment.data ? readString(comment.data, "text") : null;
|
|
@@ -42118,7 +43275,7 @@ var add_issue_note_default = defineTool({
|
|
|
42118
43275
|
organizationSlug: params.organizationSlug ?? context$1.constraints.organizationSlug
|
|
42119
43276
|
});
|
|
42120
43277
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
42121
|
-
(
|
|
43278
|
+
setOrganizationContext(parsed.organizationSlug);
|
|
42122
43279
|
(0, __sentry_core.setTag)("issue.id", parsed.issueId);
|
|
42123
43280
|
await ensureIssueWithinProjectConstraint({
|
|
42124
43281
|
apiService,
|
|
@@ -42144,7 +43301,26 @@ var add_issue_note_default = defineTool({
|
|
|
42144
43301
|
});
|
|
42145
43302
|
|
|
42146
43303
|
//#endregion
|
|
42147
|
-
//#region ../mcp-core/dist/onboarding-status-update-
|
|
43304
|
+
//#region ../mcp-core/dist/onboarding-status-update-BJR7w05r.js
|
|
43305
|
+
const updateBaseSchema = zod.z.object({
|
|
43306
|
+
status: AgenticOnboardingStageStatusUpdateSchema.describe("The stage's current status."),
|
|
43307
|
+
runStatus: AgenticOnboardingRunStatusUpdateSchema.optional().describe("Set only when the entire onboarding run has completed or failed."),
|
|
43308
|
+
eventNote: zod.z.string().trim().min(1).max(256).optional().describe("Short context to display with this progress event. Required when status is failed.")
|
|
43309
|
+
}).strict();
|
|
43310
|
+
const createProjectUpdateSchema = updateBaseSchema.extend({
|
|
43311
|
+
stage: zod.z.literal("create_project").describe("Report progress while creating or selecting Sentry projects."),
|
|
43312
|
+
extra: zod.z.object({ projectSlugs: zod.z.array(zod.z.string().trim().min(1)).min(1).max(100).describe("Sentry project slugs created or selected during onboarding. Values accumulate across updates; include each project as it becomes usable while active, then all known projects when completed.") }).strict().optional().describe("Project metadata accepted only by the create_project stage.")
|
|
43313
|
+
});
|
|
43314
|
+
const receiveVerificationErrorUpdateSchema = updateBaseSchema.extend({
|
|
43315
|
+
stage: zod.z.literal("receive_verification_error").describe("Report progress while receiving the verification error in Sentry."),
|
|
43316
|
+
extra: zod.z.object({ issueIds: zod.z.array(zod.z.string().trim().min(1)).min(1).max(100).describe("Sentry issue IDs observed after sending the verification error. Values accumulate across updates; include each matching issue as it is confirmed, then all known issues when completed.") }).strict().optional().describe("Issue metadata accepted only by the receive_verification_error stage.")
|
|
43317
|
+
});
|
|
43318
|
+
const updateWithoutExtraSchema = updateBaseSchema.extend({ stage: AgenticOnboardingStageSchema.exclude(["create_project", "receive_verification_error"]).describe("Report progress for a stage that does not accept extra metadata.") });
|
|
43319
|
+
const onboardingUpdateSchema = zod.z.discriminatedUnion("stage", [
|
|
43320
|
+
createProjectUpdateSchema,
|
|
43321
|
+
receiveVerificationErrorUpdateSchema,
|
|
43322
|
+
updateWithoutExtraSchema
|
|
43323
|
+
]).describe("The stage-specific onboarding progress update.");
|
|
42148
43324
|
var onboarding_status_update_default = defineTool({
|
|
42149
43325
|
name: "onboarding_status_update",
|
|
42150
43326
|
skills: require_resolve.ALL_SKILLS,
|
|
@@ -42167,13 +43343,8 @@ var onboarding_status_update_default = defineTool({
|
|
|
42167
43343
|
inputSchema: {
|
|
42168
43344
|
organizationSlug: ParamOrganizationSlug,
|
|
42169
43345
|
regionUrl: ParamRegionUrl.nullable().default(null),
|
|
42170
|
-
runToken:
|
|
42171
|
-
|
|
42172
|
-
status: AgenticOnboardingStageStatusUpdateSchema.describe("The stage's current status."),
|
|
42173
|
-
runStatus: AgenticOnboardingRunStatusUpdateSchema.optional().describe("Set only when the entire onboarding run has completed or failed."),
|
|
42174
|
-
eventNote: zod.z.string().trim().min(1).max(256).optional().describe("Short context to display with this progress event. Required when status is failed."),
|
|
42175
|
-
projectSlugs: AgenticOnboardingStatusUpdateSchema.shape.projectSlugs.describe("Validated Sentry project slugs. Send only for create_project. Values accumulate across updates; include each project as it becomes usable while active, then all known projects when completed."),
|
|
42176
|
-
issueIds: AgenticOnboardingStatusUpdateSchema.shape.issueIds.describe("Validated Sentry issue IDs returned by MCP. Send only for receive_verification_error. Values accumulate across updates; include each matching issue as it is confirmed, then all known issues when completed.")
|
|
43346
|
+
runToken: AgenticOnboardingRunTokenSchema.describe("The 10-character onboarding run token supplied by Sentry."),
|
|
43347
|
+
update: onboardingUpdateSchema
|
|
42177
43348
|
},
|
|
42178
43349
|
annotations: {
|
|
42179
43350
|
readOnlyHint: false,
|
|
@@ -42183,26 +43354,42 @@ var onboarding_status_update_default = defineTool({
|
|
|
42183
43354
|
},
|
|
42184
43355
|
async handler(params, context$1) {
|
|
42185
43356
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
42186
|
-
(
|
|
43357
|
+
setOrganizationContext(params.organizationSlug);
|
|
43358
|
+
const update = AgenticOnboardingStatusUpdateSchema.parse({
|
|
43359
|
+
schemaVersion: 1,
|
|
43360
|
+
runToken: params.runToken,
|
|
43361
|
+
...params.update
|
|
43362
|
+
});
|
|
42187
43363
|
const run = await apiService.updateAgenticOnboardingStatus({
|
|
42188
43364
|
organizationSlug: params.organizationSlug,
|
|
42189
|
-
update
|
|
42190
|
-
schemaVersion: 1,
|
|
42191
|
-
runToken: params.runToken,
|
|
42192
|
-
stage: params.stage,
|
|
42193
|
-
status: params.status,
|
|
42194
|
-
...params.runStatus ? { runStatus: params.runStatus } : {},
|
|
42195
|
-
...params.eventNote ? { eventNote: params.eventNote } : {},
|
|
42196
|
-
...params.projectSlugs ? { projectSlugs: params.projectSlugs } : {},
|
|
42197
|
-
...params.issueIds ? { issueIds: params.issueIds } : {}
|
|
42198
|
-
}
|
|
43365
|
+
update
|
|
42199
43366
|
});
|
|
42200
43367
|
return `Onboarding status updated. Continue updates: ${run.continueUpdates ? "yes" : "no"}.`;
|
|
42201
43368
|
}
|
|
42202
43369
|
});
|
|
42203
43370
|
|
|
42204
43371
|
//#endregion
|
|
42205
|
-
//#region ../mcp-core/dist/catalog-
|
|
43372
|
+
//#region ../mcp-core/dist/catalog-CZAR_B3F.js
|
|
43373
|
+
const legacyGetAIConversationDetails = {
|
|
43374
|
+
...get_agent_conversation_details_default,
|
|
43375
|
+
name: "get_ai_conversation_details",
|
|
43376
|
+
includeInSkillDefinitions: false,
|
|
43377
|
+
description: [
|
|
43378
|
+
"Deprecated alias for get_agent_conversation_details.",
|
|
43379
|
+
"",
|
|
43380
|
+
"Use get_agent_conversation_details for new integrations. This alias is kept for backward compatibility."
|
|
43381
|
+
].join("\n")
|
|
43382
|
+
};
|
|
43383
|
+
const legacySearchAIConversations = {
|
|
43384
|
+
...search_agent_conversations_default,
|
|
43385
|
+
name: "search_ai_conversations",
|
|
43386
|
+
includeInSkillDefinitions: false,
|
|
43387
|
+
description: [
|
|
43388
|
+
"Deprecated alias for search_agent_conversations.",
|
|
43389
|
+
"",
|
|
43390
|
+
"Use search_agent_conversations for new integrations. This alias is kept for backward compatibility."
|
|
43391
|
+
].join("\n")
|
|
43392
|
+
};
|
|
42206
43393
|
/**
|
|
42207
43394
|
* Catalog of ordinary Sentry MCP operations.
|
|
42208
43395
|
*
|
|
@@ -42230,6 +43417,7 @@ const catalogTools = {
|
|
|
42230
43417
|
delete_uptime_monitor: delete_uptime_monitor_default,
|
|
42231
43418
|
find_alert_rules: find_alert_rules_default,
|
|
42232
43419
|
get_alert_rule: get_alert_rule_default,
|
|
43420
|
+
get_alert_options: get_alert_options_default,
|
|
42233
43421
|
get_issue_details: get_issue_details_default,
|
|
42234
43422
|
get_event_stacktrace: get_event_stacktrace_default,
|
|
42235
43423
|
get_issue_activity: get_issue_activity_default,
|
|
@@ -42257,19 +43445,22 @@ const catalogTools = {
|
|
|
42257
43445
|
search_issue_events: search_issue_events_default,
|
|
42258
43446
|
get_profile: get_profile_default,
|
|
42259
43447
|
get_profile_details: get_profile_details_default,
|
|
43448
|
+
get_sentry_mcp_info: get_sentry_mcp_info_default,
|
|
42260
43449
|
get_sentry_resource: get_sentry_resource_default,
|
|
42261
43450
|
get_snapshot: get_snapshot_default,
|
|
42262
43451
|
get_snapshot_image: get_snapshot_image_default,
|
|
42263
43452
|
get_latest_base_snapshot: get_latest_base_snapshot_default,
|
|
42264
|
-
|
|
42265
|
-
|
|
43453
|
+
get_agent_conversation_details: get_agent_conversation_details_default,
|
|
43454
|
+
get_ai_conversation_details: legacyGetAIConversationDetails,
|
|
43455
|
+
search_agent_conversations: search_agent_conversations_default,
|
|
43456
|
+
search_ai_conversations: legacySearchAIConversations,
|
|
42266
43457
|
add_issue_note: add_issue_note_default,
|
|
42267
43458
|
onboarding_status_update: onboarding_status_update_default
|
|
42268
43459
|
};
|
|
42269
43460
|
var catalog_default = catalogTools;
|
|
42270
43461
|
|
|
42271
43462
|
//#endregion
|
|
42272
|
-
//#region ../mcp-core/dist/schema-
|
|
43463
|
+
//#region ../mcp-core/dist/schema-Bf6vaXky.js
|
|
42273
43464
|
function zodFieldMapToJsonSchema(fieldMap) {
|
|
42274
43465
|
const zodObject = Object.keys(fieldMap).length > 0 ? zod.z.object(fieldMap) : zod.z.object({});
|
|
42275
43466
|
const { $schema: _,...jsonSchema$1 } = zod.z.toJSONSchema(zodObject, {
|
|
@@ -42281,7 +43472,7 @@ function zodFieldMapToJsonSchema(fieldMap) {
|
|
|
42281
43472
|
}
|
|
42282
43473
|
|
|
42283
43474
|
//#endregion
|
|
42284
|
-
//#region ../mcp-core/dist/search
|
|
43475
|
+
//#region ../mcp-core/dist/search--TO414uy.js
|
|
42285
43476
|
function tokenize(value) {
|
|
42286
43477
|
return value.toLowerCase().split(/[^a-z0-9_]+/).map((token) => token.trim()).filter(Boolean);
|
|
42287
43478
|
}
|
|
@@ -42332,7 +43523,7 @@ function searchToolCatalog({ tools, context: context$1, query, limit }) {
|
|
|
42332
43523
|
}
|
|
42333
43524
|
|
|
42334
43525
|
//#endregion
|
|
42335
|
-
//#region ../mcp-core/dist/search-tools-
|
|
43526
|
+
//#region ../mcp-core/dist/search-tools-DD_Fpn20.js
|
|
42336
43527
|
const DEFAULT_LIMIT = 8;
|
|
42337
43528
|
const MAX_LIMIT = 20;
|
|
42338
43529
|
const toolAnnotationsOutputSchema = zod.z.object({
|
|
@@ -42414,7 +43605,7 @@ function createSearchToolsTool(getTools) {
|
|
|
42414
43605
|
}
|
|
42415
43606
|
|
|
42416
43607
|
//#endregion
|
|
42417
|
-
//#region ../mcp-core/dist/execute-tool-
|
|
43608
|
+
//#region ../mcp-core/dist/execute-tool-Z6g9XYm0.js
|
|
42418
43609
|
function setToolArgumentAttributes(span, params) {
|
|
42419
43610
|
for (const [key, value] of Object.entries(params)) {
|
|
42420
43611
|
const attributeValue = value == null || typeof value === "object" ? JSON.stringify(value) : value;
|
|
@@ -42443,6 +43634,7 @@ async function executeCatalogToolWithSpan({ tool: tool$1, params, context: conte
|
|
|
42443
43634
|
} catch (error) {
|
|
42444
43635
|
span.setStatus({ code: 2 });
|
|
42445
43636
|
if (!isExpectedToolError(error)) span.recordException(error);
|
|
43637
|
+
recordToolFailure(tool$1, error, params, context$1);
|
|
42446
43638
|
throw error;
|
|
42447
43639
|
}
|
|
42448
43640
|
});
|
|
@@ -42498,7 +43690,7 @@ function createExecuteTool(getTools) {
|
|
|
42498
43690
|
}
|
|
42499
43691
|
|
|
42500
43692
|
//#endregion
|
|
42501
|
-
//#region ../mcp-core/dist/tools-
|
|
43693
|
+
//#region ../mcp-core/dist/tools-EVTUbO4b.js
|
|
42502
43694
|
function getAllTools() {
|
|
42503
43695
|
return allTools;
|
|
42504
43696
|
}
|
|
@@ -59128,7 +60320,7 @@ function buildServer({ context: context$1, experimentalMode = false, tools: cust
|
|
|
59128
60320
|
tools: customTools
|
|
59129
60321
|
});
|
|
59130
60322
|
for (const { name: name$4, config, handler } of registrations$1) server$1.registerTool(name$4, config, handler);
|
|
59131
|
-
return (0,
|
|
60323
|
+
return (0, __sentry_core_server.wrapMcpServerWithSentry)(server$1);
|
|
59132
60324
|
}
|
|
59133
60325
|
const server = new __modelcontextprotocol_sdk_server_mcp_js.McpServer(serverInfo);
|
|
59134
60326
|
const registrations = configureServer({
|
|
@@ -59138,7 +60330,7 @@ function buildServer({ context: context$1, experimentalMode = false, tools: cust
|
|
|
59138
60330
|
tools: customTools
|
|
59139
60331
|
});
|
|
59140
60332
|
for (const { name: name$4, config, handler } of registrations) server.registerTool(name$4, config, handler);
|
|
59141
|
-
return (0,
|
|
60333
|
+
return (0, __sentry_core_server.wrapMcpServerWithSentry)(server);
|
|
59142
60334
|
}
|
|
59143
60335
|
/**
|
|
59144
60336
|
* Configures an MCP server with tools filtered by granted skills.
|
|
@@ -59205,8 +60397,8 @@ function configureServer({ server, context: context$1, experimentalMode = false,
|
|
|
59205
60397
|
if (context$1.clientFamily) (0, __sentry_core.setTag)("app.client.family", context$1.clientFamily);
|
|
59206
60398
|
if (context$1.transport) (0, __sentry_core.setTag)("app.transport", context$1.transport);
|
|
59207
60399
|
(0, __sentry_core.setTag)("app.server.mode.experimental", experimentalMode);
|
|
60400
|
+
const rawParams = params && typeof params === "object" && !Array.isArray(params) ? params : {};
|
|
59208
60401
|
try {
|
|
59209
|
-
const rawParams = params && typeof params === "object" && !Array.isArray(params) ? params : {};
|
|
59210
60402
|
const paramsWithConstraints = injectConstraintParams(rawParams, tool$1, contextWithToolAvailability);
|
|
59211
60403
|
if (activeSpan) for (const [key, value] of Object.entries(paramsWithConstraints)) {
|
|
59212
60404
|
const attributeValue = value == null || typeof value === "object" ? JSON.stringify(value) : value;
|
|
@@ -59234,6 +60426,7 @@ function configureServer({ server, context: context$1, experimentalMode = false,
|
|
|
59234
60426
|
if (isApiAuthenticationErrorDeep(error) && context$1.onUpstreamUnauthorized) try {
|
|
59235
60427
|
await context$1.onUpstreamUnauthorized();
|
|
59236
60428
|
} catch {}
|
|
60429
|
+
recordToolFailure(tool$1, error, rawParams, contextWithToolAvailability);
|
|
59237
60430
|
return {
|
|
59238
60431
|
content: [{
|
|
59239
60432
|
type: "text",
|
|
@@ -59252,111 +60445,6 @@ function configureServer({ server, context: context$1, experimentalMode = false,
|
|
|
59252
60445
|
return registrations;
|
|
59253
60446
|
}
|
|
59254
60447
|
|
|
59255
|
-
//#endregion
|
|
59256
|
-
//#region ../mcp-core/dist/sentry-D99fvngC.js
|
|
59257
|
-
const SCRUB_PATTERNS = [
|
|
59258
|
-
{
|
|
59259
|
-
pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
|
|
59260
|
-
replacement: "[REDACTED_OPENAI_KEY]",
|
|
59261
|
-
description: "OpenAI API key"
|
|
59262
|
-
},
|
|
59263
|
-
{
|
|
59264
|
-
pattern: /\bBearer\s+[a-zA-Z0-9\-._~+/]+={0,}/g,
|
|
59265
|
-
replacement: "Bearer [REDACTED_TOKEN]",
|
|
59266
|
-
description: "Bearer token"
|
|
59267
|
-
},
|
|
59268
|
-
{
|
|
59269
|
-
pattern: /\bsntrys_[a-zA-Z0-9_]+\b/g,
|
|
59270
|
-
replacement: "[REDACTED_SENTRY_TOKEN]",
|
|
59271
|
-
description: "Sentry access token"
|
|
59272
|
-
}
|
|
59273
|
-
];
|
|
59274
|
-
const MAX_SCRUB_DEPTH = 20;
|
|
59275
|
-
/**
|
|
59276
|
-
* Recursively scrub sensitive data from any value.
|
|
59277
|
-
* Returns tuple of [scrubbedValue, didScrub, descriptionsOfMatchedPatterns]
|
|
59278
|
-
*/
|
|
59279
|
-
function scrubValue(value, depth = 0) {
|
|
59280
|
-
if (depth >= MAX_SCRUB_DEPTH) return [
|
|
59281
|
-
"[MAX_DEPTH_EXCEEDED]",
|
|
59282
|
-
false,
|
|
59283
|
-
[]
|
|
59284
|
-
];
|
|
59285
|
-
if (typeof value === "string") {
|
|
59286
|
-
let scrubbed = value;
|
|
59287
|
-
let didScrub = false;
|
|
59288
|
-
const matchedDescriptions = [];
|
|
59289
|
-
for (const { pattern, replacement, description: description$73 } of SCRUB_PATTERNS) {
|
|
59290
|
-
pattern.lastIndex = 0;
|
|
59291
|
-
if (pattern.test(scrubbed)) {
|
|
59292
|
-
didScrub = true;
|
|
59293
|
-
matchedDescriptions.push(description$73);
|
|
59294
|
-
pattern.lastIndex = 0;
|
|
59295
|
-
scrubbed = scrubbed.replace(pattern, replacement);
|
|
59296
|
-
}
|
|
59297
|
-
}
|
|
59298
|
-
return [
|
|
59299
|
-
scrubbed,
|
|
59300
|
-
didScrub,
|
|
59301
|
-
matchedDescriptions
|
|
59302
|
-
];
|
|
59303
|
-
}
|
|
59304
|
-
if (Array.isArray(value)) {
|
|
59305
|
-
let arrayDidScrub = false;
|
|
59306
|
-
const arrayDescriptions = [];
|
|
59307
|
-
const scrubbedArray = value.map((item) => {
|
|
59308
|
-
const [scrubbed, didScrub, descriptions] = scrubValue(item, depth + 1);
|
|
59309
|
-
if (didScrub) {
|
|
59310
|
-
arrayDidScrub = true;
|
|
59311
|
-
arrayDescriptions.push(...descriptions);
|
|
59312
|
-
}
|
|
59313
|
-
return scrubbed;
|
|
59314
|
-
});
|
|
59315
|
-
return [
|
|
59316
|
-
scrubbedArray,
|
|
59317
|
-
arrayDidScrub,
|
|
59318
|
-
arrayDescriptions
|
|
59319
|
-
];
|
|
59320
|
-
}
|
|
59321
|
-
if (value && typeof value === "object") {
|
|
59322
|
-
let objectDidScrub = false;
|
|
59323
|
-
const objectDescriptions = [];
|
|
59324
|
-
const scrubbed = {};
|
|
59325
|
-
for (const [key, val] of Object.entries(value)) {
|
|
59326
|
-
const [scrubbedVal, didScrub, descriptions] = scrubValue(val, depth + 1);
|
|
59327
|
-
if (didScrub) {
|
|
59328
|
-
objectDidScrub = true;
|
|
59329
|
-
objectDescriptions.push(...descriptions);
|
|
59330
|
-
}
|
|
59331
|
-
scrubbed[key] = scrubbedVal;
|
|
59332
|
-
}
|
|
59333
|
-
return [
|
|
59334
|
-
scrubbed,
|
|
59335
|
-
objectDidScrub,
|
|
59336
|
-
objectDescriptions
|
|
59337
|
-
];
|
|
59338
|
-
}
|
|
59339
|
-
return [
|
|
59340
|
-
value,
|
|
59341
|
-
false,
|
|
59342
|
-
[]
|
|
59343
|
-
];
|
|
59344
|
-
}
|
|
59345
|
-
/**
|
|
59346
|
-
* Sentry beforeSend hook that scrubs sensitive data from events
|
|
59347
|
-
* and applies custom fingerprinting for specific error types.
|
|
59348
|
-
*/
|
|
59349
|
-
function sentryBeforeSend(event, hint) {
|
|
59350
|
-
const firstException = event?.exception?.values?.[0];
|
|
59351
|
-
if (firstException?.type === "AI_APICallError" && firstException.value) event.fingerprint = ["AI_APICallError", firstException.value];
|
|
59352
|
-
const [scrubbedEvent, didScrub, descriptions] = scrubValue(event);
|
|
59353
|
-
if (didScrub) {
|
|
59354
|
-
const uniqueDescriptions = [...new Set(descriptions)];
|
|
59355
|
-
console.warn(`[Sentry] Event contained sensitive data: ${uniqueDescriptions.join(", ")}`);
|
|
59356
|
-
}
|
|
59357
|
-
return scrubbedEvent;
|
|
59358
|
-
}
|
|
59359
|
-
|
|
59360
60448
|
//#endregion
|
|
59361
60449
|
//#region src/index.ts
|
|
59362
60450
|
const packageName = "@sentry/mcp-server";
|
|
@@ -59490,7 +60578,6 @@ async function main() {
|
|
|
59490
60578
|
}
|
|
59491
60579
|
__sentry_node.init({
|
|
59492
60580
|
dsn: cfg.sentryDsn,
|
|
59493
|
-
sendDefaultPii: true,
|
|
59494
60581
|
tracesSampleRate: 1,
|
|
59495
60582
|
beforeSend: sentryBeforeSend,
|
|
59496
60583
|
initialScope: { tags: {
|
|
@@ -59523,17 +60610,28 @@ async function main() {
|
|
|
59523
60610
|
}
|
|
59524
60611
|
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
59525
60612
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
59526
|
-
|
|
59527
|
-
|
|
59528
|
-
|
|
59529
|
-
|
|
59530
|
-
|
|
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:");
|
|
59531
60632
|
});
|
|
59532
|
-
process.on("unhandledRejection",
|
|
59533
|
-
|
|
59534
|
-
__sentry_node.captureException(reason);
|
|
59535
|
-
await __sentry_node.flush(SENTRY_TIMEOUT);
|
|
59536
|
-
process.exit(1);
|
|
60633
|
+
process.on("unhandledRejection", (reason) => {
|
|
60634
|
+
exitAfterError(reason, "Unhandled rejection:");
|
|
59537
60635
|
});
|
|
59538
60636
|
const context$1 = {
|
|
59539
60637
|
accessToken: cfg.accessToken,
|
|
@@ -59554,11 +60652,8 @@ async function main() {
|
|
|
59554
60652
|
context: context$1,
|
|
59555
60653
|
experimentalMode: cli.experimental
|
|
59556
60654
|
});
|
|
59557
|
-
require_stdio.startStdio(server, context$1).catch(
|
|
59558
|
-
|
|
59559
|
-
__sentry_node.captureException(err);
|
|
59560
|
-
await __sentry_node.flush(SENTRY_TIMEOUT);
|
|
59561
|
-
process.exit(1);
|
|
60655
|
+
require_stdio.startStdio(server, context$1).catch((err) => {
|
|
60656
|
+
exitAfterError(err, "Server error:");
|
|
59562
60657
|
});
|
|
59563
60658
|
}
|
|
59564
60659
|
main().catch((err) => {
|