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