@sentry/mcp-server 0.40.0 → 0.42.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.
Files changed (75) hide show
  1. package/dist/auth/constants.cjs +1 -1
  2. package/dist/auth/constants.js +1 -1
  3. package/dist/auth/device-code-flow.cjs +3 -3
  4. package/dist/auth/device-code-flow.js +3 -3
  5. package/dist/auth/resolve-token.cjs +4 -4
  6. package/dist/auth/resolve-token.js +4 -4
  7. package/dist/{auth-CmmVlYDi.cjs → auth-B__Aec1m.cjs} +4 -4
  8. package/dist/{auth-CmmVlYDi.cjs.map → auth-B__Aec1m.cjs.map} +1 -1
  9. package/dist/{auth-CpyUfxVa.js → auth-BtRpItji.js} +4 -4
  10. package/dist/{auth-CpyUfxVa.js.map → auth-BtRpItji.js.map} +1 -1
  11. package/dist/{blob-utils-DgVug_Di-B5c8BuPf.cjs → blob-utils-B0ae0K-m-BF8kTomr.cjs} +2 -2
  12. package/dist/{blob-utils-DgVug_Di-B5c8BuPf.cjs.map → blob-utils-B0ae0K-m-BF8kTomr.cjs.map} +1 -1
  13. package/dist/{blob-utils-DgVug_Di-DaP7N_l-.js → blob-utils-B0ae0K-m-BhC2W04C.js} +2 -2
  14. package/dist/{blob-utils-DgVug_Di-DaP7N_l-.js.map → blob-utils-B0ae0K-m-BhC2W04C.js.map} +1 -1
  15. package/dist/blob-utils-BM8EcgEO.js +3 -0
  16. package/dist/blob-utils-DBvCs9nw.cjs +3 -0
  17. package/dist/cli/commands/auth.cjs +5 -5
  18. package/dist/cli/commands/auth.js +5 -5
  19. package/dist/cli/resolve.cjs +2 -2
  20. package/dist/cli/resolve.js +2 -2
  21. package/dist/cli/usage.cjs +1 -1
  22. package/dist/cli/usage.js +1 -1
  23. package/dist/{config-B-l88mOS-DNM_M--P.cjs → config-40SaJWzQ-Bxau3bPR.cjs} +2 -2
  24. package/dist/{config-B-l88mOS-DNM_M--P.cjs.map → config-40SaJWzQ-Bxau3bPR.cjs.map} +1 -1
  25. package/dist/{config-B-l88mOS-v5IBYyQU.js → config-40SaJWzQ-Dz27jdMQ.js} +2 -2
  26. package/dist/{config-B-l88mOS-v5IBYyQU.js.map → config-40SaJWzQ-Dz27jdMQ.js.map} +1 -1
  27. package/dist/config-DeGbV11k.cjs +7 -0
  28. package/dist/{config-_di9BWJ0.js → config-NGx6OsOU.js} +1 -1
  29. package/dist/{constants-CS0iQGX_.js → constants-CGu8w21D.js} +11 -8
  30. package/dist/constants-CGu8w21D.js.map +1 -0
  31. package/dist/{constants-DyDxXiYc.cjs → constants-Cw_BclsW.cjs} +16 -7
  32. package/dist/constants-Cw_BclsW.cjs.map +1 -0
  33. package/dist/{device-code-flow-D1UFW6dK.cjs → device-code-flow-afx1qvK6.cjs} +3 -3
  34. package/dist/{device-code-flow-D1UFW6dK.cjs.map → device-code-flow-afx1qvK6.cjs.map} +1 -1
  35. package/dist/{device-code-flow-CARIuIzP.js → device-code-flow-mwBASRbi.js} +3 -3
  36. package/dist/{device-code-flow-CARIuIzP.js.map → device-code-flow-mwBASRbi.js.map} +1 -1
  37. package/dist/index.cjs +1333 -462
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.js +1326 -455
  40. package/dist/index.js.map +1 -1
  41. package/dist/{resolve-D3vntNua.cjs → resolve-BvvBO-dw.cjs} +9 -6
  42. package/dist/resolve-BvvBO-dw.cjs.map +1 -0
  43. package/dist/{resolve-C9Uf3wka.js → resolve-DOyeMm4X.js} +9 -6
  44. package/dist/resolve-DOyeMm4X.js.map +1 -0
  45. package/dist/{resolve-token-CYqj4HQ5.js → resolve-token-BHBj9ll0.js} +3 -3
  46. package/dist/{resolve-token-CYqj4HQ5.js.map → resolve-token-BHBj9ll0.js.map} +1 -1
  47. package/dist/{resolve-token-DKvK-YrS.cjs → resolve-token-dsXzYI7-.cjs} +3 -3
  48. package/dist/{resolve-token-DKvK-YrS.cjs.map → resolve-token-dsXzYI7-.cjs.map} +1 -1
  49. package/dist/{stdio-iZJ0t3f6.js → stdio-0Gl343e-.js} +2 -2
  50. package/dist/{stdio-iZJ0t3f6.js.map → stdio-0Gl343e-.js.map} +1 -1
  51. package/dist/{stdio-BhYLPDOA.cjs → stdio-CZiqpRKP.cjs} +2 -2
  52. package/dist/{stdio-BhYLPDOA.cjs.map → stdio-CZiqpRKP.cjs.map} +1 -1
  53. package/dist/transports/stdio.cjs +2 -2
  54. package/dist/transports/stdio.js +2 -2
  55. package/dist/{usage-Crfzx1qJ.cjs → usage-DZ4QDygT.cjs} +6 -4
  56. package/dist/usage-DZ4QDygT.cjs.map +1 -0
  57. package/dist/{usage-Con424Df.js → usage-Hi-6-LDr.js} +6 -4
  58. package/dist/usage-Hi-6-LDr.js.map +1 -0
  59. package/dist/version-NjstoynH.js +7 -0
  60. package/dist/version-NjstoynH.js.map +1 -0
  61. package/dist/{version-CDZpvmqM.cjs → version-_1CmW0BF.cjs} +3 -3
  62. package/dist/version-_1CmW0BF.cjs.map +1 -0
  63. package/package.json +4 -4
  64. package/dist/blob-utils-CJyQkdm-.js +0 -3
  65. package/dist/blob-utils-DGsI5_gF.cjs +0 -3
  66. package/dist/config-DRWtJff1.cjs +0 -7
  67. package/dist/constants-CS0iQGX_.js.map +0 -1
  68. package/dist/constants-DyDxXiYc.cjs.map +0 -1
  69. package/dist/resolve-C9Uf3wka.js.map +0 -1
  70. package/dist/resolve-D3vntNua.cjs.map +0 -1
  71. package/dist/usage-Con424Df.js.map +0 -1
  72. package/dist/usage-Crfzx1qJ.cjs.map +0 -1
  73. package/dist/version-CDZpvmqM.cjs.map +0 -1
  74. package/dist/version-a8th87fY.js +0 -7
  75. package/dist/version-a8th87fY.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  const require_chunk = require('./chunk-Cv9WC9bY.cjs');
3
- const require_resolve = require('./resolve-D3vntNua.cjs');
4
- const require_constants = require('./constants-DyDxXiYc.cjs');
5
- const require_version = require('./version-CDZpvmqM.cjs');
3
+ const require_resolve = require('./resolve-BvvBO-dw.cjs');
4
+ const require_constants = require('./constants-Cw_BclsW.cjs');
5
+ const require_version = require('./version-_1CmW0BF.cjs');
6
6
  const require_token_error$1 = require('./token-error-x_miDBP3.cjs');
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
- const require_usage = require('./usage-Crfzx1qJ.cjs');
7
+ const require_blob_utils_B0ae0K_m = require('./blob-utils-B0ae0K-m-BF8kTomr.cjs');
8
+ const require_config_40SaJWzQ = require('./config-40SaJWzQ-Bxau3bPR.cjs');
9
+ const require_stdio = require('./stdio-CZiqpRKP.cjs');
10
+ const require_usage = require('./usage-DZ4QDygT.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-D1UFW6dK.cjs');
14
+ require('./device-code-flow-afx1qvK6.cjs');
15
15
  require('./token-cache-ATUcs1cg.cjs');
16
- const require_resolve_token = require('./resolve-token-DKvK-YrS.cjs');
17
- const require_auth = require('./auth-CmmVlYDi.cjs');
16
+ const require_resolve_token = require('./resolve-token-dsXzYI7-.cjs');
17
+ const require_auth = require('./auth-B__Aec1m.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"));
@@ -399,7 +399,7 @@ function validateSlugOrId(val, ctx) {
399
399
  }
400
400
 
401
401
  //#endregion
402
- //#region ../mcp-core/dist/schema-BPiG3cQY.js
402
+ //#region ../mcp-core/dist/schema-Bp2NOd0m.js
403
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.");
404
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`.");
405
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.");
@@ -452,7 +452,7 @@ const ParamIgnoreCount = zod.z.number().int().positive().describe("How many time
452
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.");
453
453
  const ParamIgnoreUserCount = zod.z.number().int().positive().describe("How many users must be affected before the issue stops being ignored when ignoreMode is 'untilUserCount'.");
454
454
  const ParamIgnoreUserWindowMinutes = zod.z.number().int().positive().max(7 * 24 * 60).describe("Optional time window in minutes for ignoreUserCount. If omitted, Sentry counts all future affected users.");
455
- const ParamReason = zod.z.string().trim().min(1).describe("Optional reason for taking this action. When provided, it will be posted as a comment on the issue's activity feed.");
455
+ const ParamReason = zod.z.string().overwrite((s) => s.replace(/\0/g, "")).trim().min(1).describe("Optional reason for taking this action. When provided, it will be posted as a comment on the issue's activity feed.");
456
456
  const ParamSentryGuide = zod.z.enum(SENTRY_GUIDES).describe("Optional guide filter to limit search results to specific documentation sections. Use either a platform (e.g., 'javascript', 'python') or platform/guide combination (e.g., 'javascript/nextjs', 'python/django').");
457
457
  const ParamEventId = zod.z.string().trim().regex(/^[0-9a-fA-F]{32}$/, "Event ID must be a 32-character hexadecimal string").describe("The ID of the event. e.g. `c49541c747cb4d8aa3efb70ca5aba243`");
458
458
  /**
@@ -2158,7 +2158,7 @@ function isApiAuthenticationErrorDeep(error) {
2158
2158
  }
2159
2159
 
2160
2160
  //#endregion
2161
- //#region ../mcp-core/dist/schema-y99KGEDP.js
2161
+ //#region ../mcp-core/dist/schema-C3DdeX-U.js
2162
2162
  /**
2163
2163
  * Schema for Sentry API error responses.
2164
2164
  *
@@ -2358,7 +2358,7 @@ const AlertActionOptionSchema = zod.z.object({
2358
2358
  name: zod.z.string(),
2359
2359
  installationId: zod.z.string(),
2360
2360
  installationUuid: zod.z.string(),
2361
- status: zod.z.number(),
2361
+ status: zod.z.string(),
2362
2362
  settings: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
2363
2363
  title: zod.z.string().optional()
2364
2364
  }).optional()
@@ -3727,7 +3727,7 @@ const EventsStatsResponseSchema = zod.z.object({
3727
3727
  }).passthrough();
3728
3728
 
3729
3729
  //#endregion
3730
- //#region ../mcp-core/dist/client-BXJ5ud71.js
3730
+ //#region ../mcp-core/dist/client-BMqioSXJ.js
3731
3731
  const SENTRY_MCP_SEARCH_EVENTS_REFERRER = "api.mcp.search-events";
3732
3732
  /**
3733
3733
  * Mapping of common network error codes to user-friendly messages.
@@ -3944,15 +3944,10 @@ var SentryApiService = class {
3944
3944
  this.apiPrefix = `${this.protocol}://${this.host}/api/0`;
3945
3945
  }
3946
3946
  /**
3947
- * Checks if the current host is Sentry SaaS (sentry.io).
3948
- *
3949
- * Used to determine API endpoint availability and URL formats.
3950
- * Self-hosted instances may not have all endpoints available.
3951
- *
3952
- * @returns True if using Sentry SaaS, false for self-hosted instances
3947
+ * Whether API control requests and web URLs use public SaaS routing.
3953
3948
  */
