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