@sentry/mcp-server 0.40.0 → 0.41.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 (74) 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-CYOpb-jm.cjs} +4 -4
  8. package/dist/{auth-CmmVlYDi.cjs.map → auth-CYOpb-jm.cjs.map} +1 -1
  9. package/dist/{auth-CpyUfxVa.js → auth-YZqLxyqD.js} +4 -4
  10. package/dist/{auth-CpyUfxVa.js.map → auth-YZqLxyqD.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/parse.d.cts.map +1 -1
  20. package/dist/cli/resolve.cjs +2 -2
  21. package/dist/cli/resolve.js +2 -2
  22. package/dist/cli/usage.cjs +1 -1
  23. package/dist/cli/usage.js +1 -1
  24. package/dist/{config-B-l88mOS-DNM_M--P.cjs → config-40SaJWzQ-Bxau3bPR.cjs} +2 -2
  25. package/dist/{config-B-l88mOS-DNM_M--P.cjs.map → config-40SaJWzQ-Bxau3bPR.cjs.map} +1 -1
  26. package/dist/{config-B-l88mOS-v5IBYyQU.js → config-40SaJWzQ-Dz27jdMQ.js} +2 -2
  27. package/dist/{config-B-l88mOS-v5IBYyQU.js.map → config-40SaJWzQ-Dz27jdMQ.js.map} +1 -1
  28. package/dist/config-DeGbV11k.cjs +7 -0
  29. package/dist/{config-_di9BWJ0.js → config-NGx6OsOU.js} +1 -1
  30. package/dist/{constants-DyDxXiYc.cjs → constants-BqO-QSHl.cjs} +3 -2
  31. package/dist/{constants-DyDxXiYc.cjs.map → constants-BqO-QSHl.cjs.map} +1 -1
  32. package/dist/{constants-CS0iQGX_.js → constants-Da7VwSRQ.js} +3 -2
  33. package/dist/{constants-CS0iQGX_.js.map → constants-Da7VwSRQ.js.map} +1 -1
  34. package/dist/{device-code-flow-CARIuIzP.js → device-code-flow-Bk6L232R.js} +3 -3
  35. package/dist/{device-code-flow-CARIuIzP.js.map → device-code-flow-Bk6L232R.js.map} +1 -1
  36. package/dist/{device-code-flow-D1UFW6dK.cjs → device-code-flow-Dv-auCiV.cjs} +3 -3
  37. package/dist/{device-code-flow-D1UFW6dK.cjs.map → device-code-flow-Dv-auCiV.cjs.map} +1 -1
  38. package/dist/index.cjs +1323 -447
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.js +1316 -440
  41. package/dist/index.js.map +1 -1
  42. package/dist/{resolve-D3vntNua.cjs → resolve-CZUghJrC.cjs} +9 -6
  43. package/dist/resolve-CZUghJrC.cjs.map +1 -0
  44. package/dist/{resolve-C9Uf3wka.js → resolve-CkkdMFiR.js} +9 -6
  45. package/dist/resolve-CkkdMFiR.js.map +1 -0
  46. package/dist/{resolve-token-CYqj4HQ5.js → resolve-token-4RkU7UPe.js} +3 -3
  47. package/dist/{resolve-token-CYqj4HQ5.js.map → resolve-token-4RkU7UPe.js.map} +1 -1
  48. package/dist/{resolve-token-DKvK-YrS.cjs → resolve-token-Daqu57f-.cjs} +3 -3
  49. package/dist/{resolve-token-DKvK-YrS.cjs.map → resolve-token-Daqu57f-.cjs.map} +1 -1
  50. package/dist/{stdio-BhYLPDOA.cjs → stdio-4lgW_97D.cjs} +2 -2
  51. package/dist/{stdio-BhYLPDOA.cjs.map → stdio-4lgW_97D.cjs.map} +1 -1
  52. package/dist/{stdio-iZJ0t3f6.js → stdio-C0wKX460.js} +2 -2
  53. package/dist/{stdio-iZJ0t3f6.js.map → stdio-C0wKX460.js.map} +1 -1
  54. package/dist/transports/stdio.cjs +2 -2
  55. package/dist/transports/stdio.js +2 -2
  56. package/dist/{usage-Crfzx1qJ.cjs → usage-DZ4QDygT.cjs} +6 -4
  57. package/dist/usage-DZ4QDygT.cjs.map +1 -0
  58. package/dist/{usage-Con424Df.js → usage-Hi-6-LDr.js} +6 -4
  59. package/dist/usage-Hi-6-LDr.js.map +1 -0
  60. package/dist/{version-CDZpvmqM.cjs → version-B-XjWQrQ.cjs} +3 -3
  61. package/dist/version-B-XjWQrQ.cjs.map +1 -0
  62. package/dist/version-CWKzsUXy.js +7 -0
  63. package/dist/version-CWKzsUXy.js.map +1 -0
  64. package/package.json +4 -4
  65. package/dist/blob-utils-CJyQkdm-.js +0 -3
  66. package/dist/blob-utils-DGsI5_gF.cjs +0 -3
  67. package/dist/config-DRWtJff1.cjs +0 -7
  68. package/dist/resolve-C9Uf3wka.js.map +0 -1
  69. package/dist/resolve-D3vntNua.cjs.map +0 -1
  70. package/dist/usage-Con424Df.js.map +0 -1
  71. package/dist/usage-Crfzx1qJ.cjs.map +0 -1
  72. package/dist/version-CDZpvmqM.cjs.map +0 -1
  73. package/dist/version-a8th87fY.js +0 -7
  74. package/dist/version-a8th87fY.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  const require_chunk = require('./chunk-Cv9WC9bY.cjs');
3
- const require_resolve = require('./resolve-D3vntNua.cjs');
4
- const require_constants = require('./constants-DyDxXiYc.cjs');
5
- const require_version = require('./version-CDZpvmqM.cjs');
3
+ const require_resolve = require('./resolve-CZUghJrC.cjs');
4
+ const require_constants = require('./constants-BqO-QSHl.cjs');
5
+ const require_version = require('./version-B-XjWQrQ.cjs');
6
6
  const require_token_error$1 = require('./token-error-x_miDBP3.cjs');
7
- const require_blob_utils_DgVug_Di = require('./blob-utils-DgVug_Di-B5c8BuPf.cjs');
8
- const require_config_B_l88mOS = require('./config-B-l88mOS-DNM_M--P.cjs');
9
- const require_stdio = require('./stdio-BhYLPDOA.cjs');
10
- const require_usage = require('./usage-Crfzx1qJ.cjs');
7
+ const require_blob_utils_B0ae0K_m = require('./blob-utils-B0ae0K-m-BF8kTomr.cjs');
8
+ const require_config_40SaJWzQ = require('./config-40SaJWzQ-Bxau3bPR.cjs');
9
+ const require_stdio = require('./stdio-4lgW_97D.cjs');
10
+ const require_usage = require('./usage-DZ4QDygT.cjs');
11
11
  const require_output = require('./output-DEoNyYz7.cjs');
12
12
  const require_parse = require('./parse-CPY7-_2_.cjs');
13
13
  require('./types-dghCRFW4.cjs');
14
- require('./device-code-flow-D1UFW6dK.cjs');
14
+ require('./device-code-flow-Dv-auCiV.cjs');
15
15
  require('./token-cache-ATUcs1cg.cjs');
16
- const require_resolve_token = require('./resolve-token-DKvK-YrS.cjs');
17
- const require_auth = require('./auth-CmmVlYDi.cjs');
16
+ const require_resolve_token = require('./resolve-token-Daqu57f-.cjs');
17
+ const require_auth = require('./auth-CYOpb-jm.cjs');
18
18
  const zod = require_chunk.__toESM(require("zod"));
19
19
  const __sentry_core = require_chunk.__toESM(require("@sentry/core"));
20
20
  const node_util = require_chunk.__toESM(require("node:util"));
@@ -399,7 +399,7 @@ function validateSlugOrId(val, ctx) {
399
399
  }
400
400
 
401
401
  //#endregion
402
- //#region ../mcp-core/dist/schema-BPiG3cQY.js
402
+ //#region ../mcp-core/dist/schema-Bp2NOd0m.js
403
403
  const ParamOrganizationSlug = zod.z.string().trim().superRefine(validateSlug).describe("The organization's slug. You can find a existing list of organizations you have access to using the `find_organizations()` tool.");
404
404
  const ParamTeamSlug = zod.z.string().trim().superRefine(validateSlug).describe("The team's slug. You can find a list of existing teams in an organization with the Sentry tool `find_teams`.");
405
405
  const ParamProjectSlug = zod.z.string().trim().superRefine(validateSlug).describe("The project's slug. You can find a list of existing projects in an organization using the `find_projects()` tool.");
@@ -452,7 +452,7 @@ const ParamIgnoreCount = zod.z.number().int().positive().describe("How many time
452
452
  const ParamIgnoreWindowMinutes = zod.z.number().int().positive().max(7 * 24 * 60).describe("Optional time window in minutes for ignoreCount. If omitted, Sentry counts all future occurrences.");
453
453
  const ParamIgnoreUserCount = zod.z.number().int().positive().describe("How many users must be affected before the issue stops being ignored when ignoreMode is 'untilUserCount'.");
454
454
  const ParamIgnoreUserWindowMinutes = zod.z.number().int().positive().max(7 * 24 * 60).describe("Optional time window in minutes for ignoreUserCount. If omitted, Sentry counts all future affected users.");
455
- const ParamReason = zod.z.string().trim().min(1).describe("Optional reason for taking this action. When provided, it will be posted as a comment on the issue's activity feed.");
455
+ const ParamReason = zod.z.string().overwrite((s) => s.replace(/\0/g, "")).trim().min(1).describe("Optional reason for taking this action. When provided, it will be posted as a comment on the issue's activity feed.");
456
456
  const ParamSentryGuide = zod.z.enum(SENTRY_GUIDES).describe("Optional guide filter to limit search results to specific documentation sections. Use either a platform (e.g., 'javascript', 'python') or platform/guide combination (e.g., 'javascript/nextjs', 'python/django').");
457
457
  const ParamEventId = zod.z.string().trim().regex(/^[0-9a-fA-F]{32}$/, "Event ID must be a 32-character hexadecimal string").describe("The ID of the event. e.g. `c49541c747cb4d8aa3efb70ca5aba243`");
458
458
  /**
@@ -2158,7 +2158,7 @@ function isApiAuthenticationErrorDeep(error) {
2158
2158
  }
2159
2159
 
2160
2160
  //#endregion
2161
- //#region ../mcp-core/dist/schema-y99KGEDP.js
2161
+ //#region ../mcp-core/dist/schema-C3DdeX-U.js
2162
2162
  /**
2163
2163
  * Schema for Sentry API error responses.
2164
2164
  *
@@ -2358,7 +2358,7 @@ const AlertActionOptionSchema = zod.z.object({
2358
2358
  name: zod.z.string(),
2359
2359
  installationId: zod.z.string(),
2360
2360
  installationUuid: zod.z.string(),
2361
- status: zod.z.number(),
2361
+ status: zod.z.string(),
2362
2362
  settings: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
2363
2363
  title: zod.z.string().optional()
2364
2364
  }).optional()
@@ -3727,7 +3727,7 @@ const EventsStatsResponseSchema = zod.z.object({
3727
3727
  }).passthrough();
3728
3728
 
3729
3729
  //#endregion
3730
- //#region ../mcp-core/dist/client-BXJ5ud71.js
3730
+ //#region ../mcp-core/dist/client-DCCV37EK.js
3731
3731
  const SENTRY_MCP_SEARCH_EVENTS_REFERRER = "api.mcp.search-events";
3732
3732
  /**
3733
3733
  * Mapping of common network error codes to user-friendly messages.
@@ -4239,7 +4239,10 @@ var SentryApiService = class {
4239
4239
  return require_constants.getMonitorUrl(this.host, organizationSlug, monitorSlug, this.protocol, projectSlug$1);
4240
4240
  }
4241
4241
  getUptimeMonitorUrl(organizationSlug, uptimeMonitorId) {
4242
- return require_constants.getUptimeMonitorUrl(this.host, organizationSlug, uptimeMonitorId, this.protocol);
4242
+ return this.getDetectorUrl(organizationSlug, uptimeMonitorId);
4243
+ }
4244
+ getDetectorUrl(organizationSlug, detectorId) {
4245
+ return require_constants.getUptimeMonitorUrl(this.host, organizationSlug, detectorId, this.protocol);
4243
4246
  }
4244
4247
  getReleaseUrl(organizationSlug, releaseVersion) {
4245
4248
  return require_constants.getReleaseUrl(this.host, organizationSlug, releaseVersion, this.protocol);
@@ -4714,10 +4717,32 @@ var SentryApiService = class {
4714
4717
  const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/workflows/${ruleId}/project-scope/`, void 0, opts);
4715
4718
  return AlertRuleProjectScopeSchema.parse(body);
4716
4719
  }
4720
+ async getDetectorForAlertRule({ organizationSlug, alertRuleId }, opts) {
4721
+ const query = new URLSearchParams({ alert_rule_id: String(alertRuleId) });
4722
+ const body = await this.requestJSON(`${apiPath`/organizations/${organizationSlug}/alert-rule-detector/`}?${query}`, void 0, opts);
4723
+ return zod.z.object({ detectorId: zod.z.string() }).parse(body).detectorId;
4724
+ }
4717
4725
  async getDetector({ organizationSlug, detectorId }, opts) {
4718
4726
  const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/detectors/${detectorId}/`, void 0, opts);
4719
4727
  return DetectorSchema.parse(body);
4720
4728
  }
4729
+ async createMetricMonitor({ organizationSlug, projectSlug: projectSlug$1, body }, opts) {
4730
+ const response = await this.requestJSON(apiPath`/organizations/${organizationSlug}/projects/${projectSlug$1}/detectors/`, {
4731
+ method: "POST",
4732
+ body: JSON.stringify(body)
4733
+ }, opts);
4734
+ return DetectorSchema.parse(response);
4735
+ }
4736
+ async updateMetricMonitor({ organizationSlug, monitorId, body }, opts) {
4737
+ const response = await this.requestJSON(apiPath`/organizations/${organizationSlug}/detectors/${monitorId}/`, {
4738
+ method: "PUT",
4739
+ body: JSON.stringify(body)
4740
+ }, opts);
4741
+ return DetectorSchema.parse(response);
4742
+ }
4743
+ async deleteMetricMonitor({ organizationSlug, monitorId }, opts) {
4744
+ await this.request(apiPath`/organizations/${organizationSlug}/detectors/${monitorId}/`, { method: "DELETE" }, opts);
4745
+ }
4721
4746
  async listDetectorsPage({ organizationSlug, projectId, types, query, cursor, limit = 25 }, opts) {
4722
4747
  const search = new URLSearchParams({
4723
4748
  project: projectId ?? "-1",
@@ -4754,6 +4779,23 @@ var SentryApiService = class {
4754
4779
  nextCursor: getNextCursor(response.headers.get("link"))
4755
4780
  };
4756
4781
  }
4782
+ async createAlertRule({ organizationSlug, body }, opts) {
4783
+ const response = await this.requestJSON(apiPath`/organizations/${organizationSlug}/workflows/`, {
4784
+ method: "POST",
4785
+ body: JSON.stringify(body)
4786
+ }, opts);
4787
+ return IssueAlertRuleSchema.parse(response);
4788
+ }
4789
+ async updateAlertRule({ organizationSlug, ruleId, body }, opts) {
4790
+ const response = await this.requestJSON(apiPath`/organizations/${organizationSlug}/workflows/${ruleId}/`, {
4791
+ method: "PUT",
4792
+ body: JSON.stringify(body)
4793
+ }, opts);
4794
+ return IssueAlertRuleSchema.parse(response);
4795
+ }
4796
+ async deleteAlertRule({ organizationSlug, ruleId }, opts) {
4797
+ await this.request(apiPath`/organizations/${organizationSlug}/workflows/${ruleId}/`, { method: "DELETE" }, opts);
4798
+ }
4757
4799
  async listMetricAlertRules(params, opts) {
4758
4800
  const page = await this.listMetricAlertRulesPage(params, opts);
4759
4801
  return page.rules;
@@ -5396,7 +5438,8 @@ var SentryApiService = class {
5396
5438
  eventType,
5397
5439
  eventId: bodyObj.id,
5398
5440
  validationError: parseResult.error.message,
5399
- validationIssues: parseResult.error.issues
5441
+ validationIssues: parseResult.error.issues,
5442
+ contextType: bodyObj.context === null ? "null" : Array.isArray(bodyObj.context) ? "array" : typeof bodyObj.context
5400
5443
  } });
5401
5444
  throw new ApiValidationError(`Event failed schema validation: ${parseResult.error.message}`, void 0, void 0, body);
5402
5445
  }
@@ -5928,7 +5971,7 @@ var SentryApiService = class {
5928
5971
  const blob = await response.blob();
5929
5972
  let contentType = response.headers.get("content-type") ?? "";
5930
5973
  if (!contentType.startsWith("image/")) {
5931
- const { detectImageMimeType } = await Promise.resolve().then(() => require("./blob-utils-DGsI5_gF.cjs"));
5974
+ const { detectImageMimeType } = await Promise.resolve().then(() => require("./blob-utils-DBvCs9nw.cjs"));
5932
5975
  contentType = await detectImageMimeType(blob) ?? contentType;
5933
5976
  }
5934
5977
  return {
@@ -12297,7 +12340,7 @@ function stepCountIs(stepCount) {
12297
12340
  return ({ steps }) => steps.length === stepCount;
12298
12341
  }
12299
12342
  async function isStopConditionMet({ stopConditions, steps }) {
12300
- return (await Promise.all(stopConditions.map((condition) => condition({ steps })))).some((result) => result);
12343
+ return (await Promise.all(stopConditions.map((condition$1) => condition$1({ steps })))).some((result) => result);
12301
12344
  }
12302
12345
  async function toResponseMessages({ content: inputContent, tools }) {
12303
12346
  const responseMessages = [];
@@ -13754,7 +13797,7 @@ function isToolVisibleInMode(tool$1, experimentalMode) {
13754
13797
  }
13755
13798
 
13756
13799
  //#endregion
13757
- //#region ../mcp-core/dist/availability-KeZ7TRFd.js
13800
+ //#region ../mcp-core/dist/availability-BE2fy3-A.js
13758
13801
  function getToolPlacement({ key, experimentalMode, useDefaultSurfacePolicy }) {
13759
13802
  if (useDefaultSurfacePolicy) return {
13760
13803
  isCatalogTool: !isOutsideCatalogToolName(key),
@@ -13890,7 +13933,7 @@ function validateRegionUrl(regionUrl, baseHost) {
13890
13933
  }
13891
13934
 
13892
13935
  //#endregion
13893
- //#region ../mcp-core/dist/api-D4GH5wp9.js
13936
+ //#region ../mcp-core/dist/api-Bl-oStZo.js
13894
13937
  /**
13895
13938
  * Create a Sentry API service from server context with optional region override
13896
13939
  * @param context - Server context containing host and access token
@@ -13944,7 +13987,7 @@ function structuredResult(structuredContent) {
13944
13987
  }
13945
13988
 
13946
13989
  //#endregion
13947
- //#region ../mcp-core/dist/whoami-DthGP5fH.js
13990
+ //#region ../mcp-core/dist/whoami-CFoPgjQo.js
13948
13991
  const whoamiOutputSchema = zod.z.object({
13949
13992
  user: zod.z.object({
13950
13993
  id: zod.z.string(),
@@ -13995,7 +14038,7 @@ var whoami_default = defineTool({
13995
14038
  });
13996
14039
 
13997
14040
  //#endregion
13998
- //#region ../mcp-core/dist/get-sentry-mcp-info-Dg-_VZlQ.js
14041
+ //#region ../mcp-core/dist/get-sentry-mcp-info-BBsunwzd.js
13999
14042
  const getSentryMcpInfoOutputSchema = zod.z.object({ version: zod.z.string().describe("The Sentry MCP server version.") });
14000
14043
  var get_sentry_mcp_info_default = defineTool({
14001
14044
  name: "get_sentry_mcp_info",
@@ -14021,7 +14064,7 @@ var get_sentry_mcp_info_default = defineTool({
14021
14064
  });
14022
14065
 
14023
14066
  //#endregion
14024
- //#region ../mcp-core/dist/find-organizations-BjoY7_gy.js
14067
+ //#region ../mcp-core/dist/find-organizations-DOIimwjx.js
14025
14068
  const RESULT_LIMIT$3 = 25;
14026
14069
  const findOrganizationsOutputSchema = zod.z.object({
14027
14070
  organizations: zod.z.array(zod.z.object({
@@ -14080,7 +14123,7 @@ function setOrganizationContext(organizationSlug) {
14080
14123
  }
14081
14124
 
14082
14125
  //#endregion
14083
- //#region ../mcp-core/dist/find-teams-C5yde5nc.js
14126
+ //#region ../mcp-core/dist/find-teams-Cfa12d1c.js
14084
14127
  const RESULT_LIMIT$2 = 25;
14085
14128
  const findTeamsOutputSchema = zod.z.object({
14086
14129
  teams: zod.z.array(zod.z.object({
@@ -14138,7 +14181,7 @@ var find_teams_default = defineTool({
14138
14181
  });
14139
14182
 
14140
14183
  //#endregion
14141
- //#region ../mcp-core/dist/find-projects-DBOb3oe-.js
14184
+ //#region ../mcp-core/dist/find-projects-DE4Nq_Kn.js
14142
14185
  const RESULT_LIMIT$1 = 25;
14143
14186
  const findProjectsOutputSchema = zod.z.object({
14144
14187
  projects: zod.z.array(zod.z.object({ slug: zod.z.string() })),
@@ -14186,7 +14229,7 @@ var find_projects_default = defineTool({
14186
14229
  });
14187
14230
 
14188
14231
  //#endregion
14189
- //#region ../mcp-core/dist/find-releases-BF8-U7mW.js
14232
+ //#region ../mcp-core/dist/find-releases-DMoBorIi.js
14190
14233
  const RESULT_LIMIT = 25;
14191
14234
  const findReleasesOutputSchema = zod.z.object({
14192
14235
  releases: zod.z.array(zod.z.object({
@@ -14353,9 +14396,13 @@ function assertProjectListContainsConstraint({ resourceLabel, scopedProjectSlug,
14353
14396
  const hasMatchingProject = projects?.some((project) => projectSlug(project) === scopedProjectSlug) ?? false;
14354
14397
  if (!hasMatchingProject) throw projectConstraintError(resourceLabel, scopedProjectSlug);
14355
14398
  }
14399
+ function assertProjectConstraintEvidence({ resourceLabel, scopedProjectSlug, hasEvidence }) {
14400
+ if (!scopedProjectSlug || hasEvidence) return;
14401
+ throw projectConstraintError(resourceLabel, scopedProjectSlug);
14402
+ }
14356
14403
 
14357
14404
  //#endregion
14358
- //#region ../mcp-core/dist/get-release-details-DvY_TDet.js
14405
+ //#region ../mcp-core/dist/get-release-details-BmJDR5lj.js
14359
14406
  function formatProjects(release) {
14360
14407
  if (!release.projects || release.projects.length === 0) return null;
14361
14408
  return release.projects.map((project) => project.slug ?? project.name).join(", ");
@@ -14639,7 +14686,7 @@ async function resolveDashboardId({ apiService, organizationSlug, dashboardIdOrT
14639
14686
  }
14640
14687
 
14641
14688
  //#endregion
14642
- //#region ../mcp-core/dist/find-dashboards-oyqvVv8a.js
14689
+ //#region ../mcp-core/dist/find-dashboards-BGgshEMj.js
14643
14690
  const PROJECT_DASHBOARD_CURSOR_PREFIX = "mcp-dashboard-project:";
14644
14691
  const dashboardSummarySchema = zod.z.object({
14645
14692
  id: zod.z.string(),
@@ -14850,7 +14897,7 @@ var find_dashboards_default = defineTool({
14850
14897
  });
14851
14898
 
14852
14899
  //#endregion
14853
- //#region ../mcp-core/dist/get-dashboard-details-D_U6hOFe.js
14900
+ //#region ../mcp-core/dist/get-dashboard-details-CLsgh-Ri.js
14854
14901
  var get_dashboard_details_default = defineTool({
14855
14902
  name: "get_dashboard_details",
14856
14903
  skills: ["inspect"],
@@ -14924,7 +14971,7 @@ var get_dashboard_details_default = defineTool({
14924
14971
  });
14925
14972
 
14926
14973
  //#endregion
14927
- //#region ../mcp-core/dist/find-monitors-CwXZsdiJ.js
14974
+ //#region ../mcp-core/dist/find-monitors-D2etuU3z.js
14928
14975
  const ENVIRONMENT_LIMIT = 5;
14929
14976
  const monitorScheduleOutputSchema = zod.z.object({
14930
14977
  type: zod.z.string().nullable(),
@@ -15102,7 +15149,7 @@ var find_monitors_default = defineTool({
15102
15149
  });
15103
15150
 
15104
15151
  //#endregion
15105
- //#region ../mcp-core/dist/get-monitor-details-CDcHPW6x.js
15152
+ //#region ../mcp-core/dist/get-monitor-details-fFUVGZDe.js
15106
15153
  function formatProject(monitor) {
15107
15154
  if (!monitor.project) return null;
15108
15155
  return monitor.project.slug ?? monitor.project.name ?? null;
@@ -15395,7 +15442,7 @@ function toUptimeMonitorSummary(monitor, webUrl) {
15395
15442
  }
15396
15443
 
15397
15444
  //#endregion
15398
- //#region ../mcp-core/dist/find-uptime-monitors-B5dw0P9D.js
15445
+ //#region ../mcp-core/dist/find-uptime-monitors-CWyFARYv.js
15399
15446
  const findUptimeMonitorsOutputSchema = zod.z.object({
15400
15447
  monitors: zod.z.array(uptimeMonitorListItemSchema),
15401
15448
  hasMore: zod.z.boolean()
@@ -15463,7 +15510,7 @@ var find_uptime_monitors_default = defineTool({
15463
15510
  });
15464
15511
 
15465
15512
  //#endregion
15466
- //#region ../mcp-core/dist/get-uptime-monitor-details-B40FMp1m.js
15513
+ //#region ../mcp-core/dist/get-uptime-monitor-details-B5Q0Wf6H.js
15467
15514
  function formatCheck(check, monitorEnvironment) {
15468
15515
  const time = formatDate(check.timestamp) ?? formatDate(check.scheduledCheckTime) ?? "unknown time";
15469
15516
  const status = check.checkStatus ?? "unknown";
@@ -15585,7 +15632,549 @@ var get_uptime_monitor_details_default = defineTool({
15585
15632
  });
15586
15633
 
15587
15634
  //#endregion
15588
- //#region ../mcp-core/dist/create-uptime-monitor-BarA-8c1.js
15635
+ //#region ../mcp-core/dist/detector-details-4Y6bkh3B.js
15636
+ const conditionGroupSchema$1 = zod.z.object({
15637
+ id: zod.z.union([zod.z.string(), zod.z.number()]).optional(),
15638
+ logicType: zod.z.string(),
15639
+ conditions: zod.z.array(zod.z.object({
15640
+ id: zod.z.union([zod.z.string(), zod.z.number()]).optional(),
15641
+ type: zod.z.string(),
15642
+ comparison: zod.z.unknown(),
15643
+ conditionResult: zod.z.unknown()
15644
+ }))
15645
+ });
15646
+ const metricQuerySchema = zod.z.object({
15647
+ dataset: zod.z.string(),
15648
+ query: zod.z.string(),
15649
+ aggregate: zod.z.string(),
15650
+ timeWindow: zod.z.number(),
15651
+ environment: zod.z.string().nullable(),
15652
+ eventTypes: zod.z.array(zod.z.string()),
15653
+ extrapolationMode: zod.z.string().nullable().optional()
15654
+ });
15655
+ const metricQueryDetailsSchema = metricQuerySchema.omit({ timeWindow: true }).extend({ timeWindowSeconds: zod.z.number() });
15656
+ /** Project the metric query without subscription or backend identifiers. */
15657
+ function getMetricQuery(source) {
15658
+ if (source.type !== "snuba_query_subscription" || !isPlainObject$3(source.queryObj)) return null;
15659
+ const parsed = metricQuerySchema.safeParse(source.queryObj.snubaQuery);
15660
+ if (!parsed.success) return null;
15661
+ const { timeWindow,...query } = parsed.data;
15662
+ return {
15663
+ ...query,
15664
+ timeWindowSeconds: timeWindow
15665
+ };
15666
+ }
15667
+
15668
+ //#endregion
15669
+ //#region ../mcp-core/dist/metric-monitors-DQgq8kRa.js
15670
+ const metricMonitorReferenceFields = {
15671
+ organizationSlug: ParamOrganizationSlug,
15672
+ regionUrl: ParamRegionUrl.nullable().default(null),
15673
+ projectSlug: ParamProjectSlug.optional(),
15674
+ monitorId: zod.z.string().trim().regex(/^\d+$/).describe("Native Metric Monitor ID from find_metric_monitors.")
15675
+ };
15676
+ const metricMonitorSummarySchema = zod.z.object({
15677
+ id: zod.z.string(),
15678
+ name: zod.z.string(),
15679
+ projectId: zod.z.string().nullable(),
15680
+ enabled: zod.z.boolean(),
15681
+ owner: zod.z.string().nullable(),
15682
+ workflowIds: zod.z.array(zod.z.string()),
15683
+ webUrl: zod.z.string()
15684
+ });
15685
+ const metricMonitorDetailsSchema = metricMonitorSummarySchema.extend({
15686
+ description: zod.z.string().nullable(),
15687
+ config: zod.z.object({
15688
+ detectionType: zod.z.string(),
15689
+ comparisonDeltaSeconds: zod.z.number().optional()
15690
+ }),
15691
+ 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."),
15692
+ dataSources: zod.z.array(zod.z.object({
15693
+ type: zod.z.string(),
15694
+ query: metricQueryDetailsSchema.optional(),
15695
+ unavailableReason: zod.z.string().optional()
15696
+ })),
15697
+ dateCreated: zod.z.string().nullable(),
15698
+ dateUpdated: zod.z.string().nullable()
15699
+ });
15700
+ function toMetricMonitorSummary(api, organizationSlug, detector) {
15701
+ return {
15702
+ id: detector.id,
15703
+ name: detector.name,
15704
+ projectId: detector.projectId,
15705
+ enabled: detector.enabled,
15706
+ owner: detector.owner ? formatActor(detector.owner) : null,
15707
+ workflowIds: detector.workflowIds ?? [],
15708
+ webUrl: api.getDetectorUrl(organizationSlug, detector.id)
15709
+ };
15710
+ }
15711
+ function toMetricMonitorDetails(api, organizationSlug, detector) {
15712
+ const config = zod.z.object({
15713
+ detectionType: zod.z.string(),
15714
+ comparisonDelta: zod.z.number().nullish()
15715
+ }).parse(detector.config);
15716
+ return {
15717
+ ...toMetricMonitorSummary(api, organizationSlug, detector),
15718
+ description: detector.description ?? null,
15719
+ config: {
15720
+ detectionType: config.detectionType,
15721
+ ...config.comparisonDelta != null ? { comparisonDeltaSeconds: config.comparisonDelta } : {}
15722
+ },
15723
+ conditionGroup: detector.conditionGroup ? conditionGroupSchema$1.parse(detector.conditionGroup) : null,
15724
+ dataSources: (detector.dataSources ?? []).map((source) => {
15725
+ const query = getMetricQuery(source);
15726
+ return {
15727
+ type: typeof source.type === "string" ? source.type : "unknown",
15728
+ ...query ? { query } : { unavailableReason: "Source configuration is unavailable." }
15729
+ };
15730
+ }),
15731
+ dateCreated: formatDate(detector.dateCreated),
15732
+ dateUpdated: formatDate(detector.dateUpdated)
15733
+ };
15734
+ }
15735
+ function getMetricMonitorReference(detector) {
15736
+ return detector.alertRuleId != null ? String(detector.alertRuleId) : `detector:${detector.id}`;
15737
+ }
15738
+ async function listMetricMonitors(api, params) {
15739
+ const project = params.projectSlug ? await api.getProject({
15740
+ organizationSlug: params.organizationSlug,
15741
+ projectSlugOrId: params.projectSlug
15742
+ }) : void 0;
15743
+ const page = await api.listDetectorsPage({
15744
+ organizationSlug: params.organizationSlug,
15745
+ projectId: project ? String(project.id) : void 0,
15746
+ types: ["metric_issue"],
15747
+ query: params.query,
15748
+ cursor: params.cursor,
15749
+ limit: params.limit
15750
+ });
15751
+ return {
15752
+ ...page,
15753
+ detectors: page.detectors.filter((detector) => detector.type === "metric_issue" && (!project || detector.projectId === String(project.id)))
15754
+ };
15755
+ }
15756
+ async function getMetricMonitor(api, params) {
15757
+ if (params.projectSlug) assertProjectRefWithinConstraint({
15758
+ resourceLabel: "Metric Monitor",
15759
+ scopedProjectSlug: params.scopedProjectSlug,
15760
+ project: { slug: params.projectSlug }
15761
+ });
15762
+ const projectSlug$1 = params.scopedProjectSlug ?? params.projectSlug;
15763
+ const detector = await api.getDetector({
15764
+ organizationSlug: params.organizationSlug,
15765
+ detectorId: params.monitorId
15766
+ });
15767
+ 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.");
15768
+ if (projectSlug$1) {
15769
+ const project = await api.getProject({
15770
+ organizationSlug: params.organizationSlug,
15771
+ projectSlugOrId: projectSlug$1
15772
+ });
15773
+ assertProjectConstraintEvidence({
15774
+ resourceLabel: "Metric Monitor",
15775
+ scopedProjectSlug: projectSlug$1,
15776
+ hasEvidence: detector.projectId === String(project.id)
15777
+ });
15778
+ }
15779
+ return detector;
15780
+ }
15781
+ async function findExactMetricMonitorMatches(api, params) {
15782
+ const page = await listMetricMonitors(api, {
15783
+ ...params,
15784
+ query: `name:${JSON.stringify(params.name)}`,
15785
+ limit: 100
15786
+ });
15787
+ 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.");
15788
+ return page.detectors.filter((detector) => detector.name.toLowerCase() === params.name.toLowerCase());
15789
+ }
15790
+
15791
+ //#endregion
15792
+ //#region ../mcp-core/dist/find-metric-monitors-CHqrB1D0.js
15793
+ const findMetricMonitorsOutputSchema = zod.z.object({
15794
+ monitors: zod.z.array(metricMonitorSummarySchema),
15795
+ nextCursor: zod.z.string().nullable()
15796
+ });
15797
+ var find_metric_monitors_default = defineTool({
15798
+ name: "find_metric_monitors",
15799
+ skills: ["inspect"],
15800
+ requiredScopes: ["org:read", "project:read"],
15801
+ description: [
15802
+ "Find Sentry Metric Monitors that evaluate errors, performance, logs, metrics or crash rates.",
15803
+ "Use this tool to find a monitor ID before inspecting its query and detection conditions with get_metric_monitor_details.",
15804
+ "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').",
15805
+ "Omit projectSlug to search all accessible projects. Pass nextCursor as cursor with the same filters to retrieve more results.",
15806
+ "find_metric_monitors(organizationSlug='my-org', projectSlug='backend', query='latency')"
15807
+ ].join("\n"),
15808
+ inputSchema: {
15809
+ organizationSlug: ParamOrganizationSlug,
15810
+ regionUrl: ParamRegionUrl.nullable().default(null),
15811
+ projectSlug: ParamProjectSlugOrAll.optional(),
15812
+ query: zod.z.string().trim().min(1).optional().describe("Optional monitor search, such as a name or name:\"latency\". This searches monitor metadata, not the monitored event query. Results are always restricted to Metric Monitors."),
15813
+ cursor: zod.z.string().optional().describe("nextCursor from the previous page."),
15814
+ limit: zod.z.number().int().min(1).max(100).default(10)
15815
+ },
15816
+ outputSchema: findMetricMonitorsOutputSchema,
15817
+ annotations: {
15818
+ readOnlyHint: true,
15819
+ destructiveHint: false,
15820
+ openWorldHint: true
15821
+ },
15822
+ async handler(params, context$1) {
15823
+ const requestedProject = params.projectSlug === "all" ? void 0 : params.projectSlug;
15824
+ if (requestedProject) assertProjectRefWithinConstraint({
15825
+ resourceLabel: "Metric Monitor list",
15826
+ scopedProjectSlug: context$1.constraints.projectSlug,
15827
+ project: { slug: requestedProject }
15828
+ });
15829
+ const projectSlug$1 = context$1.constraints.projectSlug ?? requestedProject;
15830
+ setOrganizationContext(params.organizationSlug);
15831
+ if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
15832
+ const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
15833
+ const page = await listMetricMonitors(api, {
15834
+ ...params,
15835
+ projectSlug: projectSlug$1
15836
+ });
15837
+ return structuredResult({
15838
+ monitors: page.detectors.map((detector) => toMetricMonitorSummary(api, params.organizationSlug, detector)),
15839
+ nextCursor: page.nextCursor
15840
+ });
15841
+ }
15842
+ });
15843
+
15844
+ //#endregion
15845
+ //#region ../mcp-core/dist/get-metric-monitor-details-CpK77H6p.js
15846
+ const getMetricMonitorDetailsOutputSchema = zod.z.object({ monitor: metricMonitorDetailsSchema });
15847
+ var get_metric_monitor_details_default = defineTool({
15848
+ name: "get_metric_monitor_details",
15849
+ skills: ["inspect"],
15850
+ requiredScopes: ["org:read", "project:read"],
15851
+ description: [
15852
+ "Inspect a Sentry Metric Monitor's query, dataset, detection mode, thresholds, resolution conditions and connected Alerts.",
15853
+ "Use monitorId from find_metric_monitors, not a legacy metric alert ID. Time windows and comparison deltas are in seconds.",
15854
+ "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.",
15855
+ "workflowIds identify notification Alerts; inspect their actions with get_alert_rule(kind='issue').",
15856
+ "get_metric_monitor_details(organizationSlug='my-org', monitorId='12345')"
15857
+ ].join("\n"),
15858
+ inputSchema: metricMonitorReferenceFields,
15859
+ outputSchema: getMetricMonitorDetailsOutputSchema,
15860
+ annotations: {
15861
+ readOnlyHint: true,
15862
+ destructiveHint: false,
15863
+ openWorldHint: true
15864
+ },
15865
+ async handler(params, context$1) {
15866
+ const projectSlug$1 = context$1.constraints.projectSlug ?? params.projectSlug;
15867
+ setOrganizationContext(params.organizationSlug);
15868
+ if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
15869
+ const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
15870
+ const detector = await getMetricMonitor(api, {
15871
+ ...params,
15872
+ scopedProjectSlug: context$1.constraints.projectSlug
15873
+ });
15874
+ return structuredResult({ monitor: toMetricMonitorDetails(api, params.organizationSlug, detector) });
15875
+ }
15876
+ });
15877
+
15878
+ //#endregion
15879
+ //#region ../mcp-core/dist/metric-monitor-config-CPca208I.js
15880
+ const metricConditionSchema = conditionGroupSchema$1.shape.conditions.element;
15881
+ const thresholdCondition = metricConditionSchema.extend({
15882
+ type: zod.z.enum([
15883
+ "gt",
15884
+ "lt",
15885
+ "gte",
15886
+ "lte"
15887
+ ]),
15888
+ comparison: zod.z.number(),
15889
+ conditionResult: zod.z.union([
15890
+ zod.z.literal(75),
15891
+ zod.z.literal(50),
15892
+ zod.z.literal(0)
15893
+ ])
15894
+ });
15895
+ const anomalyCondition = metricConditionSchema.extend({
15896
+ type: zod.z.literal("anomaly_detection"),
15897
+ comparison: zod.z.object({
15898
+ sensitivity: zod.z.enum([
15899
+ "low",
15900
+ "medium",
15901
+ "high"
15902
+ ]),
15903
+ seasonality: zod.z.literal("auto"),
15904
+ thresholdType: zod.z.union([
15905
+ zod.z.literal(0),
15906
+ zod.z.literal(1),
15907
+ zod.z.literal(2)
15908
+ ])
15909
+ }),
15910
+ conditionResult: zod.z.union([zod.z.literal(75), zod.z.literal(50)])
15911
+ });
15912
+ const metricMonitorQuerySchema = metricQueryDetailsSchema.extend({
15913
+ dataset: zod.z.enum([
15914
+ "events",
15915
+ "transactions",
15916
+ "generic_metrics",
15917
+ "metrics",
15918
+ "events_analytics_platform"
15919
+ ]),
15920
+ aggregate: zod.z.string().min(1),
15921
+ timeWindowSeconds: zod.z.number().int().positive()
15922
+ });
15923
+ const metricMonitorDetectionConfigSchema = zod.z.object({
15924
+ detectionType: zod.z.enum([
15925
+ "static",
15926
+ "percent",
15927
+ "dynamic"
15928
+ ]),
15929
+ comparisonDeltaSeconds: zod.z.number().int().positive().nullable().optional()
15930
+ });
15931
+ const metricMonitorConditionGroupSchema = conditionGroupSchema$1.extend({ conditions: zod.z.array(zod.z.discriminatedUnion("type", [thresholdCondition, anomalyCondition])).min(1).max(3) });
15932
+ const metricMonitorConfigFields = {
15933
+ name: zod.z.string().trim().min(1).max(200).optional(),
15934
+ description: zod.z.string().nullable().optional(),
15935
+ status: zod.z.enum(["active", "disabled"]).optional(),
15936
+ owner: zod.z.string().regex(/^(user|team):\d+$/).nullable().optional().describe("Owner actor, e.g. team:123 or user:123. Pass null to clear."),
15937
+ 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."),
15938
+ 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."),
15939
+ 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."),
15940
+ workflowIds: zod.z.array(zod.z.string().regex(/^\d+$/)).optional().describe("Replaces this monitor's Alert connections. Copy all IDs to retain from get_metric_monitor_details; [] disconnects all. Does not edit the Alerts themselves.")
15941
+ };
15942
+ const metricMonitorCreateFields = {
15943
+ name: metricMonitorConfigFields.name.unwrap(),
15944
+ description: metricMonitorConfigFields.description,
15945
+ owner: metricMonitorConfigFields.owner,
15946
+ 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."),
15947
+ config: metricMonitorDetectionConfigSchema.describe("Detection mode. Percent requires comparisonDeltaSeconds. Static and Dynamic do not use a comparison delta."),
15948
+ conditionGroup: metricMonitorConditionGroupSchema.omit({ id: true }).extend({
15949
+ logicType: zod.z.literal("any").default("any"),
15950
+ conditions: zod.z.array(zod.z.discriminatedUnion("type", [thresholdCondition.omit({ id: true }), anomalyCondition.omit({ id: true })])).min(1).max(3)
15951
+ }).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."),
15952
+ 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.")
15953
+ };
15954
+ /** Convert partial tool input to the native detector write contract, preserving omitted fields. */
15955
+ function toMetricMonitorUpdate(current, params) {
15956
+ const { status, query, config, conditionGroup,...metadata } = params;
15957
+ const body = Object.fromEntries(Object.entries(metadata).filter(([, value]) => value !== void 0));
15958
+ if (status !== void 0) body.enabled = status === "active";
15959
+ if (query !== void 0) {
15960
+ const sources = current.dataSources ?? [];
15961
+ const existing = sources.length === 1 ? getMetricQuery(sources[0]) : null;
15962
+ if (!existing) throw new UserInputError("This monitor's query is unavailable or has multiple sources; cannot safely update it.");
15963
+ const { timeWindowSeconds,...merged } = {
15964
+ ...existing,
15965
+ ...query
15966
+ };
15967
+ body.dataSources = [{
15968
+ ...merged,
15969
+ timeWindow: timeWindowSeconds
15970
+ }];
15971
+ }
15972
+ if (config !== void 0 || conditionGroup !== void 0) {
15973
+ 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.");
15974
+ body.config = toMetricDetectionConfig(config ?? {}, conditionGroup?.conditions ?? conditionGroupSchema$1.parse(current.conditionGroup).conditions, current.config);
15975
+ if (conditionGroup !== void 0) body.conditionGroup = conditionGroup;
15976
+ }
15977
+ if (Object.keys(body).length === 0) throw new UserInputError("Provide at least one field to update on the Metric Monitor.");
15978
+ return body;
15979
+ }
15980
+ /** Map detection config to native units and validate its effective conditions. */
15981
+ function toMetricDetectionConfig(config, conditions, current = {}) {
15982
+ const { comparisonDeltaSeconds,...changes } = config;
15983
+ const result = {
15984
+ ...current,
15985
+ ...changes
15986
+ };
15987
+ if (comparisonDeltaSeconds !== void 0) result.comparisonDelta = comparisonDeltaSeconds;
15988
+ if (result.detectionType !== "percent") {
15989
+ if (comparisonDeltaSeconds != null) throw new UserInputError("comparisonDeltaSeconds is only supported for Percent detection.");
15990
+ if (config.detectionType !== void 0) result.comparisonDelta = null;
15991
+ }
15992
+ const dynamic = result.detectionType === "dynamic";
15993
+ if (dynamic && conditions.length !== 1) throw new UserInputError("Dynamic detection requires exactly one anomaly_detection condition.");
15994
+ 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.");
15995
+ if (result.detectionType === "percent" && !(typeof result.comparisonDelta === "number" && result.comparisonDelta > 0)) throw new UserInputError("Percent detection requires comparisonDeltaSeconds.");
15996
+ return result;
15997
+ }
15998
+
15999
+ //#endregion
16000
+ //#region ../mcp-core/dist/create-metric-monitor-DehNk_ph.js
16001
+ var create_metric_monitor_default = defineTool({
16002
+ name: "create_metric_monitor",
16003
+ skills: ["project-management"],
16004
+ requiredScopes: [
16005
+ "org:read",
16006
+ "project:read",
16007
+ "alerts:write"
16008
+ ],
16009
+ description: [
16010
+ "Create a Sentry Metric Monitor with Static, Percent or Dynamic detection in a project.",
16011
+ "Provide the complete query, detection config and conditions. Time windows and comparison deltas use seconds. Percent comparisons are absolute: 110 means 10% higher.",
16012
+ "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'.",
16013
+ "New monitors start ACTIVE and immediately evaluate data. Initially disabled creation is not supported. Use update_metric_monitor to disable an existing monitor.",
16014
+ "workflowIds optionally connect existing notification Alerts, including shared Alerts, without modifying their configuration. Create an Alert separately with create_alert_rule if needed.",
16015
+ "Dataset access, quota, aggregate, window and historical-data requirements are enforced by Sentry. Dynamic detection requires sufficient history and Seer availability.",
16016
+ "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.",
16017
+ "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}]})"
16018
+ ].join("\n"),
16019
+ inputSchema: {
16020
+ organizationSlug: ParamOrganizationSlug,
16021
+ regionUrl: ParamRegionUrl.nullable().default(null),
16022
+ projectSlug: ParamProjectSlug,
16023
+ ...metricMonitorCreateFields
16024
+ },
16025
+ outputSchema: zod.z.object({
16026
+ monitor: metricMonitorDetailsSchema,
16027
+ guidance: zod.z.string().optional()
16028
+ }),
16029
+ annotations: {
16030
+ readOnlyHint: false,
16031
+ destructiveHint: false,
16032
+ idempotentHint: false,
16033
+ openWorldHint: true
16034
+ },
16035
+ async handler(params, context$1) {
16036
+ assertProjectRefWithinConstraint({
16037
+ resourceLabel: "Metric Monitor",
16038
+ scopedProjectSlug: context$1.constraints.projectSlug,
16039
+ project: { slug: params.projectSlug }
16040
+ });
16041
+ const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
16042
+ setOrganizationContext(params.organizationSlug);
16043
+ (0, __sentry_core.setTag)("project.slug", params.projectSlug);
16044
+ const { timeWindowSeconds,...query } = params.query;
16045
+ const body = {
16046
+ type: "metric_issue",
16047
+ name: params.name,
16048
+ description: params.description,
16049
+ owner: params.owner,
16050
+ config: toMetricDetectionConfig(params.config, params.conditionGroup.conditions),
16051
+ conditionGroup: params.conditionGroup,
16052
+ dataSources: [{
16053
+ ...query,
16054
+ timeWindow: timeWindowSeconds
16055
+ }],
16056
+ workflowIds: params.workflowIds
16057
+ };
16058
+ let created;
16059
+ try {
16060
+ created = await api.createMetricMonitor({
16061
+ organizationSlug: params.organizationSlug,
16062
+ projectSlug: params.projectSlug,
16063
+ body
16064
+ });
16065
+ } catch (error) {
16066
+ 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.";
16067
+ throw error;
16068
+ }
16069
+ const monitor = toMetricMonitorDetails(api, params.organizationSlug, created);
16070
+ return structuredResult({
16071
+ monitor,
16072
+ ...monitor.workflowIds.length === 0 ? { guidance: "This monitor has no connected Alerts. Connect an Alert with update_metric_monitor to configure notifications." } : {}
16073
+ });
16074
+ }
16075
+ });
16076
+
16077
+ //#endregion
16078
+ //#region ../mcp-core/dist/update-metric-monitor-Cgqd2yRY.js
16079
+ var update_metric_monitor_default = defineTool({
16080
+ name: "update_metric_monitor",
16081
+ skills: ["project-management"],
16082
+ requiredScopes: [
16083
+ "org:read",
16084
+ "project:read",
16085
+ "alerts:write"
16086
+ ],
16087
+ description: [
16088
+ "Update a Sentry Metric Monitor's query, detection conditions, metadata, status or connected Alerts.",
16089
+ "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.",
16090
+ "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.",
16091
+ "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.",
16092
+ "Dynamic changes may require sufficient historical data. Dataset access, query and window constraints are enforced by Sentry.",
16093
+ "workflowIds connect existing Alerts, including shared Alerts, without editing their actions or other monitors. Use update_alert_rule for notification configuration.",
16094
+ "Requires alerts:write; reconnect OAuth if the existing token lacks it.",
16095
+ "update_metric_monitor(organizationSlug='my-org', monitorId='12345', status='disabled')",
16096
+ "update_metric_monitor(organizationSlug='my-org', monitorId='12345', query={query:'level:error', timeWindowSeconds:300})"
16097
+ ].join("\n"),
16098
+ inputSchema: {
16099
+ ...metricMonitorReferenceFields,
16100
+ ...metricMonitorConfigFields
16101
+ },
16102
+ outputSchema: zod.z.object({ monitor: metricMonitorDetailsSchema }),
16103
+ annotations: {
16104
+ readOnlyHint: false,
16105
+ destructiveHint: true,
16106
+ idempotentHint: false,
16107
+ openWorldHint: true
16108
+ },
16109
+ async handler(params, context$1) {
16110
+ const { organizationSlug, regionUrl, monitorId, projectSlug: requestedProject,...changes } = params;
16111
+ const projectSlug$1 = context$1.constraints.projectSlug ?? requestedProject;
16112
+ setOrganizationContext(organizationSlug);
16113
+ if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
16114
+ const api = apiServiceFromContext(context$1, { regionUrl: regionUrl ?? void 0 });
16115
+ const current = await getMetricMonitor(api, {
16116
+ organizationSlug,
16117
+ monitorId,
16118
+ projectSlug: requestedProject,
16119
+ scopedProjectSlug: context$1.constraints.projectSlug
16120
+ });
16121
+ const updated = await api.updateMetricMonitor({
16122
+ organizationSlug,
16123
+ monitorId,
16124
+ body: toMetricMonitorUpdate(current, changes)
16125
+ });
16126
+ return structuredResult({ monitor: toMetricMonitorDetails(api, organizationSlug, updated) });
16127
+ }
16128
+ });
16129
+
16130
+ //#endregion
16131
+ //#region ../mcp-core/dist/delete-metric-monitor-CQQGfd1b.js
16132
+ var delete_metric_monitor_default = defineTool({
16133
+ name: "delete_metric_monitor",
16134
+ skills: ["project-management"],
16135
+ requiredScopes: [
16136
+ "org:read",
16137
+ "project:read",
16138
+ "alerts:write"
16139
+ ],
16140
+ description: [
16141
+ "Permanently delete a Sentry Metric Monitor, preserving its connected Alerts and their other monitors.",
16142
+ "Use get_metric_monitor_details to inspect the monitor and obtain its native monitorId. Legacy metric alert IDs are not monitor IDs.",
16143
+ "Use update_metric_monitor(status='disabled') to pause detection instead. Deletion also removes an associated legacy metric alert and its incident history when present.",
16144
+ "Sentry hides the monitor from normal reads immediately and completes deletion in the background.",
16145
+ "delete_metric_monitor(organizationSlug='my-org', monitorId='12345')"
16146
+ ].join("\n"),
16147
+ inputSchema: metricMonitorReferenceFields,
16148
+ outputSchema: zod.z.object({
16149
+ success: zod.z.literal(true),
16150
+ monitorId: zod.z.string()
16151
+ }),
16152
+ annotations: {
16153
+ readOnlyHint: false,
16154
+ destructiveHint: true,
16155
+ idempotentHint: true,
16156
+ openWorldHint: true
16157
+ },
16158
+ async handler(params, context$1) {
16159
+ const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
16160
+ setOrganizationContext(params.organizationSlug);
16161
+ await getMetricMonitor(api, {
16162
+ ...params,
16163
+ scopedProjectSlug: context$1.constraints.projectSlug
16164
+ });
16165
+ await api.deleteMetricMonitor({
16166
+ organizationSlug: params.organizationSlug,
16167
+ monitorId: params.monitorId
16168
+ });
16169
+ return structuredResult({
16170
+ success: true,
16171
+ monitorId: params.monitorId
16172
+ });
16173
+ }
16174
+ });
16175
+
16176
+ //#endregion
16177
+ //#region ../mcp-core/dist/create-uptime-monitor-CAxBjsSx.js
15589
16178
  const createUptimeMonitorOutputSchema = zod.z.object({ monitor: uptimeMonitorSummarySchema });
15590
16179
  var create_uptime_monitor_default = defineTool({
15591
16180
  name: "create_uptime_monitor",
@@ -15666,7 +16255,7 @@ var create_uptime_monitor_default = defineTool({
15666
16255
  });
15667
16256
 
15668
16257
  //#endregion
15669
- //#region ../mcp-core/dist/update-uptime-monitor-Borxg5io.js
16258
+ //#region ../mcp-core/dist/update-uptime-monitor-D1vKssl2.js
15670
16259
  const updateUptimeMonitorOutputSchema = zod.z.object({ monitor: uptimeMonitorSummarySchema });
15671
16260
  function hasDefinedUpdate(value) {
15672
16261
  return value !== void 0;
@@ -15757,7 +16346,7 @@ var update_uptime_monitor_default = defineTool({
15757
16346
  });
15758
16347
 
15759
16348
  //#endregion
15760
- //#region ../mcp-core/dist/delete-uptime-monitor-CpzZ4G3P.js
16349
+ //#region ../mcp-core/dist/delete-uptime-monitor-C-6L8z8v.js
15761
16350
  const deleteUptimeMonitorOutputSchema = zod.z.object({
15762
16351
  success: zod.z.literal(true),
15763
16352
  uptimeMonitorId: zod.z.string(),
@@ -15816,12 +16405,12 @@ var delete_uptime_monitor_default = defineTool({
15816
16405
  });
15817
16406
 
15818
16407
  //#endregion
15819
- //#region ../mcp-core/dist/find-alert-rules-Dc55EgzE.js
16408
+ //#region ../mcp-core/dist/find-alert-rules-jLQlz-Pg.js
15820
16409
  const AlertRuleKind$1 = zod.z.enum([
15821
16410
  "all",
15822
16411
  "issue",
15823
16412
  "metric"
15824
- ]).describe("Which alert rule family to search. Use `all` to include Alerts (workflows) and legacy metric alerts.");
16413
+ ]).describe("Which alert rule family to search. Use `all` to include Alerts (workflows) and Metric Monitors.");
15825
16414
  const issueAlertRuleSummarySchema = zod.z.object({
15826
16415
  id: zod.z.string(),
15827
16416
  name: zod.z.string(),
@@ -15837,14 +16426,16 @@ const issueAlertRuleSummarySchema = zod.z.object({
15837
16426
  webUrl: zod.z.string()
15838
16427
  });
15839
16428
  const metricAlertRuleSummarySchema = zod.z.object({
15840
- id: zod.z.string(),
16429
+ id: zod.z.string().describe("Legacy alert-rule ID when available, otherwise detector:<monitorId>."),
16430
+ monitorId: zod.z.string(),
16431
+ projectId: zod.z.string().nullable(),
16432
+ enabled: zod.z.boolean(),
15841
16433
  name: zod.z.string(),
15842
- status: zod.z.union([zod.z.string(), zod.z.number()]).nullable(),
16434
+ status: zod.z.enum(["enabled", "disabled"]),
15843
16435
  dataset: zod.z.string().nullable(),
15844
16436
  aggregate: zod.z.string().nullable(),
15845
16437
  query: zod.z.string().nullable(),
15846
16438
  timeWindowMinutes: zod.z.number().nullable(),
15847
- projects: zod.z.array(zod.z.string()),
15848
16439
  environment: zod.z.string().nullable(),
15849
16440
  owner: zod.z.string().nullable(),
15850
16441
  dateCreated: zod.z.string().nullable(),
@@ -15858,7 +16449,7 @@ const findAlertRulesOutputSchema = zod.z.object({
15858
16449
  issue: paginationStateSchema.nullable(),
15859
16450
  metric: paginationStateSchema.nullable()
15860
16451
  }),
15861
- warnings: zod.z.array(zod.z.string()).optional()
16452
+ metricMonitorHint: zod.z.string().optional()
15862
16453
  });
15863
16454
  function getIssueAlertRuleFrequency(rule) {
15864
16455
  if (typeof rule.frequency === "number") return rule.frequency;
@@ -15882,7 +16473,7 @@ var find_alert_rules_default = defineTool({
15882
16473
  "",
15883
16474
  "Use this tool when you need to:",
15884
16475
  "- List Alerts (workflows) for an organization or project, including Alerts without connected sources",
15885
- "- List metric alert rules for an organization or project",
16476
+ "- List Metric Monitors using compatibility references; prefer find_metric_monitors for canonical monitor IDs",
15886
16477
  "- Find an alert rule ID by name before inspecting it",
15887
16478
  "- Check alert conditions, queries, triggers, actions, owner, or environment",
15888
16479
  "",
@@ -15894,7 +16485,7 @@ var find_alert_rules_default = defineTool({
15894
16485
  "",
15895
16486
  "<hints>",
15896
16487
  "- Omit `projectSlug` to search organization-wide. A project filter finds connected Alerts, which may also cover other projects.",
15897
- "- With `kind='all'`, an unavailable legacy metric alert API is reported in `warnings`; the returned Alerts are still usable.",
16488
+ "- Metric entries expose monitorId and projectId. id retains a legacy alert-rule ID when available, otherwise detector:<monitorId>. status describes enabled/disabled monitoring, not a legacy alert status.",
15898
16489
  "- Issue and metric alert rules have independent pagination state. Reuse a nextCursor only with its matching kind.",
15899
16490
  "</hints>"
15900
16491
  ].join("\n"),
@@ -15938,17 +16529,12 @@ var find_alert_rules_default = defineTool({
15938
16529
  rules: [],
15939
16530
  nextCursor: null
15940
16531
  };
15941
- const warnings = [];
15942
- const metricPage = includeMetric ? await apiService.listMetricAlertRulesPage({
16532
+ const metricPage = includeMetric ? await listMetricMonitors(apiService, {
15943
16533
  organizationSlug,
15944
16534
  projectSlug: projectSlug$1,
15945
- query: params.query ?? void 0,
16535
+ query: params.query ? `name:${JSON.stringify(`*${params.query}*`)}` : void 0,
15946
16536
  cursor: params.cursor ?? void 0,
15947
16537
  limit: params.limit
15948
- }).catch((error) => {
15949
- if (params.kind !== "all" || !(error instanceof ApiError) || error.status !== 410) throw error;
15950
- warnings.push("Metric alerts could not be listed: Sentry's legacy metric alert API is no longer available for this organization.");
15951
- return null;
15952
16538
  }) : null;
15953
16539
  return structuredResult({
15954
16540
  issueRules: issuePage.rules.map((rule) => ({
@@ -15965,60 +16551,47 @@ var find_alert_rules_default = defineTool({
15965
16551
  lastTriggered: formatDate(rule.lastTriggered),
15966
16552
  webUrl: apiService.getIssueAlertRuleUrl(organizationSlug, rule.id)
15967
16553
  })),
15968
- metricRules: (metricPage?.rules ?? []).map((rule) => ({
15969
- id: String(rule.id),
15970
- name: rule.name,
15971
- status: rule.status ?? null,
15972
- dataset: rule.dataset ?? null,
15973
- aggregate: rule.aggregate ?? null,
15974
- query: rule.query ?? null,
15975
- timeWindowMinutes: rule.timeWindow ?? null,
15976
- projects: rule.projects,
15977
- environment: rule.environment ?? null,
15978
- owner: getOwner(rule.owner),
15979
- dateCreated: formatDate(rule.dateCreated),
15980
- webUrl: apiService.getMetricAlertRuleUrl(organizationSlug, rule.id)
15981
- })),
16554
+ metricRules: (metricPage?.detectors ?? []).map((detector) => {
16555
+ const monitor = toMetricMonitorDetails(apiService, organizationSlug, detector);
16556
+ const source = monitor.dataSources.find((source$1) => source$1.type === "snuba_query_subscription");
16557
+ const query = source && "query" in source ? source.query : void 0;
16558
+ return {
16559
+ id: getMetricMonitorReference(detector),
16560
+ monitorId: monitor.id,
16561
+ projectId: monitor.projectId,
16562
+ enabled: monitor.enabled,
16563
+ name: monitor.name,
16564
+ status: monitor.enabled ? "enabled" : "disabled",
16565
+ dataset: query?.dataset ?? null,
16566
+ aggregate: query?.aggregate ?? null,
16567
+ query: query?.query ?? null,
16568
+ timeWindowMinutes: query ? query.timeWindowSeconds / 60 : null,
16569
+ environment: query?.environment ?? null,
16570
+ owner: monitor.owner,
16571
+ dateCreated: monitor.dateCreated,
16572
+ webUrl: monitor.webUrl
16573
+ };
16574
+ }),
15982
16575
  pagination: {
15983
16576
  issue: includeIssue ? { nextCursor: issuePage.nextCursor } : null,
15984
16577
  metric: metricPage ? { nextCursor: metricPage.nextCursor } : null
15985
16578
  },
15986
- ...warnings.length > 0 ? { warnings } : {}
16579
+ ...includeMetric ? { metricMonitorHint: "Use get_metric_monitor_details with monitorId. Legacy get_alert_rule(kind=metric) accepts each entry's id; never pass monitorId as a bare legacy ID." } : {}
15987
16580
  });
15988
16581
  }
15989
16582
  });
15990
16583
 
15991
16584
  //#endregion
15992
- //#region ../mcp-core/dist/alert-rule-details-CJ-FfoC7.js
15993
- const componentId = zod.z.union([zod.z.string(), zod.z.number()]);
15994
- const conditionSchema = zod.z.object({
15995
- id: componentId.optional(),
15996
- type: zod.z.string(),
15997
- comparison: zod.z.unknown(),
15998
- conditionResult: zod.z.unknown()
15999
- });
16000
- const conditionGroupSchema$1 = zod.z.object({
16001
- id: componentId.optional(),
16002
- logicType: zod.z.string(),
16003
- conditions: zod.z.array(conditionSchema)
16004
- });
16585
+ //#region ../mcp-core/dist/alert-rule-details-CR0CKQr6.js
16586
+ const componentId$1 = zod.z.union([zod.z.string(), zod.z.number()]);
16005
16587
  const actionGroupSchema = conditionGroupSchema$1.extend({ actions: zod.z.array(zod.z.object({
16006
- id: componentId.optional(),
16588
+ id: componentId$1.optional(),
16007
16589
  type: zod.z.string(),
16008
- integrationId: componentId.nullable().optional(),
16590
+ integrationId: componentId$1.nullable().optional(),
16009
16591
  config: zod.z.record(zod.z.string(), zod.z.unknown()),
16010
16592
  data: zod.z.record(zod.z.string(), zod.z.unknown()),
16011
16593
  status: zod.z.string().optional()
16012
16594
  })) });
16013
- const metricQuerySchema = zod.z.object({
16014
- dataset: zod.z.string(),
16015
- query: zod.z.string(),
16016
- aggregate: zod.z.string(),
16017
- timeWindow: zod.z.number(),
16018
- environment: zod.z.string().nullable(),
16019
- eventTypes: zod.z.array(zod.z.string()),
16020
- extrapolationMode: zod.z.string().nullable().optional()
16021
- });
16022
16595
  const uptimeQuerySchema = zod.z.object({
16023
16596
  url: zod.z.string(),
16024
16597
  method: zod.z.string(),
@@ -16058,16 +16631,11 @@ function sourceDetails(source) {
16058
16631
  };
16059
16632
  if (!isPlainObject$3(query)) return unavailable;
16060
16633
  if (type === "snuba_query_subscription") {
16061
- const parsed = metricQuerySchema.safeParse(query.snubaQuery);
16062
- if (!parsed.success) return unavailable;
16063
- const { timeWindow,...config } = parsed.data;
16064
- return {
16634
+ const metricQuery = getMetricQuery(source);
16635
+ return metricQuery ? {
16065
16636
  type,
16066
- query: {
16067
- ...config,
16068
- timeWindowSeconds: timeWindow
16069
- }
16070
- };
16637
+ query: metricQuery
16638
+ } : unavailable;
16071
16639
  }
16072
16640
  if (type === "uptime_subscription") {
16073
16641
  const parsed = uptimeQuerySchema.safeParse(query);
@@ -16158,158 +16726,9 @@ async function getAlertRuleDetails(api, organizationSlug, rule, scopedProjectSlu
16158
16726
  }
16159
16727
 
16160
16728
  //#endregion
16161
- //#region ../mcp-core/dist/alerts-Cv9MFDEC.js
16162
- const NUMERIC_ID_PATTERN = /^\d+$/;
16163
- const COMPONENT_DETAIL_SKIP_KEYS = new Set([
16164
- "id",
16165
- "type",
16166
- "conditions",
16167
- "actions"
16168
- ]);
16169
- const WORKFLOW_GROUP_DETAIL_SKIP_KEYS = new Set([
16170
- "id",
16171
- "type",
16172
- "logicType",
16173
- "conditions",
16174
- "actions"
16175
- ]);
16729
+ //#region ../mcp-core/dist/alerts-BTOF3LY7.js
16176
16730
  function isNumericAlertRuleId(value) {
16177
- return NUMERIC_ID_PATTERN.test(value);
16178
- }
16179
- function humanizeKey(value) {
16180
- if (value === "conditionResult") return "result";
16181
- if (value === "targetIdentifier") return "target";
16182
- if (value === "alertThreshold") return "threshold";
16183
- return value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
16184
- }
16185
- function humanizeValue(value) {
16186
- const normalized = value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim();
16187
- if (!normalized) return value;
16188
- return normalized.charAt(0).toUpperCase() + normalized.slice(1);
16189
- }
16190
- function formatScalar(value) {
16191
- if (typeof value === "string") {
16192
- const trimmed = value.trim();
16193
- return trimmed ? trimmed : null;
16194
- }
16195
- if (typeof value === "number" || typeof value === "boolean") return formatUnknown(value);
16196
- return null;
16197
- }
16198
- function formatDetailValue(value) {
16199
- if (Array.isArray(value)) {
16200
- const items = value.map(formatDetailValue).filter((item) => item !== null);
16201
- return items.length > 0 ? items.join(", ") : null;
16202
- }
16203
- if (isPlainObject$3(value)) {
16204
- const details = Object.entries(value).filter(([key]) => key !== "id").map(([key, item]) => {
16205
- const formatted = formatDetailValue(item);
16206
- return formatted ? `${humanizeKey(key)}: ${formatted}` : null;
16207
- }).filter((item) => item !== null);
16208
- return details.length > 0 ? details.join(", ") : null;
16209
- }
16210
- return formatScalar(value);
16211
- }
16212
- function shouldSkipDetail(key, value) {
16213
- return key === "targetDisplay" && typeof value === "string" && value.toLowerCase() === "unknown";
16214
- }
16215
- function getComponentDetailEntries(component, skippedKeys) {
16216
- const detailEntries = [];
16217
- for (const [key, value] of Object.entries(component)) if (!skippedKeys.has(key) && value !== void 0 && value !== null && !shouldSkipDetail(key, value)) {
16218
- if (key === "config" && isPlainObject$3(value)) {
16219
- detailEntries.push(...Object.entries(value).filter(([configKey, configValue]) => !shouldSkipDetail(configKey, configValue)));
16220
- continue;
16221
- }
16222
- detailEntries.push([key, value]);
16223
- }
16224
- return detailEntries;
16225
- }
16226
- function formatComponentDetails(component, skippedKeys) {
16227
- const details = getComponentDetailEntries(component, skippedKeys).map(([key, value]) => {
16228
- const formatted = formatDetailValue(value);
16229
- return formatted ? `${humanizeKey(key)}: ${formatted}` : null;
16230
- }).filter((item) => item !== null).join(", ");
16231
- return details || null;
16232
- }
16233
- function formatComponent(component) {
16234
- const type = typeof component.type === "string" ? component.type : null;
16235
- const label = type ? humanizeValue(type) : "Component";
16236
- const details = formatComponentDetails(component, COMPONENT_DETAIL_SKIP_KEYS);
16237
- if (!details) return label;
16238
- return `${label} (${details})`;
16239
- }
16240
- function singularizeComponentLabel(label) {
16241
- if (label.endsWith("ies")) return `${label.slice(0, -3)}y`;
16242
- if (label.endsWith("s")) return label.slice(0, -1);
16243
- return label;
16244
- }
16245
- function formatThresholdTrigger(component) {
16246
- const label = formatScalar(component.label);
16247
- const threshold = formatScalar(component.alertThreshold);
16248
- const resolveThreshold = formatScalar(component.resolveThreshold);
16249
- if (!threshold) return null;
16250
- const thresholdLabel = label ? `${humanizeValue(label)} threshold` : "Threshold";
16251
- return resolveThreshold ? `${thresholdLabel}: ${threshold}; resolves below: ${resolveThreshold}` : `${thresholdLabel}: ${threshold}`;
16252
- }
16253
- function formatWorkflowGroup(component, componentLabel) {
16254
- const lines = [];
16255
- const logicType = typeof component.logicType === "string" ? component.logicType : null;
16256
- if (logicType) lines.push(`- Logic: ${logicType}`);
16257
- const componentDetails = componentLabel === "Trigger" ? formatThresholdTrigger(component) ?? formatComponentDetails(component, WORKFLOW_GROUP_DETAIL_SKIP_KEYS) : formatComponentDetails(component, WORKFLOW_GROUP_DETAIL_SKIP_KEYS);
16258
- if (componentDetails) lines.push(`- ${componentLabel}: ${componentDetails}`);
16259
- const conditions = readComponentList(component.conditions);
16260
- if (conditions?.length) {
16261
- lines.push(`- Conditions: ${conditions.slice(0, 5).map(formatComponent).join("; ")}`);
16262
- if (conditions.length > 5) lines.push(`- ...and ${conditions.length - 5} more conditions`);
16263
- }
16264
- const actions = readComponentList(component.actions);
16265
- if (actions?.length) {
16266
- lines.push(`- Actions: ${actions.slice(0, 5).map(formatComponent).join("; ")}`);
16267
- if (actions.length > 5) lines.push(`- ...and ${actions.length - 5} more actions`);
16268
- }
16269
- if (lines.length === 0) lines.push(`- ${formatComponent(component)}`);
16270
- return lines;
16271
- }
16272
- function readComponentList(value) {
16273
- if (!Array.isArray(value)) return void 0;
16274
- return value.filter(isPlainObject$3);
16275
- }
16276
- function formatComponentSummary(label, components, headingLevel) {
16277
- if (!components || components.length === 0) return [];
16278
- const heading = "#".repeat(Math.min(headingLevel, 6));
16279
- const lines = [
16280
- "",
16281
- `${heading} ${label}`,
16282
- ""
16283
- ];
16284
- const componentLabel = singularizeComponentLabel(label);
16285
- for (const component of components.slice(0, 5)) lines.push(...formatWorkflowGroup(component, componentLabel));
16286
- if (components.length > 5) lines.push(`- ...and ${components.length - 5} more`);
16287
- return lines;
16288
- }
16289
- function formatMetricAlertRule(rule, options = {}) {
16290
- const headingLevel = options.headingLevel ?? 2;
16291
- const includeComponents = options.includeComponents ?? true;
16292
- const heading = "#".repeat(Math.min(headingLevel, 6));
16293
- const owner = rule.owner ? formatActor(rule.owner) : null;
16294
- const projects = rule.projects ?? [];
16295
- const lines = compactLines([
16296
- `${heading} ${rule.name}`,
16297
- "",
16298
- `**Kind**: Metric Alert`,
16299
- `**ID**: ${formatId(rule.id)}`,
16300
- rule.status !== void 0 ? `**Status**: ${formatUnknown(rule.status)}` : null,
16301
- rule.dataset ? `**Dataset**: ${rule.dataset}` : null,
16302
- rule.aggregate ? `**Aggregate**: ${rule.aggregate}` : null,
16303
- rule.query ? `**Query**: ${rule.query}` : null,
16304
- rule.timeWindow !== void 0 && rule.timeWindow !== null ? `**Time Window**: ${rule.timeWindow} minutes` : null,
16305
- projects.length > 0 ? `**Projects**: ${projects.join(", ")}` : null,
16306
- rule.environment ? `**Environment**: ${rule.environment}` : null,
16307
- owner ? `**Owner**: ${owner}` : null,
16308
- formatDate(rule.dateCreated) ? `**Created**: ${formatDate(rule.dateCreated)}` : null,
16309
- options.url ? `**URL**: ${options.url}` : null
16310
- ]);
16311
- if (includeComponents) lines.push(...formatComponentSummary("Triggers", rule.triggers, headingLevel + 1));
16312
- return lines.join("\n");
16731
+ return /^\d+$/.test(value);
16313
16732
  }
16314
16733
  /** Resolve case-insensitive names only when the search results are complete. */
16315
16734
  async function findExactIssueAlertRuleMatches(apiService, params) {
@@ -16322,15 +16741,6 @@ async function findExactIssueAlertRuleMatches(apiService, params) {
16322
16741
  if (page.nextCursor) throw new UserInputError("Alert name search is incomplete. Find the Alert with find_alert_rules and retry with its numeric ID and explicit kind.");
16323
16742
  return page.rules.filter((rule) => rule.name.toLowerCase() === params.ruleName.toLowerCase());
16324
16743
  }
16325
- async function findExactMetricAlertRuleMatches(apiService, params) {
16326
- const rules = await apiService.listMetricAlertRules({
16327
- organizationSlug: params.organizationSlug,
16328
- projectSlug: params.projectSlug,
16329
- query: params.ruleName,
16330
- limit: 100
16331
- });
16332
- return rules.filter((rule) => rule.name.toLowerCase() === params.ruleName.toLowerCase());
16333
- }
16334
16744
  async function resolveIssueAlertRule(apiService, params) {
16335
16745
  if (isNumericAlertRuleId(params.ruleIdOrName)) try {
16336
16746
  return await apiService.getIssueAlertRule({
@@ -16354,43 +16764,47 @@ async function resolveIssueAlertRule(apiService, params) {
16354
16764
  if (matches.length > 1) throw new UserInputError(`Multiple issue alert rules named "${params.ruleIdOrName}" were found. Retry with the numeric rule ID.`);
16355
16765
  throw new UserInputError(`Issue alert rule "${params.ruleIdOrName}" was not found${params.projectSlug ? ` in project ${params.projectSlug}` : ""}.`);
16356
16766
  }
16767
+ /** Bare numeric references retain their legacy alert-rule identity. */
16357
16768
  async function resolveMetricAlertRule(apiService, params) {
16358
- if (isNumericAlertRuleId(params.ruleIdOrName)) try {
16359
- return await apiService.getMetricAlertRule({
16360
- organizationSlug: params.organizationSlug,
16361
- ruleId: params.ruleIdOrName
16769
+ const { organizationSlug, projectSlug: projectSlug$1, ruleIdOrName } = params;
16770
+ let monitorId;
16771
+ if (/^detector:\d+$/.test(ruleIdOrName)) monitorId = ruleIdOrName.slice(9);
16772
+ else if (isNumericAlertRuleId(ruleIdOrName)) try {
16773
+ monitorId = await apiService.getDetectorForAlertRule({
16774
+ organizationSlug,
16775
+ alertRuleId: ruleIdOrName
16362
16776
  });
16363
16777
  } catch (error) {
16364
- if (!(error instanceof ApiNotFoundError)) throw error;
16778
+ if (!(error instanceof ApiClientError) || error.status !== 404 && error.status !== 410) throw error;
16779
+ throw new UserInputError(`Legacy metric alert "${ruleIdOrName}" could not be mapped to a monitor. Use find_metric_monitors, then get_metric_monitor_details with its monitor ID.`);
16365
16780
  }
16366
- const matches = await findExactMetricAlertRuleMatches(apiService, {
16367
- organizationSlug: params.organizationSlug,
16368
- projectSlug: params.projectSlug,
16369
- ruleName: params.ruleIdOrName
16370
- });
16371
- if (matches.length === 1) return apiService.getMetricAlertRule({
16372
- organizationSlug: params.organizationSlug,
16373
- ruleId: matches[0].id
16781
+ else {
16782
+ const matches = await findExactMetricMonitorMatches(apiService, {
16783
+ organizationSlug,
16784
+ projectSlug: projectSlug$1,
16785
+ name: ruleIdOrName
16786
+ });
16787
+ 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.`);
16788
+ monitorId = matches[0].id;
16789
+ }
16790
+ return getMetricMonitor(apiService, {
16791
+ organizationSlug,
16792
+ projectSlug: projectSlug$1,
16793
+ monitorId
16374
16794
  });
16375
- if (matches.length > 1) throw new UserInputError(`Multiple metric alert rules named "${params.ruleIdOrName}" were found. Retry with the numeric rule ID.`);
16376
- throw new UserInputError(`Metric alert rule "${params.ruleIdOrName}" was not found.`);
16377
16795
  }
16378
16796
 
16379
16797
  //#endregion
16380
- //#region ../mcp-core/dist/get-alert-rule-DOk7Olu5.js
16798
+ //#region ../mcp-core/dist/get-alert-rule-BnwsOR0V.js
16381
16799
  const AlertRuleKind = zod.z.enum([
16382
16800
  "all",
16383
16801
  "issue",
16384
16802
  "metric"
16385
- ]).describe("Which alert rule family to inspect. Use `issue` or `metric` for numeric IDs; `all` treats the value as an exact-name lookup.");
16803
+ ]).describe("Which alert family to inspect. Numeric metric IDs are legacy alert-rule IDs, not monitor IDs. `all` performs an exact-name lookup.");
16386
16804
  function describeMatch(match) {
16387
16805
  const project = match.projectSlug ? ` project ${match.projectSlug}` : "";
16388
16806
  return `${match.kind} alert ${String(match.rule.id)} (${match.rule.name})${project}`;
16389
16807
  }
16390
- function assertMetricAlertRuleWithinProject(rule, projectSlug$1) {
16391
- if (!projectSlug$1) return;
16392
- if (!rule.projects?.includes(projectSlug$1)) throw new UserInputError(`Metric alert rule is outside project "${projectSlug$1}".`);
16393
- }
16394
16808
  var get_alert_rule_default = defineTool({
16395
16809
  name: "get_alert_rule",
16396
16810
  skills: ["inspect"],
@@ -16407,7 +16821,7 @@ var get_alert_rule_default = defineTool({
16407
16821
  "</examples>",
16408
16822
  "",
16409
16823
  "<hints>",
16410
- "- Use `kind='issue'` or `kind='metric'` for numeric IDs because issue and metric alerts use separate endpoints.",
16824
+ "- Prefer get_metric_monitor_details for Metric Monitors. With kind=metric, numeric IDs retain their legacy alert-rule meaning; detector:123 explicitly identifies monitor 123.",
16411
16825
  "- With `kind='all'`, a digit-only `ruleIdOrName` is treated as an exact alert rule name.",
16412
16826
  "- Issue Alerts are notification workflows and may cover multiple projects or have no connected sources. Omit projectSlug to inspect organization-wide.",
16413
16827
  "- Issue details include complete conditions, notification actions, connected monitors and project scope. Inaccessible or session-restricted sources are marked explicitly.",
@@ -16418,7 +16832,7 @@ var get_alert_rule_default = defineTool({
16418
16832
  regionUrl: ParamRegionUrl.nullable().default(null),
16419
16833
  kind: AlertRuleKind.default("all"),
16420
16834
  projectSlug: ParamProjectSlugOrAll.nullable().default(null),
16421
- ruleIdOrName: zod.z.string().trim().min(1).describe("The alert rule's numeric ID, or an exact alert rule name.")
16835
+ ruleIdOrName: zod.z.string().trim().min(1).describe("An Alert ID or exact name. Metric references accept legacy numeric alert-rule IDs or detector:123 for canonical monitor IDs.")
16422
16836
  },
16423
16837
  annotations: {
16424
16838
  readOnlyHint: true,
@@ -16437,7 +16851,6 @@ var get_alert_rule_default = defineTool({
16437
16851
  const organizationSlug = params.organizationSlug;
16438
16852
  setOrganizationContext(organizationSlug);
16439
16853
  if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
16440
- const warnings = [];
16441
16854
  let match;
16442
16855
  if (params.kind === "issue") {
16443
16856
  const rule = await resolveIssueAlertRule(apiService, {
@@ -16456,7 +16869,6 @@ var get_alert_rule_default = defineTool({
16456
16869
  projectSlug: projectSlug$1,
16457
16870
  ruleIdOrName: params.ruleIdOrName
16458
16871
  });
16459
- assertMetricAlertRuleWithinProject(rule, projectSlug$1);
16460
16872
  match = {
16461
16873
  kind: "metric",
16462
16874
  rule,
@@ -16474,25 +16886,18 @@ var get_alert_rule_default = defineTool({
16474
16886
  rule,
16475
16887
  projectSlug: projectSlug$1
16476
16888
  })));
16477
- try {
16478
- const metricPage = await apiService.listMetricAlertRulesPage({
16479
- organizationSlug,
16480
- projectSlug: projectSlug$1,
16481
- query: params.ruleIdOrName,
16482
- limit: 100
16483
- });
16484
- if (metricPage.nextCursor) throw new UserInputError("Alert name search is incomplete. Find the Alert with find_alert_rules and retry with its numeric ID and explicit kind.");
16485
- matches.push(...metricPage.rules.filter((rule) => rule.name.toLowerCase() === params.ruleIdOrName.toLowerCase()).map((rule) => ({
16486
- kind: "metric",
16487
- rule,
16488
- projectSlug: projectSlug$1
16489
- })));
16490
- } catch (error) {
16491
- if (!(error instanceof ApiClientError) || error.status !== 410) throw error;
16492
- warnings.push("Metric alert lookup is unavailable because the legacy API has been retired. Only issue Alerts were searched.");
16493
- }
16494
- if (matches.length === 0) throw new UserInputError(`Alert rule "${params.ruleIdOrName}" was not found.${warnings.length ? ` ${warnings.join(" ")}` : ""}`);
16495
- if (matches.length > 1) throw new UserInputError(`Multiple alert rules named "${params.ruleIdOrName}" were found: ${matches.map(describeMatch).join(", ")}. Retry with the numeric rule ID and explicit kind.`);
16889
+ const metricMonitors = await findExactMetricMonitorMatches(apiService, {
16890
+ organizationSlug,
16891
+ projectSlug: projectSlug$1,
16892
+ name: params.ruleIdOrName
16893
+ });
16894
+ matches.push(...metricMonitors.map((rule) => ({
16895
+ kind: "metric",
16896
+ rule,
16897
+ projectSlug: projectSlug$1
16898
+ })));
16899
+ if (matches.length === 0) throw new UserInputError(`Alert rule "${params.ruleIdOrName}" was not found.`);
16900
+ if (matches.length > 1) throw new UserInputError(`Multiple alert rules named "${params.ruleIdOrName}" were found: ${matches.map(describeMatch).join(", ")}. Retry with the Alert ID and kind=issue, or use get_metric_monitor_details with the monitor ID.`);
16496
16901
  const [found] = matches;
16497
16902
  match = found.kind === "issue" ? {
16498
16903
  ...found,
@@ -16503,28 +16908,23 @@ var get_alert_rule_default = defineTool({
16503
16908
  })
16504
16909
  } : {
16505
16910
  ...found,
16506
- rule: await apiService.getMetricAlertRule({
16911
+ rule: await getMetricMonitor(apiService, {
16507
16912
  organizationSlug,
16508
- ruleId: found.rule.id
16913
+ projectSlug: projectSlug$1,
16914
+ monitorId: found.rule.id
16509
16915
  })
16510
16916
  };
16511
- if (match.kind === "metric") assertMetricAlertRuleWithinProject(match.rule, match.projectSlug);
16512
16917
  }
16513
- if (match.kind === "issue") return structuredResult({
16514
- alertRule: await getAlertRuleDetails(apiService, organizationSlug, match.rule, context$1.constraints.projectSlug),
16515
- ...warnings.length ? { warnings } : {}
16918
+ if (match.kind === "issue") return structuredResult({ alertRule: await getAlertRuleDetails(apiService, organizationSlug, match.rule, context$1.constraints.projectSlug) });
16919
+ return structuredResult({
16920
+ metricMonitor: toMetricMonitorDetails(apiService, organizationSlug, match.rule),
16921
+ guidance: "Use get_metric_monitor_details with this monitor's id for canonical Metric Monitor inspection. Connected notification Alerts are identified by workflowIds."
16516
16922
  });
16517
- const scopeLabel = projectSlug$1 ? `${organizationSlug}/${projectSlug$1}` : organizationSlug;
16518
- let output = `# Alert Rule in **${scopeLabel}**\n\n`;
16519
- output += formatMetricAlertRule(match.rule, { url: apiService.getMetricAlertRuleUrl(organizationSlug, match.rule.id) });
16520
- output += "\n\n## Response Notes\n\n";
16521
- output += "- Use these details to inspect alert conditions, filters, routing, and notification actions before changing the rule in Sentry.\n";
16522
- return output;
16523
16923
  }
16524
16924
  });
16525
16925
 
16526
16926
  //#endregion
16527
- //#region ../mcp-core/dist/get-alert-options-DaJVqiFn.js
16927
+ //#region ../mcp-core/dist/get-alert-options-B1-eE0_t.js
16528
16928
  const sectionSchema = zod.z.enum([
16529
16929
  "actions",
16530
16930
  "conditions",
@@ -16676,7 +17076,474 @@ var get_alert_options_default = defineTool({
16676
17076
  });
16677
17077
 
16678
17078
  //#endregion
16679
- //#region ../mcp-core/dist/enhance-error-C-IasWwg.js
17079
+ //#region ../mcp-core/dist/alert-rule-connections-D-rBMpEh.js
17080
+ /** Shared Alerts can only be mutated from a session covering their entire scope. */
17081
+ async function validateAlertRuleProjectScope(api, params) {
17082
+ if (params.projectSlug) assertProjectRefWithinConstraint({
17083
+ resourceLabel: "Alert rule",
17084
+ scopedProjectSlug: params.scopedProjectSlug,
17085
+ project: { slug: params.projectSlug }
17086
+ });
17087
+ const projectSlug$1 = params.scopedProjectSlug ?? params.projectSlug;
17088
+ if (!projectSlug$1) return void 0;
17089
+ const [project, scope] = await Promise.all([api.getProject({
17090
+ organizationSlug: params.organizationSlug,
17091
+ projectSlugOrId: projectSlug$1
17092
+ }), api.getAlertRuleProjectScope({
17093
+ organizationSlug: params.organizationSlug,
17094
+ ruleId: params.ruleId
17095
+ })]);
17096
+ assertProjectConstraintEvidence({
17097
+ resourceLabel: "Alert rule",
17098
+ scopedProjectSlug: params.scopedProjectSlug,
17099
+ hasEvidence: !scope.includesAllProjects && scope.projectIds.length > 0 && scope.projectIds.every((id) => id === String(project.id))
17100
+ });
17101
+ if (!scope.includesAllProjects && !scope.projectIds.includes(String(project.id))) throw new UserInputError(`Alert rule is outside project "${projectSlug$1}".`);
17102
+ return params.scopedProjectSlug ? {
17103
+ id: String(project.id),
17104
+ slug: project.slug
17105
+ } : void 0;
17106
+ }
17107
+ /** Apply connection changes after the caller has authorized the workflow's current scope. */
17108
+ async function resolveAlertRuleConnections(api, params) {
17109
+ const additions = /* @__PURE__ */ new Set();
17110
+ const removals = /* @__PURE__ */ new Set();
17111
+ const detectorIds = new Set(params.currentDetectorIds.map(String));
17112
+ for (const [projectSlugs, requestedDetectorIds, resolvedIds] of [[
17113
+ params.addProjectSlugs,
17114
+ params.addDetectorIds,
17115
+ additions
17116
+ ], [
17117
+ params.removeProjectSlugs,
17118
+ params.removeDetectorIds,
17119
+ removals
17120
+ ]]) {
17121
+ for (const projectSlug$1 of new Set(projectSlugs ?? [])) {
17122
+ const project = await api.getProject({
17123
+ organizationSlug: params.organizationSlug,
17124
+ projectSlugOrId: projectSlug$1
17125
+ });
17126
+ const projectId = String(project.id);
17127
+ assertProjectConstraintEvidence({
17128
+ resourceLabel: "Alert source",
17129
+ scopedProjectSlug: params.scopedProject?.slug,
17130
+ hasEvidence: projectId === params.scopedProject?.id
17131
+ });
17132
+ const matches = /* @__PURE__ */ new Set();
17133
+ let cursor;
17134
+ do {
17135
+ const page = await api.listDetectorsPage({
17136
+ organizationSlug: params.organizationSlug,
17137
+ projectId,
17138
+ types: ["issue_stream"],
17139
+ cursor,
17140
+ limit: 100
17141
+ });
17142
+ for (const detector of page.detectors) if (detector.type === "issue_stream" && detector.projectId !== null && String(detector.projectId) === projectId) matches.add(String(detector.id));
17143
+ cursor = page.nextCursor ?? void 0;
17144
+ } while (cursor);
17145
+ const [detectorId] = matches;
17146
+ 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.`);
17147
+ 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.`);
17148
+ resolvedIds.add(detectorId);
17149
+ }
17150
+ for (const detectorId of new Set(requestedDetectorIds ?? [])) {
17151
+ if (resolvedIds === removals && detectorIds.has(detectorId)) {
17152
+ removals.add(detectorId);
17153
+ continue;
17154
+ }
17155
+ const detector = await api.getDetector({
17156
+ organizationSlug: params.organizationSlug,
17157
+ detectorId
17158
+ });
17159
+ assertProjectConstraintEvidence({
17160
+ resourceLabel: "Alert source",
17161
+ scopedProjectSlug: params.scopedProject?.slug,
17162
+ hasEvidence: detector.projectId !== null && String(detector.projectId) === params.scopedProject?.id
17163
+ });
17164
+ resolvedIds.add(String(detector.id));
17165
+ }
17166
+ }
17167
+ if ([...additions].some((id) => removals.has(id))) throw new UserInputError("The same Alert source cannot be added and removed in one update.");
17168
+ for (const id of removals) detectorIds.delete(id);
17169
+ for (const id of additions) detectorIds.add(id);
17170
+ if (params.scopedProject && detectorIds.size === 0) throw new UserInputError("Disconnecting every Alert source requires an organization-wide session.");
17171
+ return [...detectorIds];
17172
+ }
17173
+
17174
+ //#endregion
17175
+ //#region ../mcp-core/dist/alert-rule-config-BZlFpT72.js
17176
+ const componentId = zod.z.union([zod.z.string(), zod.z.number()]);
17177
+ const logicType = zod.z.enum([
17178
+ "all",
17179
+ "any",
17180
+ "any-short",
17181
+ "none"
17182
+ ]);
17183
+ const condition = zod.z.object({
17184
+ id: componentId.optional(),
17185
+ type: zod.z.string(),
17186
+ comparison: zod.z.unknown(),
17187
+ conditionResult: zod.z.unknown()
17188
+ });
17189
+ const ParamAlertTriggers = zod.z.object({
17190
+ id: componentId.optional(),
17191
+ logicType,
17192
+ conditions: zod.z.array(condition)
17193
+ }).describe("The complete trigger group. Preserve existing condition IDs when editing; omitted conditions are removed. Use the configuration returned by get_alert_rule.");
17194
+ const action = zod.z.object({
17195
+ id: componentId.optional(),
17196
+ type: zod.z.string(),
17197
+ integrationId: componentId.nullable().optional(),
17198
+ data: zod.z.record(zod.z.string(), zod.z.unknown()),
17199
+ config: zod.z.record(zod.z.string(), zod.z.unknown()),
17200
+ status: zod.z.string().optional()
17201
+ });
17202
+ const ParamAlertActionFilters = zod.z.array(zod.z.object({
17203
+ id: componentId.optional(),
17204
+ logicType,
17205
+ conditions: zod.z.array(condition),
17206
+ actions: zod.z.array(action)
17207
+ })).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.");
17208
+ const ParamNewAlertTriggers = ParamAlertTriggers.omit({ id: true }).extend({ conditions: zod.z.array(condition.omit({ id: true })) }).refine((group) => group.conditions.length === 0 || group.logicType === "any-short", {
17209
+ message: "New Alert trigger conditions require logicType='any-short'.",
17210
+ path: ["logicType"]
17211
+ }).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.");
17212
+ const ParamNewAlertActionFilters = zod.z.array(ParamAlertActionFilters.element.omit({ id: true }).extend({
17213
+ conditions: zod.z.array(condition.omit({ id: true })),
17214
+ actions: zod.z.array(action.omit({ id: true }))
17215
+ })).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.");
17216
+ const alertRuleConfigFields = {
17217
+ name: zod.z.string().trim().min(1).max(256).optional(),
17218
+ status: zod.z.enum(["active", "disabled"]).optional(),
17219
+ frequencyMinutes: zod.z.number().int().min(0).optional().describe("Minimum interval between notifications, in minutes."),
17220
+ environment: zod.z.string().min(1).nullable().optional(),
17221
+ owner: zod.z.string().regex(/^(user|team):\d+$/).nullable().optional().describe("Owner actor user:ID or team:ID. Pass null to clear.")
17222
+ };
17223
+ const alertRuleSummarySchema = zod.z.object({
17224
+ id: zod.z.string(),
17225
+ name: zod.z.string(),
17226
+ enabled: zod.z.boolean().optional(),
17227
+ config: zod.z.object({ frequency: zod.z.number().int().min(0).optional() }).optional(),
17228
+ environment: zod.z.string().nullable().optional(),
17229
+ owner: zod.z.string().nullable().optional(),
17230
+ triggers: ParamAlertTriggers.nullable().optional(),
17231
+ actionFilters: ParamAlertActionFilters.nullable().optional(),
17232
+ detectorIds: zod.z.array(zod.z.string()),
17233
+ webUrl: zod.z.string().url()
17234
+ });
17235
+ /** Returns editable alert configuration and component IDs, excluding backend metadata. */
17236
+ function toAlertRuleSummary(rule, webUrl) {
17237
+ return alertRuleSummarySchema.parse({
17238
+ id: String(rule.id),
17239
+ name: rule.name,
17240
+ enabled: rule.enabled,
17241
+ config: rule.config,
17242
+ environment: rule.environment,
17243
+ owner: typeof rule.owner === "string" || rule.owner === null ? rule.owner : void 0,
17244
+ triggers: rule.triggers,
17245
+ actionFilters: rule.actionFilters,
17246
+ detectorIds: (rule.detectorIds ?? []).map(String),
17247
+ webUrl
17248
+ });
17249
+ }
17250
+ /** Sentry can save a Slack action after a channel lookup timeout. */
17251
+ function assertResolvedAlertDestinations(rule, operation = "update") {
17252
+ 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).");
17253
+ }
17254
+
17255
+ //#endregion
17256
+ //#region ../mcp-core/dist/update-alert-rule-BZFdGe-H.js
17257
+ const updateAlertRuleOutputSchema = zod.z.object({ alertRule: alertRuleSummarySchema });
17258
+ /** Preserve copied actions while asking Sentry to resolve a changed Slack destination. */
17259
+ function resolveChangedSlackDestinations(groups, current) {
17260
+ const previousActions = (current.actionFilters ?? []).flatMap((group) => Array.isArray(group.actions) ? group.actions.filter(isPlainObject$3) : []);
17261
+ return groups.map((group) => ({
17262
+ ...group,
17263
+ actions: group.actions.map((action$1) => {
17264
+ const previous = previousActions.find((candidate) => action$1.id !== void 0 && String(candidate.id) === String(action$1.id));
17265
+ 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;
17266
+ const config = { ...action$1.config };
17267
+ delete config.targetIdentifier;
17268
+ return {
17269
+ ...action$1,
17270
+ config
17271
+ };
17272
+ })
17273
+ }));
17274
+ }
17275
+ var update_alert_rule_default = defineTool({
17276
+ name: "update_alert_rule",
17277
+ skills: ["project-management"],
17278
+ requiredScopes: [
17279
+ "org:read",
17280
+ "project:read",
17281
+ "alerts:write"
17282
+ ],
17283
+ description: [
17284
+ "Update a Sentry Alert (workflow), including notification actions and connections.",
17285
+ "Use get_alert_rule with kind='issue' first to inspect the complete triggers and actionFilters configuration.",
17286
+ "Use get_alert_options to discover notification actions, integrations, conditions, and available sources.",
17287
+ "Omit fields to leave them unchanged. Pass null to clear owner or environment.",
17288
+ "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.",
17289
+ "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.",
17290
+ "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.",
17291
+ "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.",
17292
+ "Metric Monitor detection queries and thresholds are separate operations.",
17293
+ "All-project connections require Sentry's all-project feature and an API token with org:write in addition to alerts:write.",
17294
+ "A project-constrained session can only edit alerts affecting that project exclusively.",
17295
+ "Requires alerts:write; reconnect OAuth if the existing token lacks it.",
17296
+ "<examples>",
17297
+ "update_alert_rule(organizationSlug='my-org', ruleIdOrName='12345', status='disabled')",
17298
+ "update_alert_rule(organizationSlug='my-org', projectSlug='backend', ruleIdOrName='Notify backend team', frequencyMinutes=30)",
17299
+ "</examples>"
17300
+ ].join("\n"),
17301
+ inputSchema: {
17302
+ organizationSlug: ParamOrganizationSlug,
17303
+ regionUrl: ParamRegionUrl.nullable().default(null),
17304
+ projectSlug: ParamProjectSlug.nullable().optional(),
17305
+ ruleIdOrName: zod.z.string().trim().min(1).describe("Workflow ID or exact alert name. Digit-only values are treated as IDs. Use IDs from get_alert_rule(kind='issue')."),
17306
+ ...alertRuleConfigFields,
17307
+ triggers: ParamAlertTriggers.optional(),
17308
+ actionFilters: ParamAlertActionFilters.optional(),
17309
+ addProjectSlugs: zod.z.array(ParamProjectSlug).min(1).optional().describe("Projects whose existing issue streams should be connected."),
17310
+ removeProjectSlugs: zod.z.array(ParamProjectSlug).min(1).optional().describe("Projects whose issue streams should be disconnected; other monitor connections are retained."),
17311
+ addDetectorIds: zod.z.array(zod.z.string().regex(/^\d+$/)).min(1).optional().describe("Existing detector IDs to connect, from get_alert_options(section='sources')."),
17312
+ removeDetectorIds: zod.z.array(zod.z.string().regex(/^\d+$/)).min(1).optional().describe("Detector IDs to disconnect. Other connections are retained.")
17313
+ },
17314
+ annotations: {
17315
+ readOnlyHint: false,
17316
+ destructiveHint: true,
17317
+ idempotentHint: false,
17318
+ openWorldHint: true
17319
+ },
17320
+ outputSchema: updateAlertRuleOutputSchema,
17321
+ async handler(params, context$1) {
17322
+ if ([
17323
+ params.name,
17324
+ params.status,
17325
+ params.frequencyMinutes,
17326
+ params.environment,
17327
+ params.owner,
17328
+ params.triggers,
17329
+ params.actionFilters,
17330
+ params.addProjectSlugs,
17331
+ params.removeProjectSlugs,
17332
+ params.addDetectorIds,
17333
+ params.removeDetectorIds
17334
+ ].every((value) => value === void 0)) throw new UserInputError("Provide at least one field to update on the alert rule.");
17335
+ if (params.projectSlug) assertProjectRefWithinConstraint({
17336
+ resourceLabel: "Alert rule",
17337
+ scopedProjectSlug: context$1.constraints.projectSlug,
17338
+ project: { slug: params.projectSlug }
17339
+ });
17340
+ const projectSlug$1 = context$1.constraints.projectSlug ?? params.projectSlug;
17341
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
17342
+ const organizationSlug = params.organizationSlug;
17343
+ setOrganizationContext(organizationSlug);
17344
+ if (projectSlug$1) (0, __sentry_core.setTag)("project.slug", projectSlug$1);
17345
+ let ruleId = params.ruleIdOrName;
17346
+ if (!isNumericAlertRuleId(ruleId)) {
17347
+ const matches = await findExactIssueAlertRuleMatches(apiService, {
17348
+ organizationSlug,
17349
+ projectSlug: projectSlug$1 ?? void 0,
17350
+ ruleName: ruleId
17351
+ });
17352
+ if (matches.length > 1) throw new UserInputError("The alert name cannot be resolved unambiguously. Retry with the numeric workflow ID from get_alert_rule.");
17353
+ if (matches.length === 0) throw new UserInputError(`Alert rule "${ruleId}" was not found${projectSlug$1 ? ` in project ${projectSlug$1}` : ""}.`);
17354
+ ruleId = String(matches[0].id);
17355
+ }
17356
+ const current = await apiService.getIssueAlertRule({
17357
+ organizationSlug,
17358
+ ruleId
17359
+ });
17360
+ const scopedProject = await validateAlertRuleProjectScope(apiService, {
17361
+ organizationSlug,
17362
+ ruleId,
17363
+ projectSlug: projectSlug$1,
17364
+ scopedProjectSlug: context$1.constraints.projectSlug
17365
+ });
17366
+ if (typeof current.enabled !== "boolean") throw new Error("Sentry returned an alert without its enabled state; refusing to update it.");
17367
+ const body = {
17368
+ name: params.name ?? current.name,
17369
+ enabled: params.status === void 0 ? current.enabled : params.status === "active"
17370
+ };
17371
+ if (params.frequencyMinutes !== void 0) body.config = {
17372
+ ...current.config,
17373
+ frequency: params.frequencyMinutes
17374
+ };
17375
+ if (params.environment !== void 0) body.environment = params.environment;
17376
+ if (params.owner !== void 0) body.owner = params.owner;
17377
+ if (params.triggers !== void 0) body.triggers = params.triggers;
17378
+ if (params.actionFilters !== void 0) body.actionFilters = resolveChangedSlackDestinations(params.actionFilters, current);
17379
+ if ([
17380
+ params.addProjectSlugs,
17381
+ params.removeProjectSlugs,
17382
+ params.addDetectorIds,
17383
+ params.removeDetectorIds
17384
+ ].some((value) => value !== void 0)) body.detectorIds = await resolveAlertRuleConnections(apiService, {
17385
+ organizationSlug,
17386
+ currentDetectorIds: current.detectorIds ?? [],
17387
+ addProjectSlugs: params.addProjectSlugs,
17388
+ removeProjectSlugs: params.removeProjectSlugs,
17389
+ addDetectorIds: params.addDetectorIds,
17390
+ removeDetectorIds: params.removeDetectorIds,
17391
+ scopedProject
17392
+ });
17393
+ const updated = await apiService.updateAlertRule({
17394
+ organizationSlug,
17395
+ ruleId,
17396
+ body
17397
+ });
17398
+ const alertRule = toAlertRuleSummary(updated, apiService.getIssueAlertRuleUrl(organizationSlug, updated.id));
17399
+ if (params.actionFilters !== void 0) assertResolvedAlertDestinations(alertRule);
17400
+ return structuredResult({ alertRule });
17401
+ }
17402
+ });
17403
+
17404
+ //#endregion
17405
+ //#region ../mcp-core/dist/create-alert-rule-syQO2c8s.js
17406
+ var create_alert_rule_default = defineTool({
17407
+ name: "create_alert_rule",
17408
+ skills: ["project-management"],
17409
+ requiredScopes: [
17410
+ "org:read",
17411
+ "project:read",
17412
+ "alerts:write"
17413
+ ],
17414
+ description: [
17415
+ "Create a Sentry Alert (workflow) with notification actions and explicit sources.",
17416
+ "Use get_alert_options for available actions, integrations, conditions, and sources. All notification providers use their native config and data fields.",
17417
+ "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'.",
17418
+ "To reuse an existing Alert across projects, use update_alert_rule instead.",
17419
+ "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.",
17420
+ "New Alerts default to active with a 30-minute notification interval. Use status='disabled' to configure one before enabling it.",
17421
+ "Project-constrained sessions require sources exclusively within that project. All-project sources require Sentry's feature and org:write in addition to alerts:write.",
17422
+ "After a timeout or error, search for the Alert before retrying: creation may already have succeeded.",
17423
+ "<examples>",
17424
+ "create_alert_rule(organizationSlug='my-org', name='Backend notifications', status='disabled', detectorIds=[], actionFilters=[])",
17425
+ "</examples>"
17426
+ ].join("\n"),
17427
+ inputSchema: {
17428
+ organizationSlug: ParamOrganizationSlug,
17429
+ regionUrl: ParamRegionUrl.nullable().default(null),
17430
+ ...alertRuleConfigFields,
17431
+ name: alertRuleConfigFields.name.unwrap(),
17432
+ status: alertRuleConfigFields.status.default("active"),
17433
+ frequencyMinutes: alertRuleConfigFields.frequencyMinutes.default(30),
17434
+ triggers: ParamNewAlertTriggers.nullable().optional(),
17435
+ actionFilters: ParamNewAlertActionFilters,
17436
+ projectSlugs: zod.z.array(ParamProjectSlug).optional().describe("Projects whose issue streams should be connected."),
17437
+ detectorIds: zod.z.array(zod.z.string().regex(/^\d+$/)).optional().describe("Existing source IDs from get_alert_options. Pass [] explicitly for an Alert without sources.")
17438
+ },
17439
+ annotations: {
17440
+ readOnlyHint: false,
17441
+ destructiveHint: false,
17442
+ idempotentHint: false,
17443
+ openWorldHint: true
17444
+ },
17445
+ outputSchema: zod.z.object({
17446
+ alertRule: alertRuleSummarySchema,
17447
+ guidance: zod.z.string().optional()
17448
+ }),
17449
+ async handler(params, context$1) {
17450
+ 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.");
17451
+ const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
17452
+ setOrganizationContext(params.organizationSlug);
17453
+ const project = context$1.constraints.projectSlug ? await api.getProject({
17454
+ organizationSlug: params.organizationSlug,
17455
+ projectSlugOrId: context$1.constraints.projectSlug
17456
+ }) : void 0;
17457
+ const detectorIds = await resolveAlertRuleConnections(api, {
17458
+ organizationSlug: params.organizationSlug,
17459
+ currentDetectorIds: [],
17460
+ addProjectSlugs: params.projectSlugs,
17461
+ addDetectorIds: params.detectorIds,
17462
+ scopedProject: project ? {
17463
+ id: String(project.id),
17464
+ slug: project.slug
17465
+ } : void 0
17466
+ });
17467
+ const created = await api.createAlertRule({
17468
+ organizationSlug: params.organizationSlug,
17469
+ body: {
17470
+ name: params.name,
17471
+ enabled: params.status === "active",
17472
+ config: { frequency: params.frequencyMinutes },
17473
+ environment: params.environment,
17474
+ owner: params.owner,
17475
+ triggers: params.triggers?.conditions.length ? params.triggers : void 0,
17476
+ actionFilters: params.actionFilters,
17477
+ detectorIds
17478
+ }
17479
+ });
17480
+ const alertRule = toAlertRuleSummary(created, api.getIssueAlertRuleUrl(params.organizationSlug, created.id));
17481
+ assertResolvedAlertDestinations(alertRule, "create");
17482
+ return structuredResult({
17483
+ alertRule,
17484
+ ...alertRule.detectorIds.length === 0 ? { guidance: "This Alert has no sources and will not send notifications until connected using update_alert_rule." } : {}
17485
+ });
17486
+ }
17487
+ });
17488
+
17489
+ //#endregion
17490
+ //#region ../mcp-core/dist/delete-alert-rule-DLQ6rN94.js
17491
+ var delete_alert_rule_default = defineTool({
17492
+ name: "delete_alert_rule",
17493
+ skills: ["project-management"],
17494
+ requiredScopes: [
17495
+ "org:read",
17496
+ "project:read",
17497
+ "alerts:write"
17498
+ ],
17499
+ description: [
17500
+ "Permanently delete a Sentry Alert (workflow), preserving its connected monitors.",
17501
+ "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.",
17502
+ "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.",
17503
+ "A project-constrained session can only delete Alerts affecting that project exclusively.",
17504
+ "Sentry removes the Alert from normal reads immediately and completes internal deletion in the background.",
17505
+ "<examples>",
17506
+ "delete_alert_rule(organizationSlug='my-org', ruleId='12345')",
17507
+ "</examples>"
17508
+ ].join("\n"),
17509
+ inputSchema: {
17510
+ organizationSlug: ParamOrganizationSlug,
17511
+ regionUrl: ParamRegionUrl.nullable().default(null),
17512
+ projectSlug: ParamProjectSlug.nullable().optional(),
17513
+ ruleId: zod.z.string().regex(/^\d+$/).describe("Workflow ID from get_alert_rule(kind='issue').")
17514
+ },
17515
+ annotations: {
17516
+ readOnlyHint: false,
17517
+ destructiveHint: true,
17518
+ idempotentHint: true,
17519
+ openWorldHint: true
17520
+ },
17521
+ outputSchema: zod.z.object({
17522
+ success: zod.z.literal(true),
17523
+ ruleId: zod.z.string()
17524
+ }),
17525
+ async handler(params, context$1) {
17526
+ const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
17527
+ setOrganizationContext(params.organizationSlug);
17528
+ await validateAlertRuleProjectScope(api, {
17529
+ organizationSlug: params.organizationSlug,
17530
+ ruleId: params.ruleId,
17531
+ projectSlug: params.projectSlug,
17532
+ scopedProjectSlug: context$1.constraints.projectSlug
17533
+ });
17534
+ await api.deleteAlertRule({
17535
+ organizationSlug: params.organizationSlug,
17536
+ ruleId: params.ruleId
17537
+ });
17538
+ return structuredResult({
17539
+ success: true,
17540
+ ruleId: params.ruleId
17541
+ });
17542
+ }
17543
+ });
17544
+
17545
+ //#endregion
17546
+ //#region ../mcp-core/dist/enhance-error-CD_-s-wU.js
16680
17547
  /**
16681
17548
  * Enhances a 404 error with parameter context to help users understand what went wrong.
16682
17549
  * This is optional - tools can use this when they want to provide extra context.
@@ -16704,7 +17571,7 @@ function enhanceNotFoundError(error, params) {
16704
17571
  }
16705
17572
 
16706
17573
  //#endregion
16707
- //#region ../mcp-core/dist/code-location-B3p1xz3c.js
17574
+ //#region ../mcp-core/dist/code-location-CSEeU0rZ.js
16708
17575
  /** Formats a verified source location for the issue-details response. */
16709
17576
  function formatCodeLocation(codeLocation) {
16710
17577
  const output = ["## Code Location", ""];
@@ -16720,7 +17587,7 @@ function findMostRelevantInAppFrame(frames) {
16720
17587
  }
16721
17588
 
16722
17589
  //#endregion
16723
- //#region ../mcp-core/dist/tool-call-formatting-DQggqUN_.js
17590
+ //#region ../mcp-core/dist/tool-call-formatting-DBtwNDuD.js
16724
17591
  function formatArgumentValue(value) {
16725
17592
  if (typeof value === "string") return `'${value.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
16726
17593
  if (Array.isArray(value) || typeof value === "object") return JSON.stringify(value);
@@ -16773,7 +17640,7 @@ function formatAvailableToolCallInstruction({ toolName, experimentalMode, purpos
16773
17640
  }
16774
17641
 
16775
17642
  //#endregion
16776
- //#region ../mcp-core/dist/ai-conversation-actions-CLccuTm5.js
17643
+ //#region ../mcp-core/dist/ai-conversation-actions-s0M7WLfT.js
16777
17644
  const MAX_SUGGESTED_ACTIONS = 3;
16778
17645
  function formatInlineCode$1(value) {
16779
17646
  const backtickRuns = value.match(/`+/g) ?? [];
@@ -16820,14 +17687,14 @@ function formatAIConversationActionInstructions({ organizationSlug, aiConversati
16820
17687
  directToolNames
16821
17688
  });
16822
17689
  if (actions.length === 0) return ["Agent conversation detail lookup is not available in this session."];
16823
- return actions.map((action) => `Use the Sentry tool ${formatInlineCode$1(formatToolCall({
16824
- toolName: action.toolName,
16825
- arguments: action.arguments
17690
+ return actions.map((action$1) => `Use the Sentry tool ${formatInlineCode$1(formatToolCall({
17691
+ toolName: action$1.toolName,
17692
+ arguments: action$1.arguments
16826
17693
  }))} to fetch the full transcript.`);
16827
17694
  }
16828
17695
 
16829
17696
  //#endregion
16830
- //#region ../mcp-core/dist/seer-DqLgmvV9.js
17697
+ //#region ../mcp-core/dist/seer-BRHapSed.js
16831
17698
  const SEER_POLLING_INTERVAL = 5e3;
16832
17699
  const SEER_TIMEOUT = 5 * 60 * 1e3;
16833
17700
  const SEER_MAX_RETRIES = 3;
@@ -17005,7 +17872,7 @@ function getActiveAutofixTodo(autofix) {
17005
17872
  }
17006
17873
 
17007
17874
  //#endregion
17008
- //#region ../mcp-core/dist/user-formatting-CTX3nhjo.js
17875
+ //#region ../mcp-core/dist/user-formatting-BPq81AXF.js
17009
17876
  function formatUserGeoSummary(value) {
17010
17877
  if (!isPlainObject$3(value)) return null;
17011
17878
  const parts = [
@@ -17019,7 +17886,7 @@ function formatUserGeoSummary(value) {
17019
17886
  }
17020
17887
 
17021
17888
  //#endregion
17022
- //#region ../mcp-core/dist/formatting-31tlKXsb.js
17889
+ //#region ../mcp-core/dist/formatting-DmyvXxeg.js
17023
17890
  /**
17024
17891
  * Convert Seer fixability score to actionability label.
17025
17892
  * Thresholds match Sentry core: src/sentry/seer/autofix/constants.py
@@ -17959,11 +18826,11 @@ function getMetricAlertSnubaQuery(evidenceData) {
17959
18826
  }
17960
18827
  return void 0;
17961
18828
  }
17962
- function formatMetricAlertCondition(condition) {
17963
- const comparison = condition.comparison;
18829
+ function formatMetricAlertCondition(condition$1) {
18830
+ const comparison = condition$1.comparison;
17964
18831
  const formattedComparison = formatPrimitive(comparison);
17965
18832
  if (formattedComparison == null) return void 0;
17966
- const type = condition.type;
18833
+ const type = condition$1.type;
17967
18834
  const typeLabel = (() => {
17968
18835
  if (type === 0 || type === "0" || type === "gt" || type === "gte") return type === "gte" ? "at or above" : "above";
17969
18836
  if (type === 1 || type === "1" || type === "lt" || type === "lte") return type === "lte" ? "at or below" : "below";
@@ -17994,7 +18861,7 @@ function formatMetricAlertDetails(evidenceData) {
17994
18861
  if (formattedValue) parts.push(`**Evaluated Value**: ${formattedValue}`);
17995
18862
  const conditions = evidenceData.conditions;
17996
18863
  if (Array.isArray(conditions)) {
17997
- const formattedConditions = conditions.filter(isPlainObject$3).map(formatMetricAlertCondition).filter((condition) => condition != null);
18864
+ const formattedConditions = conditions.filter(isPlainObject$3).map(formatMetricAlertCondition).filter((condition$1) => condition$1 != null);
17998
18865
  if (formattedConditions.length > 0) parts.push(`**Threshold**: ${formattedConditions.join(", ")}`);
17999
18866
  }
18000
18867
  if (evidenceData.alert_id != null) parts.push(`**Alert Rule ID**: ${String(evidenceData.alert_id)}`);
@@ -18406,7 +19273,7 @@ function stripReplayMetadata(event) {
18406
19273
  }
18407
19274
 
18408
19275
  //#endregion
18409
- //#region ../mcp-core/dist/url-scope-V6MOdP9h.js
19276
+ //#region ../mcp-core/dist/url-scope-DtjC8gup.js
18410
19277
  function resolveScopedOrganizationSlug({ resourceLabel, scopedOrganizationSlug, urlOrganizationSlug }) {
18411
19278
  if (!scopedOrganizationSlug) return urlOrganizationSlug;
18412
19279
  if (scopedOrganizationSlug !== urlOrganizationSlug) throw new UserInputError(`${resourceLabel} URL is outside the active organization constraint. Expected organization "${scopedOrganizationSlug}" but got "${urlOrganizationSlug}".`);
@@ -18430,7 +19297,7 @@ function resolveScopedProjectSlugOrId({ resourceLabel, scopedProjectSlugOrId, ur
18430
19297
  }
18431
19298
 
18432
19299
  //#endregion
18433
- //#region ../mcp-core/dist/issue-helpers-qGxiGeE5.js
19300
+ //#region ../mcp-core/dist/issue-helpers-CgwVDYw_.js
18434
19301
  /**
18435
19302
  * Extracts the Sentry issue ID and organization slug from a full URL
18436
19303
  *
@@ -18510,7 +19377,7 @@ function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
18510
19377
  }
18511
19378
 
18512
19379
  //#endregion
18513
- //#region ../mcp-core/dist/issue-y4HGWyCn.js
19380
+ //#region ../mcp-core/dist/issue-DhVQI_Lq.js
18514
19381
  function assertIssueWithinProjectConstraint({ issue, projectSlug: projectSlug$1, resourceLabel = "Issue" }) {
18515
19382
  assertScopedProjectSlug({
18516
19383
  resourceLabel,
@@ -18532,7 +19399,7 @@ async function ensureIssueWithinProjectConstraint({ apiService, organizationSlug
18532
19399
  }
18533
19400
 
18534
19401
  //#endregion
18535
- //#region ../mcp-core/dist/code-location-Dh_XFzfu.js
19402
+ //#region ../mcp-core/dist/code-location-DyFkzIBX.js
18536
19403
  const CODE_LOCATION_TIMEOUT_MS = 3e3;
18537
19404
  /** Resolves a verified source location, omitting optional enrichment failures. */
18538
19405
  async function resolveCodeLocation({ apiService, organizationSlug, projectSlug: projectSlug$1, event }) {
@@ -18635,7 +19502,7 @@ function getString$1(value) {
18635
19502
  }
18636
19503
 
18637
19504
  //#endregion
18638
- //#region ../mcp-core/dist/get-issue-details-t289hNuc.js
19505
+ //#region ../mcp-core/dist/get-issue-details-BiJxmpqb.js
18639
19506
  const MAX_RELATED_REPLAYS = 5;
18640
19507
  const MAX_AI_CONVERSATION_MATCHES = 3;
18641
19508
  const AI_CONVERSATION_LOOKUP_WINDOW_MS = 24 * 60 * 60 * 1e3;
@@ -19185,7 +20052,7 @@ function getReplayDataSource(issue) {
19185
20052
  }
19186
20053
 
19187
20054
  //#endregion
19188
- //#region ../mcp-core/dist/event-stacktrace-WES63IMe.js
20055
+ //#region ../mcp-core/dist/event-stacktrace-QI05nZO8.js
19189
20056
  /**
19190
20057
  * Fetches an issue event and formats the selected thread stacktrace.
19191
20058
  */
@@ -19264,7 +20131,7 @@ function selectUnique(threads, predicate, notFoundMessage, ambiguousMessage) {
19264
20131
  }
19265
20132
 
19266
20133
  //#endregion
19267
- //#region ../mcp-core/dist/get-event-stacktrace-CDGRtbOg.js
20134
+ //#region ../mcp-core/dist/get-event-stacktrace-tjlLJZiz.js
19268
20135
  var get_event_stacktrace_default = defineTool({
19269
20136
  name: "get_event_stacktrace",
19270
20137
  skills: [
@@ -19335,7 +20202,7 @@ var get_event_stacktrace_default = defineTool({
19335
20202
  });
19336
20203
 
19337
20204
  //#endregion
19338
- //#region ../mcp-core/dist/get-issue-activity-DA97QQfR.js
20205
+ //#region ../mcp-core/dist/get-issue-activity-Bia5Nuf3.js
19339
20206
  function getActivityText(activity) {
19340
20207
  const data = activity.data;
19341
20208
  if (!data) return null;
@@ -19428,7 +20295,7 @@ var get_issue_activity_default = defineTool({
19428
20295
  });
19429
20296
 
19430
20297
  //#endregion
19431
- //#region ../mcp-core/dist/breadcrumbs-uFW9kNaP.js
20298
+ //#region ../mcp-core/dist/breadcrumbs-e3Dfin9q.js
19432
20299
  /**
19433
20300
  * Fetches breadcrumbs from an issue event and formats them.
19434
20301
  * Defaults to the latest event when eventId is omitted.
@@ -19492,7 +20359,7 @@ function cleanAndTruncate(str, maxLen) {
19492
20359
  }
19493
20360
 
19494
20361
  //#endregion
19495
- //#region ../mcp-core/dist/get-issue-breadcrumbs-D-UCFqx1.js
20362
+ //#region ../mcp-core/dist/get-issue-breadcrumbs-Bz9-IJtC.js
19496
20363
  var get_issue_breadcrumbs_default = defineTool({
19497
20364
  name: "get_issue_breadcrumbs",
19498
20365
  skills: ["inspect", "triage"],
@@ -19554,7 +20421,7 @@ var get_issue_breadcrumbs_default = defineTool({
19554
20421
  });
19555
20422
 
19556
20423
  //#endregion
19557
- //#region ../mcp-core/dist/get-issue-tag-values-CyHuVJ-4.js
20424
+ //#region ../mcp-core/dist/get-issue-tag-values-C1aDbALn.js
19558
20425
  const getIssueTagValuesOutputSchema = zod.z.object({ tag: zod.z.object({
19559
20426
  key: zod.z.string(),
19560
20427
  name: zod.z.string(),
@@ -19672,7 +20539,7 @@ var get_issue_tag_values_default = defineTool({
19672
20539
  });
19673
20540
 
19674
20541
  //#endregion
19675
- //#region ../mcp-core/dist/get-issue-user-reports-DhU4yW1i.js
20542
+ //#region ../mcp-core/dist/get-issue-user-reports-DbOE_90E.js
19676
20543
  function getReporter(report) {
19677
20544
  const userId = report.user?.id?.trim();
19678
20545
  const userIdReporter = userId && !["none", "null"].includes(userId.toLowerCase()) ? `user:${userId}` : null;
@@ -23260,7 +24127,7 @@ function createAnthropic(options = {}) {
23260
24127
  var anthropic = createAnthropic();
23261
24128
 
23262
24129
  //#endregion
23263
- //#region ../mcp-core/dist/anthropic-provider-NqnQSpoe.js
24130
+ //#region ../mcp-core/dist/anthropic-provider--SUYBjgx.js
23264
24131
  const DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-5";
23265
24132
  let configuredBaseUrl$2;
23266
24133
  /**
@@ -27545,24 +28412,24 @@ function isResponseAnnotationAddedChunk(chunk) {
27545
28412
  function isErrorChunk(chunk) {
27546
28413
  return chunk.type === "error";
27547
28414
  }
27548
- function mapWebSearchOutput(action) {
28415
+ function mapWebSearchOutput(action$1) {
27549
28416
  var _a$4;
27550
- switch (action.type) {
28417
+ switch (action$1.type) {
27551
28418
  case "search": return {
27552
28419
  action: {
27553
28420
  type: "search",
27554
- query: (_a$4 = action.query) != null ? _a$4 : void 0
28421
+ query: (_a$4 = action$1.query) != null ? _a$4 : void 0
27555
28422
  },
27556
- ...action.sources != null && { sources: action.sources }
28423
+ ...action$1.sources != null && { sources: action$1.sources }
27557
28424
  };
27558
28425
  case "open_page": return { action: {
27559
28426
  type: "openPage",
27560
- url: action.url
28427
+ url: action$1.url
27561
28428
  } };
27562
28429
  case "find_in_page": return { action: {
27563
28430
  type: "findInPage",
27564
- url: action.url,
27565
- pattern: action.pattern
28431
+ url: action$1.url,
28432
+ pattern: action$1.pattern
27566
28433
  } };
27567
28434
  }
27568
28435
  }
@@ -27913,7 +28780,7 @@ function createOpenAI(options = {}) {
27913
28780
  var openai = createOpenAI();
27914
28781
 
27915
28782
  //#endregion
27916
- //#region ../mcp-core/dist/azure-openai-provider-BcsSfFBw.js
28783
+ //#region ../mcp-core/dist/azure-openai-provider-CKkQLwl5.js
27917
28784
  const DEFAULT_OPENAI_MODEL$1 = "gpt-5";
27918
28785
  let configuredBaseUrl$1;
27919
28786
  function setAzureOpenAIBaseUrl(baseUrl) {
@@ -27971,7 +28838,7 @@ function getAzureOpenAIModel(model) {
27971
28838
  }
27972
28839
 
27973
28840
  //#endregion
27974
- //#region ../mcp-core/dist/openai-provider-DNtIUzcM.js
28841
+ //#region ../mcp-core/dist/openai-provider-DnOTZd1E.js
27975
28842
  const DEFAULT_OPENAI_MODEL = "gpt-5";
27976
28843
  let configuredBaseUrl;
27977
28844
  /**
@@ -28011,7 +28878,7 @@ function getOpenAIModel(model) {
28011
28878
  }
28012
28879
 
28013
28880
  //#endregion
28014
- //#region ../mcp-core/dist/openrouter-provider-Bq38hmFY.js
28881
+ //#region ../mcp-core/dist/openrouter-provider-dumbTY12.js
28015
28882
  const DEFAULT_OPENROUTER_MODEL = "openai/gpt-5.6-luna";
28016
28883
  const DEFAULT_OPENROUTER_REASONING_EFFORT = "high";
28017
28884
  const OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1";
@@ -28063,7 +28930,7 @@ function getOpenRouterProviderOptions() {
28063
28930
  }
28064
28931
 
28065
28932
  //#endregion
28066
- //#region ../mcp-core/dist/provider-factory-BNDtCneN.js
28933
+ //#region ../mcp-core/dist/provider-factory-B9E4CNJm.js
28067
28934
  let configuredProvider;
28068
28935
  /**
28069
28936
  * Configure the embedded agent provider explicitly.
@@ -28208,7 +29075,7 @@ function getResolvedProviderType() {
28208
29075
  }
28209
29076
 
28210
29077
  //#endregion
28211
- //#region ../mcp-core/dist/resolve-region-url-DgkcX4pA.js
29078
+ //#region ../mcp-core/dist/resolve-region-url-CA9xj3fR.js
28212
29079
  const regionUrlCache = /* @__PURE__ */ new WeakMap();
28213
29080
  function getRegionUrlCache(context$1) {
28214
29081
  let cache = regionUrlCache.get(context$1);
@@ -28247,7 +29114,7 @@ async function resolveRegionUrlForOrganization({ context: context$1, organizatio
28247
29114
  }
28248
29115
 
28249
29116
  //#endregion
28250
- //#region ../mcp-core/dist/semantic-display-C9x4ir1O.js
29117
+ //#region ../mcp-core/dist/semantic-display-BDloW8Vy.js
28251
29118
  const SPAN_LABEL_MAX_LENGTH = 160;
28252
29119
  const SPAN_METADATA_MAX_LENGTH = 64;
28253
29120
  const SPAN_ATTRIBUTE_MAX_LENGTH = 2048;
@@ -28463,15 +29330,15 @@ function formatCloudEventsSpanDisplay(span, fallbackLabel) {
28463
29330
  };
28464
29331
  }
28465
29332
  function formatCicdSpanDisplay(span, fallbackLabel) {
28466
- const action = getSpanAttributeString(span, ["cicd.pipeline.action.name"]);
29333
+ const action$1 = getSpanAttributeString(span, ["cicd.pipeline.action.name"]);
28467
29334
  const pipeline = getSpanAttributeString(span, ["cicd.pipeline.name"]);
28468
29335
  const pipelineResult = getSpanAttributeString(span, ["cicd.pipeline.result"]);
28469
29336
  const taskName = getSpanAttributeString(span, ["cicd.pipeline.task.name"]);
28470
29337
  const taskResult = getSpanAttributeString(span, ["cicd.pipeline.task.run.result"]);
28471
29338
  const errorType = getErrorType(span);
28472
- if (!action && !pipeline && !pipelineResult && !taskName && !taskResult) return null;
29339
+ if (!action$1 && !pipeline && !pipelineResult && !taskName && !taskResult) return null;
28473
29340
  return {
28474
- label: joinDisplayParts([action, pipeline]) || taskName || fallbackLabel,
29341
+ label: joinDisplayParts([action$1, pipeline]) || taskName || fallbackLabel,
28475
29342
  metadata: compactStrings([
28476
29343
  pipelineResult,
28477
29344
  taskResult,
@@ -28635,7 +29502,7 @@ function formatDisplayPart(value, maxLength) {
28635
29502
  }
28636
29503
 
28637
29504
  //#endregion
28638
- //#region ../mcp-core/dist/get-trace-details-DIFsJzLU.js
29505
+ //#region ../mcp-core/dist/get-trace-details-g8zN4KSN.js
28639
29506
  const MAX_TRACE_FETCH_LIMIT = 1e3;
28640
29507
  const MAX_FOCUSED_TRACE_FETCH_LIMIT = 1e4;
28641
29508
  const MIN_TRACE_FETCH_LIMIT = 50;
@@ -29388,7 +30255,7 @@ function buildTraceNextSteps({ organizationSlug, traceId, spanFocused = false, e
29388
30255
  }
29389
30256
 
29390
30257
  //#endregion
29391
- //#region ../mcp-core/dist/get-span-details-CC9cxfpa.js
30258
+ //#region ../mcp-core/dist/get-span-details-DHgNG0pz.js
29392
30259
  var get_span_details_default = defineTool({
29393
30260
  name: "get_span_details",
29394
30261
  skills: ["inspect"],
@@ -29429,7 +30296,7 @@ var get_span_details_default = defineTool({
29429
30296
  });
29430
30297
 
29431
30298
  //#endregion
29432
- //#region ../mcp-core/dist/url-helpers-DtpSKjOI.js
30299
+ //#region ../mcp-core/dist/url-helpers-D2DDUGaY.js
29433
30300
  /**
29434
30301
  * Parses a Sentry URL and extracts resource type and identifiers.
29435
30302
  *
@@ -29692,7 +30559,7 @@ function isProfileUrl(url) {
29692
30559
  }
29693
30560
 
29694
30561
  //#endregion
29695
- //#region ../mcp-core/dist/get-replay-details-BM6gDmGp.js
30562
+ //#region ../mcp-core/dist/get-replay-details-BdTNeycJ.js
29696
30563
  const MAX_ACTIVITY_EVENTS = 6;
29697
30564
  const MAX_RELATED_ERRORS = 3;
29698
30565
  const MAX_RELATED_TRACES = 2;
@@ -30029,7 +30896,7 @@ function quoteDetail(value) {
30029
30896
  }
30030
30897
 
30031
30898
  //#endregion
30032
- //#region ../mcp-core/dist/get-event-attachment-LSEqrcub.js
30899
+ //#region ../mcp-core/dist/get-event-attachment-Do-iYoox.js
30033
30900
  function formatMegabytes(bytes) {
30034
30901
  return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
30035
30902
  }
@@ -30134,7 +31001,7 @@ var get_event_attachment_default = defineTool({
30134
31001
  const isEmpty = attachment.bytes.length === 0;
30135
31002
  if (isBinary && !isEmpty) {
30136
31003
  const isImage = effectiveMimeType.startsWith("image/");
30137
- const base64 = require_blob_utils_DgVug_Di.bytesToBase64(attachment.bytes);
31004
+ const base64 = require_blob_utils_B0ae0K_m.bytesToBase64(attachment.bytes);
30138
31005
  if (isImage) {
30139
31006
  const image = {
30140
31007
  type: "image",
@@ -30222,7 +31089,7 @@ var get_event_attachment_default = defineTool({
30222
31089
  });
30223
31090
 
30224
31091
  //#endregion
30225
- //#region ../mcp-core/dist/formatting-BG8yQUmg.js
31092
+ //#region ../mcp-core/dist/formatting-CLP0WPDy.js
30226
31093
  /**
30227
31094
  * Helper function to format assignedTo field for display
30228
31095
  */
@@ -30234,7 +31101,7 @@ function formatAssignedTo(assignedTo) {
30234
31101
  }
30235
31102
 
30236
31103
  //#endregion
30237
- //#region ../mcp-core/dist/update-issue-BH3fTM71.js
31104
+ //#region ../mcp-core/dist/update-issue-B7NEEemc.js
30238
31105
  function pluralize(value, noun) {
30239
31106
  return `${value} ${noun}${value === 1 ? "" : "s"}`;
30240
31107
  }
@@ -30643,7 +31510,7 @@ var update_issue_default = defineTool({
30643
31510
  });
30644
31511
 
30645
31512
  //#endregion
30646
- //#region ../mcp-core/dist/provider-fallback-B4jxYMQu.js
31513
+ //#region ../mcp-core/dist/provider-fallback-DdJOQofk.js
30647
31514
  /**
30648
31515
  * Run an optional embedded-agent rewrite and fall back to the caller's direct
30649
31516
  * behavior when the agent cannot complete the rewrite.
@@ -30683,7 +31550,7 @@ async function withProviderFallback({ operation, fallback, onFallback, run }) {
30683
31550
  }
30684
31551
 
30685
31552
  //#endregion
30686
- //#region ../mcp-core/dist/sentry-CcB-AERp.js
31553
+ //#region ../mcp-core/dist/sentry-B-6ys7Bw.js
30687
31554
  const SCRUB_PATTERNS = [
30688
31555
  {
30689
31556
  pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
@@ -30802,7 +31669,7 @@ function scrubSensitiveText(text$1) {
30802
31669
  }
30803
31670
 
30804
31671
  //#endregion
30805
- //#region ../mcp-core/dist/callEmbeddedAgent-DvwjAsbW.js
31672
+ //#region ../mcp-core/dist/callEmbeddedAgent-CN7-IYD9.js
30806
31673
  /**
30807
31674
  * Resolve the underlying provider failure from an AI SDK error.
30808
31675
  *
@@ -30997,7 +31864,7 @@ function rescueFromText(text$1, schema) {
30997
31864
  }
30998
31865
 
30999
31866
  //#endregion
31000
- //#region ../mcp-core/dist/utils-_7jC6e0y.js
31867
+ //#region ../mcp-core/dist/utils-DbOLEr0v.js
31001
31868
  /**
31002
31869
  * Standard response schema for all embedded agent tools.
31003
31870
  * Tools return either an error message or the result data, never both.
@@ -31116,7 +31983,7 @@ function agentTool(config) {
31116
31983
  }
31117
31984
 
31118
31985
  //#endregion
31119
- //#region ../mcp-core/dist/dataset-fields-nUaj8nt3.js
31986
+ //#region ../mcp-core/dist/dataset-fields-BLSn5y5v.js
31120
31987
  const REPLAY_EXCLUDED_TAGS = new Set([
31121
31988
  "browser",
31122
31989
  "device",
@@ -31615,7 +32482,7 @@ function getReplayCommonPatterns(availableFields) {
31615
32482
  }
31616
32483
 
31617
32484
  //#endregion
31618
- //#region ../mcp-core/dist/otel-semantics-D9c5D-bO.js
32485
+ //#region ../mcp-core/dist/otel-semantics-DJJCl9iN.js
31619
32486
  var namespace$72 = "android";
31620
32487
  var description$72 = "The Android platform on which the Android application is running.\n";
31621
32488
  var attributes$72 = {
@@ -36637,7 +37504,7 @@ function createOtelLookupTool(options) {
36637
37504
  }
36638
37505
 
36639
37506
  //#endregion
36640
- //#region ../mcp-core/dist/whoami-B81Oqo48.js
37507
+ //#region ../mcp-core/dist/whoami-DQvnv4Cu.js
36641
37508
  /**
36642
37509
  * Get the current authenticated user's information from Sentry API
36643
37510
  */
@@ -36666,7 +37533,7 @@ function createWhoamiTool(options) {
36666
37533
  }
36667
37534
 
36668
37535
  //#endregion
36669
- //#region ../mcp-core/dist/utils-DNoGJro2.js
37536
+ //#region ../mcp-core/dist/utils-C8th2C0P.js
36670
37537
  const DEFAULT_MAX_VALUE_LENGTH = 200;
36671
37538
  const DEFAULT_MAX_ARRAY_ITEMS = 20;
36672
37539
  const SENTRY_SEARCH_TOKEN_PATTERN = /(^|\s)!?([A-Za-z_][A-Za-z0-9_.[\],-]*):(?=\S)(?!\/\/)/g;
@@ -37127,7 +37994,7 @@ function createDatasetAttributesTool(options) {
37127
37994
  attributeTypes: zod.z.array(traceItemAttributeTypeSchema).min(1).optional().describe("Optional attribute types to list. Use ['string','number','boolean'] when unsure.")
37128
37995
  }),
37129
37996
  execute: async ({ dataset, substringMatch, query, attributeTypes }) => {
37130
- const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await Promise.resolve().then(() => require("./config-DRWtJff1.cjs"));
37997
+ const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await Promise.resolve().then(() => require("./config-DeGbV11k.cjs"));
37131
37998
  const normalizedDataset = require_constants.normalizeEventsDataset(dataset);
37132
37999
  const attributeTimeParams = { statsPeriod: "14d" };
37133
38000
  const { attributes: customAttributes, fieldTypes } = await fetchCustomAttributes(apiService, organizationSlug, dataset, projectId, attributeTimeParams, {
@@ -37217,7 +38084,7 @@ function createValidateEventsSearchTool(options) {
37217
38084
  }
37218
38085
 
37219
38086
  //#endregion
37220
- //#region ../mcp-core/dist/agent-D-RH-_8n.js
38087
+ //#region ../mcp-core/dist/agent-lnW45bNS.js
37221
38088
  const SEARCH_EVENTS_DATASETS$1 = [...require_constants.PUBLIC_EVENTS_DATASETS, "replays"];
37222
38089
  const searchEventsAgentOutputSchema = zod.z.object({
37223
38090
  dataset: zod.z.enum(SEARCH_EVENTS_DATASETS$1).describe("Which dataset to use for the query"),
@@ -37307,7 +38174,7 @@ async function searchEventsAgent(options) {
37307
38174
  const whoamiTool = createWhoamiTool({ apiService: options.apiService });
37308
38175
  const environmentNames = options.environmentNames ?? await fetchEnvironmentNames(options);
37309
38176
  return await callEmbeddedAgent({
37310
- system: buildSystemPromptWithEnvironments(require_config_B_l88mOS.systemPrompt, environmentNames),
38177
+ system: buildSystemPromptWithEnvironments(require_config_40SaJWzQ.systemPrompt, environmentNames),
37311
38178
  prompt: options.query,
37312
38179
  tools: {
37313
38180
  datasetAttributes: datasetAttributesTool,
@@ -37321,7 +38188,7 @@ async function searchEventsAgent(options) {
37321
38188
  }
37322
38189
 
37323
38190
  //#endregion
37324
- //#region ../mcp-core/dist/analyzer-BuS9K0e5.js
38191
+ //#region ../mcp-core/dist/analyzer-DTPOg7sk.js
37325
38192
  /**
37326
38193
  * Analyzes flamegraph data to extract hot paths (most CPU-intensive call stacks).
37327
38194
  *
@@ -37580,7 +38447,7 @@ function hasProfileData(flamegraph) {
37580
38447
  }
37581
38448
 
37582
38449
  //#endregion
37583
- //#region ../mcp-core/dist/formatters-DsABISrU.js
38450
+ //#region ../mcp-core/dist/formatters-URITEr9v.js
37584
38451
  /**
37585
38452
  * Format an explanation for how the input query was translated
37586
38453
  */
@@ -38085,7 +38952,7 @@ function formatTimeSeriesResults(params) {
38085
38952
  }
38086
38953
 
38087
38954
  //#endregion
38088
- //#region ../mcp-core/dist/replays-DQeYjWub.js
38955
+ //#region ../mcp-core/dist/replays-c2P32g8H.js
38089
38956
  const DEFAULT_REPLAY_SORT = "-started_at";
38090
38957
  const DEFAULT_REPLAY_STATS_PERIOD = "14d";
38091
38958
  const REPLAY_SORT_FIELDS = [
@@ -38210,14 +39077,14 @@ function formatReplayEnvironment(environment) {
38210
39077
  }
38211
39078
 
38212
39079
  //#endregion
38213
- //#region ../mcp-core/dist/search-events-BFGK2Xtv.js
39080
+ //#region ../mcp-core/dist/search-events-BwinOa9_.js
38214
39081
  const SEARCH_EVENTS_DATASETS = [...require_constants.PUBLIC_EVENTS_DATASETS, "replays"];
38215
39082
  const DEFAULT_EVENTS_SORT = "-timestamp";
38216
39083
  function defaultSortForDataset(dataset) {
38217
39084
  return dataset === "replays" ? DEFAULT_REPLAY_SORT : DEFAULT_EVENTS_SORT;
38218
39085
  }
38219
39086
  function defaultFieldsForDataset(dataset) {
38220
- return require_config_B_l88mOS.RECOMMENDED_FIELDS[require_constants.normalizeEventsDataset(dataset)].basic;
39087
+ return require_config_40SaJWzQ.RECOMMENDED_FIELDS[require_constants.normalizeEventsDataset(dataset)].basic;
38221
39088
  }
38222
39089
  function resolveEventFields({ dataset, explicitFields, agentFields, trustExplicitFields }) {
38223
39090
  if (trustExplicitFields && explicitFields && explicitFields.length > 0) return explicitFields;
@@ -38240,7 +39107,7 @@ function augmentFieldsWithSort(fields, sort) {
38240
39107
  return fields;
38241
39108
  }
38242
39109
  function buildRequestFields(dataset, fields) {
38243
- return dataset !== "replays" && require_constants.isMetricsDataset(dataset) && !isAggregateQuery(fields) ? Array.from(new Set([...fields, ...require_config_B_l88mOS.TRACE_METRICS_SAMPLE_IDENTITY_FIELDS])) : fields;
39110
+ return dataset !== "replays" && require_constants.isMetricsDataset(dataset) && !isAggregateQuery(fields) ? Array.from(new Set([...fields, ...require_config_40SaJWzQ.TRACE_METRICS_SAMPLE_IDENTITY_FIELDS])) : fields;
38244
39111
  }
38245
39112
  function isTraceItemDataset(dataset) {
38246
39113
  return dataset === "spans" || dataset === "logs" || dataset === "metrics";
@@ -38708,7 +39575,7 @@ var search_events_default = defineTool({
38708
39575
  });
38709
39576
 
38710
39577
  //#endregion
38711
- //#region ../mcp-core/dist/create-team-CgnBfkV1.js
39578
+ //#region ../mcp-core/dist/create-team-DwS01236.js
38712
39579
  const createTeamOutputSchema = zod.z.object({ team: zod.z.object({
38713
39580
  id: zod.z.string(),
38714
39581
  slug: zod.z.string(),
@@ -38767,7 +39634,7 @@ var create_team_default = defineTool({
38767
39634
  });
38768
39635
 
38769
39636
  //#endregion
38770
- //#region ../mcp-core/dist/create-project-BHO4uN-y.js
39637
+ //#region ../mcp-core/dist/create-project-05c6zbZ5.js
38771
39638
  function getUsableClientKey(clientKeys) {
38772
39639
  return clientKeys.find((key) => key.name === "Default" && key.isActive && key.dsn.public) ?? clientKeys.find((key) => key.isActive && key.dsn.public);
38773
39640
  }
@@ -38923,7 +39790,7 @@ var create_project_default = defineTool({
38923
39790
  });
38924
39791
 
38925
39792
  //#endregion
38926
- //#region ../mcp-core/dist/update-project-CQdb0Elv.js
39793
+ //#region ../mcp-core/dist/update-project-BRCGh4Aa.js
38927
39794
  const updateProjectOutputSchema = zod.z.object({ project: zod.z.object({
38928
39795
  id: zod.z.string(),
38929
39796
  slug: zod.z.string(),
@@ -38999,6 +39866,7 @@ var update_project_default = defineTool({
38999
39866
  platform: params.platform
39000
39867
  });
39001
39868
  } catch (err) {
39869
+ if (err instanceof ApiClientError) throw err;
39002
39870
  logIssue(err);
39003
39871
  throw new Error(`Failed to update project ${params.projectSlug}: ${err instanceof Error ? err.message : "Unknown error"}`, { cause: err });
39004
39872
  }
@@ -39012,7 +39880,7 @@ var update_project_default = defineTool({
39012
39880
  });
39013
39881
 
39014
39882
  //#endregion
39015
- //#region ../mcp-core/dist/add-team-to-project-CNjkc5mL.js
39883
+ //#region ../mcp-core/dist/add-team-to-project-2VzT50yY.js
39016
39884
  const assignedTeamSchema$1 = zod.z.object({
39017
39885
  id: zod.z.string(),
39018
39886
  slug: zod.z.string(),
@@ -39099,7 +39967,7 @@ var add_team_to_project_default = defineTool({
39099
39967
  });
39100
39968
 
39101
39969
  //#endregion
39102
- //#region ../mcp-core/dist/remove-team-from-project-CM2_RkK5.js
39970
+ //#region ../mcp-core/dist/remove-team-from-project-B5ujAYRT.js
39103
39971
  const assignedTeamSchema = zod.z.object({
39104
39972
  id: zod.z.string(),
39105
39973
  slug: zod.z.string(),
@@ -39185,7 +40053,7 @@ var remove_team_from_project_default = defineTool({
39185
40053
  });
39186
40054
 
39187
40055
  //#endregion
39188
- //#region ../mcp-core/dist/create-dsn-BtFKEMq7.js
40056
+ //#region ../mcp-core/dist/create-dsn-ZV3Yg_GU.js
39189
40057
  const createDsnOutputSchema = zod.z.object({ dsn: zod.z.object({
39190
40058
  id: zod.z.string(),
39191
40059
  name: zod.z.string(),
@@ -39250,7 +40118,7 @@ var create_dsn_default = defineTool({
39250
40118
  });
39251
40119
 
39252
40120
  //#endregion
39253
- //#region ../mcp-core/dist/find-dsns-CqiIxv7u.js
40121
+ //#region ../mcp-core/dist/find-dsns-DoBoWSvp.js
39254
40122
  const findDsnsOutputSchema = zod.z.object({ dsns: zod.z.array(zod.z.object({
39255
40123
  id: zod.z.string(),
39256
40124
  name: zod.z.string(),
@@ -39300,7 +40168,7 @@ var find_dsns_default = defineTool({
39300
40168
  });
39301
40169
 
39302
40170
  //#endregion
39303
- //#region ../mcp-core/dist/update-dsn-DP7ljBh8.js
40171
+ //#region ../mcp-core/dist/update-dsn-Dym3_7M_.js
39304
40172
  var update_dsn_default = defineTool({
39305
40173
  name: "update_dsn",
39306
40174
  skills: ["project-management"],
@@ -39434,7 +40302,7 @@ var update_dsn_default = defineTool({
39434
40302
  });
39435
40303
 
39436
40304
  //#endregion
39437
- //#region ../mcp-core/dist/analyze-issue-with-seer-Bh4zPWGl.js
40305
+ //#region ../mcp-core/dist/analyze-issue-with-seer-8DghOZ5F.js
39438
40306
  var analyze_issue_with_seer_default = defineTool({
39439
40307
  name: "analyze_issue_with_seer",
39440
40308
  skills: ["seer"],
@@ -39623,7 +40491,7 @@ var analyze_issue_with_seer_default = defineTool({
39623
40491
  });
39624
40492
 
39625
40493
  //#endregion
39626
- //#region ../mcp-core/dist/search-docs-Tj5IpQIk.js
40494
+ //#region ../mcp-core/dist/search-docs-CZh-QUFq.js
39627
40495
  var search_docs_default = defineTool({
39628
40496
  name: "search_docs",
39629
40497
  skills: ["inspect", "docs"],
@@ -39720,7 +40588,7 @@ var search_docs_default = defineTool({
39720
40588
  });
39721
40589
 
39722
40590
  //#endregion
39723
- //#region ../mcp-core/dist/get-doc-D-DZcOOW.js
40591
+ //#region ../mcp-core/dist/get-doc-DPW8F2PA.js
39724
40592
  var get_doc_default = defineTool({
39725
40593
  name: "get_doc",
39726
40594
  skills: ["inspect", "docs"],
@@ -39798,7 +40666,7 @@ var get_doc_default = defineTool({
39798
40666
  });
39799
40667
 
39800
40668
  //#endregion
39801
- //#region ../mcp-core/dist/config-CCjTO4AY.js
40669
+ //#region ../mcp-core/dist/config-BrGCkvH1.js
39802
40670
  /**
39803
40671
  * Configuration for the search-issues agent
39804
40672
  */
@@ -39895,7 +40763,7 @@ Use issueFields only when a requested field is not in the built-in fields list.
39895
40763
  Use whoami only for natural-language me references.`;
39896
40764
 
39897
40765
  //#endregion
39898
- //#region ../mcp-core/dist/agent-DyOsplyJ.js
40766
+ //#region ../mcp-core/dist/agent-Yf6hHfCo.js
39899
40767
  const searchIssuesAgentOutputSchema = zod.z.object({
39900
40768
  query: zod.z.string().describe("The Sentry issue search query"),
39901
40769
  sort: zod.z.enum([
@@ -39929,7 +40797,7 @@ async function searchIssuesAgent(options) {
39929
40797
  }
39930
40798
 
39931
40799
  //#endregion
39932
- //#region ../mcp-core/dist/formatters-CZbnEl5Q.js
40800
+ //#region ../mcp-core/dist/formatters-Br98r9MZ.js
39933
40801
  /**
39934
40802
  * Format an explanation for how the input query was translated
39935
40803
  */
@@ -40023,7 +40891,7 @@ function formatDate$1(dateString) {
40023
40891
  }
40024
40892
 
40025
40893
  //#endregion
40026
- //#region ../mcp-core/dist/search-issues-lbSTiP3S.js
40894
+ //#region ../mcp-core/dist/search-issues-CVTy2EU1.js
40027
40895
  const ProjectSlugOrIdSchema = zod.z.string().trim().superRefine(validateSlugOrId);
40028
40896
  function buildIssueSearchRepairPrompt(params) {
40029
40897
  return [
@@ -40203,7 +41071,7 @@ var search_issues_default = defineTool({
40203
41071
  });
40204
41072
 
40205
41073
  //#endregion
40206
- //#region ../mcp-core/dist/config-Nif76Shh.js
41074
+ //#region ../mcp-core/dist/config-BAf0GIjB.js
40207
41075
  const systemPrompt$1 = `You are a Sentry issue event filter translator. Your job is to:
40208
41076
  1. Translate natural language queries into Sentry tag filters for events within a SPECIFIC issue
40209
41077
  2. Select appropriate fields to return in the results
@@ -40536,7 +41404,7 @@ const EXAMPLE_QUERIES = [
40536
41404
  ];
40537
41405
 
40538
41406
  //#endregion
40539
- //#region ../mcp-core/dist/utils-DeCBYEnS.js
41407
+ //#region ../mcp-core/dist/utils-BwSqp7q3.js
40540
41408
  /**
40541
41409
  * Create a tool for the agent to query available tags and fields for issue events
40542
41410
  * The tool is pre-bound with the API service and organization configured for the appropriate region
@@ -40619,7 +41487,7 @@ Received: ${params.issueUrl}`);
40619
41487
  }
40620
41488
 
40621
41489
  //#endregion
40622
- //#region ../mcp-core/dist/agent-DTdycAuW.js
41490
+ //#region ../mcp-core/dist/agent-CUQW9K0A.js
40623
41491
  const searchIssueEventsAgentOutputSchema = zod.z.object({
40624
41492
  query: zod.z.string().describe("Sentry query filters for tags/fields (NOT including issue: prefix - handler adds that)"),
40625
41493
  fields: zod.z.array(zod.z.string()).describe("Array of field names to return in results"),
@@ -40661,7 +41529,7 @@ async function searchIssueEventsAgent(options) {
40661
41529
  }
40662
41530
 
40663
41531
  //#endregion
40664
- //#region ../mcp-core/dist/search-issue-events-Ck9S6CNC.js
41532
+ //#region ../mcp-core/dist/search-issue-events-Cpqmc9WI.js
40665
41533
  function buildIssueEventSearchRepairPrompt(params) {
40666
41534
  return [
40667
41535
  "Fix this Sentry issue event search request.",
@@ -40814,7 +41682,7 @@ var search_issue_events_default = defineTool({
40814
41682
  });
40815
41683
 
40816
41684
  //#endregion
40817
- //#region ../mcp-core/dist/formatter-ffKOVbDF.js
41685
+ //#region ../mcp-core/dist/formatter-CoaUL0l7.js
40818
41686
  /**
40819
41687
  * Maps a change type to its corresponding status icon.
40820
41688
  */
@@ -41190,7 +42058,7 @@ function formatSdkSummary(profile) {
41190
42058
  }
41191
42059
 
41192
42060
  //#endregion
41193
- //#region ../mcp-core/dist/get-profile-4EwZiRri.js
42061
+ //#region ../mcp-core/dist/get-profile-N5qcVpaX.js
41194
42062
  /**
41195
42063
  * Resolves profile parameters from URL or explicit params.
41196
42064
  * URL takes precedence if provided and valid.
@@ -41408,7 +42276,7 @@ var get_profile_default = defineTool({
41408
42276
  });
41409
42277
 
41410
42278
  //#endregion
41411
- //#region ../mcp-core/dist/get-profile-details-KNM3CXky.js
42279
+ //#region ../mcp-core/dist/get-profile-details-BET4anQH.js
41412
42280
  function resolveProfileDetailsParams(params) {
41413
42281
  if (params.profileUrl) {
41414
42282
  if (!isProfileUrl(params.profileUrl)) throw new UserInputError("Invalid profile URL. URL must point to a Sentry profile resource.");
@@ -41636,7 +42504,7 @@ var get_profile_details_default = defineTool({
41636
42504
  });
41637
42505
 
41638
42506
  //#endregion
41639
- //#region ../mcp-core/dist/get-agent-conversation-details-bM0VVNAG.js
42507
+ //#region ../mcp-core/dist/get-agent-conversation-details-DNjjSdLo.js
41640
42508
  function withoutUndefined(value) {
41641
42509
  return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0));
41642
42510
  }
@@ -42052,7 +42920,7 @@ var get_agent_conversation_details_default = defineTool({
42052
42920
  });
42053
42921
 
42054
42922
  //#endregion
42055
- //#region ../mcp-core/dist/formatting-B1ckR5H7.js
42923
+ //#region ../mcp-core/dist/formatting-DeMPfsp0.js
42056
42924
  function getSnapshotImageDisplayName(img) {
42057
42925
  return img.display_name || img.image_file_name || "unknown";
42058
42926
  }
@@ -42146,7 +43014,7 @@ function isPlainObject$2(value) {
42146
43014
  }
42147
43015
 
42148
43016
  //#endregion
42149
- //#region ../mcp-core/dist/handlers-DhPeWak0.js
43017
+ //#region ../mcp-core/dist/handlers-CqW5tNuO.js
42150
43018
  function fullResolutionHint({ organizationSlug, snapshotId, imageIdentifier, experimentalMode, availableToolNames, directToolNames }) {
42151
43019
  return `- **Full Resolution**: ${formatToolCallInstruction({
42152
43020
  toolName: "get_snapshot_image",
@@ -42201,7 +43069,7 @@ function formatImageMetadata(img) {
42201
43069
  }
42202
43070
  async function createPreviewOrNull(blob, contentType) {
42203
43071
  try {
42204
- return await require_blob_utils_DgVug_Di.createImagePreview(blob, contentType);
43072
+ return await require_blob_utils_B0ae0K_m.createImagePreview(blob, contentType);
42205
43073
  } catch {
42206
43074
  return null;
42207
43075
  }
@@ -42222,7 +43090,7 @@ async function fetchAndAppendImage(apiService, imageUrl, label, imageResolution,
42222
43090
  });
42223
43091
  parts.push({
42224
43092
  type: "image",
42225
- data: await require_blob_utils_DgVug_Di.blobToBase64(blob),
43093
+ data: await require_blob_utils_B0ae0K_m.blobToBase64(blob),
42226
43094
  mimeType: contentType
42227
43095
  });
42228
43096
  return;
@@ -42241,7 +43109,7 @@ async function fetchAndAppendImage(apiService, imageUrl, label, imageResolution,
42241
43109
  });
42242
43110
  parts.push({
42243
43111
  type: "image",
42244
- data: await require_blob_utils_DgVug_Di.blobToBase64(preview.blob),
43112
+ data: await require_blob_utils_B0ae0K_m.blobToBase64(preview.blob),
42245
43113
  mimeType: preview.contentType
42246
43114
  });
42247
43115
  }
@@ -42412,7 +43280,7 @@ async function fetchSnapshotSummary(apiService, organizationSlug, snapshotId, so
42412
43280
  }
42413
43281
 
42414
43282
  //#endregion
42415
- //#region ../mcp-core/dist/get-snapshot-P1FuvUwa.js
43283
+ //#region ../mcp-core/dist/get-snapshot-C4WOsWq5.js
42416
43284
  var get_snapshot_default = defineTool({
42417
43285
  name: "get_snapshot",
42418
43286
  skills: ["inspect"],
@@ -42490,7 +43358,7 @@ var get_snapshot_default = defineTool({
42490
43358
  });
42491
43359
 
42492
43360
  //#endregion
42493
- //#region ../mcp-core/dist/get-snapshot-image-DjtwEpMj.js
43361
+ //#region ../mcp-core/dist/get-snapshot-image-hLQpyN5Q.js
42494
43362
  var get_snapshot_image_default = defineTool({
42495
43363
  name: "get_snapshot_image",
42496
43364
  skills: ["inspect"],
@@ -42551,7 +43419,7 @@ var get_snapshot_image_default = defineTool({
42551
43419
  });
42552
43420
 
42553
43421
  //#endregion
42554
- //#region ../mcp-core/dist/get-sentry-resource-BXVp2SKN.js
43422
+ //#region ../mcp-core/dist/get-sentry-resource-BL4xny06.js
42555
43423
  /** Types with full API integration. */
42556
43424
  const FULLY_SUPPORTED_TYPES = [
42557
43425
  "issue",
@@ -42939,7 +43807,7 @@ var get_sentry_resource_default = defineTool({
42939
43807
  });
42940
43808
 
42941
43809
  //#endregion
42942
- //#region ../mcp-core/dist/get-latest-base-snapshot-CEkWKEZJ.js
43810
+ //#region ../mcp-core/dist/get-latest-base-snapshot-AuY1Du2x.js
42943
43811
  var get_latest_base_snapshot_default = defineTool({
42944
43812
  name: "get_latest_base_snapshot",
42945
43813
  skills: ["inspect"],
@@ -43035,7 +43903,7 @@ var get_latest_base_snapshot_default = defineTool({
43035
43903
  });
43036
43904
 
43037
43905
  //#endregion
43038
- //#region ../mcp-core/dist/search-agent-conversations-BGO_38e-.js
43906
+ //#region ../mcp-core/dist/search-agent-conversations-Bry9ErI6.js
43039
43907
  const PREVIEW_LENGTH = 240;
43040
43908
  const TRACE_ID_SAMPLE_SIZE = 3;
43041
43909
  const usdFormatter = new Intl.NumberFormat("en-US", {
@@ -43225,7 +44093,7 @@ var search_agent_conversations_default = defineTool({
43225
44093
  });
43226
44094
 
43227
44095
  //#endregion
43228
- //#region ../mcp-core/dist/add-issue-note-YI_XzMvf.js
44096
+ //#region ../mcp-core/dist/add-issue-note-BYMSMlk0.js
43229
44097
  function formatComment(comment) {
43230
44098
  const actor = comment.user ? formatActor(comment.user) : "current user";
43231
44099
  const text$1 = comment.data ? readString(comment.data, "text") : null;
@@ -43301,7 +44169,7 @@ var add_issue_note_default = defineTool({
43301
44169
  });
43302
44170
 
43303
44171
  //#endregion
43304
- //#region ../mcp-core/dist/onboarding-status-update-BJR7w05r.js
44172
+ //#region ../mcp-core/dist/onboarding-status-update-BxV4YFti.js
43305
44173
  const updateBaseSchema = zod.z.object({
43306
44174
  status: AgenticOnboardingStageStatusUpdateSchema.describe("The stage's current status."),
43307
44175
  runStatus: AgenticOnboardingRunStatusUpdateSchema.optional().describe("Set only when the entire onboarding run has completed or failed."),
@@ -43369,7 +44237,7 @@ var onboarding_status_update_default = defineTool({
43369
44237
  });
43370
44238
 
43371
44239
  //#endregion
43372
- //#region ../mcp-core/dist/catalog-CZAR_B3F.js
44240
+ //#region ../mcp-core/dist/catalog-nksfG2jJ.js
43373
44241
  const legacyGetAIConversationDetails = {
43374
44242
  ...get_agent_conversation_details_default,
43375
44243
  name: "get_ai_conversation_details",
@@ -43412,12 +44280,20 @@ const catalogTools = {
43412
44280
  get_monitor_details: get_monitor_details_default,
43413
44281
  find_uptime_monitors: find_uptime_monitors_default,
43414
44282
  get_uptime_monitor_details: get_uptime_monitor_details_default,
44283
+ find_metric_monitors: find_metric_monitors_default,
44284
+ get_metric_monitor_details: get_metric_monitor_details_default,
44285
+ create_metric_monitor: create_metric_monitor_default,
44286
+ update_metric_monitor: update_metric_monitor_default,
44287
+ delete_metric_monitor: delete_metric_monitor_default,
43415
44288
  create_uptime_monitor: create_uptime_monitor_default,
43416
44289
  update_uptime_monitor: update_uptime_monitor_default,
43417
44290
  delete_uptime_monitor: delete_uptime_monitor_default,
43418
44291
  find_alert_rules: find_alert_rules_default,
43419
44292
  get_alert_rule: get_alert_rule_default,
43420
44293
  get_alert_options: get_alert_options_default,
44294
+ update_alert_rule: update_alert_rule_default,
44295
+ create_alert_rule: create_alert_rule_default,
44296
+ delete_alert_rule: delete_alert_rule_default,
43421
44297
  get_issue_details: get_issue_details_default,
43422
44298
  get_event_stacktrace: get_event_stacktrace_default,
43423
44299
  get_issue_activity: get_issue_activity_default,
@@ -43460,7 +44336,7 @@ const catalogTools = {
43460
44336
  var catalog_default = catalogTools;
43461
44337
 
43462
44338
  //#endregion
43463
- //#region ../mcp-core/dist/schema-Bf6vaXky.js
44339
+ //#region ../mcp-core/dist/schema-lxCqP5_R.js
43464
44340
  function zodFieldMapToJsonSchema(fieldMap) {
43465
44341
  const zodObject = Object.keys(fieldMap).length > 0 ? zod.z.object(fieldMap) : zod.z.object({});
43466
44342
  const { $schema: _,...jsonSchema$1 } = zod.z.toJSONSchema(zodObject, {
@@ -43472,7 +44348,7 @@ function zodFieldMapToJsonSchema(fieldMap) {
43472
44348
  }
43473
44349
 
43474
44350
  //#endregion
43475
- //#region ../mcp-core/dist/search--TO414uy.js
44351
+ //#region ../mcp-core/dist/search-DQYTHTRw.js
43476
44352
  function tokenize(value) {
43477
44353
  return value.toLowerCase().split(/[^a-z0-9_]+/).map((token) => token.trim()).filter(Boolean);
43478
44354
  }
@@ -43523,7 +44399,7 @@ function searchToolCatalog({ tools, context: context$1, query, limit }) {
43523
44399
  }
43524
44400
 
43525
44401
  //#endregion
43526
- //#region ../mcp-core/dist/search-tools-DD_Fpn20.js
44402
+ //#region ../mcp-core/dist/search-tools-HGLF7OhR.js
43527
44403
  const DEFAULT_LIMIT = 8;
43528
44404
  const MAX_LIMIT = 20;
43529
44405
  const toolAnnotationsOutputSchema = zod.z.object({
@@ -43605,7 +44481,7 @@ function createSearchToolsTool(getTools) {
43605
44481
  }
43606
44482
 
43607
44483
  //#endregion
43608
- //#region ../mcp-core/dist/execute-tool-Z6g9XYm0.js
44484
+ //#region ../mcp-core/dist/execute-tool-CsdhgdEx.js
43609
44485
  function setToolArgumentAttributes(span, params) {
43610
44486
  for (const [key, value] of Object.entries(params)) {
43611
44487
  const attributeValue = value == null || typeof value === "object" ? JSON.stringify(value) : value;
@@ -43690,7 +44566,7 @@ function createExecuteTool(getTools) {
43690
44566
  }
43691
44567
 
43692
44568
  //#endregion
43693
- //#region ../mcp-core/dist/tools-EVTUbO4b.js
44569
+ //#region ../mcp-core/dist/tools-C-IV5AvU.js
43694
44570
  function getAllTools() {
43695
44571
  return allTools;
43696
44572
  }
@@ -52187,9 +53063,9 @@ var require_codegen = /* @__PURE__ */ __commonJSMin((exports$1) => {
52187
53063
  var Else = class extends BlockNode {};
52188
53064
  Else.kind = "else";
52189
53065
  var If = class If$1 extends BlockNode {
52190
- constructor(condition, nodes) {
53066
+ constructor(condition$1, nodes) {
52191
53067
  super(nodes);
52192
- this.condition = condition;
53068
+ this.condition = condition$1;
52193
53069
  }
52194
53070
  render(opts) {
52195
53071
  let code = `if(${this.condition})` + super.render(opts);
@@ -52421,15 +53297,15 @@ var require_codegen = /* @__PURE__ */ __commonJSMin((exports$1) => {
52421
53297
  code.push("}");
52422
53298
  return new code_1._Code(code);
52423
53299
  }
52424
- if(condition, thenBody, elseBody) {
52425
- this._blockNode(new If(condition));
53300
+ if(condition$1, thenBody, elseBody) {
53301
+ this._blockNode(new If(condition$1));
52426
53302
  if (thenBody && elseBody) this.code(thenBody).else().code(elseBody).endIf();
52427
53303
  else if (thenBody) this.code(thenBody).endIf();
52428
53304
  else if (elseBody) throw new Error("CodeGen: \"else\" body without \"then\" body");
52429
53305
  return this;
52430
53306
  }
52431
- elseIf(condition) {
52432
- return this._elseNode(new If(condition));
53307
+ elseIf(condition$1) {
53308
+ return this._elseNode(new If(condition$1));
52433
53309
  }
52434
53310
  else() {
52435
53311
  return this._elseNode(new Else());
@@ -53163,9 +54039,9 @@ var require_defaults = /* @__PURE__ */ __commonJSMin((exports$1) => {
53163
54039
  (0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`);
53164
54040
  return;
53165
54041
  }
53166
- let condition = (0, codegen_1._)`${childData} === undefined`;
53167
- if (opts.useDefaults === "empty") condition = (0, codegen_1._)`${condition} || ${childData} === null || ${childData} === ""`;
53168
- gen.if(condition, (0, codegen_1._)`${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);
54042
+ let condition$1 = (0, codegen_1._)`${childData} === undefined`;
54043
+ if (opts.useDefaults === "empty") condition$1 = (0, codegen_1._)`${condition$1} || ${childData} === null || ${childData} === ""`;
54044
+ gen.if(condition$1, (0, codegen_1._)`${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);
53169
54045
  }
53170
54046
  });
53171
54047
  var require_code = /* @__PURE__ */ __commonJSMin((exports$1) => {
@@ -53934,11 +54810,11 @@ var require_validate = /* @__PURE__ */ __commonJSMin((exports$1) => {
53934
54810
  }
53935
54811
  if ("code" in def ? def.trackErrors : def.errors !== false) this.errsCount = it.gen.const("_errs", names_1.default.errors);
53936
54812
  }
53937
- result(condition, successAction, failAction) {
53938
- this.failResult((0, codegen_1.not)(condition), successAction, failAction);
54813
+ result(condition$1, successAction, failAction) {
54814
+ this.failResult((0, codegen_1.not)(condition$1), successAction, failAction);
53939
54815
  }
53940
- failResult(condition, successAction, failAction) {
53941
- this.gen.if(condition);
54816
+ failResult(condition$1, successAction, failAction) {
54817
+ this.gen.if(condition$1);
53942
54818
  if (failAction) failAction();
53943
54819
  else this.error();
53944
54820
  if (successAction) {
@@ -53948,24 +54824,24 @@ var require_validate = /* @__PURE__ */ __commonJSMin((exports$1) => {
53948
54824
  } else if (this.allErrors) this.gen.endIf();
53949
54825
  else this.gen.else();
53950
54826
  }
53951
- pass(condition, failAction) {
53952
- this.failResult((0, codegen_1.not)(condition), void 0, failAction);
54827
+ pass(condition$1, failAction) {
54828
+ this.failResult((0, codegen_1.not)(condition$1), void 0, failAction);
53953
54829
  }
53954
- fail(condition) {
53955
- if (condition === void 0) {
54830
+ fail(condition$1) {
54831
+ if (condition$1 === void 0) {
53956
54832
  this.error();
53957
54833
  if (!this.allErrors) this.gen.if(false);
53958
54834
  return;
53959
54835
  }
53960
- this.gen.if(condition);
54836
+ this.gen.if(condition$1);
53961
54837
  this.error();
53962
54838
  if (this.allErrors) this.gen.endIf();
53963
54839
  else this.gen.else();
53964
54840
  }
53965
- fail$data(condition) {
53966
- if (!this.$data) return this.fail(condition);
54841
+ fail$data(condition$1) {
54842
+ if (!this.$data) return this.fail(condition$1);
53967
54843
  const { schemaCode } = this;
53968
- this.fail((0, codegen_1._)`${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`);
54844
+ this.fail((0, codegen_1._)`${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition$1)})`);
53969
54845
  }
53970
54846
  error(append, errorParams, errorPaths) {
53971
54847
  if (errorParams) {