3954
- isSaas() {
3955
- return require_constants.isSentryHost(this.host);
3949
+ isPublicSaas() {
3950
+ return require_constants.isPublicSentryHost(this.host);
3956
3951
  }
3957
3952
  /**
3958
3953
  * Validates and applies time parameters to a URLSearchParams object.
@@ -4239,7 +4234,10 @@ var SentryApiService = class {
4239
4234
  return require_constants.getMonitorUrl(this.host, organizationSlug, monitorSlug, this.protocol, projectSlug$1);
4240
4235
  }
4241
4236
  getUptimeMonitorUrl(organizationSlug, uptimeMonitorId) {
4242
- return require_constants.getUptimeMonitorUrl(this.host, organizationSlug, uptimeMonitorId, this.protocol);
4237
+ return this.getDetectorUrl(organizationSlug, uptimeMonitorId);
4238
+ }
4239
+ getDetectorUrl(organizationSlug, detectorId) {
4240
+ return require_constants.getUptimeMonitorUrl(this.host, organizationSlug, detectorId, this.protocol);
4243
4241
  }
4244
4242
  getReleaseUrl(organizationSlug, releaseVersion) {
4245
4243
  return require_constants.getReleaseUrl(this.host, organizationSlug, releaseVersion, this.protocol);
@@ -4249,12 +4247,12 @@ var SentryApiService = class {
4249
4247
  }
4250
4248
  getIssueAlertRuleUrl(organizationSlug, ruleId) {
4251
4249
  const encodedRuleId = encodeURIComponent(String(ruleId));
4252
- if (this.isSaas()) return `${this.protocol}://${organizationSlug}.sentry.io/monitors/alerts/${encodedRuleId}/`;
4250
+ if (this.isPublicSaas()) return `${this.protocol}://${organizationSlug}.sentry.io/monitors/alerts/${encodedRuleId}/`;
4253
4251
  return `${this.protocol}://${this.host}/organizations/${organizationSlug}/monitors/alerts/${encodedRuleId}/`;
4254
4252
  }
4255
4253
  getMetricAlertRuleUrl(organizationSlug, ruleId) {
4256
4254
  const encodedRuleId = encodeURIComponent(String(ruleId));
4257
- if (this.isSaas()) return `${this.protocol}://${organizationSlug}.sentry.io/issues/alerts/rules/details/${encodedRuleId}/`;
4255
+ if (this.isPublicSaas()) return `${this.protocol}://${organizationSlug}.sentry.io/issues/alerts/rules/details/${encodedRuleId}/`;
4258
4256
  return `${this.protocol}://${this.host}/organizations/${organizationSlug}/issues/alerts/rules/details/${encodedRuleId}/`;
4259
4257
  }
4260
4258
  /**
@@ -4291,8 +4289,8 @@ var SentryApiService = class {
4291
4289
  urlParams.set("mode", "aggregate");
4292
4290
  if (aggregateFunctions && aggregateFunctions.length > 0) urlParams.set("yAxis", aggregateFunctions[0]);
4293
4291
  } else urlParams.set("yAxis", "count()");
4294
- const webHost = this.isSaas() ? "sentry.io" : this.host;
4295
- const path = this.isSaas() ? `${this.protocol}://${organizationSlug}.${webHost}/explore/discover/homepage/` : `${this.protocol}://${this.host}/organizations/${organizationSlug}/explore/discover/homepage/`;
4292
+ const webHost = this.isPublicSaas() ? "sentry.io" : this.host;
4293
+ const path = this.isPublicSaas() ? `${this.protocol}://${organizationSlug}.${webHost}/explore/discover/homepage/` : `${this.protocol}://${this.host}/organizations/${organizationSlug}/explore/discover/homepage/`;
4296
4294
  return `${path}?${urlParams.toString()}`;
4297
4295
  }
4298
4296
  isAggregateExplorerQuery(params) {
@@ -4325,7 +4323,7 @@ var SentryApiService = class {
4325
4323
  } else urlParams.set("statsPeriod", params.statsPeriod || "24h");
4326
4324
  }
4327
4325
  buildExplorePath(organizationSlug, page) {
4328
- if (this.isSaas()) return `${this.protocol}://${organizationSlug}.sentry.io/explore/${page}/`;
4326
+ if (this.isPublicSaas()) return `${this.protocol}://${organizationSlug}.sentry.io/explore/${page}/`;
4329
4327
  return `${this.protocol}://${this.host}/organizations/${organizationSlug}/explore/${page}/`;
4330
4328
  }
4331
4329
  /** Builds a Spans Explorer URL using its `query`, `field`, and `sort` contract. */
@@ -4459,7 +4457,7 @@ var SentryApiService = class {
4459
4457
  */
4460
4458
  async getAuthenticatedUser(opts) {
4461
4459
  let authHost;
4462
- if (this.isSaas()) authHost = "sentry.io";
4460
+ if (this.isPublicSaas()) authHost = "sentry.io";
4463
4461
  const body = await this.requestJSON("/auth/", void 0, {
4464
4462
  ...opts,
4465
4463
  host: authHost
@@ -4493,7 +4491,7 @@ var SentryApiService = class {
4493
4491
  const queryString = queryParams.toString();
4494
4492
  const path = `/organizations/?${queryString}`;
4495
4493
  let host = void 0;
4496
- if (this.isSaas() && !this.host.endsWith(".my.sentry.io")) host = "sentry.io";
4494
+ if (this.isPublicSaas()) host = "sentry.io";
4497
4495
  const body = await this.requestJSON(path, void 0, { host });
4498
4496
  return OrganizationListSchema.parse(body);
4499
4497
  }
@@ -4714,10 +4712,32 @@ var SentryApiService = class {
4714
4712
  const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/workflows/${ruleId}/project-scope/`, void 0, opts);
4715
4713
  return AlertRuleProjectScopeSchema.parse(body);
4716
4714
  }
4715
+ async getDetectorForAlertRule({ organizationSlug, alertRuleId }, opts) {
4716
+ const query = new URLSearchParams({ alert_rule_id: String(alertRuleId) });
4717
+ const body = await this.requestJSON(`${apiPath`/organizations/${organizationSlug}/alert-rule-detector/`}?${query}`, void 0, opts);
4718
+ return zod.z.object({ detectorId: zod.z.string() }).parse(body).detectorId;
4719
+ }
4717
4720
  async getDetector({ organizationSlug, detectorId }, opts) {
4718
4721
  const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/detectors/${detectorId}/`, void 0, opts);
4719
4722
  return DetectorSchema.parse(body);
4720
4723
  }
4724
+ async createMetricMonitor({ organizationSlug, projectSlug: projectSlug$1, body }, opts) {
4725
+ const response = await this.requestJSON(apiPath`/organizations/${organizationSlug}/projects/${projectSlug$1}/detectors/`, {
4726
+ method: "POST",
4727
+ body: JSON.stringify(body)
4728
+ }, opts);
4729
+ return DetectorSchema.parse(response);
4730
+ }
4731
+ async updateMetricMonitor({ organizationSlug, monitorId, body }, opts) {
4732
+ const response = await this.requestJSON(apiPath`/organizations/${organizationSlug}/detectors/${monitorId}/`, {
4733
+ method: "PUT",
4734
+ body: JSON.stringify(body)
4735
+ }, opts);
4736
+ return DetectorSchema.parse(response);
4737
+ }
4738
+ async deleteMetricMonitor({ organizationSlug, monitorId }, opts) {
4739
+ await this.request(apiPath`/organizations/${organizationSlug}/detectors/${monitorId}/`, { method: "DELETE" }, opts);
4740
+ }
4721
4741
  async listDetectorsPage({ organizationSlug, projectId, types, query, cursor, limit = 25 }, opts) {
4722
4742
  const search = new URLSearchParams({
4723
4743
  project: projectId ?? "-1",
@@ -4754,6 +4774,23 @@ var SentryApiService = class {
4754
4774
  nextCursor: getNextCursor(response.headers.get("link"))
4755
4775
  };
4756
4776
  }
4777
+ async createAlertRule({ organizationSlug, body }, opts) {
4778
+ const response = await this.requestJSON(apiPath`/organizations/${organizationSlug}/workflows/`, {
4779
+ method: "POST",
4780
+ body: JSON.stringify(body)
4781
+ }, opts);
4782
+ return IssueAlertRuleSchema.parse(response);
4783
+ }
4784
+ async updateAlertRule({ organizationSlug, ruleId, body }, opts) {
4785
+ const response = await this.requestJSON(apiPath`/organizations/${organizationSlug}/workflows/${ruleId}/`, {
4786
+ method: "PUT",
4787
+ body: JSON.stringify(body)
4788
+ }, opts);
4789
+ return IssueAlertRuleSchema.parse(response);
4790
+ }
4791
+ async deleteAlertRule({ organizationSlug, ruleId }, opts) {
4792
+ await this.request(apiPath`/organizations/${organizationSlug}/workflows/${ruleId}/`, { method: "DELETE" }, opts);
4793
+ }
4757
4794
  async listMetricAlertRules(params, opts) {
4758
4795
  const page = await this.listMetricAlertRulesPage(params, opts);
4759
4796
  return page.rules;
@@ -5396,7 +5433,8 @@ var SentryApiService = class {
5396
5433
  eventType,
5397
5434
  eventId: bodyObj.id,
5398
5435
  validationError: parseResult.error.message,
5399
- validationIssues: parseResult.error.issues
5436
+ validationIssues: parseResult.error.issues,
5437
+ contextType: bodyObj.context === null ? "null" : Array.isArray(bodyObj.context) ? "array" : typeof bodyObj.context
5400
5438
  } });
5401
5439
  throw new ApiValidationError(`Event failed schema validation: ${parseResult.error.message}`, void 0, void 0, body);
5402
5440
  }
@@ -5928,7 +5966,7 @@ var SentryApiService = class {
5928
5966
  const blob = await response.blob();
5929
5967
  let contentType = response.headers.get("content-type") ?? "";
5930
5968
  if (!contentType.startsWith("image/")) {
5931
- const { detectImageMimeType } = await Promise.resolve().then(() => require("./blob-utils-DGsI5_gF.cjs"));
5969
+ const { detectImageMimeType } = await Promise.resolve().then(() => require("./blob-utils-DBvCs9nw.cjs"));
5932
5970
  contentType = await detectImageMimeType(blob) ?? contentType;
5933
5971
  }
5934
5972
  return {
@@ -12297,7 +12335,7 @@ function stepCountIs(stepCount) {
12297
12335
  return ({ steps }) => steps.length === stepCount;
12298
12336
  }
12299
12337
  async function isStopConditionMet({ stopConditions, steps }) {
12300
- return (await Promise.all(stopConditions.map((condition) => condition({ steps })))).some((result) => result);
12338
+ return (await Promise.all(stopConditions.map((condition$1) => condition$1({ steps })))).some((result) => result);
12301
12339
  }
12302
12340
  async function toResponseMessages({ content: inputContent, tools }) {
12303
12341
  const responseMessages = [];
@@ -13754,7 +13792,7 @@ function isToolVisibleInMode(tool$1, experimentalMode) {
13754
13792
  }
13755
13793
 
13756
13794
  //#endregion
13757
- //#region ../mcp-core/dist/availability-KeZ7TRFd.js
13795
+ //#region ../mcp-core/dist/availability-BE2fy3-A.js
13758
13796
  function getToolPlacement({ key, experimentalMode, useDefaultSurfacePolicy }) {
13759
13797
  if (useDefaultSurfacePolicy) return {
13760
13798
  isCatalogTool: !isOutsideCatalogToolName(key),
@@ -13890,7 +13928,7 @@ function validateRegionUrl(regionUrl, baseHost) {
13890
13928
  }
13891
13929
 
13892
13930
  //#endregion
13893
- //#region ../mcp-core/dist/api-D4GH5wp9.js
13931
+ //#region ../mcp-core/dist/api-WgAP3kxC.js
13894
13932
  /**
13895
13933
  * Create a Sentry API service from server context with optional region override
13896
13934
  * @param context - Server context containing host and access token
@@ -13944,7 +13982,7 @@ function structuredResult(structuredContent) {
13944
13982
  }
13945
13983
 
13946
13984
  //#endregion
13947
- //#region ../mcp-core/dist/whoami-DthGP5fH.js
13985
+ //#region ../mcp-core/dist/whoami-EoDhvBvs.js
13948
13986
  const whoamiOutputSchema = zod.z.object({
13949
13987
  user: zod.z.object({
13950
13988
  id: zod.z.string(),
@@ -13995,7 +14033,7 @@ var whoami_default = defineTool({
13995
14033
  });
13996
14034
 
13997
14035
  //#endregion
13998
- //#region ../mcp-core/dist/get-sentry-mcp-info-Dg-_VZlQ.js
14036
+ //#region ../mcp-core/dist/get-sentry-mcp-info-DKxD0sCm.js
13999
14037
  const getSentryMcpInfoOutputSchema = zod.z.object({ version: zod.z.string().describe("The Sentry MCP server version.") });
14000
14038
  var get_sentry_mcp_info_default = defineTool({
14001
14039
  name: "get_sentry_mcp_info",
@@ -14021,7 +14059,7 @@ var get_sentry_mcp_info_default = defineTool({
14021
14059
  });
14022
14060
 
14023
14061
  //#endregion
14024
- //#region ../mcp-core/dist/find-organizations-BjoY7_gy.js
14062
+ //#region ../mcp-core/dist/find-organizations-Cn0PtgIL.js
14025
14063
  const RESULT_LIMIT$3 = 25;
14026
14064
  const findOrganizationsOutputSchema = zod.z.object({
14027
14065
  organizations: zod.z.array(zod.z.object({
@@ -14080,7 +14118,7 @@ function setOrganizationContext(organizationSlug) {
14080
14118
  }
14081
14119
 
14082
14120
  //#endregion
14083
- //#region ../mcp-core/dist/find-teams-C5yde5nc.js
14121
+ //#region ../mcp-core/dist/find-teams-DBDkm24J.js
14084
14122
  const RESULT_LIMIT$2 = 25;
14085
14123
  const findTeamsOutputSchema = zod.z.object({
14086
14124
  teams: zod.z.array(zod.z.object({
@@ -14138,7 +14176,7 @@ var find_teams_default = defineTool({
14138
14176
  });
14139
14177
 
14140
14178
  //#endregion
14141
- //#region ../mcp-core/dist/find-projects-DBOb3oe-.js
14179
+ //#region ../mcp-core/dist/find-projects-Dw0XbBbl.js
14142
14180
  const RESULT_LIMIT$1 = 25;
14143
14181
  const findProjectsOutputSchema = zod.z.object({
14144
14182
  projects: zod.z.array(zod.z.object({ slug: zod.z.string() })),
@@ -14186,7 +14224,7 @@ var find_projects_default = defineTool({
14186
14224
  });
14187
14225
 
14188
14226
  //#endregion
14189
- //#region ../mcp-core/dist/find-releases-BF8-U7mW.js
14227
+ //#region ../mcp-core/dist/find-releases-BANyYOrP.js
14190
14228
  const RESULT_LIMIT = 25;
14191
14229
  const findReleasesOutputSchema = zod.z.object({
14192
14230
  releases: zod.z.array(zod.z.object({
@@ -14353,9 +14391,13 @@ function assertProjectListContainsConstraint({ resourceLabel, scopedProjectSlug,
14353
14391
  const hasMatchingProject = projects?.some((project) => projectSlug(project) === scopedProjectSlug) ?? false;
14354
14392
  if (!hasMatchingProject) throw projectConstraintError(resourceLabel, scopedProjectSlug);
14355
14393
  }
14394
+ function assertProjectConstraintEvidence({ resourceLabel, scopedProjectSlug, hasEvidence }) {
14395
+ if (!scopedProjectSlug || hasEvidence) return;
14396
+ throw projectConstraintError(resourceLabel, scopedProjectSlug);
14397
+ }
14356
14398
 
14357
14399
  //#endregion
14358
- //#region ../mcp-core/dist/get-release-details-DvY_TDet.js
14400
+ //#region ../mcp-core/dist/get-release-details-EO7WDxG1.js
14359
14401
  function formatProjects(release) {
14360
14402
  if (!release.projects || release.projects.length === 0) return null;
14361
14403
  return release.projects.map((project) => project.slug ?? project.name).join(", ");
@@ -14639,7 +14681,7 @@ async function resolveDashboardId({ apiService, organizationSlug, dashboardIdOrT
14639
14681
  }
14640
14682
 
14641
14683
  //#endregion
14642
- //#region ../mcp-core/dist/find-dashboards-oyqvVv8a.js
14684
+ //#region ../mcp-core/dist/find-dashboards-DKLP0i-d.js
14643
14685
  const PROJECT_DASHBOARD_CURSOR_PREFIX = "mcp-dashboard-project:";
14644
14686
  const dashboardSummarySchema = zod.z.object({
14645
14687
  id: zod.z.string(),
@@ -14850,7 +14892,7 @@ var find_dashboards_default = defineTool({
14850
14892
  });
14851
14893
 
14852
14894
  //#endregion
14853
- //#region ../mcp-core/dist/get-dashboard-details-D_U6hOFe.js
14895
+ //#region ../mcp-core/dist/get-dashboard-details--oIztzid.js
14854
14896
  var get_dashboard_details_default = defineTool({
14855
14897
  name: "get_dashboard_details",
14856
14898
  skills: ["inspect"],
@@ -14924,7 +14966,7 @@ var get_dashboard_details_default = defineTool({
14924
14966
  });
14925
14967
 
14926
14968
  //#endregion
14927
- //#region ../mcp-core/dist/find-monitors-CwXZsdiJ.js
14969
+ //#region ../mcp-core/dist/find-monitors-CL13rhUK.js
14928
14970
  const ENVIRONMENT_LIMIT = 5;
14929
14971
  const monitorScheduleOutputSchema = zod.z.object({
14930
14972
  type: zod.z.string().nullable(),
@@ -15102,7 +15144,7 @@ var find_monitors_default = defineTool({
15102
15144
  });
15103
15145
 
15104
15146
  //#endregion
15105
- //#region ../mcp-core/dist/get-monitor-details-CDcHPW6x.js
15147
+ //#region ../mcp-core/dist/get-monitor-details-rOWfK-z4.js
15106
15148
  function formatProject(monitor) {
15107
15149
  if (!monitor.project) return null;
15108
15150
  return monitor.project.slug ?? monitor.project.name ?? null;
@@ -15395,7 +15437,7 @@ function toUptimeMonitorSummary(monitor, webUrl) {
15395
15437
  }
15396
15438
 
15397
15439
  //#endregion
15398
- //#region ../mcp-core/dist/find-uptime-monitors-B5dw0P9D.js
15440
+ //#region ../mcp-core/dist/find-uptime-monitors-CfklmxHQ.js
15399
15441
  const findUptimeMonitorsOutputSchema = zod.z.object({
15400
15442
  monitors: zod.z.array(uptimeMonitorListItemSchema),
15401
15443
  hasMore: zod.z.boolean()
@@ -15463,7 +15505,7 @@ var find_uptime_monitors_default = defineTool({
15463
15505
  });
15464
15506
 
15465
15507
  //#endregion
15466
- //#region ../mcp-core/dist/get-uptime-monitor-details-B40FMp1m.js
15508
+ //#region ../mcp-core/dist/get-uptime-monitor-details-DTAs_Yxr.js
15467
15509
  function formatCheck(check, monitorEnvironment) {
15468
15510
  const time = formatDate(check.timestamp) ?? formatDate(check.scheduledCheckTime) ?? "unknown time";
15469
15511
  const status = check.checkStatus ?? "unknown";
@@ -15585,7 +15627,549 @@ var get_uptime_monitor_details_default = defineTool({
15585
15627
  });
15586
15628
 
15587
15629
  //#endregion
15588
- //#region ../mcp-core/dist/create-uptime-monitor-BarA-8c1.js
15630
+ //#region ../mcp-core/dist/detector-details-4Y6bkh3B.js
15631
+ const conditionGroupSchema$1 = zod.z.object({
15632
+ id: zod.z.union([zod.z.string(), zod.z.number()]).optional(),
15633
+ logicType: zod.z.string(),
15634
+ conditions: zod.z.array(zod.z.object({
15635
+ id: zod.z.union([zod.z.string(), zod.z.number()]).optional(),
15636
+ type: zod.z.string(),
15637
+ comparison: zod.z.unknown(),
15638
+ conditionResult: zod.z.unknown()
15639
+ }))
15640
+ });
15641
+ const metricQuerySchema = zod.z.object({
15642
+ dataset: zod.z.string(),
15643
+ query: zod.z.string(),
15644
+ aggregate: zod.z.string(),
15645
+ timeWindow: zod.z.number(),
15646
+ environment: zod.z.string().nullable(),
15647
+ eventTypes: zod.z.array(zod.z.string()),
15648
+ extrapolationMode: zod.z.string().nullable().optional()
15649
+ });
15650
+ const metricQueryDetailsSchema = metricQuerySchema.omit({ timeWindow: true }).extend({ timeWindowSeconds: zod.z.number() });
15651
+ /** Project the metric query without subscription or backend identifiers. */
15652
+ function getMetricQuery(source) {
15653
+ if (source.type !== "snuba_query_subscription" || !isPlainObject$3(source.queryObj)) return null;
15654
+ const parsed = metricQuerySchema.safeParse(source.queryObj.snubaQuery);
15655
+ if (!parsed.success) return null;
15656
+ const { timeWindow,...query } = parsed.data;
15657
+ return {
15658
+ ...query,
15659
+ timeWindowSeconds: timeWindow
15660
+ };
15661
+ }
15662
+
15663
+ //#endregion
15664
+ //#region ../mcp-core/dist/metric-monitors-DQgq8kRa.js
15665
+ const metricMonitorReferenceFields = {
15666
+ organizationSlug: ParamOrganizationSlug,
15667
+ regionUrl: ParamRegionUrl.nullable().default(null),
15668
+ projectSlug: ParamProjectSlug.optional(),
15669
+ monitorId: zod.z.string().trim().regex(/^\d+$/).describe("Native Metric Monitor ID from find_metric_monitors.")
15670
+ };
15671
+ const metricMonitorSummarySchema = zod.z.object({
15672
+ id: zod.z.string(),
15673
+ name: zod.z.string(),
15674
+ projectId: zod.z.string().nullable(),
15675
+ enabled: zod.z.boolean(),
15676
+ owner: zod.z.string().nullable(),
15677
+ workflowIds: zod.z.array(zod.z.string()),
15678
+ webUrl: zod.z.string()
15679
+ });
15680
+ const metricMonitorDetailsSchema = metricMonitorSummarySchema.extend({
15681
+ description: zod.z.string().nullable(),
15682
+ config: zod.z.object({
15683
+ detectionType: zod.z.string(),
15684
+ comparisonDeltaSeconds: zod.z.number().optional()
15685
+ }),
15686
+ conditionGroup: conditionGroupSchema$1.nullable().describe("Native detection conditions, including resolution. Results: 75 critical, 50 warning, 0 resolved. Percent comparisons are absolute percentages (110 means 10% higher). Dynamic comparisons contain sensitivity, seasonality and thresholdType."),
15687
+ dataSources: zod.z.array(zod.z.object({
15688
+ type: zod.z.string(),
15689
+ query: metricQueryDetailsSchema.optional(),
15690
+ unavailableReason: zod.z.string().optional()
15691
+ })),
15692
+ dateCreated: zod.z.string().nullable(),
15693
+ dateUpdated: zod.z.string().nullable()
15694
+ });
15695
+ function toMetricMonitorSummary(api, organizationSlug, detector) {
15696
+ return {
15697
+ id: detector.id,
15698
+ name: detector.name,
15699
+ projectId: detector.projectId,
15700
+ enabled: detector.enabled,
15701
+ owner: detector.owner ? formatActor(detector.owner) : null,
15702
+ workflowIds: detector.workflowIds ?? [],
15703
+ webUrl: api.getDetectorUrl(organizationSlug, detector.id)
15704
+ };
15705
+ }
15706
+ function toMetricMonitorDetails(api, organizationSlug, detector) {
15707
+ const config = zod.z.object({
15708
+ detectionType: zod.z.string(),
15709
+ comparisonDelta: zod.z.number().nullish()
15710
+ }).parse(detector.config);
15711
+ return {
15712
+ ...toMetricMonitorSummary(api, organizationSlug, detector),
15713
+ description: detector.description ?? null,
15714
+ config: {
15715
+ detectionType: config.detectionType,
15716
+ ...config.comparisonDelta != null ? { comparisonDeltaSeconds: config.comparisonDelta } : {}
15717
+ },
15718
+ conditionGroup: detector.conditionGroup ? conditionGroupSchema$1.parse(detector.conditionGroup) : null,
15719
+ dataSources: (detector.dataSources ?? []).map((source) => {
15720
+ const query = getMetricQuery(source);
15721
+ return {
15722
+ type: typeof source.type === "string" ? source.type : "unknown",
15723
+ ...query ? { query } : { unavailableReason: "Source configuration is unavailable." }
15724
+ };
15725
+ }),
15726
+ dateCreated: formatDate(detector.dateCreated),
15727
+ dateUpdated: formatDate(detector.dateUpdated)
15728
+ };
15729
+ }
15730
+ function getMetricMonitorReference(detector) {
15731
+ return detector.alertRuleId != null ? String(detector.alertRuleId) : `detector:${detector.id}`;
15732
+ }
15733
+ async function listMetricMonitors(api, params) {
15734
+ const project = params.projectSlug ? await api.getProject({
15735
+ organizationSlug: params.organizationSlug,
15736
+ projectSlugOrId: params.projectSlug
15737
+ }) : void 0;
15738
+ const page = await api.listDetectorsPage({
15739
+ organizationSlug: params.organizationSlug,
15740
+ projectId: project ? String(project.id) : void 0,
15741
+ types: ["metric_issue"],
15742
+ query: params.query,
15743
+ cursor: params.cursor,
15744
+ limit: params.limit
15745
+ });
15746
+ return {
15747
+ ...page,
15748
+ detectors: page.detectors.filter((detector) => detector.type === "metric_issue" && (!project || detector.projectId === String(project.id)))
15749
+ };
15750
+ }
15751
+ async function getMetricMonitor(api, params) {
15752
+ if (params.projectSlug) assertProjectRefWithinConstraint({
15753
+ resourceLabel: "Metric Monitor",
15754
+ scopedProjectSlug: params.scopedProjectSlug,
15755
+ project: { slug: params.projectSlug }
15756
+ });
15757
+ const projectSlug$1 = params.scopedProjectSlug ?? params.projectSlug;
15758
+ const detector = await api.getDetector({
15759
+ organizationSlug: params.organizationSlug,
15760
+ detectorId: params.monitorId
15761
+ });
15762
+ if (detector.type !== "metric_issue") throw new UserInputError("This ID does not identify a Metric Monitor. Use find_metric_monitors to find its monitor ID.");
15763
+ if (projectSlug$1) {
15764
+ const project = await api.getProject({
15765
+ organizationSlug: params.organizationSlug,
15766
+ projectSlugOrId: projectSlug$1
15767
+ });
15768
+ assertProjectConstraintEvidence({
15769
+ resourceLabel: "Metric Monitor",
15770
+ scopedProjectSlug: projectSlug$1,
15771
+ hasEvidence: detector.projectId === String(project.id)
15772
+ });
15773
+ }
15774
+ return detector;
15775
+ }
15776
+ async function findExactMetricMonitorMatches(api, params) {
15777
+ const page = await listMetricMonitors(api, {
15778
+ ...params,
15779
+ query: `name:${JSON.stringify(params.name)}`,
15780
+ limit: 100
15781
+ });
15782
+ if (page.nextCursor) throw new UserInputError("Metric Monitor name search is incomplete. Use find_metric_monitors and retry with get_metric_monitor_details and its monitor ID.");
15783
+ return page.detectors.filter((detector) => detector.name.toLowerCase() === params.name.toLowerCase());
15784
+ }
15785
+
15786
+ //#endregion
15787
+ //#region ../mcp-core/dist/find-metric-monitors-CV2esXDV.js
15788
+ const findMetricMonitorsOutputSchema = zod.z.object({
15789
+ monitors: zod.z.array(metricMonitorSummarySchema),
15790
+ nextCursor: zod.z.string().nullable()
15791
+ });
15792
+ var find_metric_monitors_default = defineTool({
15793
+ name: "find_metric_monitors",
15794
+ skills: ["inspect"],
15795
+ requiredScopes: ["org:read", "project:read"],
15796
+ description: [
15797
+ "Find Sentry Metric Monitors that evaluate errors, performance, logs, metrics or crash rates.",
15798
+ "Use this tool to find a monitor ID before inspecting its query and detection conditions with get_metric_monitor_details.",
15799
+ "Results contain native monitor IDs, separate from legacy metric alert IDs. Alerts connected through workflowIds control notifications; inspect them with get_alert_rule(kind='issue').",
15800
+ "Omit projectSlug to search all accessible projects. Pass nextCursor as cursor with the same filters to retrieve more results.",
15801
+ "find_metric_monitors(organizationSlug='my-org', projectSlug='backend', query='latency')"
15802
+ ].join("\n"),
15803
+ inputSchema: {
15804
+ organizationSlug: ParamOrganizationSlug,
15805
+ regionUrl: ParamRegionUrl.nullable().default(null),
15806
+ projectSlug: ParamProjectSlugOrAll.optional(),
15807
+ query: zod.z.string().trim().min(1).optional().describe("Optional monitor search, such as a name or name:\"latency\". This searches monitor metadata, not the monitored event query. Results are always restricted to Metric Monitors."),
15808
+ cursor: zod.z.string().optional().describe("nextCursor from the previous page."),
15809
+ limit: zod.z.number().int().min(1).max(100).default(10)
15810
+ },
15811
+ outputSchema: findMetricMonitorsOutputSchema,
15812
+ annotations: {
15813
+ readOnlyHint: true,
15814
+ destructiveHint: false,
15815
+ openWorldHint: true
15816
+ },
15817
+ async handler(params, context$1) {
15818
+ const requestedProject = params.projectSlug === "all" ? void 0 : params.projectSlug;
15819
+ if (requestedProject) assertProjectRefWithinConstraint({
15820
+ resourceLabel: "Metric Monitor list",
15821
+ scopedProjectSlug: context$1.constraints.projectSlug,
15822
+ project: { slug: requestedProject }
15823
+ });
15824
+ const projectSlug$1 = context$1.constraints.projectSlug ?? requestedProject;
15825
+ setOrganizationContext(params.organizationSlug);
15826
+ if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
15827
+ const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
15828
+ const page = await listMetricMonitors(api, {
15829
+ ...params,
15830
+ projectSlug: projectSlug$1
15831
+ });
15832
+ return structuredResult({
15833
+ monitors: page.detectors.map((detector) => toMetricMonitorSummary(api, params.organizationSlug, detector)),
15834
+ nextCursor: page.nextCursor
15835
+ });
15836
+ }
15837
+ });
15838
+
15839
+ //#endregion
15840
+ //#region ../mcp-core/dist/get-metric-monitor-details-CgVPjtPz.js
15841
+ const getMetricMonitorDetailsOutputSchema = zod.z.object({ monitor: metricMonitorDetailsSchema });
15842
+ var get_metric_monitor_details_default = defineTool({
15843
+ name: "get_metric_monitor_details",
15844
+ skills: ["inspect"],
15845
+ requiredScopes: ["org:read", "project:read"],
15846
+ description: [
15847
+ "Inspect a Sentry Metric Monitor's query, dataset, detection mode, thresholds, resolution conditions and connected Alerts.",
15848
+ "Use monitorId from find_metric_monitors, not a legacy metric alert ID. Time windows and comparison deltas are in seconds.",
15849
+ "Condition results use 75 for critical, 50 for warning and 0 for resolved. Percent comparisons are absolute percentages (110 means 10% higher); dynamic conditions include sensitivity and direction.",
15850
+ "workflowIds identify notification Alerts; inspect their actions with get_alert_rule(kind='issue').",
15851
+ "get_metric_monitor_details(organizationSlug='my-org', monitorId='12345')"
15852
+ ].join("\n"),
15853
+ inputSchema: metricMonitorReferenceFields,
15854
+ outputSchema: getMetricMonitorDetailsOutputSchema,
15855
+ annotations: {
15856
+ readOnlyHint: true,
15857
+ destructiveHint: false,
15858
+ openWorldHint: true
15859
+ },
15860
+ async handler(params, context$1) {
15861
+ const projectSlug$1 = context$1.constraints.projectSlug ?? params.projectSlug;
15862
+ setOrganizationContext(params.organizationSlug);
15863
+ if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
15864
+ const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
15865
+ const detector = await getMetricMonitor(api, {
15866
+ ...params,
15867
+ scopedProjectSlug: context$1.constraints.projectSlug
15868
+ });
15869
+ return structuredResult({ monitor: toMetricMonitorDetails(api, params.organizationSlug, detector) });
15870
+ }
15871
+ });
15872
+
15873
+ //#endregion
15874
+ //#region ../mcp-core/dist/metric-monitor-config-CPca208I.js
15875
+ const metricConditionSchema = conditionGroupSchema$1.shape.conditions.element;
15876
+ const thresholdCondition = metricConditionSchema.extend({
15877
+ type: zod.z.enum([
15878
+ "gt",
15879
+ "lt",
15880
+ "gte",
15881
+ "lte"
15882
+ ]),
15883
+ comparison: zod.z.number(),
15884
+ conditionResult: zod.z.union([
15885
+ zod.z.literal(75),
15886
+ zod.z.literal(50),
15887
+ zod.z.literal(0)
15888
+ ])
15889
+ });
15890
+ const anomalyCondition = metricConditionSchema.extend({
15891
+ type: zod.z.literal("anomaly_detection"),
15892
+ comparison: zod.z.object({
15893
+ sensitivity: zod.z.enum([
15894
+ "low",
15895
+ "medium",
15896
+ "high"
15897
+ ]),
15898
+ seasonality: zod.z.literal("auto"),
15899
+ thresholdType: zod.z.union([
15900
+ zod.z.literal(0),
15901
+ zod.z.literal(1),
15902
+ zod.z.literal(2)
15903
+ ])
15904
+ }),
15905
+ conditionResult: zod.z.union([zod.z.literal(75), zod.z.literal(50)])
15906
+ });
15907
+ const metricMonitorQuerySchema = metricQueryDetailsSchema.extend({
15908
+ dataset: zod.z.enum([
15909
+ "events",
15910
+ "transactions",
15911
+ "generic_metrics",
15912
+ "metrics",
15913
+ "events_analytics_platform"
15914
+ ]),
15915
+ aggregate: zod.z.string().min(1),
15916
+ timeWindowSeconds: zod.z.number().int().positive()
15917
+ });
15918
+ const metricMonitorDetectionConfigSchema = zod.z.object({
15919
+ detectionType: zod.z.enum([
15920
+ "static",
15921
+ "percent",
15922
+ "dynamic"
15923
+ ]),
15924
+ comparisonDeltaSeconds: zod.z.number().int().positive().nullable().optional()
15925
+ });
15926
+ const metricMonitorConditionGroupSchema = conditionGroupSchema$1.extend({ conditions: zod.z.array(zod.z.discriminatedUnion("type", [thresholdCondition, anomalyCondition])).min(1).max(3) });
15927
+ const metricMonitorConfigFields = {
15928
+ name: zod.z.string().trim().min(1).max(200).optional(),
15929
+ description: zod.z.string().nullable().optional(),
15930
+ status: zod.z.enum(["active", "disabled"]).optional(),
15931
+ owner: zod.z.string().regex(/^(user|team):\d+$/).nullable().optional().describe("Owner actor, e.g. team:123 or user:123. Pass null to clear."),
15932
+ query: metricMonitorQuerySchema.partial().refine((value) => Object.keys(value).length > 0, "Provide at least one query field.").optional().describe("Partial query changes. Omitted fields are preserved; environment:null clears its filter. metrics is crash-free Releases; events_analytics_platform supports spans, logs and application metrics via eventTypes. Dataset changes must include compatible aggregate and eventTypes."),
15933
+ config: metricMonitorDetectionConfigSchema.partial().refine((value) => Object.keys(value).length > 0, "Provide at least one config field.").optional().describe("Partial detection config. Percent mode requires comparisonDeltaSeconds. Selecting Static or Dynamic clears the comparison delta. Changing detectionType also requires compatible conditionGroup."),
15934
+ conditionGroup: metricMonitorConditionGroupSchema.optional().describe("Replaces ALL detection conditions; preserve existing IDs. Static/Percent use numeric comparisons, results 75 critical, 50 warning, 0 resolved, including a resolution condition. Percent 110 means 10% higher. Dynamic uses anomaly_detection with sensitivity, seasonality:auto and thresholdType 0 above, 1 below, 2 both."),
15935
+ workflowIds: zod.z.array(zod.z.string().regex(/^\d+$/)).optional().describe("Replaces this monitor's Alert connections. Copy all IDs to retain from get_metric_monitor_details; [] disconnects all. Does not edit the Alerts themselves.")
15936
+ };
15937
+ const metricMonitorCreateFields = {
15938
+ name: metricMonitorConfigFields.name.unwrap(),
15939
+ description: metricMonitorConfigFields.description,
15940
+ owner: metricMonitorConfigFields.owner,
15941
+ query: metricMonitorQuerySchema.extend({ environment: metricMonitorQuerySchema.shape.environment.default(null) }).describe("Complete query: dataset, aggregate, filter, eventTypes and timeWindowSeconds. metrics is crash-free Releases; events_analytics_platform supports spans, logs and application metrics via eventTypes. Omitted environment means all environments."),
15942
+ config: metricMonitorDetectionConfigSchema.describe("Detection mode. Percent requires comparisonDeltaSeconds. Static and Dynamic do not use a comparison delta."),
15943
+ conditionGroup: metricMonitorConditionGroupSchema.omit({ id: true }).extend({
15944
+ logicType: zod.z.literal("any").default("any"),
15945
+ conditions: zod.z.array(zod.z.discriminatedUnion("type", [thresholdCondition.omit({ id: true }), anomalyCondition.omit({ id: true })])).min(1).max(3)
15946
+ }).describe("Complete conditions, using logicType any. Copied group and condition IDs are discarded. Static/Percent require thresholds and resolution (results 75 critical, 50 warning, 0 resolved). Percent 110 means 10% higher. Dynamic requires one anomaly_detection condition: sensitivity, seasonality:auto, thresholdType 0 above/1 below/2 both."),
15947
+ workflowIds: metricMonitorConfigFields.workflowIds.default([]).describe("Existing notification Alert IDs to connect. Omit or pass [] to create without connected Alerts. Use find_alert_rules(kind='issue') to find workflow IDs.")
15948
+ };
15949
+ /** Convert partial tool input to the native detector write contract, preserving omitted fields. */
15950
+ function toMetricMonitorUpdate(current, params) {
15951
+ const { status, query, config, conditionGroup,...metadata } = params;
15952
+ const body = Object.fromEntries(Object.entries(metadata).filter(([, value]) => value !== void 0));
15953
+ if (status !== void 0) body.enabled = status === "active";
15954
+ if (query !== void 0) {
15955
+ const sources = current.dataSources ?? [];
15956
+ const existing = sources.length === 1 ? getMetricQuery(sources[0]) : null;
15957
+ if (!existing) throw new UserInputError("This monitor's query is unavailable or has multiple sources; cannot safely update it.");
15958
+ const { timeWindowSeconds,...merged } = {
15959
+ ...existing,
15960
+ ...query
15961
+ };
15962
+ body.dataSources = [{
15963
+ ...merged,
15964
+ timeWindow: timeWindowSeconds
15965
+ }];
15966
+ }
15967
+ if (config !== void 0 || conditionGroup !== void 0) {
15968
+ if (config?.detectionType !== void 0 && config.detectionType !== current.config.detectionType && !conditionGroup) throw new UserInputError("Changing detectionType requires a compatible conditionGroup. Inspect get_metric_monitor_details first.");
15969
+ body.config = toMetricDetectionConfig(config ?? {}, conditionGroup?.conditions ?? conditionGroupSchema$1.parse(current.conditionGroup).conditions, current.config);
15970
+ if (conditionGroup !== void 0) body.conditionGroup = conditionGroup;
15971
+ }
15972
+ if (Object.keys(body).length === 0) throw new UserInputError("Provide at least one field to update on the Metric Monitor.");
15973
+ return body;
15974
+ }
15975
+ /** Map detection config to native units and validate its effective conditions. */
15976
+ function toMetricDetectionConfig(config, conditions, current = {}) {
15977
+ const { comparisonDeltaSeconds,...changes } = config;
15978
+ const result = {
15979
+ ...current,
15980
+ ...changes
15981
+ };
15982
+ if (comparisonDeltaSeconds !== void 0) result.comparisonDelta = comparisonDeltaSeconds;
15983
+ if (result.detectionType !== "percent") {
15984
+ if (comparisonDeltaSeconds != null) throw new UserInputError("comparisonDeltaSeconds is only supported for Percent detection.");
15985
+ if (config.detectionType !== void 0) result.comparisonDelta = null;
15986
+ }
15987
+ const dynamic = result.detectionType === "dynamic";
15988
+ if (dynamic && conditions.length !== 1) throw new UserInputError("Dynamic detection requires exactly one anomaly_detection condition.");
15989
+ if (conditions.some((condition$1) => condition$1.type === "anomaly_detection" !== dynamic)) throw new UserInputError("conditionGroup must match detectionType: Dynamic requires anomaly_detection; Static and Percent require numeric threshold conditions.");
15990
+ if (result.detectionType === "percent" && !(typeof result.comparisonDelta === "number" && result.comparisonDelta > 0)) throw new UserInputError("Percent detection requires comparisonDeltaSeconds.");
15991
+ return result;
15992
+ }
15993
+
15994
+ //#endregion
15995
+ //#region ../mcp-core/dist/create-metric-monitor-Bs7AJsRO.js
15996
+ var create_metric_monitor_default = defineTool({
15997
+ name: "create_metric_monitor",
15998
+ skills: ["project-management"],
15999
+ requiredScopes: [
16000
+ "org:read",
16001
+ "project:read",
16002
+ "alerts:write"
16003
+ ],
16004
+ description: [
16005
+ "Create a Sentry Metric Monitor with Static, Percent or Dynamic detection in a project.",
16006
+ "Provide the complete query, detection config and conditions. Time windows and comparison deltas use seconds. Percent comparisons are absolute: 110 means 10% higher.",
16007
+ "To copy a monitor, use the query, config and conditionGroup from get_metric_monitor_details. Component IDs are discarded; new condition groups use logicType='any'.",
16008
+ "New monitors start ACTIVE and immediately evaluate data. Initially disabled creation is not supported. Use update_metric_monitor to disable an existing monitor.",
16009
+ "workflowIds optionally connect existing notification Alerts, including shared Alerts, without modifying their configuration. Create an Alert separately with create_alert_rule if needed.",
16010
+ "Dataset access, quota, aggregate, window and historical-data requirements are enforced by Sentry. Dynamic detection requires sufficient history and Seer availability.",
16011
+ "Creation can fail after persisting a monitor, especially during Dynamic setup. After an error or timeout, use find_metric_monitors with the name and project before retrying; do not assume rollback or blindly repeat creation.",
16012
+ "create_metric_monitor(organizationSlug='my-org', projectSlug='backend', name='High error count', query={dataset:'events', query:'level:error', aggregate:'count()', eventTypes:['error'], timeWindowSeconds:300}, config={detectionType:'static'}, conditionGroup={conditions:[{type:'gt', comparison:100, conditionResult:75}, {type:'lte', comparison:50, conditionResult:0}]})"
16013
+ ].join("\n"),
16014
+ inputSchema: {
16015
+ organizationSlug: ParamOrganizationSlug,
16016
+ regionUrl: ParamRegionUrl.nullable().default(null),
16017
+ projectSlug: ParamProjectSlug,
16018
+ ...metricMonitorCreateFields
16019
+ },
16020
+ outputSchema: zod.z.object({
16021
+ monitor: metricMonitorDetailsSchema,
16022
+ guidance: zod.z.string().optional()
16023
+ }),
16024
+ annotations: {
16025
+ readOnlyHint: false,
16026
+ destructiveHint: false,
16027
+ idempotentHint: false,
16028
+ openWorldHint: true
16029
+ },
16030
+ async handler(params, context$1) {
16031
+ assertProjectRefWithinConstraint({
16032
+ resourceLabel: "Metric Monitor",
16033
+ scopedProjectSlug: context$1.constraints.projectSlug,
16034
+ project: { slug: params.projectSlug }
16035
+ });
16036
+ const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
16037
+ setOrganizationContext(params.organizationSlug);
16038
+ (0, __sentry_core.setTag)("project.slug", params.projectSlug);
16039
+ const { timeWindowSeconds,...query } = params.query;
16040
+ const body = {
16041
+ type: "metric_issue",
16042
+ name: params.name,
16043
+ description: params.description,
16044
+ owner: params.owner,
16045
+ config: toMetricDetectionConfig(params.config, params.conditionGroup.conditions),
16046
+ conditionGroup: params.conditionGroup,
16047
+ dataSources: [{
16048
+ ...query,
16049
+ timeWindow: timeWindowSeconds
16050
+ }],
16051
+ workflowIds: params.workflowIds
16052
+ };
16053
+ let created;
16054
+ try {
16055
+ created = await api.createMetricMonitor({
16056
+ organizationSlug: params.organizationSlug,
16057
+ projectSlug: params.projectSlug,
16058
+ body
16059
+ });
16060
+ } catch (error) {
16061
+ if (error instanceof Error) error.message += "\nCreation may have partially succeeded. Use find_metric_monitors with the name and project before retrying; inspect or delete any created monitor first.";
16062
+ throw error;
16063
+ }
16064
+ const monitor = toMetricMonitorDetails(api, params.organizationSlug, created);
16065
+ return structuredResult({
16066
+ monitor,
16067
+ ...monitor.workflowIds.length === 0 ? { guidance: "This monitor has no connected Alerts. Connect an Alert with update_metric_monitor to configure notifications." } : {}
16068
+ });
16069
+ }
16070
+ });
16071
+
16072
+ //#endregion
16073
+ //#region ../mcp-core/dist/update-metric-monitor-CiKmGFny.js
16074
+ var update_metric_monitor_default = defineTool({
16075
+ name: "update_metric_monitor",
16076
+ skills: ["project-management"],
16077
+ requiredScopes: [
16078
+ "org:read",
16079
+ "project:read",
16080
+ "alerts:write"
16081
+ ],
16082
+ description: [
16083
+ "Update a Sentry Metric Monitor's query, detection conditions, metadata, status or connected Alerts.",
16084
+ "Use get_metric_monitor_details first and its native monitorId, not a legacy metric alert ID. projectSlug identifies scope; it does not move the monitor.",
16085
+ "Omit fields to preserve them. query and config accept partial changes. conditionGroup and workflowIds replace their complete configuration; preserve IDs and entries you want to retain.",
16086
+ "Static, Percent and Dynamic detection are supported. Windows and comparison deltas are in seconds. Percent thresholds are absolute (110 means 10% higher), not percentage changes.",
16087
+ "Dynamic changes may require sufficient historical data. Dataset access, query and window constraints are enforced by Sentry.",
16088
+ "workflowIds connect existing Alerts, including shared Alerts, without editing their actions or other monitors. Use update_alert_rule for notification configuration.",
16089
+ "Requires alerts:write; reconnect OAuth if the existing token lacks it.",
16090
+ "update_metric_monitor(organizationSlug='my-org', monitorId='12345', status='disabled')",
16091
+ "update_metric_monitor(organizationSlug='my-org', monitorId='12345', query={query:'level:error', timeWindowSeconds:300})"
16092
+ ].join("\n"),
16093
+ inputSchema: {
16094
+ ...metricMonitorReferenceFields,
16095
+ ...metricMonitorConfigFields
16096
+ },
16097
+ outputSchema: zod.z.object({ monitor: metricMonitorDetailsSchema }),
16098
+ annotations: {
16099
+ readOnlyHint: false,
16100
+ destructiveHint: true,
16101
+ idempotentHint: false,
16102
+ openWorldHint: true
16103
+ },
16104
+ async handler(params, context$1) {
16105
+ const { organizationSlug, regionUrl, monitorId, projectSlug: requestedProject,...changes } = params;
16106
+ const projectSlug$1 = context$1.constraints.projectSlug ?? requestedProject;
16107
+ setOrganizationContext(organizationSlug);
16108
+ if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
16109
+ const api = apiServiceFromContext(context$1, { regionUrl: regionUrl ?? void 0 });
16110
+ const current = await getMetricMonitor(api, {
16111
+ organizationSlug,
16112
+ monitorId,
16113
+ projectSlug: requestedProject,
16114
+ scopedProjectSlug: context$1.constraints.projectSlug
16115
+ });
16116
+ const updated = await api.updateMetricMonitor({
16117
+ organizationSlug,
16118
+ monitorId,
16119
+ body: toMetricMonitorUpdate(current, changes)
16120
+ });
16121
+ return structuredResult({ monitor: toMetricMonitorDetails(api, organizationSlug, updated) });
16122
+ }
16123
+ });
16124
+
16125
+ //#endregion
16126
+ //#region ../mcp-core/dist/delete-metric-monitor-CnILGM5O.js
16127
+ var delete_metric_monitor_default = defineTool({
16128
+ name: "delete_metric_monitor",
16129
+ skills: ["project-management"],
16130
+ requiredScopes: [
16131
+ "org:read",
16132
+ "project:read",
16133
+ "alerts:write"
16134
+ ],
16135
+ description: [
16136
+ "Permanently delete a Sentry Metric Monitor, preserving its connected Alerts and their other monitors.",
16137
+ "Use get_metric_monitor_details to inspect the monitor and obtain its native monitorId. Legacy metric alert IDs are not monitor IDs.",
16138
+ "Use update_metric_monitor(status='disabled') to pause detection instead. Deletion also removes an associated legacy metric alert and its incident history when present.",
16139
+ "Sentry hides the monitor from normal reads immediately and completes deletion in the background.",
16140
+ "delete_metric_monitor(organizationSlug='my-org', monitorId='12345')"
16141
+ ].join("\n"),
16142
+ inputSchema: metricMonitorReferenceFields,
16143
+ outputSchema: zod.z.object({
16144
+ success: zod.z.literal(true),
16145
+ monitorId: zod.z.string()
16146
+ }),
16147
+ annotations: {
16148
+ readOnlyHint: false,
16149
+ destructiveHint: true,
16150
+ idempotentHint: true,
16151
+ openWorldHint: true
16152
+ },
16153
+ async handler(params, context$1) {
16154
+ const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
16155
+ setOrganizationContext(params.organizationSlug);
16156
+ await getMetricMonitor(api, {
16157
+ ...params,
16158
+ scopedProjectSlug: context$1.constraints.projectSlug
16159
+ });
16160
+ await api.deleteMetricMonitor({
16161
+ organizationSlug: params.organizationSlug,
16162
+ monitorId: params.monitorId
16163
+ });
16164
+ return structuredResult({
16165
+ success: true,
16166
+ monitorId: params.monitorId
16167
+ });
16168
+ }
16169
+ });
16170
+
16171
+ //#endregion
16172
+ //#region ../mcp-core/dist/create-uptime-monitor-Dhp0SDV_.js
15589
16173
  const createUptimeMonitorOutputSchema = zod.z.object({ monitor: uptimeMonitorSummarySchema });
15590
16174
  var create_uptime_monitor_default = defineTool({
15591
16175
  name: "create_uptime_monitor",
@@ -15666,7 +16250,7 @@ var create_uptime_monitor_default = defineTool({
15666
16250
  });
15667
16251
 
15668
16252
  //#endregion
15669
- //#region ../mcp-core/dist/update-uptime-monitor-Borxg5io.js
16253
+ //#region ../mcp-core/dist/update-uptime-monitor-200hEimx.js
15670
16254
  const updateUptimeMonitorOutputSchema = zod.z.object({ monitor: uptimeMonitorSummarySchema });
15671
16255
  function hasDefinedUpdate(value) {
15672
16256
  return value !== void 0;
@@ -15757,7 +16341,7 @@ var update_uptime_monitor_default = defineTool({
15757
16341
  });
15758
16342
 
15759
16343
  //#endregion
15760
- //#region ../mcp-core/dist/delete-uptime-monitor-CpzZ4G3P.js
16344
+ //#region ../mcp-core/dist/delete-uptime-monitor-Ccj4Oh8W.js
15761
16345
  const deleteUptimeMonitorOutputSchema = zod.z.object({
15762
16346
  success: zod.z.literal(true),
15763
16347
  uptimeMonitorId: zod.z.string(),
@@ -15816,12 +16400,12 @@ var delete_uptime_monitor_default = defineTool({
15816
16400
  });
15817
16401
 
15818
16402
  //#endregion
15819
- //#region ../mcp-core/dist/find-alert-rules-Dc55EgzE.js
16403
+ //#region ../mcp-core/dist/find-alert-rules-B0eNUZYx.js
15820
16404
  const AlertRuleKind$1 = zod.z.enum([
15821
16405
  "all",
15822
16406
  "issue",
15823
16407
  "metric"
15824
- ]).describe("Which alert rule family to search. Use `all` to include Alerts (workflows) and legacy metric alerts.");
16408
+ ]).describe("Which alert rule family to search. Use `all` to include Alerts (workflows) and Metric Monitors.");
15825
16409
  const issueAlertRuleSummarySchema = zod.z.object({
15826
16410
  id: zod.z.string(),
15827
16411
  name: zod.z.string(),
@@ -15837,14 +16421,16 @@ const issueAlertRuleSummarySchema = zod.z.object({
15837
16421
  webUrl: zod.z.string()
15838
16422
  });
15839
16423
  const metricAlertRuleSummarySchema = zod.z.object({
15840
- id: zod.z.string(),
16424
+ id: zod.z.string().describe("Legacy alert-rule ID when available, otherwise detector:<monitorId>."),
16425
+ monitorId: zod.z.string(),
16426
+ projectId: zod.z.string().nullable(),
16427
+ enabled: zod.z.boolean(),
15841
16428
  name: zod.z.string(),
15842
- status: zod.z.union([zod.z.string(), zod.z.number()]).nullable(),
16429
+ status: zod.z.enum(["enabled", "disabled"]),
15843
16430
  dataset: zod.z.string().nullable(),
15844
16431
  aggregate: zod.z.string().nullable(),
15845
16432
  query: zod.z.string().nullable(),
15846
16433
  timeWindowMinutes: zod.z.number().nullable(),
15847
- projects: zod.z.array(zod.z.string()),
15848
16434
  environment: zod.z.string().nullable(),
15849
16435
  owner: zod.z.string().nullable(),
15850
16436
  dateCreated: zod.z.string().nullable(),
@@ -15858,7 +16444,7 @@ const findAlertRulesOutputSchema = zod.z.object({
15858
16444
  issue: paginationStateSchema.nullable(),
15859
16445
  metric: paginationStateSchema.nullable()
15860
16446
  }),
15861
- warnings: zod.z.array(zod.z.string()).optional()
16447
+ metricMonitorHint: zod.z.string().optional()
15862
16448
  });
15863
16449
  function getIssueAlertRuleFrequency(rule) {
15864
16450
  if (typeof rule.frequency === "number") return rule.frequency;
@@ -15882,7 +16468,7 @@ var find_alert_rules_default = defineTool({
15882
16468
  "",
15883
16469
  "Use this tool when you need to:",
15884
16470
  "- List Alerts (workflows) for an organization or project, including Alerts without connected sources",
15885
- "- List metric alert rules for an organization or project",
16471
+ "- List Metric Monitors using compatibility references; prefer find_metric_monitors for canonical monitor IDs",
15886
16472
  "- Find an alert rule ID by name before inspecting it",
15887
16473
  "- Check alert conditions, queries, triggers, actions, owner, or environment",
15888
16474
  "",
@@ -15894,7 +16480,7 @@ var find_alert_rules_default = defineTool({
15894
16480
  "",
15895
16481
  "<hints>",
15896
16482
  "- 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.",
16483
+ "- Metric entries expose monitorId and projectId. id retains a legacy alert-rule ID when available, otherwise detector:<monitorId>. status describes enabled/disabled monitoring, not a legacy alert status.",
15898
16484
  "- Issue and metric alert rules have independent pagination state. Reuse a nextCursor only with its matching kind.",
15899
16485
  "</hints>"
15900
16486
  ].join("\n"),
@@ -15938,17 +16524,12 @@ var find_alert_rules_default = defineTool({
15938
16524
  rules: [],
15939
16525
  nextCursor: null
15940
16526
  };
15941
- const warnings = [];
15942
- const metricPage = includeMetric ? await apiService.listMetricAlertRulesPage({
16527
+ const metricPage = includeMetric ? await listMetricMonitors(apiService, {
15943
16528
  organizationSlug,
15944
16529
  projectSlug: projectSlug$1,
15945
- query: params.query ?? void 0,
16530
+ query: params.query ? `name:${JSON.stringify(`*${params.query}*`)}` : void 0,
15946
16531
  cursor: params.cursor ?? void 0,
15947
16532
  limit: params.limit
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
16533
  }) : null;
15953
16534
  return structuredResult({
15954
16535
  issueRules: issuePage.rules.map((rule) => ({
@@ -15965,60 +16546,47 @@ var find_alert_rules_default = defineTool({
15965
16546
  lastTriggered: formatDate(rule.lastTriggered),
15966
16547
  webUrl: apiService.getIssueAlertRuleUrl(organizationSlug, rule.id)
15967
16548
  })),
15968
- metricRules: (metricPage?.rules ?? []).map((rule) => ({
15969
- id: String(rule.id),
15970
- name: rule.name,
15971
- status: rule.status ?? null,
15972
- dataset: rule.dataset ?? null,
15973
- aggregate: rule.aggregate ?? null,
15974
- query: rule.query ?? null,
15975
- timeWindowMinutes: rule.timeWindow ?? null,
15976
- projects: rule.projects,
15977
- environment: rule.environment ?? null,
15978
- owner: getOwner(rule.owner),
15979
- dateCreated: formatDate(rule.dateCreated),
15980
- webUrl: apiService.getMetricAlertRuleUrl(organizationSlug, rule.id)
15981
- })),
16549
+ metricRules: (metricPage?.detectors ?? []).map((detector) => {
16550
+ const monitor = toMetricMonitorDetails(apiService, organizationSlug, detector);
16551
+ const source = monitor.dataSources.find((source$1) => source$1.type === "snuba_query_subscription");
16552
+ const query = source && "query" in source ? source.query : void 0;
16553
+ return {
16554
+ id: getMetricMonitorReference(detector),
16555
+ monitorId: monitor.id,
16556
+ projectId: monitor.projectId,
16557
+ enabled: monitor.enabled,
16558
+ name: monitor.name,
16559
+ status: monitor.enabled ? "enabled" : "disabled",
16560
+ dataset: query?.dataset ?? null,
16561
+ aggregate: query?.aggregate ?? null,
16562
+ query: query?.query ?? null,
16563
+ timeWindowMinutes: query ? query.timeWindowSeconds / 60 : null,
16564
+ environment: query?.environment ?? null,
16565
+ owner: monitor.owner,
16566
+ dateCreated: monitor.dateCreated,
16567
+ webUrl: monitor.webUrl
16568
+ };
16569
+ }),
15982
16570
  pagination: {
15983
16571
  issue: includeIssue ? { nextCursor: issuePage.nextCursor } : null,
15984
16572
  metric: metricPage ? { nextCursor: metricPage.nextCursor } : null
15985
16573
  },
15986
- ...warnings.length > 0 ? { warnings } : {}
16574
+ ...includeMetric ? { metricMonitorHint: "Use get_metric_monitor_details with monitorId. Legacy get_alert_rule(kind=metric) accepts each entry's id; never pass monitorId as a bare legacy ID." } : {}
15987
16575
  });
15988
16576
  }
15989
16577
  });
15990
16578
 
15991
16579
  //#endregion
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
- });
16580
+ //#region ../mcp-core/dist/alert-rule-details-CR0CKQr6.js
16581
+ const componentId$1 = zod.z.union([zod.z.string(), zod.z.number()]);
16005
16582
  const actionGroupSchema = conditionGroupSchema$1.extend({ actions: zod.z.array(zod.z.object({
16006
- id: componentId.optional(),
16583
+ id: componentId$1.optional(),
16007
16584
  type: zod.z.string(),
16008
- integrationId: componentId.nullable().optional(),
16585
+ integrationId: componentId$1.nullable().optional(),
16009
16586
  config: zod.z.record(zod.z.string(), zod.z.unknown()),
16010
16587
  data: zod.z.record(zod.z.string(), zod.z.unknown()),
16011
16588
  status: zod.z.string().optional()
16012
16589
  })) });
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
16590
  const uptimeQuerySchema = zod.z.object({
16023
16591
  url: zod.z.string(),
16024
16592
  method: zod.z.string(),
@@ -16058,16 +16626,11 @@ function sourceDetails(source) {
16058
16626
  };
16059
16627
  if (!isPlainObject$3(query)) return unavailable;
16060
16628
  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 {
16629
+ const metricQuery = getMetricQuery(source);
16630
+ return metricQuery ? {
16065
16631
  type,
16066
- query: {
16067
- ...config,
16068
- timeWindowSeconds: timeWindow
16069
- }
16070
- };
16632
+ query: metricQuery
16633
+ } : unavailable;
16071
16634
  }
16072
16635
  if (type === "uptime_subscription") {
16073
16636
  const parsed = uptimeQuerySchema.safeParse(query);
@@ -16158,158 +16721,9 @@ async function getAlertRuleDetails(api, organizationSlug, rule, scopedProjectSlu
16158
16721
  }
16159
16722
 
16160
16723
  //#endregion
16161
- //#region ../mcp-core/dist/alerts-Cv9MFDEC.js
16162
- const NUMERIC_ID_PATTERN = /^\d+$/;
16163
- const COMPONENT_DETAIL_SKIP_KEYS = new Set([
16164
- "id",
16165
- "type",
16166
- "conditions",
16167
- "actions"
16168
- ]);
16169
- const WORKFLOW_GROUP_DETAIL_SKIP_KEYS = new Set([
16170
- "id",
16171
- "type",
16172
- "logicType",
16173
- "conditions",
16174
- "actions"
16175
- ]);
16724
+ //#region ../mcp-core/dist/alerts-BTOF3LY7.js
16176
16725
  function isNumericAlertRuleId(value) {
16177
- return NUMERIC_ID_PATTERN.test(value);
16178
- }
16179
- function humanizeKey(value) {
16180
- if (value === "conditionResult") return "result";
16181
- if (value === "targetIdentifier") return "target";
16182
- if (value === "alertThreshold") return "threshold";
16183
- return value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
16184
- }
16185
- function humanizeValue(value) {
16186
- const normalized = value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim();
16187
- if (!normalized) return value;
16188
- return normalized.charAt(0).toUpperCase() + normalized.slice(1);
16189
- }
16190
- function formatScalar(value) {
16191
- if (typeof value === "string") {
16192
- const trimmed = value.trim();
16193
- return trimmed ? trimmed : null;
16194
- }
16195
- if (typeof value === "number" || typeof value === "boolean") return formatUnknown(value);
16196
- return null;
16197
- }
16198
- function formatDetailValue(value) {
16199
- if (Array.isArray(value)) {
16200
- const items = value.map(formatDetailValue).filter((item) => item !== null);
16201
- return items.length > 0 ? items.join(", ") : null;
16202
- }
16203
- if (isPlainObject$3(value)) {
16204
- const details = Object.entries(value).filter(([key]) => key !== "id").map(([key, item]) => {
16205
- const formatted = formatDetailValue(item);
16206
- return formatted ? `${humanizeKey(key)}: ${formatted}` : null;
16207
- }).filter((item) => item !== null);
16208
- return details.length > 0 ? details.join(", ") : null;
16209
- }
16210
- return formatScalar(value);
16211
- }
16212
- function shouldSkipDetail(key, value) {
16213
- return key === "targetDisplay" && typeof value === "string" && value.toLowerCase() === "unknown";
16214
- }
16215
- function getComponentDetailEntries(component, skippedKeys) {
16216
- const detailEntries = [];
16217
- for (const [key, value] of Object.entries(component)) if (!skippedKeys.has(key) && value !== void 0 && value !== null && !shouldSkipDetail(key, value)) {
16218
- if (key === "config" && isPlainObject$3(value)) {
16219
- detailEntries.push(...Object.entries(value).filter(([configKey, configValue]) => !shouldSkipDetail(configKey, configValue)));
16220
- continue;
16221
- }
16222
- detailEntries.push([key, value]);
16223
- }
16224
- return detailEntries;
16225
- }
16226
- function formatComponentDetails(component, skippedKeys) {
16227
- const details = getComponentDetailEntries(component, skippedKeys).map(([key, value]) => {
16228
- const formatted = formatDetailValue(value);
16229
- return formatted ? `${humanizeKey(key)}: ${formatted}` : null;
16230
- }).filter((item) => item !== null).join(", ");
16231
- return details || null;
16232
- }
16233
- function formatComponent(component) {
16234
- const type = typeof component.type === "string" ? component.type : null;
16235
- const label = type ? humanizeValue(type) : "Component";
16236
- const details = formatComponentDetails(component, COMPONENT_DETAIL_SKIP_KEYS);
16237
- if (!details) return label;
16238
- return `${label} (${details})`;
16239
- }
16240
- function singularizeComponentLabel(label) {
16241
- if (label.endsWith("ies")) return `${label.slice(0, -3)}y`;
16242
- if (label.endsWith("s")) return label.slice(0, -1);
16243
- return label;
16244
- }
16245
- function formatThresholdTrigger(component) {
16246
- const label = formatScalar(component.label);
16247
- const threshold = formatScalar(component.alertThreshold);
16248
- const resolveThreshold = formatScalar(component.resolveThreshold);
16249
- if (!threshold) return null;
16250
- const thresholdLabel = label ? `${humanizeValue(label)} threshold` : "Threshold";
16251
- return resolveThreshold ? `${thresholdLabel}: ${threshold}; resolves below: ${resolveThreshold}` : `${thresholdLabel}: ${threshold}`;
16252
- }
16253
- function formatWorkflowGroup(component, componentLabel) {
16254
- const lines = [];
16255
- const logicType = typeof component.logicType === "string" ? component.logicType : null;
16256
- if (logicType) lines.push(`- Logic: ${logicType}`);
16257
- const componentDetails = componentLabel === "Trigger" ? formatThresholdTrigger(component) ?? formatComponentDetails(component, WORKFLOW_GROUP_DETAIL_SKIP_KEYS) : formatComponentDetails(component, WORKFLOW_GROUP_DETAIL_SKIP_KEYS);
16258
- if (componentDetails) lines.push(`- ${componentLabel}: ${componentDetails}`);
16259
- const conditions = readComponentList(component.conditions);
16260
- if (conditions?.length) {
16261
- lines.push(`- Conditions: ${conditions.slice(0, 5).map(formatComponent).join("; ")}`);
16262
- if (conditions.length > 5) lines.push(`- ...and ${conditions.length - 5} more conditions`);
16263
- }
16264
- const actions = readComponentList(component.actions);
16265
- if (actions?.length) {
16266
- lines.push(`- Actions: ${actions.slice(0, 5).map(formatComponent).join("; ")}`);
16267
- if (actions.length > 5) lines.push(`- ...and ${actions.length - 5} more actions`);
16268
- }
16269
- if (lines.length === 0) lines.push(`- ${formatComponent(component)}`);
16270
- return lines;
16271
- }
16272
- function readComponentList(value) {
16273
- if (!Array.isArray(value)) return void 0;
16274
- return value.filter(isPlainObject$3);
16275
- }
16276
- function formatComponentSummary(label, components, headingLevel) {
16277
- if (!components || components.length === 0) return [];
16278
- const heading = "#".repeat(Math.min(headingLevel, 6));
16279
- const lines = [
16280
- "",
16281
- `${heading} ${label}`,
16282
- ""
16283
- ];
16284
- const componentLabel = singularizeComponentLabel(label);
16285
- for (const component of components.slice(0, 5)) lines.push(...formatWorkflowGroup(component, componentLabel));
16286
- if (components.length > 5) lines.push(`- ...and ${components.length - 5} more`);
16287
- return lines;
16288
- }
16289
- function formatMetricAlertRule(rule, options = {}) {
16290
- const headingLevel = options.headingLevel ?? 2;
16291
- const includeComponents = options.includeComponents ?? true;
16292
- const heading = "#".repeat(Math.min(headingLevel, 6));
16293
- const owner = rule.owner ? formatActor(rule.owner) : null;
16294
- const projects = rule.projects ?? [];
16295
- const lines = compactLines([
16296
- `${heading} ${rule.name}`,
16297
- "",
16298
- `**Kind**: Metric Alert`,
16299
- `**ID**: ${formatId(rule.id)}`,
16300
- rule.status !== void 0 ? `**Status**: ${formatUnknown(rule.status)}` : null,
16301
- rule.dataset ? `**Dataset**: ${rule.dataset}` : null,
16302
- rule.aggregate ? `**Aggregate**: ${rule.aggregate}` : null,
16303
- rule.query ? `**Query**: ${rule.query}` : null,
16304
- rule.timeWindow !== void 0 && rule.timeWindow !== null ? `**Time Window**: ${rule.timeWindow} minutes` : null,
16305
- projects.length > 0 ? `**Projects**: ${projects.join(", ")}` : null,
16306
- rule.environment ? `**Environment**: ${rule.environment}` : null,
16307
- owner ? `**Owner**: ${owner}` : null,
16308
- formatDate(rule.dateCreated) ? `**Created**: ${formatDate(rule.dateCreated)}` : null,
16309
- options.url ? `**URL**: ${options.url}` : null
16310
- ]);
16311
- if (includeComponents) lines.push(...formatComponentSummary("Triggers", rule.triggers, headingLevel + 1));
16312
- return lines.join("\n");
16726
+ return /^\d+$/.test(value);
16313
16727
  }
16314
16728
  /** Resolve case-insensitive names only when the search results are complete. */
16315
16729
  async function findExactIssueAlertRuleMatches(apiService, params) {
@@ -16322,15 +16736,6 @@ async function findExactIssueAlertRuleMatches(apiService, params) {
16322
16736
  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
16737
  return page.rules.filter((rule) => rule.name.toLowerCase() === params.ruleName.toLowerCase());
16324
16738
  }
16325
- async function findExactMetricAlertRuleMatches(apiService, params) {
16326
- const rules = await apiService.listMetricAlertRules({
16327
- organizationSlug: params.organizationSlug,
16328
- projectSlug: params.projectSlug,
16329
- query: params.ruleName,
16330
- limit: 100
16331
- });
16332
- return rules.filter((rule) => rule.name.toLowerCase() === params.ruleName.toLowerCase());
16333
- }
16334
16739
  async function resolveIssueAlertRule(apiService, params) {
16335
16740
  if (isNumericAlertRuleId(params.ruleIdOrName)) try {
16336
16741
  return await apiService.getIssueAlertRule({
@@ -16354,43 +16759,47 @@ async function resolveIssueAlertRule(apiService, params) {
16354
16759
  if (matches.length > 1) throw new UserInputError(`Multiple issue alert rules named "${params.ruleIdOrName}" were found. Retry with the numeric rule ID.`);
16355
16760
  throw new UserInputError(`Issue alert rule "${params.ruleIdOrName}" was not found${params.projectSlug ? ` in project ${params.projectSlug}` : ""}.`);
16356
16761
  }
16762
+ /** Bare numeric references retain their legacy alert-rule identity. */
16357
16763
  async function resolveMetricAlertRule(apiService, params) {
16358
- if (isNumericAlertRuleId(params.ruleIdOrName)) try {
16359
- return await apiService.getMetricAlertRule({
16360
- organizationSlug: params.organizationSlug,
16361
- ruleId: params.ruleIdOrName
16764
+ const { organizationSlug, projectSlug: projectSlug$1, ruleIdOrName } = params;
16765
+ let monitorId;
16766
+ if (/^detector:\d+$/.test(ruleIdOrName)) monitorId = ruleIdOrName.slice(9);
16767
+ else if (isNumericAlertRuleId(ruleIdOrName)) try {
16768
+ monitorId = await apiService.getDetectorForAlertRule({
16769
+ organizationSlug,
16770
+ alertRuleId: ruleIdOrName
16362
16771
  });
16363
16772
  } catch (error) {
16364
- if (!(error instanceof ApiNotFoundError)) throw error;
16773
+ if (!(error instanceof ApiClientError) || error.status !== 404 && error.status !== 410) throw error;
16774
+ throw new UserInputError(`Legacy metric alert "${ruleIdOrName}" could not be mapped to a monitor. Use find_metric_monitors, then get_metric_monitor_details with its monitor ID.`);
16365
16775
  }
16366
- const matches = await findExactMetricAlertRuleMatches(apiService, {
16367
- organizationSlug: params.organizationSlug,
16368
- projectSlug: params.projectSlug,
16369
- ruleName: params.ruleIdOrName
16370
- });
16371
- if (matches.length === 1) return apiService.getMetricAlertRule({
16372
- organizationSlug: params.organizationSlug,
16373
- ruleId: matches[0].id
16776
+ else {
16777
+ const matches = await findExactMetricMonitorMatches(apiService, {
16778
+ organizationSlug,
16779
+ projectSlug: projectSlug$1,
16780
+ name: ruleIdOrName
16781
+ });
16782
+ if (matches.length !== 1) throw new UserInputError(matches.length > 1 ? `Multiple metric monitors named "${ruleIdOrName}" were found. Use find_metric_monitors and get_metric_monitor_details with a monitor ID.` : `Metric monitor "${ruleIdOrName}" was not found. Use find_metric_monitors to find its monitor ID.`);
16783
+ monitorId = matches[0].id;
16784
+ }
16785
+ return getMetricMonitor(apiService, {
16786
+ organizationSlug,
16787
+ projectSlug: projectSlug$1,
16788
+ monitorId
16374
16789
  });
16375
- if (matches.length > 1) throw new UserInputError(`Multiple metric alert rules named "${params.ruleIdOrName}" were found. Retry with the numeric rule ID.`);
16376
- throw new UserInputError(`Metric alert rule "${params.ruleIdOrName}" was not found.`);
16377
16790
  }
16378
16791
 
16379
16792
  //#endregion
16380
- //#region ../mcp-core/dist/get-alert-rule-DOk7Olu5.js
16793
+ //#region ../mcp-core/dist/get-alert-rule-3MdBC-Ec.js
16381
16794
  const AlertRuleKind = zod.z.enum([
16382
16795
  "all",
16383
16796
  "issue",
16384
16797
  "metric"
16385
- ]).describe("Which alert rule family to inspect. Use `issue` or `metric` for numeric IDs; `all` treats the value as an exact-name lookup.");
16798
+ ]).describe("Which alert family to inspect. Numeric metric IDs are legacy alert-rule IDs, not monitor IDs. `all` performs an exact-name lookup.");
16386
16799
  function describeMatch(match) {
16387
16800
  const project = match.projectSlug ? ` project ${match.projectSlug}` : "";
16388
16801
  return `${match.kind} alert ${String(match.rule.id)} (${match.rule.name})${project}`;
16389
16802
  }
16390
- function assertMetricAlertRuleWithinProject(rule, projectSlug$1) {
16391
- if (!projectSlug$1) return;
16392
- if (!rule.projects?.includes(projectSlug$1)) throw new UserInputError(`Metric alert rule is outside project "${projectSlug$1}".`);
16393
- }
16394
16803
  var get_alert_rule_default = defineTool({
16395
16804
  name: "get_alert_rule",
16396
16805
  skills: ["inspect"],
@@ -16407,7 +16816,7 @@ var get_alert_rule_default = defineTool({
16407
16816
  "</examples>",
16408
16817
  "",
16409
16818
  "<hints>",
16410
- "- Use `kind='issue'` or `kind='metric'` for numeric IDs because issue and metric alerts use separate endpoints.",
16819
+ "- Prefer get_metric_monitor_details for Metric Monitors. With kind=metric, numeric IDs retain their legacy alert-rule meaning; detector:123 explicitly identifies monitor 123.",
16411
16820
  "- With `kind='all'`, a digit-only `ruleIdOrName` is treated as an exact alert rule name.",
16412
16821
  "- Issue Alerts are notification workflows and may cover multiple projects or have no connected sources. Omit projectSlug to inspect organization-wide.",
16413
16822
  "- Issue details include complete conditions, notification actions, connected monitors and project scope. Inaccessible or session-restricted sources are marked explicitly.",
@@ -16418,7 +16827,7 @@ var get_alert_rule_default = defineTool({
16418
16827
  regionUrl: ParamRegionUrl.nullable().default(null),
16419
16828
  kind: AlertRuleKind.default("all"),
16420
16829
  projectSlug: ParamProjectSlugOrAll.nullable().default(null),
16421
- ruleIdOrName: zod.z.string().trim().min(1).describe("The alert rule's numeric ID, or an exact alert rule name.")
16830
+ ruleIdOrName: zod.z.string().trim().min(1).describe("An Alert ID or exact name. Metric references accept legacy numeric alert-rule IDs or detector:123 for canonical monitor IDs.")
16422
16831
  },
16423
16832
  annotations: {
16424
16833
  readOnlyHint: true,
@@ -16437,7 +16846,6 @@ var get_alert_rule_default = defineTool({
16437
16846
  const organizationSlug = params.organizationSlug;
16438
16847
  setOrganizationContext(organizationSlug);
16439
16848
  if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
16440
- const warnings = [];
16441
16849
  let match;
16442
16850
  if (params.kind === "issue") {
16443
16851
  const rule = await resolveIssueAlertRule(apiService, {
@@ -16456,7 +16864,6 @@ var get_alert_rule_default = defineTool({
16456
16864
  projectSlug: projectSlug$1,
16457
16865
  ruleIdOrName: params.ruleIdOrName
16458
16866
  });
16459
- assertMetricAlertRuleWithinProject(rule, projectSlug$1);
16460
16867
  match = {
16461
16868
  kind: "metric",
16462
16869
  rule,
@@ -16474,25 +16881,18 @@ var get_alert_rule_default = defineTool({
16474
16881
  rule,
16475
16882
  projectSlug: projectSlug$1
16476
16883
  })));
16477
- try {
16478
- const metricPage = await apiService.listMetricAlertRulesPage({
16479
- organizationSlug,
16480
- projectSlug: projectSlug$1,
16481
- query: params.ruleIdOrName,
16482
- limit: 100
16483
- });
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",
16487
- rule,
16488
- projectSlug: projectSlug$1
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.");
16493
- }
16494
- if (matches.length === 0) throw new UserInputError(`Alert rule "${params.ruleIdOrName}" was not found.${warnings.length ? ` ${warnings.join(" ")}` : ""}`);
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.`);
16884
+ const metricMonitors = await findExactMetricMonitorMatches(apiService, {
16885
+ organizationSlug,
16886
+ projectSlug: projectSlug$1,
16887
+ name: params.ruleIdOrName
16888
+ });
16889
+ matches.push(...metricMonitors.map((rule) => ({
16890
+ kind: "metric",
16891
+ rule,
16892
+ projectSlug: projectSlug$1
16893
+ })));
16894
+ if (matches.length === 0) throw new UserInputError(`Alert rule "${params.ruleIdOrName}" was not found.`);
16895
+ if (matches.length > 1) throw new UserInputError(`Multiple alert rules named "${params.ruleIdOrName}" were found: ${matches.map(describeMatch).join(", ")}. Retry with the Alert ID and kind=issue, or use get_metric_monitor_details with the monitor ID.`);
16496
16896
  const [found] = matches;
16497
16897
  match = found.kind === "issue" ? {
16498
16898
  ...found,
@@ -16503,28 +16903,23 @@ var get_alert_rule_default = defineTool({
16503
16903
  })
16504
16904
  } : {
16505
16905
  ...found,
16506
- rule: await apiService.getMetricAlertRule({
16906
+ rule: await getMetricMonitor(apiService, {
16507
16907
  organizationSlug,
16508
- ruleId: found.rule.id
16908
+ projectSlug: projectSlug$1,
16909
+ monitorId: found.rule.id
16509
16910
  })
16510
16911
  };
16511
- if (match.kind === "metric") assertMetricAlertRuleWithinProject(match.rule, match.projectSlug);
16512
16912
  }
16513
- if (match.kind === "issue") return structuredResult({
16514
- alertRule: await getAlertRuleDetails(apiService, organizationSlug, match.rule, context$1.constraints.projectSlug),
16515
- ...warnings.length ? { warnings } : {}
16913
+ if (match.kind === "issue") return structuredResult({ alertRule: await getAlertRuleDetails(apiService, organizationSlug, match.rule, context$1.constraints.projectSlug) });
16914
+ return structuredResult({
16915
+ metricMonitor: toMetricMonitorDetails(apiService, organizationSlug, match.rule),
16916
+ guidance: "Use get_metric_monitor_details with this monitor's id for canonical Metric Monitor inspection. Connected notification Alerts are identified by workflowIds."
16516
16917
  });
16517
- const scopeLabel = projectSlug$1 ? `${organizationSlug}/${projectSlug$1}` : organizationSlug;
16518
- let output = `# Alert Rule in **${scopeLabel}**\n\n`;
16519
- output += formatMetricAlertRule(match.rule, { url: apiService.getMetricAlertRuleUrl(organizationSlug, match.rule.id) });
16520
- output += "\n\n## Response Notes\n\n";
16521
- output += "- Use these details to inspect alert conditions, filters, routing, and notification actions before changing the rule in Sentry.\n";
16522
- return output;
16523
16918
  }
16524
16919
  });
16525
16920
 
16526
16921
  //#endregion
16527
- //#region ../mcp-core/dist/get-alert-options-DaJVqiFn.js
16922
+ //#region ../mcp-core/dist/get-alert-options-D-dQOLAa.js
16528
16923
  const sectionSchema = zod.z.enum([
16529
16924
  "actions",
16530
16925
  "conditions",
@@ -16676,7 +17071,474 @@ var get_alert_options_default = defineTool({
16676
17071
  });
16677
17072
 
16678
17073
  //#endregion
16679
- //#region ../mcp-core/dist/enhance-error-C-IasWwg.js
17074
+ //#region ../mcp-core/dist/alert-rule-connections-D-rBMpEh.js
17075
+ /** Shared Alerts can only be mutated from a session covering their entire scope. */
17076
+ async function validateAlertRuleProjectScope(api, params) {
17077
+ if (params.projectSlug) assertProjectRefWithinConstraint({
17078
+ resourceLabel: "Alert rule",
17079
+ scopedProjectSlug: params.scopedProjectSlug,
17080
+ project: { slug: params.projectSlug }
17081
+ });
17082
+ const projectSlug$1 = params.scopedProjectSlug ?? params.projectSlug;
17083
+ if (!projectSlug$1) return void 0;
17084
+ const [project, scope] = await Promise.all([api.getProject({
17085
+ organizationSlug: params.organizationSlug,
17086
+ projectSlugOrId: projectSlug$1
17087
+ }), api.getAlertRuleProjectScope({
17088
+ organizationSlug: params.organizationSlug,
17089
+ ruleId: params.ruleId
17090
+ })]);
17091
+ assertProjectConstraintEvidence({
17092
+ resourceLabel: "Alert rule",
17093
+ scopedProjectSlug: params.scopedProjectSlug,
17094
+ hasEvidence: !scope.includesAllProjects && scope.projectIds.length > 0 && scope.projectIds.every((id) => id === String(project.id))
17095
+ });
17096
+ if (!scope.includesAllProjects && !scope.projectIds.includes(String(project.id))) throw new UserInputError(`Alert rule is outside project "${projectSlug$1}".`);
17097
+ return params.scopedProjectSlug ? {
17098
+ id: String(project.id),
17099
+ slug: project.slug
17100
+ } : void 0;
17101
+ }
17102
+ /** Apply connection changes after the caller has authorized the workflow's current scope. */
17103
+ async function resolveAlertRuleConnections(api, params) {
17104
+ const additions = /* @__PURE__ */ new Set();
17105
+ const removals = /* @__PURE__ */ new Set();
17106
+ const detectorIds = new Set(params.currentDetectorIds.map(String));
17107
+ for (const [projectSlugs, requestedDetectorIds, resolvedIds] of [[
17108
+ params.addProjectSlugs,
17109
+ params.addDetectorIds,
17110
+ additions
17111
+ ], [
17112
+ params.removeProjectSlugs,
17113
+ params.removeDetectorIds,
17114
+ removals
17115
+ ]]) {
17116
+ for (const projectSlug$1 of new Set(projectSlugs ?? [])) {
17117
+ const project = await api.getProject({
17118
+ organizationSlug: params.organizationSlug,
17119
+ projectSlugOrId: projectSlug$1
17120
+ });
17121
+ const projectId = String(project.id);
17122
+ assertProjectConstraintEvidence({
17123
+ resourceLabel: "Alert source",
17124
+ scopedProjectSlug: params.scopedProject?.slug,
17125
+ hasEvidence: projectId === params.scopedProject?.id
17126
+ });
17127
+ const matches = /* @__PURE__ */ new Set();
17128
+ let cursor;
17129
+ do {
17130
+ const page = await api.listDetectorsPage({
17131
+ organizationSlug: params.organizationSlug,
17132
+ projectId,
17133
+ types: ["issue_stream"],
17134
+ cursor,
17135
+ limit: 100
17136
+ });
17137
+ for (const detector of page.detectors) if (detector.type === "issue_stream" && detector.projectId !== null && String(detector.projectId) === projectId) matches.add(String(detector.id));
17138
+ cursor = page.nextCursor ?? void 0;
17139
+ } while (cursor);
17140
+ const [detectorId] = matches;
17141
+ if (!detectorId) throw new UserInputError(`No issue_stream monitor was found for project "${project.slug}". Sentry creates this source automatically; it must exist before its Alert connection can be changed.`);
17142
+ if (matches.size > 1) throw new UserInputError(`Multiple issue_stream monitors were found for project "${project.slug}". The project's Alert source cannot be resolved unambiguously.`);
17143
+ resolvedIds.add(detectorId);
17144
+ }
17145
+ for (const detectorId of new Set(requestedDetectorIds ?? [])) {
17146
+ if (resolvedIds === removals && detectorIds.has(detectorId)) {
17147
+ removals.add(detectorId);
17148
+ continue;
17149
+ }
17150
+ const detector = await api.getDetector({
17151
+ organizationSlug: params.organizationSlug,
17152
+ detectorId
17153
+ });
17154
+ assertProjectConstraintEvidence({
17155
+ resourceLabel: "Alert source",
17156
+ scopedProjectSlug: params.scopedProject?.slug,
17157
+ hasEvidence: detector.projectId !== null && String(detector.projectId) === params.scopedProject?.id
17158
+ });
17159
+ resolvedIds.add(String(detector.id));
17160
+ }
17161
+ }
17162
+ if ([...additions].some((id) => removals.has(id))) throw new UserInputError("The same Alert source cannot be added and removed in one update.");
17163
+ for (const id of removals) detectorIds.delete(id);
17164
+ for (const id of additions) detectorIds.add(id);
17165
+ if (params.scopedProject && detectorIds.size === 0) throw new UserInputError("Disconnecting every Alert source requires an organization-wide session.");
17166
+ return [...detectorIds];
17167
+ }
17168
+
17169
+ //#endregion
17170
+ //#region ../mcp-core/dist/alert-rule-config-BZlFpT72.js
17171
+ const componentId = zod.z.union([zod.z.string(), zod.z.number()]);
17172
+ const logicType = zod.z.enum([
17173
+ "all",
17174
+ "any",
17175
+ "any-short",
17176
+ "none"
17177
+ ]);
17178
+ const condition = zod.z.object({
17179
+ id: componentId.optional(),
17180
+ type: zod.z.string(),
17181
+ comparison: zod.z.unknown(),
17182
+ conditionResult: zod.z.unknown()
17183
+ });
17184
+ const ParamAlertTriggers = zod.z.object({
17185
+ id: componentId.optional(),
17186
+ logicType,
17187
+ conditions: zod.z.array(condition)
17188
+ }).describe("The complete trigger group. Preserve existing condition IDs when editing; omitted conditions are removed. Use the configuration returned by get_alert_rule.");
17189
+ const action = zod.z.object({
17190
+ id: componentId.optional(),
17191
+ type: zod.z.string(),
17192
+ integrationId: componentId.nullable().optional(),
17193
+ data: zod.z.record(zod.z.string(), zod.z.unknown()),
17194
+ config: zod.z.record(zod.z.string(), zod.z.unknown()),
17195
+ status: zod.z.string().optional()
17196
+ });
17197
+ const ParamAlertActionFilters = zod.z.array(zod.z.object({
17198
+ id: componentId.optional(),
17199
+ logicType,
17200
+ conditions: zod.z.array(condition),
17201
+ actions: zod.z.array(action)
17202
+ })).describe("The complete list of action groups, conditions, and notification actions. Preserve their IDs and all unchanged groups and actions; omitted entries are removed. Slack and Microsoft Teams resolve config.targetDisplay as a channel name within integrationId. Other providers use their native config.targetIdentifier and data fields.");
17203
+ const ParamNewAlertTriggers = ParamAlertTriggers.omit({ id: true }).extend({ conditions: zod.z.array(condition.omit({ id: true })) }).refine((group) => group.conditions.length === 0 || group.logicType === "any-short", {
17204
+ message: "New Alert trigger conditions require logicType='any-short'.",
17205
+ path: ["logicType"]
17206
+ }).describe("Trigger conditions. Nonempty groups require logicType='any-short' for new Alerts. Copied component IDs are discarded. Omit, pass null, or use an empty group for no trigger conditions.");
17207
+ const ParamNewAlertActionFilters = zod.z.array(ParamAlertActionFilters.element.omit({ id: true }).extend({
17208
+ conditions: zod.z.array(condition.omit({ id: true })),
17209
+ actions: zod.z.array(action.omit({ id: true }))
17210
+ })).describe("Action groups with conditions and notification actions, from get_alert_options or get_alert_rule. Copied component IDs are discarded; integration and destination IDs are retained. Pass [] explicitly for no notification actions.");
17211
+ const alertRuleConfigFields = {
17212
+ name: zod.z.string().trim().min(1).max(256).optional(),
17213
+ status: zod.z.enum(["active", "disabled"]).optional(),
17214
+ frequencyMinutes: zod.z.number().int().min(0).optional().describe("Minimum interval between notifications, in minutes."),
17215
+ environment: zod.z.string().min(1).nullable().optional(),
17216
+ owner: zod.z.string().regex(/^(user|team):\d+$/).nullable().optional().describe("Owner actor user:ID or team:ID. Pass null to clear.")
17217
+ };
17218
+ const alertRuleSummarySchema = zod.z.object({
17219
+ id: zod.z.string(),
17220
+ name: zod.z.string(),
17221
+ enabled: zod.z.boolean().optional(),
17222
+ config: zod.z.object({ frequency: zod.z.number().int().min(0).optional() }).optional(),
17223
+ environment: zod.z.string().nullable().optional(),
17224
+ owner: zod.z.string().nullable().optional(),
17225
+ triggers: ParamAlertTriggers.nullable().optional(),
17226
+ actionFilters: ParamAlertActionFilters.nullable().optional(),
17227
+ detectorIds: zod.z.array(zod.z.string()),
17228
+ webUrl: zod.z.string().url()
17229
+ });
17230
+ /** Returns editable alert configuration and component IDs, excluding backend metadata. */
17231
+ function toAlertRuleSummary(rule, webUrl) {
17232
+ return alertRuleSummarySchema.parse({
17233
+ id: String(rule.id),
17234
+ name: rule.name,
17235
+ enabled: rule.enabled,
17236
+ config: rule.config,
17237
+ environment: rule.environment,
17238
+ owner: typeof rule.owner === "string" || rule.owner === null ? rule.owner : void 0,
17239
+ triggers: rule.triggers,
17240
+ actionFilters: rule.actionFilters,
17241
+ detectorIds: (rule.detectorIds ?? []).map(String),
17242
+ webUrl
17243
+ });
17244
+ }
17245
+ /** Sentry can save a Slack action after a channel lookup timeout. */
17246
+ function assertResolvedAlertDestinations(rule, operation = "update") {
17247
+ if (rule.actionFilters?.some((group) => group.actions.some((action$1) => action$1.type === "slack" && (typeof action$1.config.targetIdentifier !== "string" || action$1.config.targetIdentifier.length === 0)))) throw new UserInputError(operation === "create" ? `Alert ${rule.id} was created, but Sentry did not resolve a Slack destination. Read it with get_alert_rule(kind='issue', ruleIdOrName='${rule.id}') and fix it with update_alert_rule using both the channel name (targetDisplay) and explicit channel ID (targetIdentifier). Do not create another Alert.` : "The alert was saved, but Sentry did not resolve a Slack destination. Read the alert again and retry with both the channel name (targetDisplay) and explicit channel ID (targetIdentifier).");
17248
+ }
17249
+
17250
+ //#endregion
17251
+ //#region ../mcp-core/dist/update-alert-rule-BhijrzEe.js
17252
+ const updateAlertRuleOutputSchema = zod.z.object({ alertRule: alertRuleSummarySchema });
17253
+ /** Preserve copied actions while asking Sentry to resolve a changed Slack destination. */
17254
+ function resolveChangedSlackDestinations(groups, current) {
17255
+ const previousActions = (current.actionFilters ?? []).flatMap((group) => Array.isArray(group.actions) ? group.actions.filter(isPlainObject$3) : []);
17256
+ return groups.map((group) => ({
17257
+ ...group,
17258
+ actions: group.actions.map((action$1) => {
17259
+ const previous = previousActions.find((candidate) => action$1.id !== void 0 && String(candidate.id) === String(action$1.id));
17260
+ if (action$1.type !== "slack" || !previous || !isPlainObject$3(previous.config) || typeof action$1.config.targetDisplay !== "string" || action$1.config.targetDisplay.length === 0 || action$1.config.targetDisplay === previous.config.targetDisplay && String(action$1.integrationId) === String(previous.integrationId) || action$1.config.targetIdentifier !== previous.config.targetIdentifier) return action$1;
17261
+ const config = { ...action$1.config };
17262
+ delete config.targetIdentifier;
17263
+ return {
17264
+ ...action$1,
17265
+ config
17266
+ };
17267
+ })
17268
+ }));
17269
+ }
17270
+ var update_alert_rule_default = defineTool({
17271
+ name: "update_alert_rule",
17272
+ skills: ["project-management"],
17273
+ requiredScopes: [
17274
+ "org:read",
17275
+ "project:read",
17276
+ "alerts:write"
17277
+ ],
17278
+ description: [
17279
+ "Update a Sentry Alert (workflow), including notification actions and connections.",
17280
+ "Use get_alert_rule with kind='issue' first to inspect the complete triggers and actionFilters configuration.",
17281
+ "Use get_alert_options to discover notification actions, integrations, conditions, and available sources.",
17282
+ "Omit fields to leave them unchanged. Pass null to clear owner or environment.",
17283
+ "triggers replaces the trigger conditions. actionFilters replaces ALL action groups: copy the complete configuration, retain existing IDs, and change only the intended values. Omitted groups, conditions, and actions are removed.",
17284
+ "For Slack or Microsoft Teams, change config.targetDisplay to the channel name and use integrationId for the workspace or team. Sentry resolves the channel ID. Slack also accepts an explicit new targetIdentifier; a copied old ID is cleared when the name or workspace changes.",
17285
+ "Other actions use their provider's config and data. For Discord, PagerDuty, Opsgenie, and email, update targetIdentifier to the channel, service, team, or recipient ID; changing only its display name does not change the destination.",
17286
+ "Use addProjectSlugs/removeProjectSlugs to connect/disconnect a project's issue stream. Other monitors in that project remain connected. Use addDetectorIds/removeDetectorIds for individual monitors. Unmentioned connections are preserved.",
17287
+ "Metric Monitor detection queries and thresholds are separate operations.",
17288
+ "All-project connections require Sentry's all-project feature and an API token with org:write in addition to alerts:write.",
17289
+ "A project-constrained session can only edit alerts affecting that project exclusively.",
17290
+ "Requires alerts:write; reconnect OAuth if the existing token lacks it.",
17291
+ "<examples>",
17292
+ "update_alert_rule(organizationSlug='my-org', ruleIdOrName='12345', status='disabled')",
17293
+ "update_alert_rule(organizationSlug='my-org', projectSlug='backend', ruleIdOrName='Notify backend team', frequencyMinutes=30)",
17294
+ "</examples>"
17295
+ ].join("\n"),
17296
+ inputSchema: {
17297
+ organizationSlug: ParamOrganizationSlug,
17298
+ regionUrl: ParamRegionUrl.nullable().default(null),
17299
+ projectSlug: ParamProjectSlug.nullable().optional(),
17300
+ ruleIdOrName: zod.z.string().trim().min(1).describe("Workflow ID or exact alert name. Digit-only values are treated as IDs. Use IDs from get_alert_rule(kind='issue')."),
17301
+ ...alertRuleConfigFields,
17302
+ triggers: ParamAlertTriggers.optional(),
17303
+ actionFilters: ParamAlertActionFilters.optional(),
17304
+ addProjectSlugs: zod.z.array(ParamProjectSlug).min(1).optional().describe("Projects whose existing issue streams should be connected."),
17305
+ removeProjectSlugs: zod.z.array(ParamProjectSlug).min(1).optional().describe("Projects whose issue streams should be disconnected; other monitor connections are retained."),
17306
+ addDetectorIds: zod.z.array(zod.z.string().regex(/^\d+$/)).min(1).optional().describe("Existing detector IDs to connect, from get_alert_options(section='sources')."),
17307
+ removeDetectorIds: zod.z.array(zod.z.string().regex(/^\d+$/)).min(1).optional().describe("Detector IDs to disconnect. Other connections are retained.")
17308
+ },
17309
+ annotations: {
17310
+ readOnlyHint: false,
17311
+ destructiveHint: true,
17312
+ idempotentHint: false,
17313
+ openWorldHint: true
17314
+ },
17315
+ outputSchema: updateAlertRuleOutputSchema,
17316
+ async handler(params, context$1) {
17317
+ if ([
17318
+ params.name,
17319
+ params.status,
17320
+ params.frequencyMinutes,
17321
+ params.environment,
17322
+ params.owner,
17323
+ params.triggers,
17324
+ params.actionFilters,
17325
+ params.addProjectSlugs,
17326
+ params.removeProjectSlugs,
17327
+ params.addDetectorIds,
17328
+ params.removeDetectorIds
17329
+ ].every((value) => value === void 0)) throw new UserInputError("Provide at least one field to update on the alert rule.");
17330
+ if (params.projectSlug) assertProjectRefWithinConstraint({
17331
+ resourceLabel: "Alert rule",
17332
+ scopedProjectSlug: context$1.constraints.projectSlug,
17333
+ project: { slug: params.projectSlug }
17334
+ });
17335
+ const projectSlug$1 = context$1.constraints.projectSlug ?? params.projectSlug;
17336
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
17337
+ const organizationSlug = params.organizationSlug;
17338
+ setOrganizationContext(organizationSlug);
17339
+ if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
17340
+ let ruleId = params.ruleIdOrName;
17341
+ if (!isNumericAlertRuleId(ruleId)) {
17342
+ const matches = await findExactIssueAlertRuleMatches(apiService, {
17343
+ organizationSlug,
17344
+ projectSlug: projectSlug$1 ?? void 0,
17345
+ ruleName: ruleId
17346
+ });
17347
+ if (matches.length > 1) throw new UserInputError("The alert name cannot be resolved unambiguously. Retry with the numeric workflow ID from get_alert_rule.");
17348
+ if (matches.length === 0) throw new UserInputError(`Alert rule "${ruleId}" was not found${projectSlug$1 ? ` in project ${projectSlug$1}` : ""}.`);
17349
+ ruleId = String(matches[0].id);
17350
+ }
17351
+ const current = await apiService.getIssueAlertRule({
17352
+ organizationSlug,
17353
+ ruleId
17354
+ });
17355
+ const scopedProject = await validateAlertRuleProjectScope(apiService, {
17356
+ organizationSlug,
17357
+ ruleId,
17358
+ projectSlug: projectSlug$1,
17359
+ scopedProjectSlug: context$1.constraints.projectSlug
17360
+ });
17361
+ if (typeof current.enabled !== "boolean") throw new Error("Sentry returned an alert without its enabled state; refusing to update it.");
17362
+ const body = {
17363
+ name: params.name ?? current.name,
17364
+ enabled: params.status === void 0 ? current.enabled : params.status === "active"
17365
+ };
17366
+ if (params.frequencyMinutes !== void 0) body.config = {
17367
+ ...current.config,
17368
+ frequency: params.frequencyMinutes
17369
+ };
17370
+ if (params.environment !== void 0) body.environment = params.environment;
17371
+ if (params.owner !== void 0) body.owner = params.owner;
17372
+ if (params.triggers !== void 0) body.triggers = params.triggers;
17373
+ if (params.actionFilters !== void 0) body.actionFilters = resolveChangedSlackDestinations(params.actionFilters, current);
17374
+ if ([
17375
+ params.addProjectSlugs,
17376
+ params.removeProjectSlugs,
17377
+ params.addDetectorIds,
17378
+ params.removeDetectorIds
17379
+ ].some((value) => value !== void 0)) body.detectorIds = await resolveAlertRuleConnections(apiService, {
17380
+ organizationSlug,
17381
+ currentDetectorIds: current.detectorIds ?? [],
17382
+ addProjectSlugs: params.addProjectSlugs,
17383
+ removeProjectSlugs: params.removeProjectSlugs,
17384
+ addDetectorIds: params.addDetectorIds,
17385
+ removeDetectorIds: params.removeDetectorIds,
17386
+ scopedProject
17387
+ });
17388
+ const updated = await apiService.updateAlertRule({
17389
+ organizationSlug,
17390
+ ruleId,
17391
+ body
17392
+ });
17393
+ const alertRule = toAlertRuleSummary(updated, apiService.getIssueAlertRuleUrl(organizationSlug, updated.id));
17394
+ if (params.actionFilters !== void 0) assertResolvedAlertDestinations(alertRule);
17395
+ return structuredResult({ alertRule });
17396
+ }
17397
+ });
17398
+
17399
+ //#endregion
17400
+ //#region ../mcp-core/dist/create-alert-rule-DgTirEA-.js
17401
+ var create_alert_rule_default = defineTool({
17402
+ name: "create_alert_rule",
17403
+ skills: ["project-management"],
17404
+ requiredScopes: [
17405
+ "org:read",
17406
+ "project:read",
17407
+ "alerts:write"
17408
+ ],
17409
+ description: [
17410
+ "Create a Sentry Alert (workflow) with notification actions and explicit sources.",
17411
+ "Use get_alert_options for available actions, integrations, conditions, and sources. All notification providers use their native config and data fields.",
17412
+ "To copy an Alert, read get_alert_rule(kind='issue') and pass its configuration here; component IDs are discarded while integration and destination IDs are retained. New trigger groups require logicType='any-short'.",
17413
+ "To reuse an existing Alert across projects, use update_alert_rule instead.",
17414
+ "Supply projectSlugs for project issue streams and/or detectorIds for individual monitors. Pass detectorIds=[] explicitly to create an Alert without sources; it will not send notifications until connected.",
17415
+ "New Alerts default to active with a 30-minute notification interval. Use status='disabled' to configure one before enabling it.",
17416
+ "Project-constrained sessions require sources exclusively within that project. All-project sources require Sentry's feature and org:write in addition to alerts:write.",
17417
+ "After a timeout or error, search for the Alert before retrying: creation may already have succeeded.",
17418
+ "<examples>",
17419
+ "create_alert_rule(organizationSlug='my-org', name='Backend notifications', status='disabled', detectorIds=[], actionFilters=[])",
17420
+ "</examples>"
17421
+ ].join("\n"),
17422
+ inputSchema: {
17423
+ organizationSlug: ParamOrganizationSlug,
17424
+ regionUrl: ParamRegionUrl.nullable().default(null),
17425
+ ...alertRuleConfigFields,
17426
+ name: alertRuleConfigFields.name.unwrap(),
17427
+ status: alertRuleConfigFields.status.default("active"),
17428
+ frequencyMinutes: alertRuleConfigFields.frequencyMinutes.default(30),
17429
+ triggers: ParamNewAlertTriggers.nullable().optional(),
17430
+ actionFilters: ParamNewAlertActionFilters,
17431
+ projectSlugs: zod.z.array(ParamProjectSlug).optional().describe("Projects whose issue streams should be connected."),
17432
+ detectorIds: zod.z.array(zod.z.string().regex(/^\d+$/)).optional().describe("Existing source IDs from get_alert_options. Pass [] explicitly for an Alert without sources.")
17433
+ },
17434
+ annotations: {
17435
+ readOnlyHint: false,
17436
+ destructiveHint: false,
17437
+ idempotentHint: false,
17438
+ openWorldHint: true
17439
+ },
17440
+ outputSchema: zod.z.object({
17441
+ alertRule: alertRuleSummarySchema,
17442
+ guidance: zod.z.string().optional()
17443
+ }),
17444
+ async handler(params, context$1) {
17445
+ if (params.projectSlugs === void 0 && params.detectorIds === void 0) throw new UserInputError("Specify projectSlugs or detectorIds. Pass detectorIds=[] explicitly to create an Alert without sources.");
17446
+ const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
17447
+ setOrganizationContext(params.organizationSlug);
17448
+ const project = context$1.constraints.projectSlug ? await api.getProject({
17449
+ organizationSlug: params.organizationSlug,
17450
+ projectSlugOrId: context$1.constraints.projectSlug
17451
+ }) : void 0;
17452
+ const detectorIds = await resolveAlertRuleConnections(api, {
17453
+ organizationSlug: params.organizationSlug,
17454
+ currentDetectorIds: [],
17455
+ addProjectSlugs: params.projectSlugs,
17456
+ addDetectorIds: params.detectorIds,
17457
+ scopedProject: project ? {
17458
+ id: String(project.id),
17459
+ slug: project.slug
17460
+ } : void 0
17461
+ });
17462
+ const created = await api.createAlertRule({
17463
+ organizationSlug: params.organizationSlug,
17464
+ body: {
17465
+ name: params.name,
17466
+ enabled: params.status === "active",
17467
+ config: { frequency: params.frequencyMinutes },
17468
+ environment: params.environment,
17469
+ owner: params.owner,
17470
+ triggers: params.triggers?.conditions.length ? params.triggers : void 0,
17471
+ actionFilters: params.actionFilters,
17472
+ detectorIds
17473
+ }
17474
+ });
17475
+ const alertRule = toAlertRuleSummary(created, api.getIssueAlertRuleUrl(params.organizationSlug, created.id));
17476
+ assertResolvedAlertDestinations(alertRule, "create");
17477
+ return structuredResult({
17478
+ alertRule,
17479
+ ...alertRule.detectorIds.length === 0 ? { guidance: "This Alert has no sources and will not send notifications until connected using update_alert_rule." } : {}
17480
+ });
17481
+ }
17482
+ });
17483
+
17484
+ //#endregion
17485
+ //#region ../mcp-core/dist/delete-alert-rule-Chf3KTmT.js
17486
+ var delete_alert_rule_default = defineTool({
17487
+ name: "delete_alert_rule",
17488
+ skills: ["project-management"],
17489
+ requiredScopes: [
17490
+ "org:read",
17491
+ "project:read",
17492
+ "alerts:write"
17493
+ ],
17494
+ description: [
17495
+ "Permanently delete a Sentry Alert (workflow), preserving its connected monitors.",
17496
+ "Use get_alert_rule(kind='issue') to inspect the Alert and obtain its workflow ID before deletion. Metric Monitor IDs and legacy metric alert IDs are not workflow IDs.",
17497
+ "Deleting a shared Alert removes its notifications for every connected project and monitor. Use update_alert_rule to disconnect individual sources or disable it instead.",
17498
+ "A project-constrained session can only delete Alerts affecting that project exclusively.",
17499
+ "Sentry removes the Alert from normal reads immediately and completes internal deletion in the background.",
17500
+ "<examples>",
17501
+ "delete_alert_rule(organizationSlug='my-org', ruleId='12345')",
17502
+ "</examples>"
17503
+ ].join("\n"),
17504
+ inputSchema: {
17505
+ organizationSlug: ParamOrganizationSlug,
17506
+ regionUrl: ParamRegionUrl.nullable().default(null),
17507
+ projectSlug: ParamProjectSlug.nullable().optional(),
17508
+ ruleId: zod.z.string().regex(/^\d+$/).describe("Workflow ID from get_alert_rule(kind='issue').")
17509
+ },
17510
+ annotations: {
17511
+ readOnlyHint: false,
17512
+ destructiveHint: true,
17513
+ idempotentHint: true,
17514
+ openWorldHint: true
17515
+ },
17516
+ outputSchema: zod.z.object({
17517
+ success: zod.z.literal(true),
17518
+ ruleId: zod.z.string()
17519
+ }),
17520
+ async handler(params, context$1) {
17521
+ const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
17522
+ setOrganizationContext(params.organizationSlug);
17523
+ await validateAlertRuleProjectScope(api, {
17524
+ organizationSlug: params.organizationSlug,
17525
+ ruleId: params.ruleId,
17526
+ projectSlug: params.projectSlug,
17527
+ scopedProjectSlug: context$1.constraints.projectSlug
17528
+ });
17529
+ await api.deleteAlertRule({
17530
+ organizationSlug: params.organizationSlug,
17531
+ ruleId: params.ruleId
17532
+ });
17533
+ return structuredResult({
17534
+ success: true,
17535
+ ruleId: params.ruleId
17536
+ });
17537
+ }
17538
+ });
17539
+
17540
+ //#endregion
17541
+ //#region ../mcp-core/dist/enhance-error-CD_-s-wU.js
16680
17542
  /**
16681
17543
  * Enhances a 404 error with parameter context to help users understand what went wrong.
16682
17544
  * This is optional - tools can use this when they want to provide extra context.
@@ -16704,7 +17566,7 @@ function enhanceNotFoundError(error, params) {
16704
17566
  }
16705
17567
 
16706
17568
  //#endregion
16707
- //#region ../mcp-core/dist/code-location-B3p1xz3c.js
17569
+ //#region ../mcp-core/dist/code-location-CSEeU0rZ.js
16708
17570
  /** Formats a verified source location for the issue-details response. */
16709
17571
  function formatCodeLocation(codeLocation) {
16710
17572
  const output = ["## Code Location", ""];
@@ -16720,7 +17582,7 @@ function findMostRelevantInAppFrame(frames) {
16720
17582
  }
16721
17583
 
16722
17584
  //#endregion
16723
- //#region ../mcp-core/dist/tool-call-formatting-DQggqUN_.js
17585
+ //#region ../mcp-core/dist/tool-call-formatting-DBtwNDuD.js
16724
17586
  function formatArgumentValue(value) {
16725
17587
  if (typeof value === "string") return `'${value.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
16726
17588
  if (Array.isArray(value) || typeof value === "object") return JSON.stringify(value);
@@ -16773,7 +17635,7 @@ function formatAvailableToolCallInstruction({ toolName, experimentalMode, purpos
16773
17635
  }
16774
17636
 
16775
17637
  //#endregion
16776
- //#region ../mcp-core/dist/ai-conversation-actions-CLccuTm5.js
17638
+ //#region ../mcp-core/dist/ai-conversation-actions-s0M7WLfT.js
16777
17639
  const MAX_SUGGESTED_ACTIONS = 3;
16778
17640
  function formatInlineCode$1(value) {
16779
17641
  const backtickRuns = value.match(/`+/g) ?? [];
@@ -16820,14 +17682,14 @@ function formatAIConversationActionInstructions({ organizationSlug, aiConversati
16820
17682
  directToolNames
16821
17683
  });
16822
17684
  if (actions.length === 0) return ["Agent conversation detail lookup is not available in this session."];
16823
- return actions.map((action) => `Use the Sentry tool ${formatInlineCode$1(formatToolCall({
16824
- toolName: action.toolName,
16825
- arguments: action.arguments
17685
+ return actions.map((action$1) => `Use the Sentry tool ${formatInlineCode$1(formatToolCall({
17686
+ toolName: action$1.toolName,
17687
+ arguments: action$1.arguments
16826
17688
  }))} to fetch the full transcript.`);
16827
17689
  }
16828
17690
 
16829
17691
  //#endregion
16830
- //#region ../mcp-core/dist/seer-DqLgmvV9.js
17692
+ //#region ../mcp-core/dist/seer-BRHapSed.js
16831
17693
  const SEER_POLLING_INTERVAL = 5e3;
16832
17694
  const SEER_TIMEOUT = 5 * 60 * 1e3;
16833
17695
  const SEER_MAX_RETRIES = 3;
@@ -17005,7 +17867,7 @@ function getActiveAutofixTodo(autofix) {
17005
17867
  }
17006
17868
 
17007
17869
  //#endregion
17008
- //#region ../mcp-core/dist/user-formatting-CTX3nhjo.js
17870
+ //#region ../mcp-core/dist/user-formatting-BPq81AXF.js
17009
17871
  function formatUserGeoSummary(value) {
17010
17872
  if (!isPlainObject$3(value)) return null;
17011
17873
  const parts = [
@@ -17019,7 +17881,7 @@ function formatUserGeoSummary(value) {
17019
17881
  }
17020
17882
 
17021
17883
  //#endregion
17022
- //#region ../mcp-core/dist/formatting-31tlKXsb.js
17884
+ //#region ../mcp-core/dist/formatting-DmyvXxeg.js
17023
17885
  /**
17024
17886
  * Convert Seer fixability score to actionability label.
17025
17887
  * Thresholds match Sentry core: src/sentry/seer/autofix/constants.py
@@ -17959,11 +18821,11 @@ function getMetricAlertSnubaQuery(evidenceData) {
17959
18821
  }
17960
18822
  return void 0;
17961
18823
  }
17962
- function formatMetricAlertCondition(condition) {
17963
- const comparison = condition.comparison;
18824
+ function formatMetricAlertCondition(condition$1) {
18825
+ const comparison = condition$1.comparison;
17964
18826
  const formattedComparison = formatPrimitive(comparison);
17965
18827
  if (formattedComparison == null) return void 0;
17966
- const type = condition.type;
18828
+ const type = condition$1.type;
17967
18829
  const typeLabel = (() => {
17968
18830
  if (type === 0 || type === "0" || type === "gt" || type === "gte") return type === "gte" ? "at or above" : "above";
17969
18831
  if (type === 1 || type === "1" || type === "lt" || type === "lte") return type === "lte" ? "at or below" : "below";
@@ -17994,7 +18856,7 @@ function formatMetricAlertDetails(evidenceData) {
17994
18856
  if (formattedValue) parts.push(`**Evaluated Value**: ${formattedValue}`);
17995
18857
  const conditions = evidenceData.conditions;
17996
18858
  if (Array.isArray(conditions)) {
17997
- const formattedConditions = conditions.filter(isPlainObject$3).map(formatMetricAlertCondition).filter((condition) => condition != null);
18859
+ const formattedConditions = conditions.filter(isPlainObject$3).map(formatMetricAlertCondition).filter((condition$1) => condition$1 != null);
17998
18860
  if (formattedConditions.length > 0) parts.push(`**Threshold**: ${formattedConditions.join(", ")}`);
17999
18861
  }
18000
18862
  if (evidenceData.alert_id != null) parts.push(`**Alert Rule ID**: ${String(evidenceData.alert_id)}`);
@@ -18406,7 +19268,7 @@ function stripReplayMetadata(event) {
18406
19268
  }
18407
19269
 
18408
19270
  //#endregion
18409
- //#region ../mcp-core/dist/url-scope-V6MOdP9h.js
19271
+ //#region ../mcp-core/dist/url-scope-DtjC8gup.js
18410
19272
  function resolveScopedOrganizationSlug({ resourceLabel, scopedOrganizationSlug, urlOrganizationSlug }) {
18411
19273
  if (!scopedOrganizationSlug) return urlOrganizationSlug;
18412
19274
  if (scopedOrganizationSlug !== urlOrganizationSlug) throw new UserInputError(`${resourceLabel} URL is outside the active organization constraint. Expected organization "${scopedOrganizationSlug}" but got "${urlOrganizationSlug}".`);
@@ -18430,7 +19292,7 @@ function resolveScopedProjectSlugOrId({ resourceLabel, scopedProjectSlugOrId, ur
18430
19292
  }
18431
19293
 
18432
19294
  //#endregion
18433
- //#region ../mcp-core/dist/issue-helpers-qGxiGeE5.js
19295
+ //#region ../mcp-core/dist/issue-helpers-CgwVDYw_.js
18434
19296
  /**
18435
19297
  * Extracts the Sentry issue ID and organization slug from a full URL
18436
19298
  *
@@ -18510,7 +19372,7 @@ function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
18510
19372
  }
18511
19373
 
18512
19374
  //#endregion
18513
- //#region ../mcp-core/dist/issue-y4HGWyCn.js
19375
+ //#region ../mcp-core/dist/issue-DhVQI_Lq.js
18514
19376
  function assertIssueWithinProjectConstraint({ issue, projectSlug: projectSlug$1, resourceLabel = "Issue" }) {
18515
19377
  assertScopedProjectSlug({
18516
19378
  resourceLabel,
@@ -18532,7 +19394,7 @@ async function ensureIssueWithinProjectConstraint({ apiService, organizationSlug
18532
19394
  }
18533
19395
 
18534
19396
  //#endregion
18535
- //#region ../mcp-core/dist/code-location-Dh_XFzfu.js
19397
+ //#region ../mcp-core/dist/code-location-DyFkzIBX.js
18536
19398
  const CODE_LOCATION_TIMEOUT_MS = 3e3;
18537
19399
  /** Resolves a verified source location, omitting optional enrichment failures. */
18538
19400
  async function resolveCodeLocation({ apiService, organizationSlug, projectSlug: projectSlug$1, event }) {
@@ -18635,7 +19497,7 @@ function getString$1(value) {
18635
19497
  }
18636
19498
 
18637
19499
  //#endregion
18638
- //#region ../mcp-core/dist/get-issue-details-t289hNuc.js
19500
+ //#region ../mcp-core/dist/get-issue-details-eoGHUc5t.js
18639
19501
  const MAX_RELATED_REPLAYS = 5;
18640
19502
  const MAX_AI_CONVERSATION_MATCHES = 3;
18641
19503
  const AI_CONVERSATION_LOOKUP_WINDOW_MS = 24 * 60 * 60 * 1e3;
@@ -19185,7 +20047,7 @@ function getReplayDataSource(issue) {
19185
20047
  }
19186
20048
 
19187
20049
  //#endregion
19188
- //#region ../mcp-core/dist/event-stacktrace-WES63IMe.js
20050
+ //#region ../mcp-core/dist/event-stacktrace-QI05nZO8.js
19189
20051
  /**
19190
20052
  * Fetches an issue event and formats the selected thread stacktrace.
19191
20053
  */
@@ -19264,7 +20126,7 @@ function selectUnique(threads, predicate, notFoundMessage, ambiguousMessage) {
19264
20126
  }
19265
20127
 
19266
20128
  //#endregion
19267
- //#region ../mcp-core/dist/get-event-stacktrace-CDGRtbOg.js
20129
+ //#region ../mcp-core/dist/get-event-stacktrace-bBkw7XcE.js
19268
20130
  var get_event_stacktrace_default = defineTool({
19269
20131
  name: "get_event_stacktrace",
19270
20132
  skills: [
@@ -19335,7 +20197,7 @@ var get_event_stacktrace_default = defineTool({
19335
20197
  });
19336
20198
 
19337
20199
  //#endregion
19338
- //#region ../mcp-core/dist/get-issue-activity-DA97QQfR.js
20200
+ //#region ../mcp-core/dist/get-issue-activity-kTtszY5w.js
19339
20201
  function getActivityText(activity) {
19340
20202
  const data = activity.data;
19341
20203
  if (!data) return null;
@@ -19428,7 +20290,7 @@ var get_issue_activity_default = defineTool({
19428
20290
  });
19429
20291
 
19430
20292
  //#endregion
19431
- //#region ../mcp-core/dist/breadcrumbs-uFW9kNaP.js
20293
+ //#region ../mcp-core/dist/breadcrumbs-e3Dfin9q.js
19432
20294
  /**
19433
20295
  * Fetches breadcrumbs from an issue event and formats them.
19434
20296
  * Defaults to the latest event when eventId is omitted.
@@ -19492,7 +20354,7 @@ function cleanAndTruncate(str, maxLen) {
19492
20354
  }
19493
20355
 
19494
20356
  //#endregion
19495
- //#region ../mcp-core/dist/get-issue-breadcrumbs-D-UCFqx1.js
20357
+ //#region ../mcp-core/dist/get-issue-breadcrumbs-CUYsYU0Z.js
19496
20358
  var get_issue_breadcrumbs_default = defineTool({
19497
20359
  name: "get_issue_breadcrumbs",
19498
20360
  skills: ["inspect", "triage"],
@@ -19554,7 +20416,7 @@ var get_issue_breadcrumbs_default = defineTool({
19554
20416
  });
19555
20417
 
19556
20418
  //#endregion
19557
- //#region ../mcp-core/dist/get-issue-tag-values-CyHuVJ-4.js
20419
+ //#region ../mcp-core/dist/get-issue-tag-values-DyhK3PJ0.js
19558
20420
  const getIssueTagValuesOutputSchema = zod.z.object({ tag: zod.z.object({
19559
20421
  key: zod.z.string(),
19560
20422
  name: zod.z.string(),
@@ -19672,7 +20534,7 @@ var get_issue_tag_values_default = defineTool({
19672
20534
  });
19673
20535
 
19674
20536
  //#endregion
19675
- //#region ../mcp-core/dist/get-issue-user-reports-DhU4yW1i.js
20537
+ //#region ../mcp-core/dist/get-issue-user-reports-D4BEYSq0.js
19676
20538
  function getReporter(report) {
19677
20539
  const userId = report.user?.id?.trim();
19678
20540
  const userIdReporter = userId && !["none", "null"].includes(userId.toLowerCase()) ? `user:${userId}` : null;
@@ -23260,7 +24122,7 @@ function createAnthropic(options = {}) {
23260
24122
  var anthropic = createAnthropic();
23261
24123
 
23262
24124
  //#endregion
23263
- //#region ../mcp-core/dist/anthropic-provider-NqnQSpoe.js
24125
+ //#region ../mcp-core/dist/anthropic-provider-CXJE4xN5.js
23264
24126
  const DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-5";
23265
24127
  let configuredBaseUrl$2;
23266
24128
  /**
@@ -27545,24 +28407,24 @@ function isResponseAnnotationAddedChunk(chunk) {
27545
28407
  function isErrorChunk(chunk) {
27546
28408
  return chunk.type === "error";
27547
28409
  }
27548
- function mapWebSearchOutput(action) {
28410
+ function mapWebSearchOutput(action$1) {
27549
28411
  var _a$4;
27550
- switch (action.type) {
28412
+ switch (action$1.type) {
27551
28413
  case "search": return {
27552
28414
  action: {
27553
28415
  type: "search",
27554
- query: (_a$4 = action.query) != null ? _a$4 : void 0
28416
+ query: (_a$4 = action$1.query) != null ? _a$4 : void 0
27555
28417
  },
27556
- ...action.sources != null && { sources: action.sources }
28418
+ ...action$1.sources != null && { sources: action$1.sources }
27557
28419
  };
27558
28420
  case "open_page": return { action: {
27559
28421
  type: "openPage",
27560
- url: action.url
28422
+ url: action$1.url
27561
28423
  } };
27562
28424
  case "find_in_page": return { action: {
27563
28425
  type: "findInPage",
27564
- url: action.url,
27565
- pattern: action.pattern
28426
+ url: action$1.url,
28427
+ pattern: action$1.pattern
27566
28428
  } };
27567
28429
  }
27568
28430
  }
@@ -27913,7 +28775,7 @@ function createOpenAI(options = {}) {
27913
28775
  var openai = createOpenAI();
27914
28776
 
27915
28777
  //#endregion
27916
- //#region ../mcp-core/dist/azure-openai-provider-BcsSfFBw.js
28778
+ //#region ../mcp-core/dist/azure-openai-provider-B-75yre2.js
27917
28779
  const DEFAULT_OPENAI_MODEL$1 = "gpt-5";
27918
28780
  let configuredBaseUrl$1;
27919
28781
  function setAzureOpenAIBaseUrl(baseUrl) {
@@ -27971,7 +28833,7 @@ function getAzureOpenAIModel(model) {
27971
28833
  }
27972
28834
 
27973
28835
  //#endregion
27974
- //#region ../mcp-core/dist/openai-provider-DNtIUzcM.js
28836
+ //#region ../mcp-core/dist/openai-provider-BKwazO-Y.js
27975
28837
  const DEFAULT_OPENAI_MODEL = "gpt-5";
27976
28838
  let configuredBaseUrl;
27977
28839
  /**
@@ -28011,7 +28873,7 @@ function getOpenAIModel(model) {
28011
28873
  }
28012
28874
 
28013
28875
  //#endregion
28014
- //#region ../mcp-core/dist/openrouter-provider-Bq38hmFY.js
28876
+ //#region ../mcp-core/dist/openrouter-provider-BxvmG7fM.js
28015
28877
  const DEFAULT_OPENROUTER_MODEL = "openai/gpt-5.6-luna";
28016
28878
  const DEFAULT_OPENROUTER_REASONING_EFFORT = "high";
28017
28879
  const OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1";
@@ -28063,7 +28925,7 @@ function getOpenRouterProviderOptions() {
28063
28925
  }
28064
28926
 
28065
28927
  //#endregion
28066
- //#region ../mcp-core/dist/provider-factory-BNDtCneN.js
28928
+ //#region ../mcp-core/dist/provider-factory-PfhftGGp.js
28067
28929
  let configuredProvider;
28068
28930
  /**
28069
28931
  * Configure the embedded agent provider explicitly.
@@ -28208,7 +29070,7 @@ function getResolvedProviderType() {
28208
29070
  }
28209
29071
 
28210
29072
  //#endregion
28211
- //#region ../mcp-core/dist/resolve-region-url-DgkcX4pA.js
29073
+ //#region ../mcp-core/dist/resolve-region-url-DNZh3Z8R.js
28212
29074
  const regionUrlCache = /* @__PURE__ */ new WeakMap();
28213
29075
  function getRegionUrlCache(context$1) {
28214
29076
  let cache = regionUrlCache.get(context$1);
@@ -28247,7 +29109,7 @@ async function resolveRegionUrlForOrganization({ context: context$1, organizatio
28247
29109
  }
28248
29110
 
28249
29111
  //#endregion
28250
- //#region ../mcp-core/dist/semantic-display-C9x4ir1O.js
29112
+ //#region ../mcp-core/dist/semantic-display-BDloW8Vy.js
28251
29113
  const SPAN_LABEL_MAX_LENGTH = 160;
28252
29114
  const SPAN_METADATA_MAX_LENGTH = 64;
28253
29115
  const SPAN_ATTRIBUTE_MAX_LENGTH = 2048;
@@ -28463,15 +29325,15 @@ function formatCloudEventsSpanDisplay(span, fallbackLabel) {
28463
29325
  };
28464
29326
  }
28465
29327
  function formatCicdSpanDisplay(span, fallbackLabel) {
28466
- const action = getSpanAttributeString(span, ["cicd.pipeline.action.name"]);
29328
+ const action$1 = getSpanAttributeString(span, ["cicd.pipeline.action.name"]);
28467
29329
  const pipeline = getSpanAttributeString(span, ["cicd.pipeline.name"]);
28468
29330
  const pipelineResult = getSpanAttributeString(span, ["cicd.pipeline.result"]);
28469
29331
  const taskName = getSpanAttributeString(span, ["cicd.pipeline.task.name"]);
28470
29332
  const taskResult = getSpanAttributeString(span, ["cicd.pipeline.task.run.result"]);
28471
29333
  const errorType = getErrorType(span);
28472
- if (!action && !pipeline && !pipelineResult && !taskName && !taskResult) return null;
29334
+ if (!action$1 && !pipeline && !pipelineResult && !taskName && !taskResult) return null;
28473
29335
  return {
28474
- label: joinDisplayParts([action, pipeline]) || taskName || fallbackLabel,
29336
+ label: joinDisplayParts([action$1, pipeline]) || taskName || fallbackLabel,
28475
29337
  metadata: compactStrings([
28476
29338
  pipelineResult,
28477
29339
  taskResult,
@@ -28635,7 +29497,7 @@ function formatDisplayPart(value, maxLength) {
28635
29497
  }
28636
29498
 
28637
29499
  //#endregion
28638
- //#region ../mcp-core/dist/get-trace-details-DIFsJzLU.js
29500
+ //#region ../mcp-core/dist/get-trace-details-BD28I1Vc.js
28639
29501
  const MAX_TRACE_FETCH_LIMIT = 1e3;
28640
29502
  const MAX_FOCUSED_TRACE_FETCH_LIMIT = 1e4;
28641
29503
  const MIN_TRACE_FETCH_LIMIT = 50;
@@ -29388,7 +30250,7 @@ function buildTraceNextSteps({ organizationSlug, traceId, spanFocused = false, e
29388
30250
  }
29389
30251
 
29390
30252
  //#endregion
29391
- //#region ../mcp-core/dist/get-span-details-CC9cxfpa.js
30253
+ //#region ../mcp-core/dist/get-span-details-BAuZ3dc4.js
29392
30254
  var get_span_details_default = defineTool({
29393
30255
  name: "get_span_details",
29394
30256
  skills: ["inspect"],
@@ -29429,7 +30291,7 @@ var get_span_details_default = defineTool({
29429
30291
  });
29430
30292
 
29431
30293
  //#endregion
29432
- //#region ../mcp-core/dist/url-helpers-DtpSKjOI.js
30294
+ //#region ../mcp-core/dist/url-helpers-D2DDUGaY.js
29433
30295
  /**
29434
30296
  * Parses a Sentry URL and extracts resource type and identifiers.
29435
30297
  *
@@ -29692,7 +30554,7 @@ function isProfileUrl(url) {
29692
30554
  }
29693
30555
 
29694
30556
  //#endregion
29695
- //#region ../mcp-core/dist/get-replay-details-BM6gDmGp.js
30557
+ //#region ../mcp-core/dist/get-replay-details-6gC-jaim.js
29696
30558
  const MAX_ACTIVITY_EVENTS = 6;
29697
30559
  const MAX_RELATED_ERRORS = 3;
29698
30560
  const MAX_RELATED_TRACES = 2;
@@ -30029,7 +30891,7 @@ function quoteDetail(value) {
30029
30891
  }
30030
30892
 
30031
30893
  //#endregion
30032
- //#region ../mcp-core/dist/get-event-attachment-LSEqrcub.js
30894
+ //#region ../mcp-core/dist/get-event-attachment-CfKLgOEQ.js
30033
30895
  function formatMegabytes(bytes) {
30034
30896
  return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
30035
30897
  }
@@ -30134,7 +30996,7 @@ var get_event_attachment_default = defineTool({
30134
30996
  const isEmpty = attachment.bytes.length === 0;
30135
30997
  if (isBinary && !isEmpty) {
30136
30998
  const isImage = effectiveMimeType.startsWith("image/");
30137
- const base64 = require_blob_utils_DgVug_Di.bytesToBase64(attachment.bytes);
30999
+ const base64 = require_blob_utils_B0ae0K_m.bytesToBase64(attachment.bytes);
30138
31000
  if (isImage) {
30139
31001
  const image = {
30140
31002
  type: "image",
@@ -30222,7 +31084,7 @@ var get_event_attachment_default = defineTool({
30222
31084
  });
30223
31085
 
30224
31086
  //#endregion
30225
- //#region ../mcp-core/dist/formatting-BG8yQUmg.js
31087
+ //#region ../mcp-core/dist/formatting-CLP0WPDy.js
30226
31088
  /**
30227
31089
  * Helper function to format assignedTo field for display
30228
31090
  */
@@ -30234,7 +31096,7 @@ function formatAssignedTo(assignedTo) {
30234
31096
  }
30235
31097
 
30236
31098
  //#endregion
30237
- //#region ../mcp-core/dist/update-issue-BH3fTM71.js
31099
+ //#region ../mcp-core/dist/update-issue-poSM1hi0.js
30238
31100
  function pluralize(value, noun) {
30239
31101
  return `${value} ${noun}${value === 1 ? "" : "s"}`;
30240
31102
  }
@@ -30643,7 +31505,7 @@ var update_issue_default = defineTool({
30643
31505
  });
30644
31506
 
30645
31507
  //#endregion
30646
- //#region ../mcp-core/dist/provider-fallback-B4jxYMQu.js
31508
+ //#region ../mcp-core/dist/provider-fallback-DdJOQofk.js
30647
31509
  /**
30648
31510
  * Run an optional embedded-agent rewrite and fall back to the caller's direct
30649
31511
  * behavior when the agent cannot complete the rewrite.
@@ -30683,7 +31545,7 @@ async function withProviderFallback({ operation, fallback, onFallback, run }) {
30683
31545
  }
30684
31546
 
30685
31547
  //#endregion
30686
- //#region ../mcp-core/dist/sentry-CcB-AERp.js
31548
+ //#region ../mcp-core/dist/sentry-B-6ys7Bw.js
30687
31549
  const SCRUB_PATTERNS = [
30688
31550
  {
30689
31551
  pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
@@ -30802,7 +31664,7 @@ function scrubSensitiveText(text$1) {
30802
31664
  }
30803
31665
 
30804
31666
  //#endregion
30805
- //#region ../mcp-core/dist/callEmbeddedAgent-DvwjAsbW.js
31667
+ //#region ../mcp-core/dist/callEmbeddedAgent-DZIFOnvg.js
30806
31668
  /**
30807
31669
  * Resolve the underlying provider failure from an AI SDK error.
30808
31670
  *
@@ -30997,7 +31859,7 @@ function rescueFromText(text$1, schema) {
30997
31859
  }
30998
31860
 
30999
31861
  //#endregion
31000
- //#region ../mcp-core/dist/utils-_7jC6e0y.js
31862
+ //#region ../mcp-core/dist/utils-DbOLEr0v.js
31001
31863
  /**
31002
31864
  * Standard response schema for all embedded agent tools.
31003
31865
  * Tools return either an error message or the result data, never both.
@@ -31116,7 +31978,7 @@ function agentTool(config) {
31116
31978
  }
31117
31979
 
31118
31980
  //#endregion
31119
- //#region ../mcp-core/dist/dataset-fields-nUaj8nt3.js
31981
+ //#region ../mcp-core/dist/dataset-fields-BLSn5y5v.js
31120
31982
  const REPLAY_EXCLUDED_TAGS = new Set([
31121
31983
  "browser",
31122
31984
  "device",
@@ -31615,7 +32477,7 @@ function getReplayCommonPatterns(availableFields) {
31615
32477
  }
31616
32478
 
31617
32479
  //#endregion
31618
- //#region ../mcp-core/dist/otel-semantics-D9c5D-bO.js
32480
+ //#region ../mcp-core/dist/otel-semantics-DJJCl9iN.js
31619
32481
  var namespace$72 = "android";
31620
32482
  var description$72 = "The Android platform on which the Android application is running.\n";
31621
32483
  var attributes$72 = {
@@ -36637,7 +37499,7 @@ function createOtelLookupTool(options) {
36637
37499
  }
36638
37500
 
36639
37501
  //#endregion
36640
- //#region ../mcp-core/dist/whoami-B81Oqo48.js
37502
+ //#region ../mcp-core/dist/whoami-DQvnv4Cu.js
36641
37503
  /**
36642
37504
  * Get the current authenticated user's information from Sentry API
36643
37505
  */
@@ -36666,7 +37528,7 @@ function createWhoamiTool(options) {
36666
37528
  }
36667
37529
 
36668
37530
  //#endregion
36669
- //#region ../mcp-core/dist/utils-DNoGJro2.js
37531
+ //#region ../mcp-core/dist/utils-C8th2C0P.js
36670
37532
  const DEFAULT_MAX_VALUE_LENGTH = 200;
36671
37533
  const DEFAULT_MAX_ARRAY_ITEMS = 20;
36672
37534
  const SENTRY_SEARCH_TOKEN_PATTERN = /(^|\s)!?([A-Za-z_][A-Za-z0-9_.[\],-]*):(?=\S)(?!\/\/)/g;
@@ -37127,7 +37989,7 @@ function createDatasetAttributesTool(options) {
37127
37989
  attributeTypes: zod.z.array(traceItemAttributeTypeSchema).min(1).optional().describe("Optional attribute types to list. Use ['string','number','boolean'] when unsure.")
37128
37990
  }),
37129
37991
  execute: async ({ dataset, substringMatch, query, attributeTypes }) => {
37130
- const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await Promise.resolve().then(() => require("./config-DRWtJff1.cjs"));
37992
+ const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await Promise.resolve().then(() => require("./config-DeGbV11k.cjs"));
37131
37993
  const normalizedDataset = require_constants.normalizeEventsDataset(dataset);
37132
37994
  const attributeTimeParams = { statsPeriod: "14d" };
37133
37995
  const { attributes: customAttributes, fieldTypes } = await fetchCustomAttributes(apiService, organizationSlug, dataset, projectId, attributeTimeParams, {
@@ -37217,7 +38079,7 @@ function createValidateEventsSearchTool(options) {
37217
38079
  }
37218
38080
 
37219
38081
  //#endregion
37220
- //#region ../mcp-core/dist/agent-D-RH-_8n.js
38082
+ //#region ../mcp-core/dist/agent-3xfzatLu.js
37221
38083
  const SEARCH_EVENTS_DATASETS$1 = [...require_constants.PUBLIC_EVENTS_DATASETS, "replays"];
37222
38084
  const searchEventsAgentOutputSchema = zod.z.object({
37223
38085
  dataset: zod.z.enum(SEARCH_EVENTS_DATASETS$1).describe("Which dataset to use for the query"),
@@ -37307,7 +38169,7 @@ async function searchEventsAgent(options) {
37307
38169
  const whoamiTool = createWhoamiTool({ apiService: options.apiService });
37308
38170
  const environmentNames = options.environmentNames ?? await fetchEnvironmentNames(options);
37309
38171
  return await callEmbeddedAgent({
37310
- system: buildSystemPromptWithEnvironments(require_config_B_l88mOS.systemPrompt, environmentNames),
38172
+ system: buildSystemPromptWithEnvironments(require_config_40SaJWzQ.systemPrompt, environmentNames),
37311
38173
  prompt: options.query,
37312
38174
  tools: {
37313
38175
  datasetAttributes: datasetAttributesTool,
@@ -37321,7 +38183,7 @@ async function searchEventsAgent(options) {
37321
38183
  }
37322
38184
 
37323
38185
  //#endregion
37324
- //#region ../mcp-core/dist/analyzer-BuS9K0e5.js
38186
+ //#region ../mcp-core/dist/analyzer-DTPOg7sk.js
37325
38187
  /**
37326
38188
  * Analyzes flamegraph data to extract hot paths (most CPU-intensive call stacks).
37327
38189
  *
@@ -37580,7 +38442,7 @@ function hasProfileData(flamegraph) {
37580
38442
  }
37581
38443
 
37582
38444
  //#endregion
37583
- //#region ../mcp-core/dist/formatters-DsABISrU.js
38445
+ //#region ../mcp-core/dist/formatters-URITEr9v.js
37584
38446
  /**
37585
38447
  * Format an explanation for how the input query was translated
37586
38448
  */
@@ -38085,7 +38947,7 @@ function formatTimeSeriesResults(params) {
38085
38947
  }
38086
38948
 
38087
38949
  //#endregion
38088
- //#region ../mcp-core/dist/replays-DQeYjWub.js
38950
+ //#region ../mcp-core/dist/replays-c2P32g8H.js
38089
38951
  const DEFAULT_REPLAY_SORT = "-started_at";
38090
38952
  const DEFAULT_REPLAY_STATS_PERIOD = "14d";
38091
38953
  const REPLAY_SORT_FIELDS = [
@@ -38210,14 +39072,14 @@ function formatReplayEnvironment(environment) {
38210
39072
  }
38211
39073
 
38212
39074
  //#endregion
38213
- //#region ../mcp-core/dist/search-events-BFGK2Xtv.js
39075
+ //#region ../mcp-core/dist/search-events-9GC_uKqn.js
38214
39076
  const SEARCH_EVENTS_DATASETS = [...require_constants.PUBLIC_EVENTS_DATASETS, "replays"];
38215
39077
  const DEFAULT_EVENTS_SORT = "-timestamp";
38216
39078
  function defaultSortForDataset(dataset) {
38217
39079
  return dataset === "replays" ? DEFAULT_REPLAY_SORT : DEFAULT_EVENTS_SORT;
38218
39080
  }
38219
39081
  function defaultFieldsForDataset(dataset) {
38220
- return require_config_B_l88mOS.RECOMMENDED_FIELDS[require_constants.normalizeEventsDataset(dataset)].basic;
39082
+ return require_config_40SaJWzQ.RECOMMENDED_FIELDS[require_constants.normalizeEventsDataset(dataset)].basic;
38221
39083
  }
38222
39084
  function resolveEventFields({ dataset, explicitFields, agentFields, trustExplicitFields }) {
38223
39085
  if (trustExplicitFields && explicitFields && explicitFields.length > 0) return explicitFields;
@@ -38240,7 +39102,7 @@ function augmentFieldsWithSort(fields, sort) {
38240
39102
  return fields;
38241
39103
  }
38242
39104
  function buildRequestFields(dataset, 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;
39105
+ return dataset !== "replays" && require_constants.isMetricsDataset(dataset) && !isAggregateQuery(fields) ? Array.from(new Set([...fields, ...require_config_40SaJWzQ.TRACE_METRICS_SAMPLE_IDENTITY_FIELDS])) : fields;
38244
39106
  }
38245
39107
  function isTraceItemDataset(dataset) {
38246
39108
  return dataset === "spans" || dataset === "logs" || dataset === "metrics";
@@ -38708,7 +39570,7 @@ var search_events_default = defineTool({
38708
39570
  });
38709
39571
 
38710
39572
  //#endregion
38711
- //#region ../mcp-core/dist/create-team-CgnBfkV1.js
39573
+ //#region ../mcp-core/dist/create-team-BxcEavRa.js
38712
39574
  const createTeamOutputSchema = zod.z.object({ team: zod.z.object({
38713
39575
  id: zod.z.string(),
38714
39576
  slug: zod.z.string(),
@@ -38767,7 +39629,7 @@ var create_team_default = defineTool({
38767
39629
  });
38768
39630
 
38769
39631
  //#endregion
38770
- //#region ../mcp-core/dist/create-project-BHO4uN-y.js
39632
+ //#region ../mcp-core/dist/create-project-BPfG37b9.js
38771
39633
  function getUsableClientKey(clientKeys) {
38772
39634
  return clientKeys.find((key) => key.name === "Default" && key.isActive && key.dsn.public) ?? clientKeys.find((key) => key.isActive && key.dsn.public);
38773
39635
  }
@@ -38923,7 +39785,7 @@ var create_project_default = defineTool({
38923
39785
  });
38924
39786
 
38925
39787
  //#endregion
38926
- //#region ../mcp-core/dist/update-project-CQdb0Elv.js
39788
+ //#region ../mcp-core/dist/update-project-YphAStAB.js
38927
39789
  const updateProjectOutputSchema = zod.z.object({ project: zod.z.object({
38928
39790
  id: zod.z.string(),
38929
39791
  slug: zod.z.string(),
@@ -38999,6 +39861,7 @@ var update_project_default = defineTool({
38999
39861
  platform: params.platform
39000
39862
  });
39001
39863
  } catch (err) {
39864
+ if (err instanceof ApiClientError) throw err;
39002
39865
  logIssue(err);
39003
39866
  throw new Error(`Failed to update project ${params.projectSlug}: ${err instanceof Error ? err.message : "Unknown error"}`, { cause: err });
39004
39867
  }
@@ -39012,7 +39875,7 @@ var update_project_default = defineTool({
39012
39875
  });
39013
39876
 
39014
39877
  //#endregion
39015
- //#region ../mcp-core/dist/add-team-to-project-CNjkc5mL.js
39878
+ //#region ../mcp-core/dist/add-team-to-project-CKW-0xoY.js
39016
39879
  const assignedTeamSchema$1 = zod.z.object({
39017
39880
  id: zod.z.string(),
39018
39881
  slug: zod.z.string(),
@@ -39099,7 +39962,7 @@ var add_team_to_project_default = defineTool({
39099
39962
  });
39100
39963
 
39101
39964
  //#endregion
39102
- //#region ../mcp-core/dist/remove-team-from-project-CM2_RkK5.js
39965
+ //#region ../mcp-core/dist/remove-team-from-project-DAA3jAct.js
39103
39966
  const assignedTeamSchema = zod.z.object({
39104
39967
  id: zod.z.string(),
39105
39968
  slug: zod.z.string(),
@@ -39185,7 +40048,7 @@ var remove_team_from_project_default = defineTool({
39185
40048
  });
39186
40049
 
39187
40050
  //#endregion
39188
- //#region ../mcp-core/dist/create-dsn-BtFKEMq7.js
40051
+ //#region ../mcp-core/dist/create-dsn-Vt_rAOT2.js
39189
40052
  const createDsnOutputSchema = zod.z.object({ dsn: zod.z.object({
39190
40053
  id: zod.z.string(),
39191
40054
  name: zod.z.string(),
@@ -39250,7 +40113,7 @@ var create_dsn_default = defineTool({
39250
40113
  });
39251
40114
 
39252
40115
  //#endregion
39253
- //#region ../mcp-core/dist/find-dsns-CqiIxv7u.js
40116
+ //#region ../mcp-core/dist/find-dsns-BVtlnryz.js
39254
40117
  const findDsnsOutputSchema = zod.z.object({ dsns: zod.z.array(zod.z.object({
39255
40118
  id: zod.z.string(),
39256
40119
  name: zod.z.string(),
@@ -39300,7 +40163,7 @@ var find_dsns_default = defineTool({
39300
40163
  });
39301
40164
 
39302
40165
  //#endregion
39303
- //#region ../mcp-core/dist/update-dsn-DP7ljBh8.js
40166
+ //#region ../mcp-core/dist/update-dsn-DJa7zQFs.js
39304
40167
  var update_dsn_default = defineTool({
39305
40168
  name: "update_dsn",
39306
40169
  skills: ["project-management"],
@@ -39434,7 +40297,7 @@ var update_dsn_default = defineTool({
39434
40297
  });
39435
40298
 
39436
40299
  //#endregion
39437
- //#region ../mcp-core/dist/analyze-issue-with-seer-Bh4zPWGl.js
40300
+ //#region ../mcp-core/dist/analyze-issue-with-seer-CX58IHSd.js
39438
40301
  var analyze_issue_with_seer_default = defineTool({
39439
40302
  name: "analyze_issue_with_seer",
39440
40303
  skills: ["seer"],
@@ -39623,7 +40486,7 @@ var analyze_issue_with_seer_default = defineTool({
39623
40486
  });
39624
40487
 
39625
40488
  //#endregion
39626
- //#region ../mcp-core/dist/search-docs-Tj5IpQIk.js
40489
+ //#region ../mcp-core/dist/search-docs-CZh-QUFq.js
39627
40490
  var search_docs_default = defineTool({
39628
40491
  name: "search_docs",
39629
40492
  skills: ["inspect", "docs"],
@@ -39720,7 +40583,7 @@ var search_docs_default = defineTool({
39720
40583
  });
39721
40584
 
39722
40585
  //#endregion
39723
- //#region ../mcp-core/dist/get-doc-D-DZcOOW.js
40586
+ //#region ../mcp-core/dist/get-doc-Bgv-F6A-.js
39724
40587
  var get_doc_default = defineTool({
39725
40588
  name: "get_doc",
39726
40589
  skills: ["inspect", "docs"],
@@ -39798,7 +40661,7 @@ var get_doc_default = defineTool({
39798
40661
  });
39799
40662
 
39800
40663
  //#endregion
39801
- //#region ../mcp-core/dist/config-CCjTO4AY.js
40664
+ //#region ../mcp-core/dist/config-BrGCkvH1.js
39802
40665
  /**
39803
40666
  * Configuration for the search-issues agent
39804
40667
  */
@@ -39895,7 +40758,7 @@ Use issueFields only when a requested field is not in the built-in fields list.
39895
40758
  Use whoami only for natural-language me references.`;
39896
40759
 
39897
40760
  //#endregion
39898
- //#region ../mcp-core/dist/agent-DyOsplyJ.js
40761
+ //#region ../mcp-core/dist/agent-Cf8D7DxG.js
39899
40762
  const searchIssuesAgentOutputSchema = zod.z.object({
39900
40763
  query: zod.z.string().describe("The Sentry issue search query"),
39901
40764
  sort: zod.z.enum([
@@ -39929,7 +40792,7 @@ async function searchIssuesAgent(options) {
39929
40792
  }
39930
40793
 
39931
40794
  //#endregion
39932
- //#region ../mcp-core/dist/formatters-CZbnEl5Q.js
40795
+ //#region ../mcp-core/dist/formatters-DHxOgm8X.js
39933
40796
  /**
39934
40797
  * Format an explanation for how the input query was translated
39935
40798
  */
@@ -40023,7 +40886,7 @@ function formatDate$1(dateString) {
40023
40886
  }
40024
40887
 
40025
40888
  //#endregion
40026
- //#region ../mcp-core/dist/search-issues-lbSTiP3S.js
40889
+ //#region ../mcp-core/dist/search-issues-D5VnkOKc.js
40027
40890
  const ProjectSlugOrIdSchema = zod.z.string().trim().superRefine(validateSlugOrId);
40028
40891
  function buildIssueSearchRepairPrompt(params) {
40029
40892
  return [
@@ -40203,7 +41066,7 @@ var search_issues_default = defineTool({
40203
41066
  });
40204
41067
 
40205
41068
  //#endregion
40206
- //#region ../mcp-core/dist/config-Nif76Shh.js
41069
+ //#region ../mcp-core/dist/config-BAf0GIjB.js
40207
41070
  const systemPrompt$1 = `You are a Sentry issue event filter translator. Your job is to:
40208
41071
  1. Translate natural language queries into Sentry tag filters for events within a SPECIFIC issue
40209
41072
  2. Select appropriate fields to return in the results
@@ -40536,7 +41399,7 @@ const EXAMPLE_QUERIES = [
40536
41399
  ];
40537
41400
 
40538
41401
  //#endregion
40539
- //#region ../mcp-core/dist/utils-DeCBYEnS.js
41402
+ //#region ../mcp-core/dist/utils-BwSqp7q3.js
40540
41403
  /**
40541
41404
  * Create a tool for the agent to query available tags and fields for issue events
40542
41405
  * The tool is pre-bound with the API service and organization configured for the appropriate region
@@ -40619,7 +41482,7 @@ Received: ${params.issueUrl}`);
40619
41482
  }
40620
41483
 
40621
41484
  //#endregion
40622
- //#region ../mcp-core/dist/agent-DTdycAuW.js
41485
+ //#region ../mcp-core/dist/agent-Diy1JYNf.js
40623
41486
  const searchIssueEventsAgentOutputSchema = zod.z.object({
40624
41487
  query: zod.z.string().describe("Sentry query filters for tags/fields (NOT including issue: prefix - handler adds that)"),
40625
41488
  fields: zod.z.array(zod.z.string()).describe("Array of field names to return in results"),
@@ -40661,7 +41524,7 @@ async function searchIssueEventsAgent(options) {
40661
41524
  }
40662
41525
 
40663
41526
  //#endregion
40664
- //#region ../mcp-core/dist/search-issue-events-Ck9S6CNC.js
41527
+ //#region ../mcp-core/dist/search-issue-events-Cl8muuTj.js
40665
41528
  function buildIssueEventSearchRepairPrompt(params) {
40666
41529
  return [
40667
41530
  "Fix this Sentry issue event search request.",
@@ -40814,7 +41677,7 @@ var search_issue_events_default = defineTool({
40814
41677
  });
40815
41678
 
40816
41679
  //#endregion
40817
- //#region ../mcp-core/dist/formatter-ffKOVbDF.js
41680
+ //#region ../mcp-core/dist/formatter-CoaUL0l7.js
40818
41681
  /**
40819
41682
  * Maps a change type to its corresponding status icon.
40820
41683
  */
@@ -41190,7 +42053,7 @@ function formatSdkSummary(profile) {
41190
42053
  }
41191
42054
 
41192
42055
  //#endregion
41193
- //#region ../mcp-core/dist/get-profile-4EwZiRri.js
42056
+ //#region ../mcp-core/dist/get-profile-DWVqmH1v.js
41194
42057
  /**
41195
42058
  * Resolves profile parameters from URL or explicit params.
41196
42059
  * URL takes precedence if provided and valid.
@@ -41408,7 +42271,7 @@ var get_profile_default = defineTool({
41408
42271
  });
41409
42272
 
41410
42273
  //#endregion
41411
- //#region ../mcp-core/dist/get-profile-details-KNM3CXky.js
42274
+ //#region ../mcp-core/dist/get-profile-details-CASWVK-x.js
41412
42275
  function resolveProfileDetailsParams(params) {
41413
42276
  if (params.profileUrl) {
41414
42277
  if (!isProfileUrl(params.profileUrl)) throw new UserInputError("Invalid profile URL. URL must point to a Sentry profile resource.");
@@ -41636,7 +42499,7 @@ var get_profile_details_default = defineTool({
41636
42499
  });
41637
42500
 
41638
42501
  //#endregion
41639
- //#region ../mcp-core/dist/get-agent-conversation-details-bM0VVNAG.js
42502
+ //#region ../mcp-core/dist/get-agent-conversation-details-CE1puwgh.js
41640
42503
  function withoutUndefined(value) {
41641
42504
  return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0));
41642
42505
  }
@@ -42052,7 +42915,7 @@ var get_agent_conversation_details_default = defineTool({
42052
42915
  });
42053
42916
 
42054
42917
  //#endregion
42055
- //#region ../mcp-core/dist/formatting-B1ckR5H7.js
42918
+ //#region ../mcp-core/dist/formatting-DeMPfsp0.js
42056
42919
  function getSnapshotImageDisplayName(img) {
42057
42920
  return img.display_name || img.image_file_name || "unknown";
42058
42921
  }
@@ -42146,7 +43009,7 @@ function isPlainObject$2(value) {
42146
43009
  }
42147
43010
 
42148
43011
  //#endregion
42149
- //#region ../mcp-core/dist/handlers-DhPeWak0.js
43012
+ //#region ../mcp-core/dist/handlers-CqW5tNuO.js
42150
43013
  function fullResolutionHint({ organizationSlug, snapshotId, imageIdentifier, experimentalMode, availableToolNames, directToolNames }) {
42151
43014
  return `- **Full Resolution**: ${formatToolCallInstruction({
42152
43015
  toolName: "get_snapshot_image",
@@ -42201,7 +43064,7 @@ function formatImageMetadata(img) {
42201
43064
  }
42202
43065
  async function createPreviewOrNull(blob, contentType) {
42203
43066
  try {
42204
- return await require_blob_utils_DgVug_Di.createImagePreview(blob, contentType);
43067
+ return await require_blob_utils_B0ae0K_m.createImagePreview(blob, contentType);
42205
43068
  } catch {
42206
43069
  return null;
42207
43070
  }
@@ -42222,7 +43085,7 @@ async function fetchAndAppendImage(apiService, imageUrl, label, imageResolution,
42222
43085
  });
42223
43086
  parts.push({
42224
43087
  type: "image",
42225
- data: await require_blob_utils_DgVug_Di.blobToBase64(blob),
43088
+ data: await require_blob_utils_B0ae0K_m.blobToBase64(blob),
42226
43089
  mimeType: contentType
42227
43090
  });
42228
43091
  return;
@@ -42241,7 +43104,7 @@ async function fetchAndAppendImage(apiService, imageUrl, label, imageResolution,
42241
43104
  });
42242
43105
  parts.push({
42243
43106
  type: "image",
42244
- data: await require_blob_utils_DgVug_Di.blobToBase64(preview.blob),
43107
+ data: await require_blob_utils_B0ae0K_m.blobToBase64(preview.blob),
42245
43108
  mimeType: preview.contentType
42246
43109
  });
42247
43110
  }
@@ -42412,7 +43275,7 @@ async function fetchSnapshotSummary(apiService, organizationSlug, snapshotId, so
42412
43275
  }
42413
43276
 
42414
43277
  //#endregion
42415
- //#region ../mcp-core/dist/get-snapshot-P1FuvUwa.js
43278
+ //#region ../mcp-core/dist/get-snapshot-Cp8WUme2.js
42416
43279
  var get_snapshot_default = defineTool({
42417
43280
  name: "get_snapshot",
42418
43281
  skills: ["inspect"],
@@ -42490,7 +43353,7 @@ var get_snapshot_default = defineTool({
42490
43353
  });
42491
43354
 
42492
43355
  //#endregion
42493
- //#region ../mcp-core/dist/get-snapshot-image-DjtwEpMj.js
43356
+ //#region ../mcp-core/dist/get-snapshot-image-Bcz3N5o-.js
42494
43357
  var get_snapshot_image_default = defineTool({
42495
43358
  name: "get_snapshot_image",
42496
43359
  skills: ["inspect"],
@@ -42551,7 +43414,7 @@ var get_snapshot_image_default = defineTool({
42551
43414
  });
42552
43415
 
42553
43416
  //#endregion
42554
- //#region ../mcp-core/dist/get-sentry-resource-BXVp2SKN.js
43417
+ //#region ../mcp-core/dist/get-sentry-resource-DJ9t-d53.js
42555
43418
  /** Types with full API integration. */
42556
43419
  const FULLY_SUPPORTED_TYPES = [
42557
43420
  "issue",
@@ -42939,7 +43802,7 @@ var get_sentry_resource_default = defineTool({
42939
43802
  });
42940
43803
 
42941
43804
  //#endregion
42942
- //#region ../mcp-core/dist/get-latest-base-snapshot-CEkWKEZJ.js
43805
+ //#region ../mcp-core/dist/get-latest-base-snapshot-Dl4s52CB.js
42943
43806
  var get_latest_base_snapshot_default = defineTool({
42944
43807
  name: "get_latest_base_snapshot",
42945
43808
  skills: ["inspect"],
@@ -43035,7 +43898,7 @@ var get_latest_base_snapshot_default = defineTool({
43035
43898
  });
43036
43899
 
43037
43900
  //#endregion
43038
- //#region ../mcp-core/dist/search-agent-conversations-BGO_38e-.js
43901
+ //#region ../mcp-core/dist/search-agent-conversations-jYjAqguW.js
43039
43902
  const PREVIEW_LENGTH = 240;
43040
43903
  const TRACE_ID_SAMPLE_SIZE = 3;
43041
43904
  const usdFormatter = new Intl.NumberFormat("en-US", {
@@ -43225,7 +44088,7 @@ var search_agent_conversations_default = defineTool({
43225
44088
  });
43226
44089
 
43227
44090
  //#endregion
43228
- //#region ../mcp-core/dist/add-issue-note-YI_XzMvf.js
44091
+ //#region ../mcp-core/dist/add-issue-note-pMptax5b.js
43229
44092
  function formatComment(comment) {
43230
44093
  const actor = comment.user ? formatActor(comment.user) : "current user";
43231
44094
  const text$1 = comment.data ? readString(comment.data, "text") : null;
@@ -43301,7 +44164,7 @@ var add_issue_note_default = defineTool({
43301
44164
  });
43302
44165
 
43303
44166
  //#endregion
43304
- //#region ../mcp-core/dist/onboarding-status-update-BJR7w05r.js
44167
+ //#region ../mcp-core/dist/onboarding-status-update-BFCjGpyi.js
43305
44168
  const updateBaseSchema = zod.z.object({
43306
44169
  status: AgenticOnboardingStageStatusUpdateSchema.describe("The stage's current status."),
43307
44170
  runStatus: AgenticOnboardingRunStatusUpdateSchema.optional().describe("Set only when the entire onboarding run has completed or failed."),
@@ -43369,7 +44232,7 @@ var onboarding_status_update_default = defineTool({
43369
44232
  });
43370
44233
 
43371
44234
  //#endregion
43372
- //#region ../mcp-core/dist/catalog-CZAR_B3F.js
44235
+ //#region ../mcp-core/dist/catalog-BJlVMc9Y.js
43373
44236
  const legacyGetAIConversationDetails = {
43374
44237
  ...get_agent_conversation_details_default,
43375
44238
  name: "get_ai_conversation_details",
@@ -43412,12 +44275,20 @@ const catalogTools = {
43412
44275
  get_monitor_details: get_monitor_details_default,
43413
44276
  find_uptime_monitors: find_uptime_monitors_default,
43414
44277
  get_uptime_monitor_details: get_uptime_monitor_details_default,
44278
+ find_metric_monitors: find_metric_monitors_default,
44279
+ get_metric_monitor_details: get_metric_monitor_details_default,
44280
+ create_metric_monitor: create_metric_monitor_default,
44281
+ update_metric_monitor: update_metric_monitor_default,
44282
+ delete_metric_monitor: delete_metric_monitor_default,
43415
44283
  create_uptime_monitor: create_uptime_monitor_default,
43416
44284
  update_uptime_monitor: update_uptime_monitor_default,
43417
44285
  delete_uptime_monitor: delete_uptime_monitor_default,
43418
44286
  find_alert_rules: find_alert_rules_default,
43419
44287
  get_alert_rule: get_alert_rule_default,
43420
44288
  get_alert_options: get_alert_options_default,
44289
+ update_alert_rule: update_alert_rule_default,
44290
+ create_alert_rule: create_alert_rule_default,
44291
+ delete_alert_rule: delete_alert_rule_default,
43421
44292
  get_issue_details: get_issue_details_default,
43422
44293
  get_event_stacktrace: get_event_stacktrace_default,
43423
44294
  get_issue_activity: get_issue_activity_default,
@@ -43460,7 +44331,7 @@ const catalogTools = {
43460
44331
  var catalog_default = catalogTools;
43461
44332
 
43462
44333
  //#endregion
43463
- //#region ../mcp-core/dist/schema-Bf6vaXky.js
44334
+ //#region ../mcp-core/dist/schema-lxCqP5_R.js
43464
44335
  function zodFieldMapToJsonSchema(fieldMap) {
43465
44336
  const zodObject = Object.keys(fieldMap).length > 0 ? zod.z.object(fieldMap) : zod.z.object({});
43466
44337
  const { $schema: _,...jsonSchema$1 } = zod.z.toJSONSchema(zodObject, {
@@ -43472,7 +44343,7 @@ function zodFieldMapToJsonSchema(fieldMap) {
43472
44343
  }
43473
44344
 
43474
44345
  //#endregion
43475
- //#region ../mcp-core/dist/search--TO414uy.js
44346
+ //#region ../mcp-core/dist/search-DQYTHTRw.js
43476
44347
  function tokenize(value) {
43477
44348
  return value.toLowerCase().split(/[^a-z0-9_]+/).map((token) => token.trim()).filter(Boolean);
43478
44349
  }
@@ -43523,7 +44394,7 @@ function searchToolCatalog({ tools, context: context$1, query, limit }) {
43523
44394
  }
43524
44395
 
43525
44396
  //#endregion
43526
- //#region ../mcp-core/dist/search-tools-DD_Fpn20.js
44397
+ //#region ../mcp-core/dist/search-tools-HGLF7OhR.js
43527
44398
  const DEFAULT_LIMIT = 8;
43528
44399
  const MAX_LIMIT = 20;
43529
44400
  const toolAnnotationsOutputSchema = zod.z.object({
@@ -43605,7 +44476,7 @@ function createSearchToolsTool(getTools) {
43605
44476
  }
43606
44477
 
43607
44478
  //#endregion
43608
- //#region ../mcp-core/dist/execute-tool-Z6g9XYm0.js
44479
+ //#region ../mcp-core/dist/execute-tool-CsdhgdEx.js
43609
44480
  function setToolArgumentAttributes(span, params) {
43610
44481
  for (const [key, value] of Object.entries(params)) {
43611
44482
  const attributeValue = value == null || typeof value === "object" ? JSON.stringify(value) : value;
@@ -43690,7 +44561,7 @@ function createExecuteTool(getTools) {
43690
44561
  }
43691
44562
 
43692
44563
  //#endregion
43693
- //#region ../mcp-core/dist/tools-EVTUbO4b.js
44564
+ //#region ../mcp-core/dist/tools-B_S658xh.js
43694
44565
  function getAllTools() {
43695
44566
  return allTools;
43696
44567
  }
@@ -52187,9 +53058,9 @@ var require_codegen = /* @__PURE__ */ __commonJSMin((exports$1) => {
52187
53058
  var Else = class extends BlockNode {};
52188
53059
  Else.kind = "else";
52189
53060
  var If = class If$1 extends BlockNode {
52190
- constructor(condition, nodes) {
53061
+ constructor(condition$1, nodes) {
52191
53062
  super(nodes);
52192
- this.condition = condition;
53063
+ this.condition = condition$1;
52193
53064
  }
52194
53065
  render(opts) {
52195
53066
  let code = `if(${this.condition})` + super.render(opts);
@@ -52421,15 +53292,15 @@ var require_codegen = /* @__PURE__ */ __commonJSMin((exports$1) => {
52421
53292
  code.push("}");
52422
53293
  return new code_1._Code(code);
52423
53294
  }
52424
- if(condition, thenBody, elseBody) {
52425
- this._blockNode(new If(condition));
53295
+ if(condition$1, thenBody, elseBody) {
53296
+ this._blockNode(new If(condition$1));
52426
53297
  if (thenBody && elseBody) this.code(thenBody).else().code(elseBody).endIf();
52427
53298
  else if (thenBody) this.code(thenBody).endIf();
52428
53299
  else if (elseBody) throw new Error("CodeGen: \"else\" body without \"then\" body");
52429
53300
  return this;
52430
53301
  }
52431
- elseIf(condition) {
52432
- return this._elseNode(new If(condition));
53302
+ elseIf(condition$1) {
53303
+ return this._elseNode(new If(condition$1));
52433
53304
  }
52434
53305
  else() {
52435
53306
  return this._elseNode(new Else());
@@ -53163,9 +54034,9 @@ var require_defaults = /* @__PURE__ */ __commonJSMin((exports$1) => {
53163
54034
  (0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`);
53164
54035
  return;
53165
54036
  }
53166
- let condition = (0, codegen_1._)`${childData} === undefined`;
53167
- if (opts.useDefaults === "empty") condition = (0, codegen_1._)`${condition} || ${childData} === null || ${childData} === ""`;
53168
- gen.if(condition, (0, codegen_1._)`${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);
54037
+ let condition$1 = (0, codegen_1._)`${childData} === undefined`;
54038
+ if (opts.useDefaults === "empty") condition$1 = (0, codegen_1._)`${condition$1} || ${childData} === null || ${childData} === ""`;
54039
+ gen.if(condition$1, (0, codegen_1._)`${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);
53169
54040
  }
53170
54041
  });
53171
54042
  var require_code = /* @__PURE__ */ __commonJSMin((exports$1) => {
@@ -53934,11 +54805,11 @@ var require_validate = /* @__PURE__ */ __commonJSMin((exports$1) => {
53934
54805
  }
53935
54806
  if ("code" in def ? def.trackErrors : def.errors !== false) this.errsCount = it.gen.const("_errs", names_1.default.errors);
53936
54807
  }
53937
- result(condition, successAction, failAction) {
53938
- this.failResult((0, codegen_1.not)(condition), successAction, failAction);
54808
+ result(condition$1, successAction, failAction) {
54809
+ this.failResult((0, codegen_1.not)(condition$1), successAction, failAction);
53939
54810
  }
53940
- failResult(condition, successAction, failAction) {
53941
- this.gen.if(condition);
54811
+ failResult(condition$1, successAction, failAction) {
54812
+ this.gen.if(condition$1);
53942
54813
  if (failAction) failAction();
53943
54814
  else this.error();
53944
54815
  if (successAction) {
@@ -53948,24 +54819,24 @@ var require_validate = /* @__PURE__ */ __commonJSMin((exports$1) => {
53948
54819
  } else if (this.allErrors) this.gen.endIf();
53949
54820
  else this.gen.else();
53950
54821
  }
53951
- pass(condition, failAction) {
53952
- this.failResult((0, codegen_1.not)(condition), void 0, failAction);
54822
+ pass(condition$1, failAction) {
54823
+ this.failResult((0, codegen_1.not)(condition$1), void 0, failAction);
53953
54824
  }
53954
- fail(condition) {
53955
- if (condition === void 0) {
54825
+ fail(condition$1) {
54826
+ if (condition$1 === void 0) {
53956
54827
  this.error();
53957
54828
  if (!this.allErrors) this.gen.if(false);
53958
54829
  return;
53959
54830
  }
53960
- this.gen.if(condition);
54831
+ this.gen.if(condition$1);
53961
54832
  this.error();
53962
54833
  if (this.allErrors) this.gen.endIf();
53963
54834
  else this.gen.else();
53964
54835
  }
53965
- fail$data(condition) {
53966
- if (!this.$data) return this.fail(condition);
54836
+ fail$data(condition$1) {
54837
+ if (!this.$data) return this.fail(condition$1);
53967
54838
  const { schemaCode } = this;
53968
- this.fail((0, codegen_1._)`${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`);
54839
+ this.fail((0, codegen_1._)`${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition$1)})`);
53969
54840
  }
53970
54841
  error(append, errorParams, errorPaths) {
53971
54842
  if (errorParams) {