@sentry/mcp-server 0.30.0 → 0.32.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 (136) hide show
  1. package/dist/auth/constants.cjs +9 -0
  2. package/dist/auth/constants.d.cts +31 -0
  3. package/dist/auth/constants.d.cts.map +1 -0
  4. package/dist/auth/constants.d.ts +31 -0
  5. package/dist/auth/constants.d.ts.map +1 -0
  6. package/dist/auth/constants.js +3 -0
  7. package/dist/auth/device-code-flow.cjs +10 -0
  8. package/dist/auth/device-code-flow.d.cts +34 -0
  9. package/dist/auth/device-code-flow.d.cts.map +1 -0
  10. package/dist/auth/device-code-flow.d.ts +34 -0
  11. package/dist/auth/device-code-flow.d.ts.map +1 -0
  12. package/dist/auth/device-code-flow.js +6 -0
  13. package/dist/auth/resolve-token.cjs +8 -0
  14. package/dist/auth/resolve-token.d.cts +17 -0
  15. package/dist/auth/resolve-token.d.cts.map +1 -0
  16. package/dist/auth/resolve-token.d.ts +17 -0
  17. package/dist/auth/resolve-token.d.ts.map +1 -0
  18. package/dist/auth/resolve-token.js +8 -0
  19. package/dist/auth/token-cache.cjs +5 -0
  20. package/dist/auth/token-cache.d.cts +11 -0
  21. package/dist/auth/token-cache.d.cts.map +1 -0
  22. package/dist/auth/token-cache.d.ts +11 -0
  23. package/dist/auth/token-cache.d.ts.map +1 -0
  24. package/dist/auth/token-cache.js +3 -0
  25. package/dist/auth/types.cjs +7 -0
  26. package/dist/auth/types.d.cts +2 -0
  27. package/dist/auth/types.d.ts +2 -0
  28. package/dist/auth/types.js +3 -0
  29. package/dist/auth-DamN9R04.cjs +90 -0
  30. package/dist/auth-DamN9R04.cjs.map +1 -0
  31. package/dist/auth-XNi9K4Nz.js +79 -0
  32. package/dist/auth-XNi9K4Nz.js.map +1 -0
  33. package/dist/cli/commands/auth.cjs +11 -0
  34. package/dist/cli/commands/auth.d.cts +8 -0
  35. package/dist/cli/commands/auth.d.cts.map +1 -0
  36. package/dist/cli/commands/auth.d.ts +8 -0
  37. package/dist/cli/commands/auth.d.ts.map +1 -0
  38. package/dist/cli/commands/auth.js +10 -0
  39. package/dist/cli/parse.cjs +1 -1
  40. package/dist/cli/parse.d.cts +1 -1
  41. package/dist/cli/parse.d.cts.map +1 -1
  42. package/dist/cli/parse.d.ts +1 -1
  43. package/dist/cli/parse.d.ts.map +1 -1
  44. package/dist/cli/parse.js +1 -1
  45. package/dist/cli/resolve.cjs +4 -2
  46. package/dist/cli/resolve.d.cts +9 -3
  47. package/dist/cli/resolve.d.cts.map +1 -1
  48. package/dist/cli/resolve.d.ts +9 -3
  49. package/dist/cli/resolve.d.ts.map +1 -1
  50. package/dist/cli/resolve.js +3 -2
  51. package/dist/cli/types.d.cts +2 -2
  52. package/dist/cli/types.d.ts +2 -2
  53. package/dist/cli/usage.cjs +1 -1
  54. package/dist/cli/usage.js +1 -1
  55. package/dist/{config-BYPjNBPX-CxPh7iM8.cjs → config-D1QOSX9W-BurxE_FB.cjs} +4 -4
  56. package/dist/{config-BYPjNBPX-CxPh7iM8.cjs.map → config-D1QOSX9W-BurxE_FB.cjs.map} +1 -1
  57. package/dist/{config-BYPjNBPX-CdPOenPb.js → config-D1QOSX9W-CtF1qegU.js} +4 -4
  58. package/dist/{config-BYPjNBPX-CdPOenPb.js.map → config-D1QOSX9W-CtF1qegU.js.map} +1 -1
  59. package/dist/config-DvaRyDc4.cjs +7 -0
  60. package/dist/{config-NKdlAxBc.js → config-UqbHNH-n.js} +1 -1
  61. package/dist/{resolve-Ci97NUwJ.js → constants-CnQOQOfw.js} +43 -122
  62. package/dist/constants-CnQOQOfw.js.map +1 -0
  63. package/dist/{resolve-CxQZsYhh.cjs → constants-zXY4MUBL.cjs} +84 -133
  64. package/dist/constants-zXY4MUBL.cjs.map +1 -0
  65. package/dist/device-code-flow-B-sYi7io.cjs +154 -0
  66. package/dist/device-code-flow-B-sYi7io.cjs.map +1 -0
  67. package/dist/device-code-flow-BCdcs8S7.js +124 -0
  68. package/dist/device-code-flow-BCdcs8S7.js.map +1 -0
  69. package/dist/index.cjs +1694 -808
  70. package/dist/index.cjs.map +1 -1
  71. package/dist/index.js +1678 -792
  72. package/dist/index.js.map +1 -1
  73. package/dist/{parse-c8rvP4YQ.js → parse-BC0czE2L.js} +3 -1
  74. package/dist/{parse-c8rvP4YQ.js.map → parse-BC0czE2L.js.map} +1 -1
  75. package/dist/{parse-C6k7VZkG.cjs → parse-CBlXTQfk.cjs} +3 -1
  76. package/dist/{parse-C6k7VZkG.cjs.map → parse-CBlXTQfk.cjs.map} +1 -1
  77. package/dist/resolve-D19wc4BJ.js +133 -0
  78. package/dist/resolve-D19wc4BJ.js.map +1 -0
  79. package/dist/resolve-DQS7cx8P.cjs +168 -0
  80. package/dist/resolve-DQS7cx8P.cjs.map +1 -0
  81. package/dist/resolve-token-BeHiwgSY.js +47 -0
  82. package/dist/resolve-token-BeHiwgSY.js.map +1 -0
  83. package/dist/resolve-token-DKH-nkWs.cjs +52 -0
  84. package/dist/resolve-token-DKH-nkWs.cjs.map +1 -0
  85. package/dist/{stdio-D7HAkmRe.js → stdio-B6V73MMI.js} +3 -7
  86. package/dist/stdio-B6V73MMI.js.map +1 -0
  87. package/dist/{stdio-BlFtz2dW.cjs → stdio-CSjj4HGd.cjs} +3 -19
  88. package/dist/stdio-CSjj4HGd.cjs.map +1 -0
  89. package/dist/{token-CwkkxgwR.js → token-D7eiINbV.js} +2 -2
  90. package/dist/{token-CwkkxgwR.js.map → token-D7eiINbV.js.map} +1 -1
  91. package/dist/{token-C7V4_3ji.cjs → token-Dx4qrxlx.cjs} +3 -3
  92. package/dist/{token-C7V4_3ji.cjs.map → token-Dx4qrxlx.cjs.map} +1 -1
  93. package/dist/token-cache-BTEUyVx2.js +66 -0
  94. package/dist/token-cache-BTEUyVx2.js.map +1 -0
  95. package/dist/token-cache-iqkTOca3.cjs +84 -0
  96. package/dist/token-cache-iqkTOca3.cjs.map +1 -0
  97. package/dist/{token-error-BCFB3iKM.cjs → token-error-x_miDBP3.cjs} +1 -1
  98. package/dist/{token-error-BCFB3iKM.cjs.map → token-error-x_miDBP3.cjs.map} +1 -1
  99. package/dist/{token-util-D5kD3Z8e.js → token-util-DtX1UM9f.js} +1 -1
  100. package/dist/{token-util-CQ4Ghf_7.js → token-util-VkLmCUNV.js} +1 -1
  101. package/dist/{token-util-CQ4Ghf_7.js.map → token-util-VkLmCUNV.js.map} +1 -1
  102. package/dist/{token-util-8fvl2CtH.cjs → token-util-bEa_1v46.cjs} +2 -2
  103. package/dist/{token-util-CMaRPlqM.cjs → token-util-oe0G9a-s.cjs} +2 -2
  104. package/dist/{token-util-CMaRPlqM.cjs.map → token-util-oe0G9a-s.cjs.map} +1 -1
  105. package/dist/transports/stdio.cjs +2 -1
  106. package/dist/transports/stdio.js +2 -1
  107. package/dist/types-BJpeKPWI.d.cts +112 -0
  108. package/dist/types-BJpeKPWI.d.cts.map +1 -0
  109. package/dist/types-C336ZSwF.js +57 -0
  110. package/dist/types-C336ZSwF.js.map +1 -0
  111. package/dist/types-DDkgkRP9.d.ts +112 -0
  112. package/dist/types-DDkgkRP9.d.ts.map +1 -0
  113. package/dist/types-DViCeKUc.cjs +87 -0
  114. package/dist/types-DViCeKUc.cjs.map +1 -0
  115. package/dist/{types-BZvFOe59.d.ts → types-T07_vWhw.d.cts} +15 -5
  116. package/dist/types-T07_vWhw.d.cts.map +1 -0
  117. package/dist/{types-C0DSLPbp.d.cts → types-uISvMJKw.d.ts} +15 -5
  118. package/dist/types-uISvMJKw.d.ts.map +1 -0
  119. package/dist/{usage-DAChHAia.cjs → usage-DqxR1zdC.cjs} +17 -6
  120. package/dist/usage-DqxR1zdC.cjs.map +1 -0
  121. package/dist/{usage-BRTpzFg9.js → usage-QnwsoeF4.js} +17 -6
  122. package/dist/usage-QnwsoeF4.js.map +1 -0
  123. package/dist/version-BBolBvwF.js +7 -0
  124. package/dist/version-BBolBvwF.js.map +1 -0
  125. package/dist/version-g6exOvkr.cjs +19 -0
  126. package/dist/version-g6exOvkr.cjs.map +1 -0
  127. package/package.json +5 -5
  128. package/dist/config-CLW41PUq.cjs +0 -7
  129. package/dist/resolve-Ci97NUwJ.js.map +0 -1
  130. package/dist/resolve-CxQZsYhh.cjs.map +0 -1
  131. package/dist/stdio-BlFtz2dW.cjs.map +0 -1
  132. package/dist/stdio-D7HAkmRe.js.map +0 -1
  133. package/dist/types-BZvFOe59.d.ts.map +0 -1
  134. package/dist/types-C0DSLPbp.d.cts.map +0 -1
  135. package/dist/usage-BRTpzFg9.js.map +0 -1
  136. package/dist/usage-DAChHAia.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -1,10 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import { __commonJS, __export, __toDynamicImportESM, __toESM, require_token_error } from "./token-error-Df8A7mgb.js";
3
- import { ALL_SKILLS, SKILLS, finalize, getIssueUrl, getIssuesSearchUrl, getTraceUrl, isEnabledBySkills, isSentryHost } from "./resolve-Ci97NUwJ.js";
4
- import { LIB_VERSION, USER_AGENT, startStdio } from "./stdio-D7HAkmRe.js";
5
- import { RECOMMENDED_FIELDS, systemPrompt } from "./config-BYPjNBPX-CdPOenPb.js";
6
- import { buildUsage } from "./usage-BRTpzFg9.js";
7
- import { merge, parseArgv, parseEnv } from "./parse-c8rvP4YQ.js";
3
+ import { ALL_SKILLS, SKILLS, finalize, isEnabledBySkills } from "./resolve-D19wc4BJ.js";
4
+ import { getIssueUrl, getIssuesSearchUrl, getReplayUrl, getTraceUrl, isSentryHost } from "./constants-CnQOQOfw.js";
5
+ import { LIB_VERSION, USER_AGENT } from "./version-BBolBvwF.js";
6
+ import { RECOMMENDED_FIELDS, systemPrompt } from "./config-D1QOSX9W-CtF1qegU.js";
7
+ import { startStdio } from "./stdio-B6V73MMI.js";
8
+ import { buildUsage } from "./usage-QnwsoeF4.js";
9
+ import { merge, parseArgv, parseEnv } from "./parse-BC0czE2L.js";
10
+ import "./types-C336ZSwF.js";
11
+ import "./device-code-flow-BCdcs8S7.js";
12
+ import "./token-cache-BTEUyVx2.js";
13
+ import { resolveAccessToken } from "./resolve-token-BeHiwgSY.js";
14
+ import { authCommand } from "./auth-XNi9K4Nz.js";
8
15
  import { z } from "zod";
9
16
  import util from "node:util";
10
17
  import { captureException, captureMessage, getActiveSpan, logger, setTag, setUser, withScope, wrapMcpServerWithSentry } from "@sentry/core";
@@ -315,7 +322,7 @@ function validateSlugOrId(val, ctx) {
315
322
  }
316
323
 
317
324
  //#endregion
318
- //#region ../mcp-core/dist/schema-B2kce020.js
325
+ //#region ../mcp-core/dist/schema-D6EG4ADm.js
319
326
  const ParamOrganizationSlug = z.string().toLowerCase().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.");
320
327
  const ParamTeamSlug = z.string().toLowerCase().trim().superRefine(validateSlug).describe("The team's slug. You can find a list of existing teams in an organization using the `find_teams()` tool.");
321
328
  const ParamProjectSlug = z.string().toLowerCase().trim().superRefine(validateSlug).describe("The project's slug. You can find a list of existing projects in an organization using the `find_projects()` tool.");
@@ -323,6 +330,8 @@ const ParamProjectSlugOrAll = z.string().toLowerCase().trim().superRefine(valida
323
330
  const ParamSearchQuery = z.string().trim().describe("Search query to filter results by name or slug. Use this to narrow down results when there are many items.");
324
331
  const ParamIssueShortId = z.string().toUpperCase().trim().describe("The Issue ID. e.g. `PROJECT-1Z43`");
325
332
  const ParamIssueUrl = z.string().url().trim().describe("The URL of the issue. e.g. https://my-organization.sentry.io/issues/PROJECT-1Z43");
333
+ const ParamReplayId = z.string().trim().describe("The replay ID. e.g. `7e07485f-12f9-416b-8b14-26260799b51f`");
334
+ const ParamReplayUrl = z.string().url().trim().describe("The URL of the replay. e.g. https://my-organization.sentry.io/replays/7e07485f-12f9-416b-8b14-26260799b51f/");
326
335
  const ParamTraceId = z.string().trim().regex(/^[0-9a-fA-F]{32}$/, "Trace ID must be a 32-character hexadecimal string").describe("The trace ID. e.g. `a4d1aae7216b47ff8117cf4e09ce9d0a`");
327
336
  const ParamPlatform = z.string().toLowerCase().trim().describe("The platform for the project. e.g., python, javascript, react, etc.");
328
337
  const ParamTransaction = z.string().trim().describe("The transaction name. Also known as the endpoint, or route name.");
@@ -1365,8 +1374,8 @@ const asyncDisposables = /* @__PURE__ */ new Set();
1365
1374
  /**
1366
1375
  * Check if a config is for the meta logger.
1367
1376
  */
1368
- function isLoggerConfigMeta(cfg$1) {
1369
- return cfg$1.category.length === 0 || cfg$1.category.length === 1 && cfg$1.category[0] === "logtape" || cfg$1.category.length === 2 && cfg$1.category[0] === "logtape" && cfg$1.category[1] === "meta";
1377
+ function isLoggerConfigMeta(cfg) {
1378
+ return cfg.category.length === 0 || cfg.category.length === 1 && cfg.category[0] === "logtape" || cfg.category.length === 2 && cfg.category[0] === "logtape" && cfg.category[1] === "meta";
1370
1379
  }
1371
1380
  /**
1372
1381
  * Configure sync loggers with the specified configuration.
@@ -1416,20 +1425,20 @@ function configureInternal(config, allowAsync) {
1416
1425
  currentConfig = config;
1417
1426
  let metaConfigured = false;
1418
1427
  const configuredCategories = /* @__PURE__ */ new Set();
1419
- for (const cfg$1 of config.loggers) {
1420
- if (isLoggerConfigMeta(cfg$1)) metaConfigured = true;
1421
- const categoryKey = Array.isArray(cfg$1.category) ? JSON.stringify(cfg$1.category) : JSON.stringify([cfg$1.category]);
1428
+ for (const cfg of config.loggers) {
1429
+ if (isLoggerConfigMeta(cfg)) metaConfigured = true;
1430
+ const categoryKey = Array.isArray(cfg.category) ? JSON.stringify(cfg.category) : JSON.stringify([cfg.category]);
1422
1431
  if (configuredCategories.has(categoryKey)) throw new ConfigError(`Duplicate logger configuration for category: ${categoryKey}. Each category can only be configured once.`);
1423
1432
  configuredCategories.add(categoryKey);
1424
- const logger$2 = LoggerImpl.getLogger(cfg$1.category);
1425
- for (const sinkId of cfg$1.sinks ?? []) {
1433
+ const logger$2 = LoggerImpl.getLogger(cfg.category);
1434
+ for (const sinkId of cfg.sinks ?? []) {
1426
1435
  const sink = config.sinks[sinkId];
1427
1436
  if (!sink) throw new ConfigError(`Sink not found: ${sinkId}.`);
1428
1437
  logger$2.sinks.push(sink);
1429
1438
  }
1430
- logger$2.parentSinks = cfg$1.parentSinks ?? "inherit";
1431
- if (cfg$1.lowestLevel !== void 0) logger$2.lowestLevel = cfg$1.lowestLevel;
1432
- for (const filterId of cfg$1.filters ?? []) {
1439
+ logger$2.parentSinks = cfg.parentSinks ?? "inherit";
1440
+ if (cfg.lowestLevel !== void 0) logger$2.lowestLevel = cfg.lowestLevel;
1441
+ for (const filterId of cfg.filters ?? []) {
1433
1442
  const filter$1 = config.filters?.[filterId];
1434
1443
  if (filter$1 === void 0) throw new ConfigError(`Filter not found: ${filterId}.`);
1435
1444
  logger$2.filters.push(toFilter(filter$1));
@@ -1608,15 +1617,15 @@ function getLogger$1(scope, defaults) {
1608
1617
  return defaults ? logger$2.with(defaults) : logger$2;
1609
1618
  }
1610
1619
  const ISSUE_LOGGER_SCOPE = ["runtime", "issues"];
1611
- function isRecord(value) {
1620
+ function isRecord$1(value) {
1612
1621
  return typeof value === "object" && value !== null;
1613
1622
  }
1614
1623
  function isSentryContexts(value) {
1615
- if (!isRecord(value)) return false;
1616
- return Object.values(value).every((entry) => isRecord(entry));
1624
+ if (!isRecord$1(value)) return false;
1625
+ return Object.values(value).every((entry) => isRecord$1(entry));
1617
1626
  }
1618
1627
  function isBaseLogOptionsCandidate(value) {
1619
- if (!isRecord(value)) return false;
1628
+ if (!isRecord$1(value)) return false;
1620
1629
  if ("extra" in value || "loggerScope" in value) return true;
1621
1630
  if ("contexts" in value) {
1622
1631
  const contexts = value.contexts;
@@ -1625,7 +1634,7 @@ function isBaseLogOptionsCandidate(value) {
1625
1634
  return false;
1626
1635
  }
1627
1636
  function isLogIssueOptionsCandidate(value) {
1628
- return isBaseLogOptionsCandidate(value) || isRecord(value) && "attachments" in value;
1637
+ return isBaseLogOptionsCandidate(value) || isRecord$1(value) && "attachments" in value;
1629
1638
  }
1630
1639
  function parseBaseOptions(contextsOrOptions) {
1631
1640
  if (isBaseLogOptionsCandidate(contextsOrOptions)) {
@@ -1744,7 +1753,7 @@ function logIssue(error, contextsOrOptions, attachmentsArg) {
1744
1753
  ensureLoggingConfigured();
1745
1754
  const options = parseLogIssueOptions(contextsOrOptions, attachmentsArg);
1746
1755
  const eventId = withScope((scopeInstance) => {
1747
- if (options.contexts) for (const [key, context$2] of Object.entries(options.contexts)) scopeInstance.setContext(key, context$2);
1756
+ if (options.contexts) for (const [key, context$1] of Object.entries(options.contexts)) scopeInstance.setContext(key, context$1);
1748
1757
  if (options.extra) scopeInstance.setContext("log", options.extra);
1749
1758
  if (options.attachments) for (const [key, data] of Object.entries(options.attachments)) scopeInstance.addAttachment({
1750
1759
  data,
@@ -1774,7 +1783,7 @@ function logIssue(error, contextsOrOptions, attachmentsArg) {
1774
1783
  }
1775
1784
 
1776
1785
  //#endregion
1777
- //#region ../mcp-core/dist/schema-DNQm1XCl.js
1786
+ //#region ../mcp-core/dist/schema-Dp-Y371G.js
1778
1787
  /**
1779
1788
  * Schema for Sentry API error responses.
1780
1789
  *
@@ -1825,14 +1834,85 @@ const ProjectSchema = z.object({
1825
1834
  firstTransactionEvent: z.boolean().optional()
1826
1835
  }).passthrough();
1827
1836
  const ProjectListSchema = z.array(ProjectSchema);
1837
+ const ReplayTagsSchema = z.preprocess((value) => {
1838
+ if (value === void 0 || value === null || Array.isArray(value)) return {};
1839
+ return value;
1840
+ }, z.record(z.string(), z.array(z.string())));
1841
+ const ReplayDetailsSchema = z.object({
1842
+ activity: z.number().nullable().optional(),
1843
+ browser: z.object({
1844
+ name: z.string().nullable().optional(),
1845
+ version: z.string().nullable().optional()
1846
+ }).nullish().default({}),
1847
+ count_dead_clicks: z.number().nullable().optional(),
1848
+ count_errors: z.number().nullable().optional(),
1849
+ count_infos: z.number().nullable().optional(),
1850
+ count_rage_clicks: z.number().nullable().optional(),
1851
+ count_segments: z.number().nullable().optional(),
1852
+ count_urls: z.number().nullable().optional(),
1853
+ count_warnings: z.number().nullable().optional(),
1854
+ device: z.object({
1855
+ brand: z.string().nullable().optional(),
1856
+ family: z.string().nullable().optional(),
1857
+ model: z.string().nullable().optional(),
1858
+ model_id: z.string().nullable().optional(),
1859
+ name: z.string().nullable().optional()
1860
+ }).nullish().default({}),
1861
+ dist: z.string().nullable().optional(),
1862
+ duration: z.number().nullable().optional(),
1863
+ environment: z.string().nullable().optional(),
1864
+ error_ids: z.array(z.string()).optional().default([]),
1865
+ finished_at: z.string().nullable().optional(),
1866
+ has_viewed: z.boolean().nullable().optional(),
1867
+ id: z.string(),
1868
+ info_ids: z.array(z.string()).optional().default([]),
1869
+ is_archived: z.boolean().nullable().optional(),
1870
+ os: z.object({
1871
+ name: z.string().nullable().optional(),
1872
+ version: z.string().nullable().optional()
1873
+ }).nullish().default({}),
1874
+ platform: z.string().nullable().optional(),
1875
+ project_id: z.union([z.string(), z.number()]).nullable().optional(),
1876
+ releases: z.array(z.string()).nullable().optional(),
1877
+ replay_type: z.string().nullable().optional(),
1878
+ sdk: z.object({
1879
+ name: z.string().nullable().optional(),
1880
+ version: z.string().nullable().optional()
1881
+ }).nullish().default({}),
1882
+ started_at: z.string().nullable().optional(),
1883
+ tags: ReplayTagsSchema,
1884
+ trace_ids: z.array(z.string()).optional().default([]),
1885
+ urls: z.preprocess((value) => value ?? [], z.array(z.string())),
1886
+ user: z.object({
1887
+ display_name: z.string().nullable().optional(),
1888
+ email: z.string().nullable().optional(),
1889
+ id: z.string().nullable().optional(),
1890
+ ip: z.string().nullable().optional(),
1891
+ username: z.string().nullable().optional(),
1892
+ geo: z.record(z.string(), z.union([z.string(), z.null()])).optional()
1893
+ }).nullish().default({}),
1894
+ warning_ids: z.array(z.string()).optional().default([])
1895
+ }).passthrough();
1896
+ const ReplayRecordingSegmentsSchema = z.array(z.array(z.unknown()));
1897
+ const ReplayIdsByResourceSchema = z.record(z.string(), z.array(z.string()));
1828
1898
  const ClientKeySchema = z.object({
1829
1899
  id: z.union([z.string(), z.number()]),
1830
1900
  name: z.string(),
1831
1901
  dsn: z.object({ public: z.string() }),
1832
1902
  isActive: z.boolean(),
1833
- dateCreated: z.string().datetime()
1903
+ dateCreated: z.string().datetime().nullable()
1834
1904
  }).passthrough();
1835
1905
  const ClientKeyListSchema = z.array(ClientKeySchema);
1906
+ const ReleaseProjectSchema = z.object({
1907
+ id: z.union([z.string(), z.number()]),
1908
+ slug: z.string().nullable(),
1909
+ name: z.string(),
1910
+ platform: z.string().nullable().optional()
1911
+ }).passthrough();
1912
+ const ReleaseCommitAuthorSchema = z.object({
1913
+ name: z.string().nullable().optional(),
1914
+ email: z.string().nullable().optional()
1915
+ }).passthrough();
1836
1916
  const ReleaseSchema = z.object({
1837
1917
  id: z.union([z.string(), z.number()]),
1838
1918
  version: z.string(),
@@ -1844,20 +1924,17 @@ const ReleaseSchema = z.object({
1844
1924
  newGroups: z.number(),
1845
1925
  lastCommit: z.object({
1846
1926
  id: z.union([z.string(), z.number()]),
1847
- message: z.string(),
1927
+ message: z.string().nullable(),
1848
1928
  dateCreated: z.string().datetime(),
1849
- author: z.object({
1850
- name: z.string(),
1851
- email: z.string()
1852
- })
1853
- }).nullable(),
1929
+ author: ReleaseCommitAuthorSchema.optional()
1930
+ }).passthrough().nullable(),
1854
1931
  lastDeploy: z.object({
1855
1932
  id: z.union([z.string(), z.number()]),
1856
- environment: z.string(),
1933
+ environment: z.string().nullable(),
1857
1934
  dateStarted: z.string().datetime().nullable(),
1858
1935
  dateFinished: z.string().datetime().nullable()
1859
- }).nullable(),
1860
- projects: z.array(ProjectSchema)
1936
+ }).passthrough().nullable(),
1937
+ projects: z.array(ReleaseProjectSchema)
1861
1938
  });
1862
1939
  const ReleaseListSchema = z.array(ReleaseSchema);
1863
1940
  const TagSchema = z.object({
@@ -2017,6 +2094,16 @@ const BaseEventSchema = z.object({
2017
2094
  ]) }).passthrough()).optional(),
2018
2095
  context: z.record(z.string(), z.unknown()).optional(),
2019
2096
  tags: EventTagsSchema.optional(),
2097
+ user: z.object({
2098
+ display_name: z.string().nullable().optional(),
2099
+ email: z.string().nullable().optional(),
2100
+ id: z.string().nullable().optional(),
2101
+ ip: z.string().nullable().optional(),
2102
+ ip_address: z.string().nullable().optional(),
2103
+ name: z.string().nullable().optional(),
2104
+ username: z.string().nullable().optional(),
2105
+ geo: z.record(z.string(), z.union([z.string(), z.null()])).nullable().optional()
2106
+ }).passthrough().nullable().optional(),
2020
2107
  _meta: z.unknown().optional(),
2021
2108
  dateReceived: z.string().datetime().optional()
2022
2109
  });
@@ -2381,8 +2468,8 @@ const FlamegraphProfileSchema = z.object({
2381
2468
  type: z.string(),
2382
2469
  unit: z.string(),
2383
2470
  weights: z.array(z.number()),
2384
- sample_durations_ns: z.array(z.number()),
2385
- sample_counts: z.array(z.number())
2471
+ sample_durations_ns: z.preprocess((value) => value ?? [], z.array(z.number())),
2472
+ sample_counts: z.preprocess((value) => value ?? [], z.array(z.number()))
2386
2473
  }).passthrough();
2387
2474
  /**
2388
2475
  * Schema for flamegraph API response.
@@ -2396,15 +2483,15 @@ const FlamegraphProfileSchema = z.object({
2396
2483
  * already aggregated and includes percentile calculations.
2397
2484
  */
2398
2485
  const FlamegraphSchema = z.object({
2399
- activeProfileIndex: z.number(),
2486
+ activeProfileIndex: z.preprocess((value) => value ?? 0, z.number()),
2400
2487
  metadata: z.record(z.unknown()).optional(),
2401
2488
  platform: z.string(),
2402
2489
  profiles: z.array(FlamegraphProfileSchema),
2403
2490
  projectID: z.number(),
2404
2491
  shared: z.object({
2405
2492
  frames: z.array(FlamegraphFrameSchema),
2406
- frame_infos: z.array(FlamegraphFrameInfoSchema),
2407
- profiles: z.array(FlamegraphProfileMetadataSchema)
2493
+ frame_infos: z.preprocess((value) => value ?? [], z.array(FlamegraphFrameInfoSchema)),
2494
+ profiles: z.preprocess((value) => value ?? [], z.array(FlamegraphProfileMetadataSchema))
2408
2495
  }),
2409
2496
  transactionName: z.string().optional(),
2410
2497
  metrics: z.unknown().optional()
@@ -2421,9 +2508,15 @@ const ProfileFrameSchema = z.object({
2421
2508
  function: z.string(),
2422
2509
  in_app: z.boolean(),
2423
2510
  lineno: z.number().nullable().optional(),
2511
+ colno: z.number().nullable().optional(),
2424
2512
  module: z.string().nullable().optional(),
2425
2513
  abs_path: z.string().nullable().optional(),
2426
2514
  platform: z.string().nullable().optional(),
2515
+ instruction_addr: z.string().nullable().optional(),
2516
+ class_name: z.string().nullable().optional(),
2517
+ raw_function: z.string().nullable().optional(),
2518
+ symbol: z.string().nullable().optional(),
2519
+ lang: z.string().nullable().optional(),
2427
2520
  data: z.record(z.unknown()).optional()
2428
2521
  }).passthrough();
2429
2522
  /**
@@ -2435,7 +2528,8 @@ const ProfileFrameSchema = z.object({
2435
2528
  const ProfileSampleSchema = z.object({
2436
2529
  stack_id: z.number(),
2437
2530
  thread_id: z.string(),
2438
- timestamp: z.number()
2531
+ timestamp: z.number(),
2532
+ queue_address: z.string().optional()
2439
2533
  }).passthrough();
2440
2534
  /**
2441
2535
  * Schema for raw profile chunk data.
@@ -2451,6 +2545,7 @@ const ProfileSampleSchema = z.object({
2451
2545
  const ProfileChunkSchema = z.object({
2452
2546
  chunk_id: z.string(),
2453
2547
  profiler_id: z.string(),
2548
+ event_id: z.string().optional(),
2454
2549
  environment: z.string().nullable(),
2455
2550
  platform: z.string(),
2456
2551
  release: z.string(),
@@ -2459,7 +2554,10 @@ const ProfileChunkSchema = z.object({
2459
2554
  frames: z.array(ProfileFrameSchema),
2460
2555
  samples: z.array(ProfileSampleSchema),
2461
2556
  stacks: z.array(z.array(z.number())),
2462
- thread_metadata: z.record(z.object({ name: z.string().nullable() }).passthrough())
2557
+ thread_metadata: z.record(z.object({
2558
+ name: z.string().nullable(),
2559
+ priority: z.number().nullable().optional()
2560
+ }).passthrough())
2463
2561
  })
2464
2562
  }).passthrough();
2465
2563
  /**
@@ -2685,7 +2783,7 @@ function createApiError(message, status, detail, responseBody) {
2685
2783
  }
2686
2784
 
2687
2785
  //#endregion
2688
- //#region ../mcp-core/dist/client-BgpGcqn_.js
2786
+ //#region ../mcp-core/dist/client-CdmweRhR.js
2689
2787
  /**
2690
2788
  * Mapping of common network error codes to user-friendly messages.
2691
2789
  * These help users understand and resolve connection issues.
@@ -2973,6 +3071,9 @@ var SentryApiService = class {
2973
3071
  getTraceUrl(organizationSlug, traceId) {
2974
3072
  return getTraceUrl(this.host, organizationSlug, traceId);
2975
3073
  }
3074
+ getReplayUrl(organizationSlug, replayId) {
3075
+ return getReplayUrl(this.host, organizationSlug, replayId);
3076
+ }
2976
3077
  /**
2977
3078
  * Builds a URL for the legacy Discover API (used by errors dataset).
2978
3079
  *
@@ -3611,6 +3712,26 @@ var SentryApiService = class {
3611
3712
  blob: await downloadResponse.blob()
3612
3713
  };
3613
3714
  }
3715
+ async getReplayDetails({ organizationSlug, replayId }, opts) {
3716
+ const body = await this.requestJSON(`/organizations/${organizationSlug}/replays/${replayId}/`, void 0, opts);
3717
+ return z.object({ data: ReplayDetailsSchema }).parse(body).data;
3718
+ }
3719
+ async listReplayIdsForIssue({ organizationSlug, issueId, dataSource }, opts) {
3720
+ const normalizedIssueId = String(issueId);
3721
+ const queryParams = new URLSearchParams();
3722
+ queryParams.set("returnIds", "true");
3723
+ queryParams.set("query", `issue.id:[${normalizedIssueId}]`);
3724
+ queryParams.set("data_source", dataSource);
3725
+ queryParams.set("statsPeriod", "90d");
3726
+ queryParams.append("project", "-1");
3727
+ const body = await this.requestJSON(`/organizations/${organizationSlug}/replay-count/?${queryParams.toString()}`, void 0, opts);
3728
+ const replayIdsByResource = ReplayIdsByResourceSchema.parse(body);
3729
+ return replayIdsByResource[normalizedIssueId] ?? [];
3730
+ }
3731
+ async getReplayRecordingSegments({ organizationSlug, projectSlugOrId, replayId }, opts) {
3732
+ const body = await this.requestJSON(`/projects/${organizationSlug}/${projectSlugOrId}/replays/${replayId}/recording-segments/?download=true`, void 0, opts);
3733
+ return ReplayRecordingSegmentsSchema.parse(body);
3734
+ }
3614
3735
  async updateIssue({ organizationSlug, issueId, status, assignedTo }, opts) {
3615
3736
  const updateData = {};
3616
3737
  if (status !== void 0) updateData.status = status;
@@ -3955,7 +4076,7 @@ function validateRegionUrl(regionUrl, baseHost) {
3955
4076
  }
3956
4077
 
3957
4078
  //#endregion
3958
- //#region ../mcp-core/dist/api-DdwepRtn.js
4079
+ //#region ../mcp-core/dist/api-CUGzR3jb.js
3959
4080
  /**
3960
4081
  * Create a Sentry API service from server context with optional region override
3961
4082
  * @param context - Server context containing host and access token
@@ -3963,20 +4084,20 @@ function validateRegionUrl(regionUrl, baseHost) {
3963
4084
  * @returns Configured SentryApiService instance (always uses HTTPS)
3964
4085
  * @throws {UserInputError} When regionUrl is provided but invalid
3965
4086
  */
3966
- function apiServiceFromContext(context$2, opts = {}) {
3967
- let host = context$2.sentryHost;
4087
+ function apiServiceFromContext(context$1, opts = {}) {
4088
+ let host = context$1.sentryHost;
3968
4089
  if (opts.regionUrl?.trim()) {
3969
- const baseHost = context$2.sentryHost || "sentry.io";
4090
+ const baseHost = context$1.sentryHost || "sentry.io";
3970
4091
  host = validateRegionUrl(opts.regionUrl.trim(), baseHost);
3971
4092
  }
3972
4093
  return new SentryApiService({
3973
4094
  host,
3974
- accessToken: context$2.accessToken
4095
+ accessToken: context$1.accessToken
3975
4096
  });
3976
4097
  }
3977
4098
 
3978
4099
  //#endregion
3979
- //#region ../mcp-core/dist/whoami-CqdLwYYD.js
4100
+ //#region ../mcp-core/dist/whoami-BSKPp-Nn.js
3980
4101
  var whoami_default = defineTool({
3981
4102
  name: "whoami",
3982
4103
  description: [
@@ -3992,11 +4113,11 @@ var whoami_default = defineTool({
3992
4113
  readOnlyHint: true,
3993
4114
  openWorldHint: true
3994
4115
  },
3995
- async handler(params, context$2) {
3996
- const apiService = apiServiceFromContext(context$2);
4116
+ async handler(params, context$1) {
4117
+ const apiService = apiServiceFromContext(context$1);
3997
4118
  const user = await apiService.getAuthenticatedUser();
3998
4119
  let output = `You are authenticated as ${user.name} (${user.email}).\n\nYour Sentry User ID is ${user.id}.`;
3999
- const constraints = context$2.constraints;
4120
+ const constraints = context$1.constraints;
4000
4121
  if (constraints.organizationSlug || constraints.projectSlug || constraints.regionUrl) {
4001
4122
  output += "\n\n## Session Constraints\n\n";
4002
4123
  if (constraints.organizationSlug) output += `- **Organization**: ${constraints.organizationSlug}\n`;
@@ -4009,7 +4130,7 @@ var whoami_default = defineTool({
4009
4130
  });
4010
4131
 
4011
4132
  //#endregion
4012
- //#region ../mcp-core/dist/find-organizations-B8pp0NcY.js
4133
+ //#region ../mcp-core/dist/find-organizations-BaOaAx02.js
4013
4134
  const RESULT_LIMIT$2 = 25;
4014
4135
  var find_organizations_default = defineTool({
4015
4136
  name: "find_organizations",
@@ -4030,8 +4151,8 @@ var find_organizations_default = defineTool({
4030
4151
  readOnlyHint: true,
4031
4152
  openWorldHint: true
4032
4153
  },
4033
- async handler(params, context$2) {
4034
- const apiService = apiServiceFromContext(context$2);
4154
+ async handler(params, context$1) {
4155
+ const apiService = apiServiceFromContext(context$1);
4035
4156
  const organizations = await apiService.listOrganizations({ query: params.query ?? void 0 });
4036
4157
  let output = "# Organizations\n\n";
4037
4158
  if (params.query) output += `**Search query:** "${params.query}"\n\n`;
@@ -4061,7 +4182,7 @@ var find_organizations_default = defineTool({
4061
4182
  });
4062
4183
 
4063
4184
  //#endregion
4064
- //#region ../mcp-core/dist/find-teams-CC9kTwUS.js
4185
+ //#region ../mcp-core/dist/find-teams-Df4xhGsp.js
4065
4186
  const RESULT_LIMIT$1 = 25;
4066
4187
  var find_teams_default = defineTool({
4067
4188
  name: "find_teams",
@@ -4090,8 +4211,8 @@ var find_teams_default = defineTool({
4090
4211
  readOnlyHint: true,
4091
4212
  openWorldHint: true
4092
4213
  },
4093
- async handler(params, context$2) {
4094
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
4214
+ async handler(params, context$1) {
4215
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
4095
4216
  const organizationSlug = params.organizationSlug;
4096
4217
  if (!organizationSlug) throw new UserInputError("Organization slug is required. Please provide an organizationSlug parameter.");
4097
4218
  setTag("organization.slug", organizationSlug);
@@ -4109,7 +4230,7 @@ var find_teams_default = defineTool({
4109
4230
  });
4110
4231
 
4111
4232
  //#endregion
4112
- //#region ../mcp-core/dist/find-projects-BQtUPjfB.js
4233
+ //#region ../mcp-core/dist/find-projects-D9oRDdXl.js
4113
4234
  const RESULT_LIMIT = 25;
4114
4235
  var find_projects_default = defineTool({
4115
4236
  name: "find_projects",
@@ -4134,8 +4255,8 @@ var find_projects_default = defineTool({
4134
4255
  readOnlyHint: true,
4135
4256
  openWorldHint: true
4136
4257
  },
4137
- async handler(params, context$2) {
4138
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
4258
+ async handler(params, context$1) {
4259
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
4139
4260
  const organizationSlug = params.organizationSlug;
4140
4261
  if (!organizationSlug) throw new UserInputError("Organization slug is required. Please provide an organizationSlug parameter.");
4141
4262
  setTag("organization.slug", organizationSlug);
@@ -4153,7 +4274,7 @@ var find_projects_default = defineTool({
4153
4274
  });
4154
4275
 
4155
4276
  //#endregion
4156
- //#region ../mcp-core/dist/find-releases-Dsc-Bni-.js
4277
+ //#region ../mcp-core/dist/find-releases-Dy0bRn67.js
4157
4278
  var find_releases_default = defineTool({
4158
4279
  name: "find_releases",
4159
4280
  skills: ["inspect"],
@@ -4194,8 +4315,8 @@ var find_releases_default = defineTool({
4194
4315
  readOnlyHint: true,
4195
4316
  openWorldHint: true
4196
4317
  },
4197
- async handler(params, context$2) {
4198
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
4318
+ async handler(params, context$1) {
4319
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
4199
4320
  const organizationSlug = params.organizationSlug;
4200
4321
  setTag("organization.slug", organizationSlug);
4201
4322
  const releases = await apiService.listReleases({
@@ -4220,16 +4341,17 @@ var find_releases_default = defineTool({
4220
4341
  if (release.newGroups !== void 0) releaseInfo.push(`**New Issues**: ${release.newGroups}`);
4221
4342
  if (release.projects && release.projects.length > 0) releaseInfo.push(`**Projects**: ${release.projects.map((p) => p.name).join(", ")}`);
4222
4343
  if (release.lastCommit) {
4344
+ const commitAuthor = release.lastCommit.author?.name ?? release.lastCommit.author?.email ?? "Unknown";
4223
4345
  releaseInfo.push("", `### Last Commit`, "");
4224
4346
  releaseInfo.push(`**Commit ID**: ${release.lastCommit.id}`);
4225
- releaseInfo.push(`**Commit Message**: ${release.lastCommit.message}`);
4226
- releaseInfo.push(`**Commit Author**: ${release.lastCommit.author.name}`);
4347
+ releaseInfo.push(`**Commit Message**: ${release.lastCommit.message ?? "Unknown"}`);
4348
+ releaseInfo.push(`**Commit Author**: ${commitAuthor}`);
4227
4349
  releaseInfo.push(`**Commit Date**: ${new Date(release.lastCommit.dateCreated).toISOString()}`);
4228
4350
  }
4229
4351
  if (release.lastDeploy) {
4230
4352
  releaseInfo.push("", `### Last Deploy`, "");
4231
4353
  releaseInfo.push(`**Deploy ID**: ${release.lastDeploy.id}`);
4232
- releaseInfo.push(`**Environment**: ${release.lastDeploy.environment}`);
4354
+ releaseInfo.push(`**Environment**: ${release.lastDeploy.environment ?? "Unknown"}`);
4233
4355
  if (release.lastDeploy.dateStarted) releaseInfo.push(`**Deploy Started**: ${new Date(release.lastDeploy.dateStarted).toISOString()}`);
4234
4356
  if (release.lastDeploy.dateFinished) releaseInfo.push(`**Deploy Finished**: ${new Date(release.lastDeploy.dateFinished).toISOString()}`);
4235
4357
  }
@@ -4401,7 +4523,24 @@ function getOutputForAutofixStep(step) {
4401
4523
  }
4402
4524
 
4403
4525
  //#endregion
4404
- //#region ../mcp-core/dist/formatting-Dk4pZlwg.js
4526
+ //#region ../mcp-core/dist/user-formatting-R_sbOJfq.js
4527
+ function isPlainObject(value) {
4528
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4529
+ }
4530
+ function formatUserGeoSummary(value) {
4531
+ if (!isPlainObject(value)) return null;
4532
+ const parts = [
4533
+ value.country_code,
4534
+ value.city,
4535
+ value.region,
4536
+ value.country_name
4537
+ ].filter((part) => typeof part === "string" && part.length > 0);
4538
+ if (parts.length === 0) return null;
4539
+ return Array.from(new Set(parts)).join(", ");
4540
+ }
4541
+
4542
+ //#endregion
4543
+ //#region ../mcp-core/dist/formatting-BUSBBQN0.js
4405
4544
  /**
4406
4545
  * Convert Seer fixability score to actionability label.
4407
4546
  * Thresholds match Sentry core: src/sentry/seer/autofix/constants.py
@@ -4504,28 +4643,39 @@ function formatFrameHeader(frame, frameIndex, platform) {
4504
4643
  */
4505
4644
  function formatEventOutput(event, options) {
4506
4645
  let output = "";
4507
- if (!event.entries || !Array.isArray(event.entries)) {
4508
- output += formatTags(event.tags);
4509
- output += formatContext(event.context);
4510
- output += formatContexts(event.contexts);
4646
+ const eventUser = event.user;
4647
+ const eventWithReplayMetadataStripped = options?.replaySummary ? stripReplayMetadata(event) : event;
4648
+ const eventToRender = eventWithReplayMetadataStripped;
4649
+ if (options?.replaySummary) output += formatIssueReplayOutput({
4650
+ apiService: options.replaySummary.apiService,
4651
+ organizationSlug: options.replaySummary.organizationSlug,
4652
+ event,
4653
+ relatedReplayIds: options.replaySummary.relatedReplayIds
4654
+ });
4655
+ if (!eventToRender.entries || !Array.isArray(eventToRender.entries)) {
4656
+ output += formatEventUser(eventUser);
4657
+ output += formatTags(eventToRender.tags);
4658
+ output += formatContext(eventToRender.context);
4659
+ output += formatContexts(eventToRender.contexts);
4511
4660
  return output;
4512
4661
  }
4513
- const messageEntry = event.entries.find((e) => e.type === "message");
4514
- const exceptionEntry = event.entries.find((e) => e.type === "exception");
4515
- const threadsEntry = event.entries.find((e) => e.type === "threads");
4516
- const requestEntry = event.entries.find((e) => e.type === "request");
4517
- const spansEntry = event.entries.find((e) => e.type === "spans");
4518
- const cspEntry = event.entries.find((e) => e.type === "csp");
4519
- if (messageEntry) output += formatMessageInterfaceOutput(event, messageEntry.data);
4520
- if (exceptionEntry) output += formatExceptionInterfaceOutput(event, exceptionEntry.data);
4521
- else if (threadsEntry) output += formatThreadsInterfaceOutput(event, threadsEntry.data);
4522
- if (requestEntry) output += formatRequestInterfaceOutput(event, requestEntry.data);
4523
- if (cspEntry) output += formatCspInterfaceOutput(event, cspEntry.data);
4524
- if (event.type === "transaction") output += formatPerformanceIssueOutput(event, spansEntry?.data, options);
4525
- if (event.type === "generic") output += formatGenericEventOutput(event);
4526
- output += formatTags(event.tags);
4527
- output += formatContext(event.context);
4528
- output += formatContexts(event.contexts);
4662
+ const messageEntry = eventToRender.entries.find((e) => e.type === "message");
4663
+ const exceptionEntry = eventToRender.entries.find((e) => e.type === "exception");
4664
+ const threadsEntry = eventToRender.entries.find((e) => e.type === "threads");
4665
+ const requestEntry = eventToRender.entries.find((e) => e.type === "request");
4666
+ const spansEntry = eventToRender.entries.find((e) => e.type === "spans");
4667
+ const cspEntry = eventToRender.entries.find((e) => e.type === "csp");
4668
+ if (messageEntry) output += formatMessageInterfaceOutput(eventToRender, messageEntry.data);
4669
+ if (exceptionEntry) output += formatExceptionInterfaceOutput(eventToRender, exceptionEntry.data);
4670
+ else if (threadsEntry) output += formatThreadsInterfaceOutput(eventToRender, threadsEntry.data);
4671
+ if (requestEntry) output += formatRequestInterfaceOutput(eventToRender, requestEntry.data);
4672
+ if (cspEntry) output += formatCspInterfaceOutput(eventToRender, cspEntry.data);
4673
+ if (eventToRender.type === "transaction") output += formatPerformanceIssueOutput(eventToRender, spansEntry?.data, options);
4674
+ if (eventToRender.type === "generic") output += formatGenericEventOutput(eventToRender);
4675
+ output += formatEventUser(eventUser);
4676
+ output += formatTags(eventToRender.tags);
4677
+ output += formatContext(eventToRender.context);
4678
+ output += formatContexts(eventToRender.contexts);
4529
4679
  return output;
4530
4680
  }
4531
4681
  /**
@@ -4609,8 +4759,8 @@ function formatExceptionInterfaceOutput(event, data) {
4609
4759
  parts.push("```");
4610
4760
  parts.push(frames.map((frame) => {
4611
4761
  const header = formatFrameHeader(frame, void 0, event.platform);
4612
- const context$2 = renderInlineContext(frame);
4613
- return `${header}${context$2}`;
4762
+ const context$1 = renderInlineContext(frame);
4763
+ return `${header}${context$1}`;
4614
4764
  }).join("\n"));
4615
4765
  parts.push("```");
4616
4766
  });
@@ -4689,8 +4839,8 @@ function formatThreadsInterfaceOutput(event, data) {
4689
4839
  parts.push("```");
4690
4840
  parts.push(frames.map((frame) => {
4691
4841
  const header = formatFrameHeader(frame, void 0, event.platform);
4692
- const context$2 = renderInlineContext(frame);
4693
- return `${header}${context$2}`;
4842
+ const context$1 = renderInlineContext(frame);
4843
+ return `${header}${context$1}`;
4694
4844
  }).join("\n"));
4695
4845
  parts.push("```");
4696
4846
  parts.push("");
@@ -5225,9 +5375,26 @@ function formatTags(tags) {
5225
5375
  if (!tags || tags.length === 0) return "";
5226
5376
  return `### Tags\n\n${tags.map((tag) => `**${tag.key}**: ${tag.value}`).join("\n")}\n\n`;
5227
5377
  }
5228
- function formatContext(context$2) {
5229
- if (!context$2 || Object.keys(context$2).length === 0) return "";
5230
- return `### Extra Data\n\nAdditional data attached to this event.\n\n${Object.entries(context$2).map(([key, value]) => {
5378
+ function formatEventUser(user) {
5379
+ if (!user || Object.keys(user).length === 0) return "";
5380
+ const userFields = [
5381
+ ["id", user.id],
5382
+ ["email", user.email],
5383
+ ["username", user.username],
5384
+ ["ip", user.ip ?? user.ip_address],
5385
+ ["display_name", user.display_name ?? user.name]
5386
+ ].filter(([, value]) => typeof value === "string" && value.length > 0);
5387
+ const userSummary = userFields.map(([key, value]) => `${key}:${value}`).join(", ");
5388
+ const geoSummary = formatUserGeoSummary(user.geo);
5389
+ if (!userSummary && !geoSummary) return "";
5390
+ let output = "### User\n\n";
5391
+ if (userSummary) output += `**user**: ${userSummary}\n`;
5392
+ if (geoSummary) output += `**user.geo**: ${geoSummary}\n`;
5393
+ return `${output}\n`;
5394
+ }
5395
+ function formatContext(context$1) {
5396
+ if (!context$1 || Object.keys(context$1).length === 0) return "";
5397
+ return `### Extra Data\n\nAdditional data attached to this event.\n\n${Object.entries(context$1).map(([key, value]) => {
5231
5398
  return `**${key}**: ${JSON.stringify(value, void 0, 2)}`;
5232
5399
  }).join("\n")}\n\n`;
5233
5400
  }
@@ -5308,7 +5475,7 @@ function formatSeerSummary(autofixState) {
5308
5475
  * @param params - Object containing organization slug, issue, event, and API service
5309
5476
  * @returns Formatted markdown string with complete issue information
5310
5477
  */
5311
- function formatIssueOutput({ organizationSlug, issue, event, apiService, autofixState, performanceTrace, externalIssues, experimentalMode }) {
5478
+ function formatIssueOutput({ organizationSlug, issue, event, apiService, autofixState, performanceTrace, externalIssues, relatedReplayIds, experimentalMode }) {
5312
5479
  let output = `# Issue ${issue.shortId} in **${organizationSlug}**\n\n`;
5313
5480
  const isPerformanceIssue = issue.issueType?.startsWith("performance_") || issue.issueCategory === "performance";
5314
5481
  if (isPerformanceIssue && issue.metadata) {
@@ -5368,7 +5535,14 @@ function formatIssueOutput({ organizationSlug, issue, event, apiService, autofix
5368
5535
  }
5369
5536
  if (event.message) output += `**Message**:\n${event.message}\n`;
5370
5537
  output += "\n";
5371
- output += formatEventOutput(event, { performanceTrace });
5538
+ output += formatEventOutput(event, {
5539
+ performanceTrace,
5540
+ replaySummary: {
5541
+ apiService,
5542
+ organizationSlug,
5543
+ relatedReplayIds
5544
+ }
5545
+ });
5372
5546
  if (autofixState) output += formatSeerSummary(autofixState);
5373
5547
  if (externalIssues && externalIssues.length > 0) {
5374
5548
  output += "## External Issue Links\n\n";
@@ -5382,9 +5556,76 @@ function formatIssueOutput({ organizationSlug, issue, event, apiService, autofix
5382
5556
  if (experimentalMode) output += `- To see the trail of events leading up to this error, use \`get_sentry_resource(url='${apiService.getIssueUrl(organizationSlug, issue.shortId)}', resourceType='breadcrumbs')\`\n`;
5383
5557
  return output;
5384
5558
  }
5559
+ const MAX_DISPLAY_REPLAYS = 5;
5560
+ function formatIssueReplayOutput({ apiService, organizationSlug, event, relatedReplayIds }) {
5561
+ const attachedReplayId = getReplayIdFromEvent(event);
5562
+ const normalizedRelatedReplayIds = dedupeReplayIds(relatedReplayIds ?? []);
5563
+ const additionalRelatedReplayIds = normalizedRelatedReplayIds.filter((replayId) => replayId !== attachedReplayId);
5564
+ if (!attachedReplayId && normalizedRelatedReplayIds.length === 0) return "";
5565
+ const lines = ["## Session Replay", ""];
5566
+ if (attachedReplayId) lines.push(`**Attached Replay**: ${apiService.getReplayUrl(organizationSlug, attachedReplayId)}`);
5567
+ if (normalizedRelatedReplayIds.length > 0) lines.push(`**Related Replay Count**: ${normalizedRelatedReplayIds.length}`);
5568
+ if (additionalRelatedReplayIds.length > 0) {
5569
+ const displayedReplayIds = additionalRelatedReplayIds.slice(0, MAX_DISPLAY_REPLAYS);
5570
+ lines.push("");
5571
+ lines.push(attachedReplayId ? "### Other Related Replays" : "### Related Replays");
5572
+ lines.push("");
5573
+ for (const replayId of displayedReplayIds) lines.push(`- ${apiService.getReplayUrl(organizationSlug, replayId)}`);
5574
+ const remainingReplayCount = additionalRelatedReplayIds.length - displayedReplayIds.length;
5575
+ if (remainingReplayCount > 0) lines.push(`- ... and ${remainingReplayCount} more replay${remainingReplayCount === 1 ? "" : "s"}`);
5576
+ }
5577
+ const exampleReplayId = attachedReplayId ?? normalizedRelatedReplayIds.at(0) ?? null;
5578
+ if (exampleReplayId) {
5579
+ lines.push("");
5580
+ lines.push(`Use \`get_replay_details(organizationSlug='${organizationSlug}', replayId='${exampleReplayId}')\` to inspect a replay in detail.`);
5581
+ }
5582
+ return `${lines.join("\n")}\n\n`;
5583
+ }
5584
+ function getReplayIdFromEvent(event) {
5585
+ const replayContext = event.contexts?.replay;
5586
+ const replayContextId = typeof replayContext?.replay_id === "string" ? replayContext.replay_id : null;
5587
+ const replayTagId = event.tags?.find((tag) => tag.key === "replayId" || tag.key === "replay.id")?.value ?? null;
5588
+ return normalizeReplayId(replayContextId ?? replayTagId);
5589
+ }
5590
+ function dedupeReplayIds(replayIds) {
5591
+ const normalizedReplayIds = [];
5592
+ const seenReplayIds = /* @__PURE__ */ new Set();
5593
+ for (const replayId of replayIds) {
5594
+ const normalizedReplayId = normalizeReplayId(replayId);
5595
+ if (!normalizedReplayId || seenReplayIds.has(normalizedReplayId)) continue;
5596
+ seenReplayIds.add(normalizedReplayId);
5597
+ normalizedReplayIds.push(normalizedReplayId);
5598
+ }
5599
+ return normalizedReplayIds;
5600
+ }
5601
+ function normalizeReplayId(replayId) {
5602
+ if (typeof replayId !== "string") return null;
5603
+ const trimmedReplayId = replayId.trim();
5604
+ if (!trimmedReplayId) return null;
5605
+ return trimmedReplayId.replace(/-/g, "");
5606
+ }
5607
+ function stripReplayMetadata(event) {
5608
+ const tags = event.tags?.filter((tag) => tag.key !== "replay.id" && tag.key !== "replayId");
5609
+ const replayContext = event.contexts?.replay;
5610
+ if (!replayContext) return {
5611
+ ...event,
5612
+ tags
5613
+ };
5614
+ const nextReplayContext = Object.fromEntries(Object.entries(replayContext).filter(([key]) => key !== "replay_id"));
5615
+ const nonTypeReplayKeys = Object.keys(nextReplayContext).filter((key) => key !== "type");
5616
+ const contexts = nonTypeReplayKeys.length === 0 ? Object.fromEntries(Object.entries(event.contexts ?? {}).filter(([key]) => key !== "replay")) : {
5617
+ ...event.contexts,
5618
+ replay: nextReplayContext
5619
+ };
5620
+ return {
5621
+ ...event,
5622
+ tags,
5623
+ contexts
5624
+ };
5625
+ }
5385
5626
 
5386
5627
  //#endregion
5387
- //#region ../mcp-core/dist/enhance-error-BzwoJ7V0.js
5628
+ //#region ../mcp-core/dist/enhance-error-Ci4C7QqF.js
5388
5629
  /**
5389
5630
  * Enhances a 404 error with parameter context to help users understand what went wrong.
5390
5631
  * This is optional - tools can use this when they want to provide extra context.
@@ -5412,7 +5653,7 @@ function enhanceNotFoundError(error, params) {
5412
5653
  }
5413
5654
 
5414
5655
  //#endregion
5415
- //#region ../mcp-core/dist/get-issue-details-nrbE6Tst.js
5656
+ //#region ../mcp-core/dist/get-issue-details-2uGxQtn4.js
5416
5657
  var get_issue_details_default = defineTool({
5417
5658
  name: "get_issue_details",
5418
5659
  skills: [
@@ -5421,7 +5662,7 @@ var get_issue_details_default = defineTool({
5421
5662
  "seer"
5422
5663
  ],
5423
5664
  requiredScopes: ["event:read"],
5424
- hideInExperimentalMode: true,
5665
+ internalOnly: true,
5425
5666
  description: [
5426
5667
  "Get detailed information about a specific Sentry issue by ID.",
5427
5668
  "",
@@ -5473,8 +5714,8 @@ var get_issue_details_default = defineTool({
5473
5714
  readOnlyHint: true,
5474
5715
  openWorldHint: true
5475
5716
  },
5476
- async handler(params, context$2) {
5477
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
5717
+ async handler(params, context$1) {
5718
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
5478
5719
  if (params.eventId) {
5479
5720
  const orgSlug$1 = params.organizationSlug;
5480
5721
  const eventId = params.eventId;
@@ -5493,7 +5734,7 @@ var get_issue_details_default = defineTool({
5493
5734
  if (!found) return `# Event Not Found\n\nNo issue found for Event ID: ${eventId}`;
5494
5735
  issue$1 = found;
5495
5736
  }
5496
- const [{ event: event$1, performanceTrace: performanceTrace$1 }, { autofixState: autofixState$1, externalIssues: externalIssues$1 }] = await Promise.all([apiService.getEventForIssue({
5737
+ const [{ event: event$1, performanceTrace: performanceTrace$1 }, { autofixState: autofixState$1, externalIssues: externalIssues$1, relatedReplayIds: relatedReplayIds$1 }] = await Promise.all([apiService.getEventForIssue({
5497
5738
  organizationSlug: orgSlug$1,
5498
5739
  issueId: issue$1.shortId,
5499
5740
  eventId
@@ -5514,7 +5755,7 @@ var get_issue_details_default = defineTool({
5514
5755
  })), fetchIssueEnrichmentData({
5515
5756
  apiService,
5516
5757
  organizationSlug: orgSlug$1,
5517
- issueId: issue$1.shortId
5758
+ issue: issue$1
5518
5759
  })]);
5519
5760
  return formatIssueOutput({
5520
5761
  organizationSlug: orgSlug$1,
@@ -5524,7 +5765,8 @@ var get_issue_details_default = defineTool({
5524
5765
  autofixState: autofixState$1,
5525
5766
  performanceTrace: performanceTrace$1,
5526
5767
  externalIssues: externalIssues$1,
5527
- experimentalMode: context$2.experimentalMode
5768
+ relatedReplayIds: relatedReplayIds$1,
5769
+ experimentalMode: context$1.experimentalMode
5528
5770
  });
5529
5771
  }
5530
5772
  if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
@@ -5548,7 +5790,7 @@ var get_issue_details_default = defineTool({
5548
5790
  });
5549
5791
  throw error;
5550
5792
  }
5551
- const [{ event, performanceTrace }, { autofixState, externalIssues }] = await Promise.all([apiService.getLatestEventForIssue({
5793
+ const [{ event, performanceTrace }, { autofixState, externalIssues, relatedReplayIds }] = await Promise.all([apiService.getLatestEventForIssue({
5552
5794
  organizationSlug: orgSlug,
5553
5795
  issueId: issue.shortId
5554
5796
  }).then(async (event$1) => ({
@@ -5561,7 +5803,7 @@ var get_issue_details_default = defineTool({
5561
5803
  })), fetchIssueEnrichmentData({
5562
5804
  apiService,
5563
5805
  organizationSlug: orgSlug,
5564
- issueId: issue.shortId
5806
+ issue
5565
5807
  })]);
5566
5808
  return formatIssueOutput({
5567
5809
  organizationSlug: orgSlug,
@@ -5571,7 +5813,8 @@ var get_issue_details_default = defineTool({
5571
5813
  autofixState,
5572
5814
  performanceTrace,
5573
5815
  externalIssues,
5574
- experimentalMode: context$2.experimentalMode
5816
+ relatedReplayIds,
5817
+ experimentalMode: context$1.experimentalMode
5575
5818
  });
5576
5819
  }
5577
5820
  });
@@ -5580,26 +5823,36 @@ var get_issue_details_default = defineTool({
5580
5823
  * Both calls are non-blocking -- failures are silently caught so they never
5581
5824
  * prevent the primary issue details from being returned.
5582
5825
  */
5583
- async function fetchIssueEnrichmentData({ apiService, organizationSlug, issueId }) {
5584
- const [autofixState, externalIssues] = await Promise.all([apiService.getAutofixState({
5585
- organizationSlug,
5586
- issueId
5587
- }).catch(() => void 0), apiService.getIssueExternalLinks({
5588
- organizationSlug,
5589
- issueId
5590
- }).catch(() => void 0)]);
5826
+ async function fetchIssueEnrichmentData({ apiService, organizationSlug, issue }) {
5827
+ const issueId = String(issue.id);
5828
+ const [autofixState, externalIssues, relatedReplayIds] = await Promise.all([
5829
+ apiService.getAutofixState({
5830
+ organizationSlug,
5831
+ issueId: issue.shortId
5832
+ }).catch(() => void 0),
5833
+ apiService.getIssueExternalLinks({
5834
+ organizationSlug,
5835
+ issueId: issue.shortId
5836
+ }).catch(() => void 0),
5837
+ apiService.listReplayIdsForIssue({
5838
+ organizationSlug,
5839
+ issueId,
5840
+ dataSource: getReplayDataSource(issue)
5841
+ }).catch(() => void 0)
5842
+ ]);
5591
5843
  return {
5592
5844
  autofixState,
5593
- externalIssues
5845
+ externalIssues,
5846
+ relatedReplayIds
5594
5847
  };
5595
5848
  }
5596
5849
  async function maybeFetchPerformanceTrace({ apiService, organizationSlug, event }) {
5597
- const context$2 = shouldFetchTraceForEvent(event);
5598
- if (!context$2) return void 0;
5850
+ const context$1 = shouldFetchTraceForEvent(event);
5851
+ if (!context$1) return void 0;
5599
5852
  try {
5600
5853
  return await apiService.getTrace({
5601
5854
  organizationSlug,
5602
- traceId: context$2.traceId,
5855
+ traceId: context$1.traceId,
5603
5856
  limit: 1e4
5604
5857
  });
5605
5858
  } catch (error) {
@@ -5616,9 +5869,12 @@ function shouldFetchTraceForEvent(event) {
5616
5869
  if (typeof traceId !== "string" || traceId.length === 0) return null;
5617
5870
  return { traceId };
5618
5871
  }
5872
+ function getReplayDataSource(issue) {
5873
+ return issue.issueCategory === "error" || issue.type === "error" ? "discover" : "search_issues";
5874
+ }
5619
5875
 
5620
5876
  //#endregion
5621
- //#region ../mcp-core/dist/get-issue-tag-values-CIP3bFB5.js
5877
+ //#region ../mcp-core/dist/get-issue-tag-values-CurH5U6T.js
5622
5878
  var get_issue_tag_values_default = defineTool({
5623
5879
  name: "get_issue_tag_values",
5624
5880
  skills: ["inspect"],
@@ -5676,8 +5932,8 @@ var get_issue_tag_values_default = defineTool({
5676
5932
  readOnlyHint: true,
5677
5933
  openWorldHint: true
5678
5934
  },
5679
- async handler(params, context$2) {
5680
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
5935
+ async handler(params, context$1) {
5936
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
5681
5937
  if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
5682
5938
  if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
5683
5939
  if (!params.tagKey) throw new UserInputError("`tagKey` is required. Common values: url, browser, environment, release, os, device, user");
@@ -5726,14 +5982,14 @@ var get_issue_tag_values_default = defineTool({
5726
5982
  output += `\n*Showing top ${shownCount} of ${tagValues.totalValues} unique values*\n`;
5727
5983
  }
5728
5984
  output += "\n## Using this information\n\n";
5729
- output += `- Use \`get_issue_details(organizationSlug='${orgSlug}', issueId='${parsedIssueId}')\` to see the full issue details\n`;
5985
+ output += `- Use \`get_sentry_resource(resourceType='issue', organizationSlug='${orgSlug}', resourceId='${parsedIssueId}')\` to see the full issue details\n`;
5730
5986
  output += `- Try other tag keys like: url, browser, environment, release, os, device, user\n`;
5731
5987
  return output;
5732
5988
  }
5733
5989
  });
5734
5990
 
5735
5991
  //#endregion
5736
- //#region ../mcp-core/dist/get-trace-details-CJltq5DV.js
5992
+ //#region ../mcp-core/dist/get-trace-details-C3hHVNzs.js
5737
5993
  const MAX_DEPTH = 2;
5738
5994
  const MINIMUM_DURATION_THRESHOLD_MS = 10;
5739
5995
  const MIN_MEANINGFUL_CHILD_DURATION = 5;
@@ -5743,7 +5999,7 @@ var get_trace_details_default = defineTool({
5743
5999
  skills: ["inspect"],
5744
6000
  requiredScopes: ["event:read"],
5745
6001
  requiredCapabilities: ["traces"],
5746
- hideInExperimentalMode: true,
6002
+ internalOnly: true,
5747
6003
  description: [
5748
6004
  "Get detailed information about a specific Sentry trace by ID.",
5749
6005
  "",
@@ -5782,9 +6038,9 @@ var get_trace_details_default = defineTool({
5782
6038
  readOnlyHint: true,
5783
6039
  openWorldHint: true
5784
6040
  },
5785
- async handler(params, context$2) {
6041
+ async handler(params, context$1) {
5786
6042
  if (!/^[0-9a-fA-F]{32}$/.test(params.traceId)) throw new UserInputError("Trace ID must be a 32-character hexadecimal string");
5787
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
6043
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
5788
6044
  setTag("organization.slug", params.organizationSlug);
5789
6045
  setTag("trace.id", params.traceId);
5790
6046
  const traceMeta = await apiService.getTraceMeta({
@@ -6034,7 +6290,544 @@ function formatTraceOutput({ organizationSlug, traceId, traceMeta, trace: trace$
6034
6290
  }
6035
6291
 
6036
6292
  //#endregion
6037
- //#region ../mcp-core/dist/get-event-attachment-Cc5u5KZA.js
6293
+ //#region ../mcp-core/dist/url-helpers-DGhXHR0Z.js
6294
+ /**
6295
+ * Parses a Sentry URL and extracts resource type and identifiers.
6296
+ *
6297
+ * Supported URL patterns:
6298
+ * - Issue: `/issues/{issueId}` or `/organizations/{org}/issues/{issueId}`
6299
+ * - Event: `/issues/{issueId}/events/{eventId}`
6300
+ * - Trace: `/explore/traces/trace/{traceId}` or `/performance/trace/{traceId}`
6301
+ * - Profile: `/explore/profiling/profile/{project}/flamegraph/` with query params
6302
+ * - Replay: `/replays/{replayId}/`
6303
+ * - Monitor: `/crons/{monitorSlug}/` or `/monitors/{monitorSlug}/`
6304
+ * - Release: `/releases/{version}/`
6305
+ *
6306
+ * Organization slug is extracted from:
6307
+ * 1. Subdomain (e.g., `my-org.sentry.io`)
6308
+ * 2. Path (e.g., `/organizations/my-org/...` or `/my-org/issues/...`)
6309
+ *
6310
+ * @param url - A Sentry URL to parse
6311
+ * @returns Parsed URL with resource type and identifiers
6312
+ * @throws UserInputError if the URL is invalid or cannot be parsed
6313
+ *
6314
+ * @example
6315
+ * // Issue URL
6316
+ * parseSentryUrl("https://my-org.sentry.io/issues/PROJECT-123")
6317
+ * // { type: "issue", organizationSlug: "my-org", issueId: "PROJECT-123" }
6318
+ *
6319
+ * @example
6320
+ * // Replay URL
6321
+ * parseSentryUrl("https://my-org.sentry.io/replays/abc123def456/")
6322
+ * // { type: "replay", organizationSlug: "my-org", replayId: "abc123def456" }
6323
+ *
6324
+ * @example
6325
+ * // Monitor URL
6326
+ * parseSentryUrl("https://my-org.sentry.io/crons/my-cron-job/")
6327
+ * // { type: "monitor", organizationSlug: "my-org", monitorSlug: "my-cron-job" }
6328
+ */
6329
+ function parseSentryUrl(url) {
6330
+ if (!url || typeof url !== "string") throw new UserInputError("Invalid Sentry URL. URL must be a non-empty string.");
6331
+ if (!url.startsWith("http://") && !url.startsWith("https://")) throw new UserInputError("Invalid Sentry URL. Must start with http:// or https://");
6332
+ let parsedUrl;
6333
+ try {
6334
+ parsedUrl = new URL(url);
6335
+ } catch {
6336
+ throw new UserInputError(`Invalid Sentry URL. Unable to parse URL: ${url}`);
6337
+ }
6338
+ const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
6339
+ const organizationSlug = extractOrganizationSlug(parsedUrl, pathParts);
6340
+ return identifyResource(parsedUrl, pathParts, organizationSlug);
6341
+ }
6342
+ /**
6343
+ * Extracts organization slug from URL.
6344
+ *
6345
+ * Checks in order:
6346
+ * 1. `/organizations/{org}/...` path format
6347
+ * 2. `/{org}/issues/...` path format (org before known segments)
6348
+ * 3. Subdomain (e.g., `my-org.sentry.io`) - excluding region prefixes
6349
+ */
6350
+ function extractOrganizationSlug(parsedUrl, pathParts) {
6351
+ if (pathParts.includes("organizations")) {
6352
+ const orgIndex = pathParts.indexOf("organizations");
6353
+ const slug = pathParts[orgIndex + 1];
6354
+ if (slug) return slug;
6355
+ }
6356
+ const knownSegments = [
6357
+ "issues",
6358
+ "explore",
6359
+ "performance",
6360
+ "projects",
6361
+ "settings",
6362
+ "replays",
6363
+ "releases",
6364
+ "crons",
6365
+ "monitors",
6366
+ "alerts",
6367
+ "feedback",
6368
+ "dashboards",
6369
+ "discover",
6370
+ "insights"
6371
+ ];
6372
+ if (pathParts.length > 1 && knownSegments.includes(pathParts[1])) return pathParts[0];
6373
+ const hostParts = parsedUrl.hostname.split(".");
6374
+ const regionPrefixes = [
6375
+ "us",
6376
+ "eu",
6377
+ "de",
6378
+ "www"
6379
+ ];
6380
+ if (hostParts.length >= 2 && !regionPrefixes.includes(hostParts[0])) return hostParts[0];
6381
+ throw new UserInputError("Invalid Sentry URL. Could not determine organization from URL.");
6382
+ }
6383
+ /**
6384
+ * Identifies the resource type and extracts relevant identifiers.
6385
+ */
6386
+ function identifyResource(parsedUrl, pathParts, organizationSlug) {
6387
+ const profilingIndex = pathParts.indexOf("profiling");
6388
+ if (profilingIndex !== -1 && pathParts[profilingIndex + 1] === "profile") {
6389
+ const projectSlug = pathParts[profilingIndex + 2];
6390
+ const profilerId = parsedUrl.searchParams.get("profilerId") || void 0;
6391
+ const start = parsedUrl.searchParams.get("start") || void 0;
6392
+ const end = parsedUrl.searchParams.get("end") || void 0;
6393
+ return {
6394
+ type: "profile",
6395
+ organizationSlug,
6396
+ projectSlug,
6397
+ profilerId,
6398
+ start,
6399
+ end
6400
+ };
6401
+ }
6402
+ const replaysIndex = pathParts.indexOf("replays");
6403
+ if (replaysIndex !== -1) {
6404
+ const replayId = pathParts[replaysIndex + 1];
6405
+ if (replayId && replayId !== "selectors") return {
6406
+ type: "replay",
6407
+ organizationSlug,
6408
+ replayId
6409
+ };
6410
+ }
6411
+ const cronsIndex = pathParts.indexOf("crons");
6412
+ const monitorsIndex = pathParts.indexOf("monitors");
6413
+ const monitorPathIndex = cronsIndex !== -1 ? cronsIndex : monitorsIndex;
6414
+ if (monitorPathIndex !== -1) {
6415
+ const nextPart = pathParts[monitorPathIndex + 1];
6416
+ if (nextPart && nextPart !== "new") {
6417
+ const afterNext = pathParts[monitorPathIndex + 2];
6418
+ if (afterNext && afterNext !== "details") return {
6419
+ type: "monitor",
6420
+ organizationSlug,
6421
+ projectSlug: nextPart,
6422
+ monitorSlug: afterNext
6423
+ };
6424
+ return {
6425
+ type: "monitor",
6426
+ organizationSlug,
6427
+ monitorSlug: nextPart
6428
+ };
6429
+ }
6430
+ }
6431
+ const releasesIndex = pathParts.indexOf("releases");
6432
+ if (releasesIndex !== -1) {
6433
+ const releaseVersion = pathParts[releasesIndex + 1];
6434
+ if (releaseVersion && releaseVersion !== "new-events" && releaseVersion !== "all-events") return {
6435
+ type: "release",
6436
+ organizationSlug,
6437
+ releaseVersion
6438
+ };
6439
+ }
6440
+ const traceIndex = pathParts.indexOf("trace");
6441
+ if (traceIndex !== -1) {
6442
+ const traceId = pathParts[traceIndex + 1];
6443
+ if (traceId) {
6444
+ const nodeParam = parsedUrl.searchParams.get("node");
6445
+ let spanId;
6446
+ if (nodeParam?.startsWith("span-")) spanId = nodeParam.slice(5);
6447
+ return {
6448
+ type: "trace",
6449
+ organizationSlug,
6450
+ traceId,
6451
+ spanId
6452
+ };
6453
+ }
6454
+ }
6455
+ if (pathParts.includes("performance") && pathParts.includes("summary")) {
6456
+ const transaction = parsedUrl.searchParams.get("transaction") || void 0;
6457
+ if (transaction) return {
6458
+ type: "unknown",
6459
+ organizationSlug,
6460
+ transaction
6461
+ };
6462
+ }
6463
+ const issuesIndex = pathParts.indexOf("issues");
6464
+ if (issuesIndex !== -1) {
6465
+ const issueId = pathParts[issuesIndex + 1];
6466
+ if (issueId) {
6467
+ const eventsIndex = pathParts.indexOf("events", issuesIndex);
6468
+ if (eventsIndex !== -1) {
6469
+ const eventId = pathParts[eventsIndex + 1];
6470
+ if (eventId) return {
6471
+ type: "event",
6472
+ organizationSlug,
6473
+ issueId,
6474
+ eventId
6475
+ };
6476
+ }
6477
+ return {
6478
+ type: "issue",
6479
+ organizationSlug,
6480
+ issueId
6481
+ };
6482
+ }
6483
+ }
6484
+ return {
6485
+ type: "unknown",
6486
+ organizationSlug
6487
+ };
6488
+ }
6489
+ /**
6490
+ * Checks if a URL appears to be a Sentry profile URL.
6491
+ *
6492
+ * @param url - URL to check
6493
+ * @returns True if the URL looks like a profile URL
6494
+ */
6495
+ function isProfileUrl(url) {
6496
+ try {
6497
+ const parsed = parseSentryUrl(url);
6498
+ return parsed.type === "profile";
6499
+ } catch {
6500
+ return false;
6501
+ }
6502
+ }
6503
+
6504
+ //#endregion
6505
+ //#region ../mcp-core/dist/get-replay-details-Chw0wCJg.js
6506
+ const MAX_ACTIVITY_EVENTS = 6;
6507
+ const MAX_RELATED_ERRORS = 3;
6508
+ const MAX_RELATED_TRACES = 2;
6509
+ var get_replay_details_default = defineTool({
6510
+ name: "get_replay_details",
6511
+ skills: ["inspect"],
6512
+ requiredScopes: [
6513
+ "org:read",
6514
+ "project:read",
6515
+ "event:read"
6516
+ ],
6517
+ requiredCapabilities: ["replays"],
6518
+ description: [
6519
+ "Get high-level information about a specific Sentry replay by URL or replay ID.",
6520
+ "",
6521
+ "USE THIS TOOL WHEN USERS:",
6522
+ "- Share a replay URL",
6523
+ "- Ask what happened in a specific replay",
6524
+ "- Want a concise replay summary plus the next issue or trace lookups to run",
6525
+ "",
6526
+ "<examples>",
6527
+ "### With replay URL",
6528
+ "```",
6529
+ "get_replay_details(replayUrl='https://my-organization.sentry.io/replays/7e07485f-12f9-416b-8b14-26260799b51f/')",
6530
+ "```",
6531
+ "",
6532
+ "### With organization and replay ID",
6533
+ "```",
6534
+ "get_replay_details(organizationSlug='my-organization', replayId='7e07485f-12f9-416b-8b14-26260799b51f')",
6535
+ "```",
6536
+ "</examples>"
6537
+ ].join("\n"),
6538
+ inputSchema: {
6539
+ replayUrl: ParamReplayUrl.optional(),
6540
+ organizationSlug: ParamOrganizationSlug.optional(),
6541
+ replayId: ParamReplayId.optional(),
6542
+ regionUrl: ParamRegionUrl.nullable().optional()
6543
+ },
6544
+ annotations: {
6545
+ readOnlyHint: true,
6546
+ openWorldHint: true
6547
+ },
6548
+ async handler(params, context$1) {
6549
+ const resolved = resolveReplayParams(params);
6550
+ const regionUrl = await resolveReplayRegionUrl({
6551
+ context: context$1,
6552
+ organizationSlug: resolved.organizationSlug,
6553
+ regionUrl: params.regionUrl ?? context$1.constraints.regionUrl
6554
+ });
6555
+ const apiService = apiServiceFromContext(context$1, { regionUrl: regionUrl ?? void 0 });
6556
+ setTag("organization.slug", resolved.organizationSlug);
6557
+ setTag("replay.id", resolved.replayId);
6558
+ const replay = await apiService.getReplayDetails({
6559
+ organizationSlug: resolved.organizationSlug,
6560
+ replayId: resolved.replayId
6561
+ });
6562
+ const isArchived = replay.is_archived === true;
6563
+ const projectId = replay.project_id != null ? String(replay.project_id) : null;
6564
+ const hasSegments = (replay.count_segments ?? 0) > 0;
6565
+ const [{ segments }, relatedIssues, relatedTraces] = await Promise.all([
6566
+ fetchReplaySegments({
6567
+ apiService,
6568
+ organizationSlug: resolved.organizationSlug,
6569
+ replayId: resolved.replayId,
6570
+ projectId,
6571
+ isArchived,
6572
+ hasSegments
6573
+ }),
6574
+ fetchReplayIssues({
6575
+ apiService,
6576
+ organizationSlug: resolved.organizationSlug,
6577
+ errorIds: replay.error_ids
6578
+ }),
6579
+ fetchReplayTraces({
6580
+ apiService,
6581
+ organizationSlug: resolved.organizationSlug,
6582
+ traceIds: replay.trace_ids
6583
+ })
6584
+ ]);
6585
+ return formatReplayOutput({
6586
+ replay,
6587
+ organizationSlug: resolved.organizationSlug,
6588
+ replayUrl: params.replayUrl ?? apiService.getReplayUrl(resolved.organizationSlug, replay.id),
6589
+ segments,
6590
+ isArchived,
6591
+ relatedIssues,
6592
+ relatedTraces
6593
+ });
6594
+ }
6595
+ });
6596
+ function resolveReplayParams(params) {
6597
+ if (params.replayUrl) {
6598
+ const parsed = parseSentryUrl(params.replayUrl);
6599
+ if (parsed.type !== "replay" || !parsed.replayId) throw new UserInputError("Invalid replay URL. URL must point to a Sentry replay resource.");
6600
+ return {
6601
+ organizationSlug: params.organizationSlug ?? parsed.organizationSlug,
6602
+ replayId: parsed.replayId
6603
+ };
6604
+ }
6605
+ if (!params.organizationSlug || !params.replayId) throw new UserInputError("Provide either `replayUrl` or both `organizationSlug` and `replayId`.");
6606
+ return {
6607
+ organizationSlug: params.organizationSlug,
6608
+ replayId: params.replayId
6609
+ };
6610
+ }
6611
+ async function resolveReplayRegionUrl({ context: context$1, organizationSlug, regionUrl }) {
6612
+ if (regionUrl != null) {
6613
+ const trimmedRegionUrl = regionUrl.trim();
6614
+ return trimmedRegionUrl || null;
6615
+ }
6616
+ try {
6617
+ const organization = await apiServiceFromContext(context$1).getOrganization(organizationSlug);
6618
+ const resolvedRegionUrl = organization.links?.regionUrl?.trim();
6619
+ return resolvedRegionUrl || null;
6620
+ } catch {
6621
+ return null;
6622
+ }
6623
+ }
6624
+ function formatReplayOutput({ replay, organizationSlug, replayUrl, segments, isArchived, relatedIssues, relatedTraces }) {
6625
+ const lines = [];
6626
+ const user = replay.user?.display_name ?? replay.user?.email ?? replay.user?.username ?? replay.user?.id ?? "Anonymous User";
6627
+ const device = replay.device?.name ?? replay.device?.model ?? replay.device?.family ?? null;
6628
+ const activityEvents = extractReplayActivityEvents(segments);
6629
+ lines.push(`# Replay ${replay.id} in **${organizationSlug}**`);
6630
+ lines.push("");
6631
+ lines.push("## Summary");
6632
+ lines.push("");
6633
+ lines.push(`- **Replay URL**: ${replayUrl}`);
6634
+ lines.push(`- **Duration**: ${replay.duration != null ? formatDurationSeconds(replay.duration) : "Unknown"}`);
6635
+ lines.push(`- **Environment**: ${replay.environment ?? "Unknown"}`);
6636
+ lines.push(`- **Browser**: ${formatNameVersion(replay.browser?.name, replay.browser?.version)}`);
6637
+ lines.push(`- **OS**: ${formatNameVersion(replay.os?.name, replay.os?.version)}`);
6638
+ lines.push(`- **User**: ${user}`);
6639
+ if (replay.urls.length > 0) lines.push(`- **URLs**: ${replay.urls.slice(0, 3).join(", ")}`);
6640
+ if (device) lines.push(`- **Device**: ${device}`);
6641
+ if (replay.releases && replay.releases.length > 0) lines.push(`- **Release**: ${replay.releases[0]}`);
6642
+ lines.push("");
6643
+ lines.push("## Activity");
6644
+ lines.push("");
6645
+ if (isArchived) lines.push("Recording is archived and not available for playback.");
6646
+ else if (activityEvents.length > 0) {
6647
+ const startTime = activityEvents[0]?.timestampMs ?? null;
6648
+ for (const event of activityEvents) {
6649
+ const prefix = event.timestampMs !== null && startTime !== null ? `${formatRelativeTime(event.timestampMs - startTime)} · ` : "";
6650
+ const details = event.details.length > 0 ? ` · ${event.details.join(" · ")}` : "";
6651
+ lines.push(`- ${prefix}\`${event.label}\`${details}`);
6652
+ }
6653
+ } else lines.push("No activity events recorded.");
6654
+ const hasRelated = relatedIssues.length > 0 || relatedTraces.length > 0;
6655
+ if (hasRelated) {
6656
+ lines.push("");
6657
+ lines.push("## Related");
6658
+ lines.push("");
6659
+ for (const ri of relatedIssues) if (ri.issue) lines.push(`- **${ri.issue.shortId}**: ${ri.issue.title}`);
6660
+ else lines.push(`- Event \`${ri.eventId}\``);
6661
+ for (const rt of relatedTraces) {
6662
+ const spanInfo = rt.traceMeta ? ` (${rt.traceMeta.span_count} spans)` : "";
6663
+ lines.push(`- Trace \`${rt.traceId}\`${spanInfo}`);
6664
+ }
6665
+ lines.push("");
6666
+ lines.push("Use `get_sentry_resource` to inspect any issue or trace listed above.");
6667
+ }
6668
+ return lines.join("\n");
6669
+ }
6670
+ function formatDurationSeconds(durationSeconds) {
6671
+ if (durationSeconds < 60) return `${durationSeconds}s`;
6672
+ const minutes = Math.floor(durationSeconds / 60);
6673
+ const seconds = durationSeconds % 60;
6674
+ return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
6675
+ }
6676
+ async function fetchReplaySegments({ apiService, organizationSlug, replayId, projectId, isArchived, hasSegments }) {
6677
+ if (isArchived || !projectId || !hasSegments) return { segments: null };
6678
+ try {
6679
+ const segments = await apiService.getReplayRecordingSegments({
6680
+ organizationSlug,
6681
+ projectSlugOrId: projectId,
6682
+ replayId
6683
+ });
6684
+ return { segments };
6685
+ } catch {
6686
+ return { segments: null };
6687
+ }
6688
+ }
6689
+ async function fetchReplayIssues({ apiService, organizationSlug, errorIds }) {
6690
+ const ids = errorIds.slice(0, MAX_RELATED_ERRORS);
6691
+ return Promise.all(ids.map(async (eventId) => {
6692
+ try {
6693
+ const [issue] = await apiService.listIssues({
6694
+ organizationSlug,
6695
+ query: eventId,
6696
+ limit: 1
6697
+ });
6698
+ return {
6699
+ eventId,
6700
+ issue: issue ?? null
6701
+ };
6702
+ } catch {
6703
+ return {
6704
+ eventId,
6705
+ issue: null
6706
+ };
6707
+ }
6708
+ }));
6709
+ }
6710
+ async function fetchReplayTraces({ apiService, organizationSlug, traceIds }) {
6711
+ const ids = traceIds.slice(0, MAX_RELATED_TRACES);
6712
+ return Promise.all(ids.map(async (traceId) => {
6713
+ try {
6714
+ const traceMeta = await apiService.getTraceMeta({
6715
+ organizationSlug,
6716
+ traceId
6717
+ });
6718
+ return {
6719
+ traceId,
6720
+ traceMeta
6721
+ };
6722
+ } catch {
6723
+ return {
6724
+ traceId,
6725
+ traceMeta: null
6726
+ };
6727
+ }
6728
+ }));
6729
+ }
6730
+ function formatNameVersion(name$5, version) {
6731
+ if (name$5 && version) return `${name$5} ${version}`;
6732
+ return name$5 ?? version ?? "Unknown";
6733
+ }
6734
+ function extractReplayActivityEvents(segments) {
6735
+ if (!segments) return [];
6736
+ const events = [];
6737
+ for (const segment of segments) for (const event of segment) {
6738
+ const replayEvent = summarizeReplayEvent(event);
6739
+ if (replayEvent) events.push(replayEvent);
6740
+ if (events.length >= MAX_ACTIVITY_EVENTS) return events;
6741
+ }
6742
+ return events;
6743
+ }
6744
+ function summarizeReplayEvent(event) {
6745
+ if (!isRecord(event)) return null;
6746
+ const timestampMs = getEventTimestampMillis(event.timestamp);
6747
+ const data = isRecord(event.data) ? event.data : null;
6748
+ const tag = typeof data?.tag === "string" ? data.tag : "";
6749
+ const payload = isRecord(data?.payload) ? data.payload : null;
6750
+ if (tag) {
6751
+ const replayEvent = summarizeTaggedReplayEvent(tag, payload);
6752
+ if (replayEvent) return {
6753
+ timestampMs,
6754
+ ...replayEvent
6755
+ };
6756
+ }
6757
+ if (typeof event.type === "number" && data) {
6758
+ const href = typeof data.href === "string" ? data.href : null;
6759
+ if (href) return {
6760
+ timestampMs,
6761
+ label: "page.view",
6762
+ details: [`href=${href}`]
6763
+ };
6764
+ }
6765
+ return null;
6766
+ }
6767
+ function summarizeTaggedReplayEvent(tag, payload) {
6768
+ if (tag === "performanceSpan") {
6769
+ const op = firstString(payload?.op);
6770
+ const description$73 = firstString(payload?.description);
6771
+ const durationMs = isRecord(payload?.data) && typeof payload.data.duration === "number" ? payload.data.duration : null;
6772
+ if (description$73 || op) return {
6773
+ label: op ?? "performanceSpan",
6774
+ details: [description$73 ? `description=${description$73}` : null, durationMs !== null ? `duration_ms=${durationMs}` : null].filter((value) => value !== null)
6775
+ };
6776
+ }
6777
+ if (tag === "ui.click") {
6778
+ const message = firstString(payload?.message, payload?.description);
6779
+ if (message) return {
6780
+ label: tag,
6781
+ details: [`message=${quoteDetail(message)}`]
6782
+ };
6783
+ }
6784
+ const knownKeys = [
6785
+ "message",
6786
+ "description",
6787
+ "category",
6788
+ "type"
6789
+ ];
6790
+ const details = [];
6791
+ for (const key of knownKeys) {
6792
+ const value = firstString(payload?.[key]);
6793
+ if (value) details.push(`${key}=${quoteDetail(value)}`);
6794
+ }
6795
+ const extra = summarizeObject(payload, new Set(knownKeys));
6796
+ if (extra) details.push(extra);
6797
+ return details.length > 0 ? {
6798
+ label: tag,
6799
+ details
6800
+ } : null;
6801
+ }
6802
+ function getEventTimestampMillis(value) {
6803
+ if (typeof value !== "number") return null;
6804
+ return value > 1e12 ? value : value * 1e3;
6805
+ }
6806
+ function formatRelativeTime(offsetMs) {
6807
+ const offsetSeconds = Math.max(0, Math.round(offsetMs / 1e3));
6808
+ if (offsetSeconds < 60) return `T+${offsetSeconds}s`;
6809
+ const minutes = Math.floor(offsetSeconds / 60);
6810
+ const seconds = offsetSeconds % 60;
6811
+ return seconds > 0 ? `T+${minutes}m ${seconds}s` : `T+${minutes}m`;
6812
+ }
6813
+ function summarizeObject(value, excludedKeys = /* @__PURE__ */ new Set()) {
6814
+ if (!isRecord(value)) return null;
6815
+ const entries = Object.entries(value).filter(([key, nested]) => !excludedKeys.has(key) && (typeof nested === "string" || typeof nested === "number")).slice(0, 3).map(([key, nested]) => `${key}=${nested}`);
6816
+ return entries.length > 0 ? `payload=${quoteDetail(entries.join(", "))}` : null;
6817
+ }
6818
+ function firstString(...values) {
6819
+ for (const value of values) if (typeof value === "string" && value.trim()) return value.trim();
6820
+ return null;
6821
+ }
6822
+ function isRecord(value) {
6823
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6824
+ }
6825
+ function quoteDetail(value) {
6826
+ return JSON.stringify(value.trim());
6827
+ }
6828
+
6829
+ //#endregion
6830
+ //#region ../mcp-core/dist/get-event-attachment-C52Cyavz.js
6038
6831
  var get_event_attachment_default = defineTool({
6039
6832
  name: "get_event_attachment",
6040
6833
  skills: ["inspect"],
@@ -6079,8 +6872,8 @@ var get_event_attachment_default = defineTool({
6079
6872
  readOnlyHint: true,
6080
6873
  openWorldHint: true
6081
6874
  },
6082
- async handler(params, context$2) {
6083
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
6875
+ async handler(params, context$1) {
6876
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
6084
6877
  setTag("organization.slug", params.organizationSlug);
6085
6878
  if (params.attachmentId) {
6086
6879
  const attachment = await apiService.getEventAttachment({
@@ -6170,7 +6963,7 @@ var get_event_attachment_default = defineTool({
6170
6963
  });
6171
6964
 
6172
6965
  //#endregion
6173
- //#region ../mcp-core/dist/formatting-CIwRyNGU.js
6966
+ //#region ../mcp-core/dist/formatting-BMQ1BB0J.js
6174
6967
  /**
6175
6968
  * Helper function to format assignedTo field for display
6176
6969
  */
@@ -6182,7 +6975,7 @@ function formatAssignedTo(assignedTo) {
6182
6975
  }
6183
6976
 
6184
6977
  //#endregion
6185
- //#region ../mcp-core/dist/update-issue-DCtBtkoy.js
6978
+ //#region ../mcp-core/dist/update-issue-CA2a7r1b.js
6186
6979
  var update_issue_default = defineTool({
6187
6980
  name: "update_issue",
6188
6981
  skills: ["triage"],
@@ -6246,8 +7039,8 @@ var update_issue_default = defineTool({
6246
7039
  idempotentHint: true,
6247
7040
  openWorldHint: true
6248
7041
  },
6249
- async handler(params, context$2) {
6250
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
7042
+ async handler(params, context$1) {
7043
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
6251
7044
  if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
6252
7045
  if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
6253
7046
  if (!params.status && !params.assignedTo) throw new UserInputError("At least one of `status` or `assignedTo` must be provided to update the issue");
@@ -6283,7 +7076,7 @@ var update_issue_default = defineTool({
6283
7076
  output += `**Assigned To**: ${currentAssignee}\n`;
6284
7077
  output += "\n# Using this information\n\n";
6285
7078
  output += `- The issue has been successfully updated in Sentry\n`;
6286
- output += `- You can view the issue details using: \`get_issue_details(organizationSlug="${orgSlug}", issueId="${updatedIssue.shortId}")\`\n`;
7079
+ output += `- You can view the issue details using: \`get_sentry_resource(resourceType="issue", organizationSlug="${orgSlug}", resourceId="${updatedIssue.shortId}")\`\n`;
6287
7080
  if (params.status === "resolved") output += `- The issue is now marked as resolved and will no longer generate alerts\n`;
6288
7081
  else if (params.status === "ignored") output += `- The issue is now ignored and will not generate alerts until it escalates\n`;
6289
7082
  return output;
@@ -6506,14 +7299,14 @@ var marker13$1 = `vercel.ai.error.${name12$1}`;
6506
7299
  var symbol13$1 = Symbol.for(marker13$1);
6507
7300
  var _a13$1, _b13;
6508
7301
  var TypeValidationError = class _TypeValidationError extends (_b13 = AISDKError, _a13$1 = symbol13$1, _b13) {
6509
- constructor({ value, cause, context: context$2 }) {
7302
+ constructor({ value, cause, context: context$1 }) {
6510
7303
  let contextPrefix = "Type validation failed";
6511
- if (context$2 == null ? void 0 : context$2.field) contextPrefix += ` for ${context$2.field}`;
6512
- if ((context$2 == null ? void 0 : context$2.entityName) || (context$2 == null ? void 0 : context$2.entityId)) {
7304
+ if (context$1 == null ? void 0 : context$1.field) contextPrefix += ` for ${context$1.field}`;
7305
+ if ((context$1 == null ? void 0 : context$1.entityName) || (context$1 == null ? void 0 : context$1.entityId)) {
6513
7306
  contextPrefix += " (";
6514
7307
  const parts = [];
6515
- if (context$2.entityName) parts.push(context$2.entityName);
6516
- if (context$2.entityId) parts.push(`id: "${context$2.entityId}"`);
7308
+ if (context$1.entityName) parts.push(context$1.entityName);
7309
+ if (context$1.entityId) parts.push(`id: "${context$1.entityId}"`);
6517
7310
  contextPrefix += parts.join(", ");
6518
7311
  contextPrefix += ")";
6519
7312
  }
@@ -6525,7 +7318,7 @@ Error message: ${getErrorMessage$1(cause)}`,
6525
7318
  });
6526
7319
  this[_a13$1] = true;
6527
7320
  this.value = value;
6528
- this.context = context$2;
7321
+ this.context = context$1;
6529
7322
  }
6530
7323
  static isInstance(error) {
6531
7324
  return AISDKError.hasMarker(error, marker13$1);
@@ -6541,13 +7334,13 @@ Error message: ${getErrorMessage$1(cause)}`,
6541
7334
  * @param {TypeValidationContext} params.context - Optional context about what is being validated.
6542
7335
  * @returns {TypeValidationError} A TypeValidationError instance.
6543
7336
  */
6544
- static wrap({ value, cause, context: context$2 }) {
7337
+ static wrap({ value, cause, context: context$1 }) {
6545
7338
  var _a15$1, _b15, _c;
6546
- if (_TypeValidationError.isInstance(cause) && cause.value === value && ((_a15$1 = cause.context) == null ? void 0 : _a15$1.field) === (context$2 == null ? void 0 : context$2.field) && ((_b15 = cause.context) == null ? void 0 : _b15.entityName) === (context$2 == null ? void 0 : context$2.entityName) && ((_c = cause.context) == null ? void 0 : _c.entityId) === (context$2 == null ? void 0 : context$2.entityId)) return cause;
7339
+ if (_TypeValidationError.isInstance(cause) && cause.value === value && ((_a15$1 = cause.context) == null ? void 0 : _a15$1.field) === (context$1 == null ? void 0 : context$1.field) && ((_b15 = cause.context) == null ? void 0 : _b15.entityName) === (context$1 == null ? void 0 : context$1.entityName) && ((_c = cause.context) == null ? void 0 : _c.entityId) === (context$1 == null ? void 0 : context$1.entityId)) return cause;
6547
7340
  return new _TypeValidationError({
6548
7341
  value,
6549
7342
  cause,
6550
- context: context$2
7343
+ context: context$1
6551
7344
  });
6552
7345
  }
6553
7346
  };
@@ -7910,7 +8703,7 @@ var zod3ToJsonSchema = (schema, options) => {
7910
8703
  };
7911
8704
  }, {}) : void 0;
7912
8705
  const name2$4 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
7913
- const main = (_a2$4 = parseDef(schema._def, name2$4 === void 0 ? refs : {
8706
+ const main$1 = (_a2$4 = parseDef(schema._def, name2$4 === void 0 ? refs : {
7914
8707
  ...refs,
7915
8708
  currentPath: [
7916
8709
  ...refs.basePath,
@@ -7919,11 +8712,11 @@ var zod3ToJsonSchema = (schema, options) => {
7919
8712
  ]
7920
8713
  }, false)) != null ? _a2$4 : parseAnyDef();
7921
8714
  const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
7922
- if (title !== void 0) main.title = title;
8715
+ if (title !== void 0) main$1.title = title;
7923
8716
  const combined = name2$4 === void 0 ? definitions ? {
7924
- ...main,
8717
+ ...main$1,
7925
8718
  [refs.definitionPath]: definitions
7926
- } : main : {
8719
+ } : main$1 : {
7927
8720
  $ref: [
7928
8721
  ...refs.$refStrategy === "relative" ? [] : refs.basePath,
7929
8722
  refs.definitionPath,
@@ -7931,7 +8724,7 @@ var zod3ToJsonSchema = (schema, options) => {
7931
8724
  ].join("/"),
7932
8725
  [refs.definitionPath]: {
7933
8726
  ...definitions,
7934
- [name2$4]: main
8727
+ [name2$4]: main$1
7935
8728
  }
7936
8729
  };
7937
8730
  combined.$schema = "http://json-schema.org/draft-07/schema#";
@@ -8019,20 +8812,20 @@ function zodSchema(zodSchema2, options) {
8019
8812
  if (isZod4Schema(zodSchema2)) return zod4Schema(zodSchema2, options);
8020
8813
  else return zod3Schema(zodSchema2, options);
8021
8814
  }
8022
- async function validateTypes({ value, schema, context: context$2 }) {
8815
+ async function validateTypes({ value, schema, context: context$1 }) {
8023
8816
  const result = await safeValidateTypes({
8024
8817
  value,
8025
8818
  schema,
8026
- context: context$2
8819
+ context: context$1
8027
8820
  });
8028
8821
  if (!result.success) throw TypeValidationError.wrap({
8029
8822
  value,
8030
8823
  cause: result.error,
8031
- context: context$2
8824
+ context: context$1
8032
8825
  });
8033
8826
  return result.value;
8034
8827
  }
8035
- async function safeValidateTypes({ value, schema, context: context$2 }) {
8828
+ async function safeValidateTypes({ value, schema, context: context$1 }) {
8036
8829
  const actualSchema = asSchema(schema);
8037
8830
  try {
8038
8831
  if (actualSchema.validate == null) return {
@@ -8051,7 +8844,7 @@ async function safeValidateTypes({ value, schema, context: context$2 }) {
8051
8844
  error: TypeValidationError.wrap({
8052
8845
  value,
8053
8846
  cause: result.error,
8054
- context: context$2
8847
+ context: context$1
8055
8848
  }),
8056
8849
  rawValue: value
8057
8850
  };
@@ -8061,7 +8854,7 @@ async function safeValidateTypes({ value, schema, context: context$2 }) {
8061
8854
  error: TypeValidationError.wrap({
8062
8855
  value,
8063
8856
  cause: error,
8064
- context: context$2
8857
+ context: context$1
8065
8858
  }),
8066
8859
  rawValue: value
8067
8860
  };
@@ -13027,7 +13820,65 @@ function createOpenAI(options = {}) {
13027
13820
  var openai = createOpenAI();
13028
13821
 
13029
13822
  //#endregion
13030
- //#region ../mcp-core/dist/openai-provider-AuoUOnou.js
13823
+ //#region ../mcp-core/dist/azure-openai-provider-CL8cBegk.js
13824
+ const DEFAULT_OPENAI_MODEL$1 = "gpt-5";
13825
+ let configuredBaseUrl$2;
13826
+ function setAzureOpenAIBaseUrl(baseUrl) {
13827
+ configuredBaseUrl$2 = baseUrl;
13828
+ }
13829
+ function hasAzureDeploymentPath(baseUrl) {
13830
+ const pathname = new URL(baseUrl).pathname.replace(/\/+$/, "");
13831
+ return /\/openai\/deployments\/[^/]+$/i.test(pathname);
13832
+ }
13833
+ function hasAzureV1Path(baseUrl) {
13834
+ const pathname = new URL(baseUrl).pathname.replace(/\/+$/, "");
13835
+ return /\/openai\/v1$/i.test(pathname);
13836
+ }
13837
+ function getAzureOpenAIApiSurface() {
13838
+ if (!configuredBaseUrl$2) throw new ConfigurationError("Provider \"azure-openai\" requires --openai-base-url to target an Azure OpenAI endpoint.");
13839
+ if (hasAzureV1Path(configuredBaseUrl$2)) return "responses";
13840
+ if (hasAzureDeploymentPath(configuredBaseUrl$2)) return "chat-completions";
13841
+ throw new ConfigurationError("Provider \"azure-openai\" requires an Azure v1 base URL ending in /openai/v1 or a deployment URL ending in /openai/deployments/<deployment>.");
13842
+ }
13843
+ function getAzureOpenAIApiVersion() {
13844
+ const apiVersion = process.env.OPENAI_API_VERSION?.trim();
13845
+ return apiVersion && apiVersion.length > 0 ? apiVersion : void 0;
13846
+ }
13847
+ function createAzureOpenAIFetch(baseUrl) {
13848
+ const apiVersion = getAzureOpenAIApiVersion();
13849
+ const shouldAppendApiVersion = apiVersion !== void 0 && hasAzureDeploymentPath(baseUrl);
13850
+ return async (input, init) => {
13851
+ const requestUrl = input instanceof Request ? new URL(input.url) : new URL(input instanceof URL ? input.href : input.toString());
13852
+ if (shouldAppendApiVersion) requestUrl.searchParams.set("api-version", apiVersion);
13853
+ const headers = new Headers(input instanceof Request ? input.headers : void 0);
13854
+ if (init?.headers) for (const [key, value] of new Headers(init.headers).entries()) headers.set(key, value);
13855
+ if (process.env.OPENAI_API_KEY) headers.set("api-key", process.env.OPENAI_API_KEY);
13856
+ if (input instanceof Request) return fetch(new Request(requestUrl.toString(), input), {
13857
+ ...init,
13858
+ headers
13859
+ });
13860
+ return fetch(requestUrl.toString(), {
13861
+ ...init,
13862
+ headers
13863
+ });
13864
+ };
13865
+ }
13866
+ function getAzureOpenAIModel(model) {
13867
+ if (!configuredBaseUrl$2) throw new ConfigurationError("Provider \"azure-openai\" requires --openai-base-url to target an Azure OpenAI endpoint.");
13868
+ const apiSurface = getAzureOpenAIApiSurface();
13869
+ const modelId = model ?? (process.env.OPENAI_MODEL || DEFAULT_OPENAI_MODEL$1);
13870
+ const factory$1 = createOpenAI({
13871
+ baseURL: configuredBaseUrl$2,
13872
+ headers: { "User-Agent": USER_AGENT },
13873
+ name: "azure-openai",
13874
+ fetch: createAzureOpenAIFetch(configuredBaseUrl$2)
13875
+ });
13876
+ if (apiSurface === "chat-completions") return factory$1.chat(modelId);
13877
+ return factory$1(modelId);
13878
+ }
13879
+
13880
+ //#endregion
13881
+ //#region ../mcp-core/dist/openai-provider-Dgg1ZY8a.js
13031
13882
  const DEFAULT_OPENAI_MODEL = "gpt-5";
13032
13883
  let configuredBaseUrl$1;
13033
13884
  /**
@@ -13042,7 +13893,7 @@ function setOpenAIBaseUrl(baseUrl) {
13042
13893
  *
13043
13894
  * Works with:
13044
13895
  * - OpenAI API directly (default)
13045
- * - Any OpenAI-compatible API via custom base URL (Vercel AI Gateway, Azure OpenAI, etc.)
13896
+ * - Generic OpenAI-compatible APIs via custom base URL (Vercel AI Gateway, proxies, etc.)
13046
13897
  *
13047
13898
  * Configuration:
13048
13899
  * - OPENAI_API_KEY: API key for authentication (required)
@@ -13053,6 +13904,9 @@ function setOpenAIBaseUrl(baseUrl) {
13053
13904
  * - Direct OpenAI: "gpt-4o", "gpt-4-turbo", etc.
13054
13905
  * - Vercel AI Gateway: "openai/gpt-4o", "anthropic/claude-sonnet-4.5", etc.
13055
13906
  * - Other providers: Check their documentation
13907
+ *
13908
+ * Azure-specific endpoint routing lives in the dedicated `azure-openai`
13909
+ * provider so generic OpenAI-compatible endpoints keep predictable behavior.
13056
13910
  */
13057
13911
  function getOpenAIModel(model) {
13058
13912
  const defaultModel = process.env.OPENAI_MODEL || DEFAULT_OPENAI_MODEL;
@@ -13678,14 +14532,14 @@ var CacheControlValidator = class {
13678
14532
  this.breakpointCount = 0;
13679
14533
  this.warnings = [];
13680
14534
  }
13681
- getCacheControl(providerMetadata, context$2) {
14535
+ getCacheControl(providerMetadata, context$1) {
13682
14536
  const cacheControlValue = getCacheControl(providerMetadata);
13683
14537
  if (!cacheControlValue) return void 0;
13684
- if (!context$2.canCache) {
14538
+ if (!context$1.canCache) {
13685
14539
  this.warnings.push({
13686
14540
  type: "unsupported",
13687
14541
  feature: "cache_control on non-cacheable context",
13688
- details: `cache_control cannot be set on ${context$2.type}. It will be ignored.`
14542
+ details: `cache_control cannot be set on ${context$1.type}. It will be ignored.`
13689
14543
  });
13690
14544
  return void 0;
13691
14545
  }
@@ -15089,14 +15943,14 @@ var AnthropicMessagesLanguageModel = class {
15089
15943
  type: "json_schema",
15090
15944
  schema: responseFormat.schema
15091
15945
  } },
15092
- ...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && { mcp_servers: anthropicOptions.mcpServers.map((server$1) => ({
15093
- type: server$1.type,
15094
- name: server$1.name,
15095
- url: server$1.url,
15096
- authorization_token: server$1.authorizationToken,
15097
- tool_configuration: server$1.toolConfiguration ? {
15098
- allowed_tools: server$1.toolConfiguration.allowedTools,
15099
- enabled: server$1.toolConfiguration.enabled
15946
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && { mcp_servers: anthropicOptions.mcpServers.map((server) => ({
15947
+ type: server.type,
15948
+ name: server.name,
15949
+ url: server.url,
15950
+ authorization_token: server.authorizationToken,
15951
+ tool_configuration: server.toolConfiguration ? {
15952
+ allowed_tools: server.toolConfiguration.allowedTools,
15953
+ enabled: server.toolConfiguration.enabled
15100
15954
  } : void 0
15101
15955
  })) },
15102
15956
  ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && { container: anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0 ? {
@@ -16574,7 +17428,7 @@ function createAnthropic(options = {}) {
16574
17428
  var anthropic = createAnthropic();
16575
17429
 
16576
17430
  //#endregion
16577
- //#region ../mcp-core/dist/anthropic-provider-Dwv0Mug0.js
17431
+ //#region ../mcp-core/dist/anthropic-provider-ThWzRpbo.js
16578
17432
  const DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-5";
16579
17433
  let configuredBaseUrl;
16580
17434
  /**
@@ -16602,7 +17456,7 @@ function getAnthropicModel(model) {
16602
17456
  }
16603
17457
 
16604
17458
  //#endregion
16605
- //#region ../mcp-core/dist/provider-factory-C_ngaJ9s.js
17459
+ //#region ../mcp-core/dist/provider-factory-CTzV6hDZ.js
16606
17460
  let configuredProvider;
16607
17461
  /**
16608
17462
  * Configure the embedded agent provider explicitly.
@@ -16615,8 +17469,9 @@ function setAgentProvider(provider) {
16615
17469
  * Configure base URLs for providers (called from CLI).
16616
17470
  */
16617
17471
  function setProviderBaseUrls(config) {
16618
- if (config.openaiBaseUrl) setOpenAIBaseUrl(config.openaiBaseUrl);
16619
- if (config.anthropicBaseUrl) setAnthropicBaseUrl(config.anthropicBaseUrl);
17472
+ setOpenAIBaseUrl(config.openaiBaseUrl);
17473
+ setAzureOpenAIBaseUrl(config.openaiBaseUrl);
17474
+ setAnthropicBaseUrl(config.anthropicBaseUrl);
16620
17475
  }
16621
17476
  /**
16622
17477
  * Check if both API keys are present, indicating a conflict.
@@ -16630,7 +17485,8 @@ function detectProviderConflict() {
16630
17485
  function hasApiKeyForProvider(type) {
16631
17486
  switch (type) {
16632
17487
  case "anthropic": return Boolean(process.env.ANTHROPIC_API_KEY);
16633
- case "openai": return Boolean(process.env.OPENAI_API_KEY);
17488
+ case "openai":
17489
+ case "azure-openai": return Boolean(process.env.OPENAI_API_KEY);
16634
17490
  }
16635
17491
  }
16636
17492
  /**
@@ -16639,7 +17495,8 @@ function hasApiKeyForProvider(type) {
16639
17495
  function getApiKeyName(type) {
16640
17496
  switch (type) {
16641
17497
  case "anthropic": return "ANTHROPIC_API_KEY";
16642
- case "openai": return "OPENAI_API_KEY";
17498
+ case "openai":
17499
+ case "azure-openai": return "OPENAI_API_KEY";
16643
17500
  }
16644
17501
  }
16645
17502
  /**
@@ -16649,17 +17506,31 @@ function buildProvider(type) {
16649
17506
  switch (type) {
16650
17507
  case "anthropic": return {
16651
17508
  type: "anthropic",
17509
+ label: "anthropic",
16652
17510
  getModel: getAnthropicModel,
16653
17511
  getProviderOptions: () => ({})
16654
17512
  };
16655
17513
  case "openai": return {
16656
17514
  type: "openai",
17515
+ label: "openai responses API",
16657
17516
  getModel: getOpenAIModel,
16658
17517
  getProviderOptions: () => ({ openai: {
16659
17518
  structuredOutputs: false,
16660
17519
  strictJsonSchema: false
16661
17520
  } })
16662
17521
  };
17522
+ case "azure-openai": {
17523
+ const apiSurface = getAzureOpenAIApiSurface();
17524
+ return {
17525
+ type: "azure-openai",
17526
+ label: `azure-openai ${apiSurface === "chat-completions" ? "chat completions" : "responses"} API`,
17527
+ getModel: getAzureOpenAIModel,
17528
+ getProviderOptions: () => ({ openai: {
17529
+ structuredOutputs: false,
17530
+ strictJsonSchema: false
17531
+ } })
17532
+ };
17533
+ }
16663
17534
  }
16664
17535
  }
16665
17536
  /**
@@ -16669,7 +17540,7 @@ function buildProvider(type) {
16669
17540
  function resolveProviderType() {
16670
17541
  if (configuredProvider) return configuredProvider;
16671
17542
  const envProvider = process.env.EMBEDDED_AGENT_PROVIDER?.toLowerCase();
16672
- if (envProvider === "openai" || envProvider === "anthropic") return envProvider;
17543
+ if (envProvider === "openai" || envProvider === "azure-openai" || envProvider === "anthropic") return envProvider;
16673
17544
  if (detectProviderConflict()) return void 0;
16674
17545
  if (process.env.ANTHROPIC_API_KEY) return "anthropic";
16675
17546
  if (process.env.OPENAI_API_KEY) return "openai";
@@ -16688,7 +17559,7 @@ function resolveProviderType() {
16688
17559
  function getAgentProvider() {
16689
17560
  const providerType = resolveProviderType();
16690
17561
  if (providerType && !hasApiKeyForProvider(providerType)) throw new ConfigurationError(`Provider "${providerType}" is configured but ${getApiKeyName(providerType)} is not set. Please set the API key environment variable.`);
16691
- if (!providerType && detectProviderConflict()) throw new ConfigurationError("Both ANTHROPIC_API_KEY and OPENAI_API_KEY are set. Please specify which provider to use by setting the EMBEDDED_AGENT_PROVIDER environment variable to 'openai' or 'anthropic'.");
17562
+ if (!providerType && detectProviderConflict()) throw new ConfigurationError("Both ANTHROPIC_API_KEY and OPENAI_API_KEY are set. Please specify which provider to use by setting the EMBEDDED_AGENT_PROVIDER environment variable to 'openai', 'azure-openai', or 'anthropic'.");
16692
17563
  if (!providerType) throw new ConfigurationError("No embedded agent provider configured. Set OPENAI_API_KEY or ANTHROPIC_API_KEY environment variable, or use --agent-provider flag to specify a provider.");
16693
17564
  return buildProvider(providerType);
16694
17565
  }
@@ -16709,8 +17580,11 @@ function hasAgentProvider() {
16709
17580
  * Returns undefined if no provider is available, API key is missing, or both API keys are present without explicit selection.
16710
17581
  */
16711
17582
  function getResolvedProviderType() {
16712
- const providerType = resolveProviderType();
16713
- return providerType && hasApiKeyForProvider(providerType) ? providerType : void 0;
17583
+ try {
17584
+ return getAgentProvider().type;
17585
+ } catch {
17586
+ return void 0;
17587
+ }
16714
17588
  }
16715
17589
 
16716
17590
  //#endregion
@@ -16789,7 +17663,7 @@ var require_get_vercel_oidc_token = __commonJS({ "../../node_modules/.pnpm/@verc
16789
17663
  err = error;
16790
17664
  }
16791
17665
  try {
16792
- const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([await import("./token-util-D5kD3Z8e.js").then(__toDynamicImportESM()), await import("./token-CwkkxgwR.js").then(__toDynamicImportESM())]);
17666
+ const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([await import("./token-util-DtX1UM9f.js").then(__toDynamicImportESM()), await import("./token-D7eiINbV.js").then(__toDynamicImportESM())]);
16793
17667
  if (!token || isExpired(getTokenPayload(token))) {
16794
17668
  await refreshToken();
16795
17669
  token = getVercelOidcTokenSync();
@@ -18049,14 +18923,14 @@ var BaseContext = function() {
18049
18923
  return self._currentContext.get(key);
18050
18924
  };
18051
18925
  self.setValue = function(key, value) {
18052
- var context$2 = new BaseContext$1(self._currentContext);
18053
- context$2._currentContext.set(key, value);
18054
- return context$2;
18926
+ var context$1 = new BaseContext$1(self._currentContext);
18927
+ context$1._currentContext.set(key, value);
18928
+ return context$1;
18055
18929
  };
18056
18930
  self.deleteValue = function(key) {
18057
- var context$2 = new BaseContext$1(self._currentContext);
18058
- context$2._currentContext.delete(key);
18059
- return context$2;
18931
+ var context$1 = new BaseContext$1(self._currentContext);
18932
+ context$1._currentContext.delete(key);
18933
+ return context$1;
18060
18934
  };
18061
18935
  }
18062
18936
  return BaseContext$1;
@@ -18177,12 +19051,12 @@ var ContextAPI = function() {
18177
19051
  * @param thisArg optional receiver to be used for calling fn
18178
19052
  * @param args optional arguments forwarded to fn
18179
19053
  */
18180
- ContextAPI$1.prototype.with = function(context$2, fn, thisArg) {
19054
+ ContextAPI$1.prototype.with = function(context$1, fn, thisArg) {
18181
19055
  var _a$5;
18182
19056
  var args = [];
18183
19057
  for (var _i = 3; _i < arguments.length; _i++) args[_i - 3] = arguments[_i];
18184
19058
  return (_a$5 = this._getContextManager()).with.apply(_a$5, __spreadArray([
18185
- context$2,
19059
+ context$1,
18186
19060
  fn,
18187
19061
  thisArg
18188
19062
  ], __read(args), false));
@@ -18193,8 +19067,8 @@ var ContextAPI = function() {
18193
19067
  * @param context context to bind to the event emitter or function. Defaults to the currently active context
18194
19068
  * @param target function or event emitter to bind
18195
19069
  */
18196
- ContextAPI$1.prototype.bind = function(context$2, target) {
18197
- return this._getContextManager().bind(context$2, target);
19070
+ ContextAPI$1.prototype.bind = function(context$1, target) {
19071
+ return this._getContextManager().bind(context$1, target);
18198
19072
  };
18199
19073
  ContextAPI$1.prototype._getContextManager = function() {
18200
19074
  return getGlobal(API_NAME$1) || NOOP_CONTEXT_MANAGER;
@@ -18282,8 +19156,8 @@ var SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
18282
19156
  *
18283
19157
  * @param context context to get span from
18284
19158
  */
18285
- function getSpan(context$2) {
18286
- return context$2.getValue(SPAN_KEY) || void 0;
19159
+ function getSpan(context$1) {
19160
+ return context$1.getValue(SPAN_KEY) || void 0;
18287
19161
  }
18288
19162
  /**
18289
19163
  * Gets the span from the current context, if one exists.
@@ -18297,16 +19171,16 @@ function getActiveSpan$1() {
18297
19171
  * @param context context to use as parent
18298
19172
  * @param span span to set active
18299
19173
  */
18300
- function setSpan(context$2, span) {
18301
- return context$2.setValue(SPAN_KEY, span);
19174
+ function setSpan(context$1, span) {
19175
+ return context$1.setValue(SPAN_KEY, span);
18302
19176
  }
18303
19177
  /**
18304
19178
  * Remove current span stored in the context
18305
19179
  *
18306
19180
  * @param context context to delete span from
18307
19181
  */
18308
- function deleteSpan(context$2) {
18309
- return context$2.deleteValue(SPAN_KEY);
19182
+ function deleteSpan(context$1) {
19183
+ return context$1.deleteValue(SPAN_KEY);
18310
19184
  }
18311
19185
  /**
18312
19186
  * Wrap span context in a NoopSpan and set as span in a new
@@ -18315,17 +19189,17 @@ function deleteSpan(context$2) {
18315
19189
  * @param context context to set active span on
18316
19190
  * @param spanContext span context to be wrapped
18317
19191
  */
18318
- function setSpanContext(context$2, spanContext) {
18319
- return setSpan(context$2, new NonRecordingSpan(spanContext));
19192
+ function setSpanContext(context$1, spanContext) {
19193
+ return setSpan(context$1, new NonRecordingSpan(spanContext));
18320
19194
  }
18321
19195
  /**
18322
19196
  * Get the span context of the span if it exists.
18323
19197
  *
18324
19198
  * @param context context to get values from
18325
19199
  */
18326
- function getSpanContext(context$2) {
19200
+ function getSpanContext(context$1) {
18327
19201
  var _a$5;
18328
- return (_a$5 = getSpan(context$2)) === null || _a$5 === void 0 ? void 0 : _a$5.spanContext();
19202
+ return (_a$5 = getSpan(context$1)) === null || _a$5 === void 0 ? void 0 : _a$5.spanContext();
18329
19203
  }
18330
19204
 
18331
19205
  //#endregion
@@ -18363,11 +19237,11 @@ var contextApi = ContextAPI.getInstance();
18363
19237
  */
18364
19238
  var NoopTracer = function() {
18365
19239
  function NoopTracer$1() {}
18366
- NoopTracer$1.prototype.startSpan = function(name$5, options, context$2) {
18367
- if (context$2 === void 0) context$2 = contextApi.active();
19240
+ NoopTracer$1.prototype.startSpan = function(name$5, options, context$1) {
19241
+ if (context$1 === void 0) context$1 = contextApi.active();
18368
19242
  var root = Boolean(options === null || options === void 0 ? void 0 : options.root);
18369
19243
  if (root) return new NonRecordingSpan();
18370
- var parentFromContext = context$2 && getSpanContext(context$2);
19244
+ var parentFromContext = context$1 && getSpanContext(context$1);
18371
19245
  if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) return new NonRecordingSpan(parentFromContext);
18372
19246
  else return new NonRecordingSpan();
18373
19247
  };
@@ -18409,8 +19283,8 @@ var ProxyTracer = function() {
18409
19283
  this.version = version;
18410
19284
  this.options = options;
18411
19285
  }
18412
- ProxyTracer$1.prototype.startSpan = function(name$5, options, context$2) {
18413
- return this._getTracer().startSpan(name$5, options, context$2);
19286
+ ProxyTracer$1.prototype.startSpan = function(name$5, options, context$1) {
19287
+ return this._getTracer().startSpan(name$5, options, context$1);
18414
19288
  };
18415
19289
  ProxyTracer$1.prototype.startActiveSpan = function(_name, _options, _context, _fn) {
18416
19290
  var tracer = this._getTracer();
@@ -18508,7 +19382,7 @@ var SpanStatusCode;
18508
19382
  //#endregion
18509
19383
  //#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/context-api.js
18510
19384
  /** Entrypoint for context API */
18511
- var context$1 = ContextAPI.getInstance();
19385
+ var context = ContextAPI.getInstance();
18512
19386
 
18513
19387
  //#endregion
18514
19388
  //#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/api/trace.js
@@ -19885,9 +20759,9 @@ function getTracer({ isEnabled = false, tracer } = {}) {
19885
20759
  }
19886
20760
  async function recordSpan({ name: name20, tracer, attributes: attributes$73, fn, endWhenDone = true }) {
19887
20761
  return tracer.startActiveSpan(name20, { attributes: await attributes$73 }, async (span) => {
19888
- const ctx = context$1.active();
20762
+ const ctx = context.active();
19889
20763
  try {
19890
- const result = await context$1.with(ctx, () => fn(span));
20764
+ const result = await context.with(ctx, () => fn(span));
19891
20765
  if (endWhenDone) span.end();
19892
20766
  return result;
19893
20767
  } catch (error) {
@@ -22085,7 +22959,7 @@ var _a19;
22085
22959
  _a19 = symbol19;
22086
22960
 
22087
22961
  //#endregion
22088
- //#region ../mcp-core/dist/callEmbeddedAgent-BUmH_7yl.js
22962
+ //#region ../mcp-core/dist/callEmbeddedAgent-CafFXCBs.js
22089
22963
  /**
22090
22964
  * Call an embedded agent with tool call capture
22091
22965
  * This is the standard way to call embedded AI agents within MCP tools
@@ -22236,7 +23110,7 @@ function rescueFromText(text$1, schema) {
22236
23110
  }
22237
23111
 
22238
23112
  //#endregion
22239
- //#region ../mcp-core/dist/utils-CzQHxOri.js
23113
+ //#region ../mcp-core/dist/utils-BJ0gOJGl.js
22240
23114
  /**
22241
23115
  * Standard response schema for all embedded agent tools.
22242
23116
  * Tools return either an error message or the result data, never both.
@@ -22343,7 +23217,7 @@ function agentTool(config) {
22343
23217
  }
22344
23218
 
22345
23219
  //#endregion
22346
- //#region ../mcp-core/dist/otel-semantics-ByiF2y64.js
23220
+ //#region ../mcp-core/dist/otel-semantics-B6fKuCUl.js
22347
23221
  var namespace$72 = "android";
22348
23222
  var description$72 = "The Android platform on which the Android application is running.\n";
22349
23223
  var attributes$72 = {
@@ -27189,7 +28063,7 @@ function createOtelLookupTool(options) {
27189
28063
  }
27190
28064
 
27191
28065
  //#endregion
27192
- //#region ../mcp-core/dist/whoami-wTxZKtZC.js
28066
+ //#region ../mcp-core/dist/whoami-LUGpoeMT.js
27193
28067
  /**
27194
28068
  * Get the current authenticated user's information from Sentry API
27195
28069
  */
@@ -27218,7 +28092,7 @@ function createWhoamiTool(options) {
27218
28092
  }
27219
28093
 
27220
28094
  //#endregion
27221
- //#region ../mcp-core/dist/utils-x09ynXqv.js
28095
+ //#region ../mcp-core/dist/utils-D2prWzmQ.js
27222
28096
  const DEFAULT_MAX_VALUE_LENGTH = 200;
27223
28097
  const DEFAULT_MAX_ARRAY_ITEMS = 20;
27224
28098
  function getStringValue(event, key, defaultValue = "") {
@@ -27228,9 +28102,6 @@ function getStringValue(event, key, defaultValue = "") {
27228
28102
  function isAggregateQuery(fields) {
27229
28103
  return fields.some((field) => field.includes("(") && field.includes(")"));
27230
28104
  }
27231
- function isPlainObject(value) {
27232
- return typeof value === "object" && value !== null && !Array.isArray(value);
27233
- }
27234
28105
  function isPrimitive(value) {
27235
28106
  return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
27236
28107
  }
@@ -27242,20 +28113,38 @@ const USER_FIELDS = [
27242
28113
  "email",
27243
28114
  "username",
27244
28115
  "ip_address",
27245
- "name"
28116
+ "name",
28117
+ "display_name"
27246
28118
  ];
27247
28119
  const USER_IDENTITY_FIELDS = new Set([
27248
28120
  "email",
27249
28121
  "username",
27250
28122
  "ip_address",
27251
- "name"
28123
+ "name",
28124
+ "display_name"
27252
28125
  ]);
27253
- function formatUserSummary(value) {
27254
- const hasIdentityField = USER_FIELDS.some((f) => USER_IDENTITY_FIELDS.has(f) && value[f] != null);
27255
- if (!hasIdentityField) return null;
28126
+ function hasUserIdentityFields(value) {
28127
+ return USER_FIELDS.some((f) => USER_IDENTITY_FIELDS.has(f) && value[f] != null);
28128
+ }
28129
+ function hasUserSummaryFields(value, options = {}) {
28130
+ return hasUserIdentityFields(value) || options.allowId === true && value.id != null;
28131
+ }
28132
+ function formatUserSummary(value, options = {}) {
28133
+ const includeGeo = options.includeGeo ?? true;
28134
+ const allowIdOnly = options.allowIdOnly ?? false;
28135
+ const hasSummaryField = hasUserSummaryFields(value, { allowId: allowIdOnly });
28136
+ if (!hasSummaryField) return null;
27256
28137
  const parts = USER_FIELDS.filter((f) => value[f] != null).map((f) => `${f}=${formatSimpleValue(value[f])}`);
28138
+ const geoSummary = formatUserGeoSummary(value.geo);
28139
+ if (includeGeo && geoSummary) parts.push(`geo=${geoSummary}`);
27257
28140
  return parts.length > 0 ? parts.join(", ") : null;
27258
28141
  }
28142
+ function formatKnownUserValue(value, options = {}) {
28143
+ return formatUserSummary(value, {
28144
+ includeGeo: options.includeGeo,
28145
+ allowIdOnly: true
28146
+ });
28147
+ }
27259
28148
  function sanitizeWhitespace(value) {
27260
28149
  return value.replace(/\s+/g, " ").trim();
27261
28150
  }
@@ -27357,7 +28246,7 @@ function createDatasetAttributesTool(options) {
27357
28246
  "logs"
27358
28247
  ]).describe("The dataset to query attributes for") }),
27359
28248
  execute: async ({ dataset }) => {
27360
- const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await import("./config-NKdlAxBc.js");
28249
+ const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await import("./config-UqbHNH-n.js");
27361
28250
  const { attributes: customAttributes, fieldTypes } = await fetchCustomAttributes(apiService, organizationSlug, dataset, projectId);
27362
28251
  const allFields = {
27363
28252
  ...BASE_COMMON_FIELDS,
@@ -27392,7 +28281,7 @@ Use these examples as patterns for constructing your query.`;
27392
28281
  }
27393
28282
 
27394
28283
  //#endregion
27395
- //#region ../mcp-core/dist/agent-DbDfREhF.js
28284
+ //#region ../mcp-core/dist/agent-4NHLFRHJ.js
27396
28285
  const searchEventsAgentOutputSchema = z.object({
27397
28286
  dataset: z.enum([
27398
28287
  "spans",
@@ -27445,13 +28334,23 @@ async function searchEventsAgent(options) {
27445
28334
  }
27446
28335
 
27447
28336
  //#endregion
27448
- //#region ../mcp-core/dist/formatters-BNBcNMHO.js
28337
+ //#region ../mcp-core/dist/formatters-CiXu948b.js
27449
28338
  /**
27450
28339
  * Format an explanation for how a natural language query was translated
27451
28340
  */
27452
28341
  function formatExplanation$1(explanation) {
27453
28342
  return `## How I interpreted your query\n\n${explanation}`;
27454
28343
  }
28344
+ function formatUserFieldLines(value, options = {}) {
28345
+ const prefix = options.prefix ?? "";
28346
+ const geoSummary = formatUserGeoSummary(value.geo);
28347
+ const userSummary = formatKnownUserValue(value, { includeGeo: false });
28348
+ const lines = [];
28349
+ if (userSummary) lines.push(`${prefix}**user**: ${userSummary}`);
28350
+ else if (!geoSummary) lines.push(`${prefix}**user**: ${formatEventValue(value)}`);
28351
+ if (geoSummary) lines.push(`${prefix}**user.geo**: ${geoSummary}`);
28352
+ return lines;
28353
+ }
27455
28354
  /**
27456
28355
  * Format error event results for display
27457
28356
  */
@@ -27507,7 +28406,13 @@ function formatErrorResults(params) {
27507
28406
  else output += `**${field}**: ${formatEventValue(value)}\n`;
27508
28407
  }
27509
28408
  const displayedFields = new Set([...priorityFields, "id"]);
27510
- for (const [key, value] of Object.entries(event)) if (!displayedFields.has(key) && value !== null && value !== void 0) output += `**${key}**: ${formatEventValue(value)}\n`;
28409
+ for (const [key, value] of Object.entries(event)) if (!displayedFields.has(key) && value !== null && value !== void 0) {
28410
+ if (key === "user" && typeof value === "object" && value !== null) {
28411
+ for (const line of formatUserFieldLines(value)) output += `${line}\n`;
28412
+ continue;
28413
+ }
28414
+ output += `**${key}**: ${formatEventValue(value)}\n`;
28415
+ }
27511
28416
  output += "\n";
27512
28417
  }
27513
28418
  }
@@ -27588,7 +28493,13 @@ function formatLogResults(params) {
27588
28493
  } else output += `- **${field}**: ${formatEventValue(value)}\n`;
27589
28494
  }
27590
28495
  const displayedFields = new Set([...priorityFields, "id"]);
27591
- for (const [key, value] of Object.entries(event)) if (!displayedFields.has(key) && value !== null && value !== void 0) output += `- **${key}**: ${formatEventValue(value)}\n`;
28496
+ for (const [key, value] of Object.entries(event)) if (!displayedFields.has(key) && value !== null && value !== void 0) {
28497
+ if (key === "user" && typeof value === "object" && value !== null) {
28498
+ for (const line of formatUserFieldLines(value, { prefix: "- " })) output += `${line}\n`;
28499
+ continue;
28500
+ }
28501
+ output += `- **${key}**: ${formatEventValue(value)}\n`;
28502
+ }
27592
28503
  output += "\n";
27593
28504
  }
27594
28505
  }
@@ -27652,7 +28563,13 @@ function formatSpanResults(params) {
27652
28563
  else output += `**${field}**: ${formatEventValue(value)}\n`;
27653
28564
  }
27654
28565
  const displayedFields = new Set([...priorityFields, "id"]);
27655
- for (const [key, value] of Object.entries(event)) if (!displayedFields.has(key) && value !== null && value !== void 0) output += `**${key}**: ${formatEventValue(value)}\n`;
28566
+ for (const [key, value] of Object.entries(event)) if (!displayedFields.has(key) && value !== null && value !== void 0) {
28567
+ if (key === "user" && typeof value === "object" && value !== null) {
28568
+ for (const line of formatUserFieldLines(value)) output += `${line}\n`;
28569
+ continue;
28570
+ }
28571
+ output += `**${key}**: ${formatEventValue(value)}\n`;
28572
+ }
27656
28573
  output += "\n";
27657
28574
  }
27658
28575
  }
@@ -27664,7 +28581,7 @@ function formatSpanResults(params) {
27664
28581
  }
27665
28582
 
27666
28583
  //#endregion
27667
- //#region ../mcp-core/dist/handler-VSnC5MOS.js
28584
+ //#region ../mcp-core/dist/handler-D_U0I33Y.js
27668
28585
  var handler_default = defineTool({
27669
28586
  name: "search_events",
27670
28587
  skills: [
@@ -27723,8 +28640,8 @@ var handler_default = defineTool({
27723
28640
  readOnlyHint: true,
27724
28641
  openWorldHint: true
27725
28642
  },
27726
- async handler(params, context$2) {
27727
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
28643
+ async handler(params, context$1) {
28644
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
27728
28645
  const organizationSlug = params.organizationSlug;
27729
28646
  setTag("organization.slug", organizationSlug);
27730
28647
  if (params.projectSlug) setTag("project.slug", params.projectSlug);
@@ -27805,7 +28722,7 @@ var handler_default = defineTool({
27805
28722
  });
27806
28723
 
27807
28724
  //#endregion
27808
- //#region ../mcp-core/dist/create-team-XcwhOmfq.js
28725
+ //#region ../mcp-core/dist/create-team-ffsb-XSI.js
27809
28726
  var create_team_default = defineTool({
27810
28727
  name: "create_team",
27811
28728
  skills: ["project-management"],
@@ -27841,8 +28758,8 @@ var create_team_default = defineTool({
27841
28758
  destructiveHint: false,
27842
28759
  openWorldHint: true
27843
28760
  },
27844
- async handler(params, context$2) {
27845
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
28761
+ async handler(params, context$1) {
28762
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
27846
28763
  const organizationSlug = params.organizationSlug;
27847
28764
  setTag("organization.slug", organizationSlug);
27848
28765
  const team = await apiService.createTeam({
@@ -27860,7 +28777,7 @@ var create_team_default = defineTool({
27860
28777
  });
27861
28778
 
27862
28779
  //#endregion
27863
- //#region ../mcp-core/dist/create-project-B4P7uXco.js
28780
+ //#region ../mcp-core/dist/create-project-B2VvJ14B.js
27864
28781
  var create_project_default = defineTool({
27865
28782
  name: "create_project",
27866
28783
  skills: ["project-management"],
@@ -27902,8 +28819,8 @@ var create_project_default = defineTool({
27902
28819
  destructiveHint: false,
27903
28820
  openWorldHint: true
27904
28821
  },
27905
- async handler(params, context$2) {
27906
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
28822
+ async handler(params, context$1) {
28823
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
27907
28824
  const organizationSlug = params.organizationSlug;
27908
28825
  setTag("organization.slug", organizationSlug);
27909
28826
  setTag("team.slug", params.teamSlug);
@@ -27937,7 +28854,7 @@ var create_project_default = defineTool({
27937
28854
  });
27938
28855
 
27939
28856
  //#endregion
27940
- //#region ../mcp-core/dist/update-project-BSgEPew1.js
28857
+ //#region ../mcp-core/dist/update-project-1XC16fxk.js
27941
28858
  var update_project_default = defineTool({
27942
28859
  name: "update_project",
27943
28860
  skills: ["project-management"],
@@ -27995,8 +28912,8 @@ var update_project_default = defineTool({
27995
28912
  idempotentHint: true,
27996
28913
  openWorldHint: true
27997
28914
  },
27998
- async handler(params, context$2) {
27999
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
28915
+ async handler(params, context$1) {
28916
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
28000
28917
  const organizationSlug = params.organizationSlug;
28001
28918
  setTag("organization.slug", organizationSlug);
28002
28919
  setTag("project.slug", params.projectSlug);
@@ -28055,7 +28972,7 @@ var update_project_default = defineTool({
28055
28972
  });
28056
28973
 
28057
28974
  //#endregion
28058
- //#region ../mcp-core/dist/create-dsn-Lsv5Tm4_.js
28975
+ //#region ../mcp-core/dist/create-dsn-CHweFOtw.js
28059
28976
  var create_dsn_default = defineTool({
28060
28977
  name: "create_dsn",
28061
28978
  skills: ["project-management"],
@@ -28095,8 +29012,8 @@ var create_dsn_default = defineTool({
28095
29012
  destructiveHint: false,
28096
29013
  openWorldHint: true
28097
29014
  },
28098
- async handler(params, context$2) {
28099
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
29015
+ async handler(params, context$1) {
29016
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
28100
29017
  const organizationSlug = params.organizationSlug;
28101
29018
  setTag("organization.slug", organizationSlug);
28102
29019
  setTag("project.slug", params.projectSlug);
@@ -28115,7 +29032,7 @@ var create_dsn_default = defineTool({
28115
29032
  });
28116
29033
 
28117
29034
  //#endregion
28118
- //#region ../mcp-core/dist/find-dsns-DTar-HyI.js
29035
+ //#region ../mcp-core/dist/find-dsns-Bed9HEVp.js
28119
29036
  var find_dsns_default = defineTool({
28120
29037
  name: "find_dsns",
28121
29038
  skills: ["project-management"],
@@ -28140,8 +29057,8 @@ var find_dsns_default = defineTool({
28140
29057
  readOnlyHint: true,
28141
29058
  openWorldHint: true
28142
29059
  },
28143
- async handler(params, context$2) {
28144
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
29060
+ async handler(params, context$1) {
29061
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
28145
29062
  const organizationSlug = params.organizationSlug;
28146
29063
  setTag("organization.slug", organizationSlug);
28147
29064
  setTag("project.slug", params.projectSlug);
@@ -28166,7 +29083,7 @@ var find_dsns_default = defineTool({
28166
29083
  });
28167
29084
 
28168
29085
  //#endregion
28169
- //#region ../mcp-core/dist/fetch-utils-LjUGSOvJ.js
29086
+ //#region ../mcp-core/dist/fetch-utils-BFE0P13H.js
28170
29087
  /**
28171
29088
  * Fetch with timeout using AbortController
28172
29089
  * @param url - The URL to fetch
@@ -28216,7 +29133,7 @@ async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, should
28216
29133
  }
28217
29134
 
28218
29135
  //#endregion
28219
- //#region ../mcp-core/dist/analyze-issue-with-seer-BB1LSJmW.js
29136
+ //#region ../mcp-core/dist/analyze-issue-with-seer-Dm-MPYES.js
28220
29137
  var analyze_issue_with_seer_default = defineTool({
28221
29138
  name: "analyze_issue_with_seer",
28222
29139
  skills: ["seer"],
@@ -28228,7 +29145,7 @@ var analyze_issue_with_seer_default = defineTool({
28228
29145
  "- The user explicitly asks for root cause analysis, Seer analysis, or help fixing/debugging an issue",
28229
29146
  "- You are unable to accurately determine the root cause from the issue details alone",
28230
29147
  "",
28231
- "Do NOT call this tool as an automatic follow-up to get_issue_details.",
29148
+ "Do NOT call this tool as an automatic follow-up to get_sentry_resource.",
28232
29149
  "",
28233
29150
  "What this tool provides:",
28234
29151
  "- Root cause analysis with code-level explanations",
@@ -28274,8 +29191,8 @@ var analyze_issue_with_seer_default = defineTool({
28274
29191
  destructiveHint: false,
28275
29192
  openWorldHint: true
28276
29193
  },
28277
- async handler(params, context$2) {
28278
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
29194
+ async handler(params, context$1) {
29195
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
28279
29196
  const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
28280
29197
  organizationSlug: params.organizationSlug,
28281
29198
  issueId: params.issueId,
@@ -28404,7 +29321,7 @@ var analyze_issue_with_seer_default = defineTool({
28404
29321
  });
28405
29322
 
28406
29323
  //#endregion
28407
- //#region ../mcp-core/dist/search-docs-BSAFG7hT.js
29324
+ //#region ../mcp-core/dist/search-docs-BZ-uFOdh.js
28408
29325
  var search_docs_default = defineTool({
28409
29326
  name: "search_docs",
28410
29327
  skills: ["docs"],
@@ -28441,12 +29358,12 @@ var search_docs_default = defineTool({
28441
29358
  readOnlyHint: true,
28442
29359
  openWorldHint: true
28443
29360
  },
28444
- async handler(params, context$2) {
29361
+ async handler(params, context$1) {
28445
29362
  let output = `# Documentation Search Results\n\n`;
28446
29363
  output += `**Query**: "${params.query}"\n`;
28447
29364
  if (params.guide) output += `**Guide**: ${params.guide}\n`;
28448
29365
  output += `\n`;
28449
- const host = context$2.mcpUrl || "https://mcp.sentry.dev";
29366
+ const host = context$1.mcpUrl || "https://mcp.sentry.dev";
28450
29367
  const searchUrl = new URL("/api/search", host);
28451
29368
  const response = await fetchWithTimeout(searchUrl.toString(), {
28452
29369
  method: "POST",
@@ -28487,7 +29404,7 @@ var search_docs_default = defineTool({
28487
29404
  });
28488
29405
 
28489
29406
  //#endregion
28490
- //#region ../mcp-core/dist/get-doc-wVntmE_a.js
29407
+ //#region ../mcp-core/dist/get-doc-DybqY2qB.js
28491
29408
  var get_doc_default = defineTool({
28492
29409
  name: "get_doc",
28493
29410
  skills: ["docs"],
@@ -28519,7 +29436,7 @@ var get_doc_default = defineTool({
28519
29436
  readOnlyHint: true,
28520
29437
  openWorldHint: true
28521
29438
  },
28522
- async handler(params, context$2) {
29439
+ async handler(params, context$1) {
28523
29440
  setTag("doc.path", params.path);
28524
29441
  let output = `# Documentation Content\n\n`;
28525
29442
  output += `**Path**: ${params.path}\n\n`;
@@ -28564,7 +29481,7 @@ var get_doc_default = defineTool({
28564
29481
  });
28565
29482
 
28566
29483
  //#endregion
28567
- //#region ../mcp-core/dist/dataset-fields-33xy_jvb.js
29484
+ //#region ../mcp-core/dist/dataset-fields-CGkReqkR.js
28568
29485
  /**
28569
29486
  * Discover available fields for a dataset by querying Sentry's tags API
28570
29487
  */
@@ -28714,7 +29631,7 @@ function getCommonPatterns(dataset) {
28714
29631
  }
28715
29632
 
28716
29633
  //#endregion
28717
- //#region ../mcp-core/dist/config-DUCtK3n7.js
29634
+ //#region ../mcp-core/dist/config-CL2ib45U.js
28718
29635
  /**
28719
29636
  * Configuration for the search-issues agent
28720
29637
  */
@@ -28806,7 +29723,7 @@ Always use the issueFields tool to discover available fields when needed.
28806
29723
  Use the whoami tool when you need to resolve 'me' references.`;
28807
29724
 
28808
29725
  //#endregion
28809
- //#region ../mcp-core/dist/agent-Cm65dRad.js
29726
+ //#region ../mcp-core/dist/agent-BhpZL6Iz.js
28810
29727
  const searchIssuesAgentOutputSchema = z.object({
28811
29728
  query: z.string().describe("The Sentry issue search query"),
28812
29729
  sort: z.enum([
@@ -28839,7 +29756,7 @@ async function searchIssuesAgent(options) {
28839
29756
  }
28840
29757
 
28841
29758
  //#endregion
28842
- //#region ../mcp-core/dist/formatters-CmSUV_Iz.js
29759
+ //#region ../mcp-core/dist/formatters-CfxrALIQ.js
28843
29760
  /**
28844
29761
  * Format an explanation for how a natural language query was translated
28845
29762
  */
@@ -28897,11 +29814,11 @@ function formatIssueResults(params) {
28897
29814
  output += "\n";
28898
29815
  });
28899
29816
  output += "## Next Steps\n\n";
28900
- output += "- Get more details about a specific issue: Use the Issue ID with get_issue_details\n";
29817
+ output += "- Get more details about a specific issue: Use get_sentry_resource with the issue ID or issue URL\n";
28901
29818
  output += "- Update issue status: Use update_issue to resolve or assign issues\n";
28902
29819
  output += "- View event counts: Use search_events for aggregated statistics\n";
28903
29820
  const hasFeedback = issues.some((i) => i.issueCategory === "feedback");
28904
- if (hasFeedback) output += "- View feedback details: Use get_issue_details to see full feedback content and linked error events\n";
29821
+ if (hasFeedback) output += "- View feedback details: Use get_sentry_resource to see full feedback content and linked error events\n";
28905
29822
  return output;
28906
29823
  }
28907
29824
  /**
@@ -28924,7 +29841,7 @@ function formatDate(dateString) {
28924
29841
  }
28925
29842
 
28926
29843
  //#endregion
28927
- //#region ../mcp-core/dist/handler-WUQMU6e1.js
29844
+ //#region ../mcp-core/dist/handler-zYxvmdYX.js
28928
29845
  var handler_default$1 = defineTool({
28929
29846
  name: "search_issues",
28930
29847
  skills: [
@@ -28954,7 +29871,7 @@ var handler_default$1 = defineTool({
28954
29871
  "",
28955
29872
  "ALSO DO NOT USE FOR:",
28956
29873
  "- Individual error events with timestamps → use search_events",
28957
- "- Details about a specific issue ID → use get_issue_details",
29874
+ "- Details about a specific issue ID or Sentry issue URL → use get_sentry_resource",
28958
29875
  "",
28959
29876
  "REMEMBER: This tool returns a LIST of issues, not counts or statistics!",
28960
29877
  "",
@@ -28983,8 +29900,8 @@ var handler_default$1 = defineTool({
28983
29900
  readOnlyHint: true,
28984
29901
  openWorldHint: true
28985
29902
  },
28986
- async handler(params, context$2) {
28987
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
29903
+ async handler(params, context$1) {
29904
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
28988
29905
  setTag("organization.slug", params.organizationSlug);
28989
29906
  if (params.projectSlugOrId) if (isNumericId(params.projectSlugOrId)) setTag("project.id", params.projectSlugOrId);
28990
29907
  else setTag("project.slug", params.projectSlugOrId);
@@ -29047,7 +29964,7 @@ var handler_default$1 = defineTool({
29047
29964
  });
29048
29965
 
29049
29966
  //#endregion
29050
- //#region ../mcp-core/dist/config-mlP4H0sA.js
29967
+ //#region ../mcp-core/dist/config-A7NGLEjd.js
29051
29968
  const systemPrompt$2 = `You are a Sentry issue event filter translator. Your job is to:
29052
29969
  1. Translate natural language queries into Sentry tag filters for events within a SPECIFIC issue
29053
29970
  2. Select appropriate fields to return in the results
@@ -29382,7 +30299,7 @@ const EXAMPLE_QUERIES = [
29382
30299
  ];
29383
30300
 
29384
30301
  //#endregion
29385
- //#region ../mcp-core/dist/utils-b4MMh_Zk.js
30302
+ //#region ../mcp-core/dist/utils-BrIMdG-f.js
29386
30303
  /**
29387
30304
  * Create a tool for the agent to query available tags and fields for issue events
29388
30305
  * The tool is pre-bound with the API service and organization configured for the appropriate region
@@ -29459,7 +30376,7 @@ Received: ${params.issueUrl}`);
29459
30376
  }
29460
30377
 
29461
30378
  //#endregion
29462
- //#region ../mcp-core/dist/agent-BfsRV_Tw.js
30379
+ //#region ../mcp-core/dist/agent-BPV2Ep4z.js
29463
30380
  const searchIssueEventsAgentOutputSchema = z.object({
29464
30381
  query: z.string().describe("Sentry query filters for tags/fields (NOT including issue: prefix - handler adds that)"),
29465
30382
  fields: z.array(z.string()).describe("Array of field names to return in results"),
@@ -29501,7 +30418,7 @@ async function searchIssueEventsAgent(options) {
29501
30418
  }
29502
30419
 
29503
30420
  //#endregion
29504
- //#region ../mcp-core/dist/handler-C_yXGcZ7.js
30421
+ //#region ../mcp-core/dist/handler-DBc1nTD9.js
29505
30422
  var handler_default$2 = defineTool({
29506
30423
  name: "search_issue_events",
29507
30424
  skills: ["inspect", "triage"],
@@ -29511,7 +30428,7 @@ var handler_default$2 = defineTool({
29511
30428
  "",
29512
30429
  "Use this to filter events by time, environment, release, user, trace ID, or other tags. The tool automatically constrains results to the specified issue.",
29513
30430
  "",
29514
- "For cross-issue searches use search_issues, for single event details use get_issue_details.",
30431
+ "For cross-issue searches use search_issues. For single issue or event details use get_sentry_resource.",
29515
30432
  "",
29516
30433
  "<examples>",
29517
30434
  "search_issue_events(issueId='MCP-41', organizationSlug='my-org', naturalLanguageQuery='from last hour')",
@@ -29532,13 +30449,13 @@ var handler_default$2 = defineTool({
29532
30449
  readOnlyHint: true,
29533
30450
  openWorldHint: true
29534
30451
  },
29535
- async handler(params, context$2) {
30452
+ async handler(params, context$1) {
29536
30453
  const { organizationSlug, issueId } = parseIssueParams({
29537
30454
  organizationSlug: params.organizationSlug,
29538
30455
  issueId: params.issueId,
29539
30456
  issueUrl: params.issueUrl
29540
30457
  });
29541
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
30458
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
29542
30459
  setTag("organization.slug", organizationSlug);
29543
30460
  setTag("issue.id", issueId);
29544
30461
  if (params.projectSlug) setTag("project.slug", params.projectSlug);
@@ -29603,7 +30520,7 @@ var handler_default$2 = defineTool({
29603
30520
  });
29604
30521
 
29605
30522
  //#endregion
29606
- //#region ../mcp-core/dist/config-BJzhfINu.js
30523
+ //#region ../mcp-core/dist/config-BTux0Mwm.js
29607
30524
  /**
29608
30525
  * Configuration for the use_sentry embedded agent.
29609
30526
  *
@@ -29622,7 +30539,7 @@ The user may include various parameters to pass to those tools in their prompt.
29622
30539
  You MUST return tool results directly without interpreting them.`;
29623
30540
 
29624
30541
  //#endregion
29625
- //#region ../mcp-core/dist/agent-BUWEtyML.js
30542
+ //#region ../mcp-core/dist/agent-Cv4_4vN0.js
29626
30543
  /**
29627
30544
  * Output schema for the embedded agent.
29628
30545
  * The agent returns the final result string directly from its tool calls.
@@ -29643,27 +30560,29 @@ async function useSentryAgent(options) {
29643
30560
  }
29644
30561
 
29645
30562
  //#endregion
29646
- //#region ../mcp-core/dist/types-CsTmoXmm.js
30563
+ //#region ../mcp-core/dist/types-BuGvc9q3.js
29647
30564
  /**
29648
30565
  * Resolves a tool description to a string.
29649
30566
  * Handles both static strings and dynamic description functions.
29650
30567
  */
29651
- function resolveDescription(description$73, context$2) {
29652
- return typeof description$73 === "function" ? description$73(context$2) : description$73;
30568
+ function resolveDescription(description$73, context$1) {
30569
+ return typeof description$73 === "function" ? description$73(context$1) : description$73;
29653
30570
  }
29654
30571
  /**
29655
- * Determines if a tool should be visible based on experimental mode.
30572
+ * Determines if a tool should be externally visible through MCP surfaces.
30573
+ * - Tools with `internalOnly: true` are never exposed through server registration
29656
30574
  * - Tools with `experimental: true` are only visible when experimentalMode is true
29657
30575
  * - Tools with `hideInExperimentalMode: true` are hidden when experimentalMode is true
29658
30576
  */
29659
30577
  function isToolVisibleInMode(tool$1, experimentalMode) {
30578
+ if (tool$1.internalOnly) return false;
29660
30579
  if (tool$1.experimental && !experimentalMode) return false;
29661
30580
  if (tool$1.hideInExperimentalMode && experimentalMode) return false;
29662
30581
  return true;
29663
30582
  }
29664
30583
 
29665
30584
  //#endregion
29666
- //#region ../mcp-core/dist/list-issues-De-aWY0g.js
30585
+ //#region ../mcp-core/dist/list-issues-BRBWYo9f.js
29667
30586
  var list_issues_default = defineTool({
29668
30587
  name: "list_issues",
29669
30588
  skills: [
@@ -29723,8 +30642,8 @@ var list_issues_default = defineTool({
29723
30642
  readOnlyHint: true,
29724
30643
  openWorldHint: true
29725
30644
  },
29726
- async handler(params, context$2) {
29727
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
30645
+ async handler(params, context$1) {
30646
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
29728
30647
  setTag("organization.slug", params.organizationSlug);
29729
30648
  if (params.projectSlugOrId) if (isNumericId(params.projectSlugOrId)) setTag("project.id", params.projectSlugOrId);
29730
30649
  else setTag("project.slug", params.projectSlugOrId);
@@ -29746,7 +30665,7 @@ var list_issues_default = defineTool({
29746
30665
  });
29747
30666
 
29748
30667
  //#endregion
29749
- //#region ../mcp-core/dist/list-events-CikKsKpp.js
30668
+ //#region ../mcp-core/dist/list-events-DV_Gcoys.js
29750
30669
  const DEFAULT_FIELDS = {
29751
30670
  errors: RECOMMENDED_FIELDS.errors.basic,
29752
30671
  logs: RECOMMENDED_FIELDS.logs.basic,
@@ -29814,8 +30733,8 @@ var list_events_default = defineTool({
29814
30733
  readOnlyHint: true,
29815
30734
  openWorldHint: true
29816
30735
  },
29817
- async handler(params, context$2) {
29818
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
30736
+ async handler(params, context$1) {
30737
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
29819
30738
  setTag("organization.slug", params.organizationSlug);
29820
30739
  if (params.projectSlug) setTag("project.slug", params.projectSlug);
29821
30740
  let projectId;
@@ -29868,7 +30787,7 @@ var list_events_default = defineTool({
29868
30787
  });
29869
30788
 
29870
30789
  //#endregion
29871
- //#region ../mcp-core/dist/list-issue-events-rp-Q9Gof.js
30790
+ //#region ../mcp-core/dist/list-issue-events-BJUU5dDl.js
29872
30791
  var list_issue_events_default = defineTool({
29873
30792
  name: "list_issue_events",
29874
30793
  skills: ["inspect", "triage"],
@@ -29915,13 +30834,13 @@ var list_issue_events_default = defineTool({
29915
30834
  readOnlyHint: true,
29916
30835
  openWorldHint: true
29917
30836
  },
29918
- async handler(params, context$2) {
30837
+ async handler(params, context$1) {
29919
30838
  const { organizationSlug, issueId } = parseIssueParams({
29920
30839
  organizationSlug: params.organizationSlug,
29921
30840
  issueId: params.issueId,
29922
30841
  issueUrl: params.issueUrl
29923
30842
  });
29924
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
30843
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
29925
30844
  setTag("organization.slug", organizationSlug);
29926
30845
  setTag("issue.id", issueId);
29927
30846
  const eventsResponse = await apiService.listEventsForIssue({
@@ -29952,281 +30871,7 @@ var list_issue_events_default = defineTool({
29952
30871
  });
29953
30872
 
29954
30873
  //#endregion
29955
- //#region ../mcp-core/dist/url-helpers-DEjLjNeS.js
29956
- /**
29957
- * Parses a Sentry URL and extracts resource type and identifiers.
29958
- *
29959
- * Supported URL patterns:
29960
- * - Issue: `/issues/{issueId}` or `/organizations/{org}/issues/{issueId}`
29961
- * - Event: `/issues/{issueId}/events/{eventId}`
29962
- * - Trace: `/explore/traces/trace/{traceId}` or `/performance/trace/{traceId}`
29963
- * - Profile: `/explore/profiling/profile/{project}/flamegraph/` with query params
29964
- * - Replay: `/replays/{replayId}/`
29965
- * - Monitor: `/crons/{monitorSlug}/` or `/monitors/{monitorSlug}/`
29966
- * - Release: `/releases/{version}/`
29967
- *
29968
- * Organization slug is extracted from:
29969
- * 1. Subdomain (e.g., `my-org.sentry.io`)
29970
- * 2. Path (e.g., `/organizations/my-org/...` or `/my-org/issues/...`)
29971
- *
29972
- * @param url - A Sentry URL to parse
29973
- * @returns Parsed URL with resource type and identifiers
29974
- * @throws UserInputError if the URL is invalid or cannot be parsed
29975
- *
29976
- * @example
29977
- * // Issue URL
29978
- * parseSentryUrl("https://my-org.sentry.io/issues/PROJECT-123")
29979
- * // { type: "issue", organizationSlug: "my-org", issueId: "PROJECT-123" }
29980
- *
29981
- * @example
29982
- * // Replay URL
29983
- * parseSentryUrl("https://my-org.sentry.io/replays/abc123def456/")
29984
- * // { type: "replay", organizationSlug: "my-org", replayId: "abc123def456" }
29985
- *
29986
- * @example
29987
- * // Monitor URL
29988
- * parseSentryUrl("https://my-org.sentry.io/crons/my-cron-job/")
29989
- * // { type: "monitor", organizationSlug: "my-org", monitorSlug: "my-cron-job" }
29990
- */
29991
- function parseSentryUrl(url) {
29992
- if (!url || typeof url !== "string") throw new UserInputError("Invalid Sentry URL. URL must be a non-empty string.");
29993
- if (!url.startsWith("http://") && !url.startsWith("https://")) throw new UserInputError("Invalid Sentry URL. Must start with http:// or https://");
29994
- let parsedUrl;
29995
- try {
29996
- parsedUrl = new URL(url);
29997
- } catch {
29998
- throw new UserInputError(`Invalid Sentry URL. Unable to parse URL: ${url}`);
29999
- }
30000
- const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
30001
- const organizationSlug = extractOrganizationSlug(parsedUrl, pathParts);
30002
- return identifyResource(parsedUrl, pathParts, organizationSlug);
30003
- }
30004
- /**
30005
- * Extracts organization slug from URL.
30006
- *
30007
- * Checks in order:
30008
- * 1. `/organizations/{org}/...` path format
30009
- * 2. `/{org}/issues/...` path format (org before known segments)
30010
- * 3. Subdomain (e.g., `my-org.sentry.io`) - excluding region prefixes
30011
- */
30012
- function extractOrganizationSlug(parsedUrl, pathParts) {
30013
- if (pathParts.includes("organizations")) {
30014
- const orgIndex = pathParts.indexOf("organizations");
30015
- const slug = pathParts[orgIndex + 1];
30016
- if (slug) return slug;
30017
- }
30018
- const knownSegments = [
30019
- "issues",
30020
- "explore",
30021
- "performance",
30022
- "projects",
30023
- "settings",
30024
- "replays",
30025
- "releases",
30026
- "crons",
30027
- "monitors",
30028
- "alerts",
30029
- "feedback",
30030
- "dashboards",
30031
- "discover",
30032
- "insights"
30033
- ];
30034
- if (pathParts.length > 1 && knownSegments.includes(pathParts[1])) return pathParts[0];
30035
- const hostParts = parsedUrl.hostname.split(".");
30036
- const regionPrefixes = [
30037
- "us",
30038
- "eu",
30039
- "de",
30040
- "www"
30041
- ];
30042
- if (hostParts.length >= 2 && !regionPrefixes.includes(hostParts[0])) return hostParts[0];
30043
- throw new UserInputError("Invalid Sentry URL. Could not determine organization from URL.");
30044
- }
30045
- /**
30046
- * Identifies the resource type and extracts relevant identifiers.
30047
- */
30048
- function identifyResource(parsedUrl, pathParts, organizationSlug) {
30049
- const profilingIndex = pathParts.indexOf("profiling");
30050
- if (profilingIndex !== -1 && pathParts[profilingIndex + 1] === "profile") {
30051
- const projectSlug = pathParts[profilingIndex + 2];
30052
- const profilerId = parsedUrl.searchParams.get("profilerId") || void 0;
30053
- const start = parsedUrl.searchParams.get("start") || void 0;
30054
- const end = parsedUrl.searchParams.get("end") || void 0;
30055
- return {
30056
- type: "profile",
30057
- organizationSlug,
30058
- projectSlug,
30059
- profilerId,
30060
- start,
30061
- end
30062
- };
30063
- }
30064
- const replaysIndex = pathParts.indexOf("replays");
30065
- if (replaysIndex !== -1) {
30066
- const replayId = pathParts[replaysIndex + 1];
30067
- if (replayId && replayId !== "selectors") return {
30068
- type: "replay",
30069
- organizationSlug,
30070
- replayId
30071
- };
30072
- }
30073
- const cronsIndex = pathParts.indexOf("crons");
30074
- const monitorsIndex = pathParts.indexOf("monitors");
30075
- const monitorPathIndex = cronsIndex !== -1 ? cronsIndex : monitorsIndex;
30076
- if (monitorPathIndex !== -1) {
30077
- const nextPart = pathParts[monitorPathIndex + 1];
30078
- if (nextPart && nextPart !== "new") {
30079
- const afterNext = pathParts[monitorPathIndex + 2];
30080
- if (afterNext && afterNext !== "details") return {
30081
- type: "monitor",
30082
- organizationSlug,
30083
- projectSlug: nextPart,
30084
- monitorSlug: afterNext
30085
- };
30086
- return {
30087
- type: "monitor",
30088
- organizationSlug,
30089
- monitorSlug: nextPart
30090
- };
30091
- }
30092
- }
30093
- const releasesIndex = pathParts.indexOf("releases");
30094
- if (releasesIndex !== -1) {
30095
- const releaseVersion = pathParts[releasesIndex + 1];
30096
- if (releaseVersion && releaseVersion !== "new-events" && releaseVersion !== "all-events") return {
30097
- type: "release",
30098
- organizationSlug,
30099
- releaseVersion
30100
- };
30101
- }
30102
- const traceIndex = pathParts.indexOf("trace");
30103
- if (traceIndex !== -1) {
30104
- const traceId = pathParts[traceIndex + 1];
30105
- if (traceId) {
30106
- const nodeParam = parsedUrl.searchParams.get("node");
30107
- let spanId;
30108
- if (nodeParam?.startsWith("span-")) spanId = nodeParam.slice(5);
30109
- return {
30110
- type: "trace",
30111
- organizationSlug,
30112
- traceId,
30113
- spanId
30114
- };
30115
- }
30116
- }
30117
- if (pathParts.includes("performance") && pathParts.includes("summary")) {
30118
- const transaction = parsedUrl.searchParams.get("transaction") || void 0;
30119
- if (transaction) return {
30120
- type: "unknown",
30121
- organizationSlug,
30122
- transaction
30123
- };
30124
- }
30125
- const issuesIndex = pathParts.indexOf("issues");
30126
- if (issuesIndex !== -1) {
30127
- const issueId = pathParts[issuesIndex + 1];
30128
- if (issueId) {
30129
- const eventsIndex = pathParts.indexOf("events", issuesIndex);
30130
- if (eventsIndex !== -1) {
30131
- const eventId = pathParts[eventsIndex + 1];
30132
- if (eventId) return {
30133
- type: "event",
30134
- organizationSlug,
30135
- issueId,
30136
- eventId
30137
- };
30138
- }
30139
- return {
30140
- type: "issue",
30141
- organizationSlug,
30142
- issueId
30143
- };
30144
- }
30145
- }
30146
- return {
30147
- type: "unknown",
30148
- organizationSlug
30149
- };
30150
- }
30151
- /**
30152
- * Checks if a URL appears to be a Sentry profile URL.
30153
- *
30154
- * @param url - URL to check
30155
- * @returns True if the URL looks like a profile URL
30156
- */
30157
- function isProfileUrl(url) {
30158
- try {
30159
- const parsed = parseSentryUrl(url);
30160
- return parsed.type === "profile";
30161
- } catch {
30162
- return false;
30163
- }
30164
- }
30165
-
30166
- //#endregion
30167
- //#region ../mcp-core/dist/breadcrumbs-BNKwvbpZ.js
30168
- /**
30169
- * Fetches breadcrumbs from the latest event for an issue and formats them.
30170
- */
30171
- async function fetchAndFormatBreadcrumbs(apiService, organizationSlug, issueId) {
30172
- const event = await apiService.getLatestEventForIssue({
30173
- organizationSlug,
30174
- issueId
30175
- });
30176
- const breadcrumbEntry = event.entries.find((e) => e.type === "breadcrumbs");
30177
- const entryData = breadcrumbEntry?.data;
30178
- const breadcrumbs = entryData?.values ?? [];
30179
- return formatBreadcrumbs(breadcrumbs, issueId, event.id);
30180
- }
30181
- function formatBreadcrumbs(breadcrumbs, issueId, eventId) {
30182
- if (breadcrumbs.length === 0) return [
30183
- `# Breadcrumbs for ${issueId}`,
30184
- "",
30185
- `**Event ID**: ${eventId}`,
30186
- "",
30187
- "No breadcrumbs found in the latest event for this issue."
30188
- ].join("\n");
30189
- const output = [
30190
- `# Breadcrumbs for ${issueId}`,
30191
- "",
30192
- `**Event ID**: ${eventId}`,
30193
- `**Total Breadcrumbs**: ${breadcrumbs.length}`,
30194
- "",
30195
- "```"
30196
- ];
30197
- for (const crumb of breadcrumbs) {
30198
- const timestamp = crumb.timestamp ? new Date(crumb.timestamp).toISOString() : " ".repeat(24);
30199
- const level = (crumb.level ?? "info").padEnd(7);
30200
- const category = crumb.category ?? crumb.type ?? "-";
30201
- const message = cleanAndTruncate(crumb.message ?? "", 120);
30202
- const data = formatBreadcrumbData(crumb.data);
30203
- const parts = [`${timestamp} ${level} [${category}]`];
30204
- if (message) parts.push(message);
30205
- if (data) parts.push(data);
30206
- output.push(parts.join(" "));
30207
- }
30208
- output.push("```");
30209
- output.push("", "Breadcrumbs show the trail of events leading up to the error, in chronological order.", `Use \`get_sentry_resource(resourceType='issue', organizationSlug='...', resourceId='${issueId}')\` for full issue details.`);
30210
- return output.join("\n");
30211
- }
30212
- /**
30213
- * Formats breadcrumb data as a compact inline JSON string.
30214
- */
30215
- function formatBreadcrumbData(data) {
30216
- if (!data || Object.keys(data).length === 0) return "";
30217
- return cleanAndTruncate(JSON.stringify(data), 200);
30218
- }
30219
- /**
30220
- * Strips newlines and truncates a string to maxLen characters.
30221
- */
30222
- function cleanAndTruncate(str, maxLen) {
30223
- const clean = str.replace(/[\r\n]+/g, " ");
30224
- if (clean.length <= maxLen) return clean;
30225
- return `${clean.slice(0, maxLen)}...`;
30226
- }
30227
-
30228
- //#endregion
30229
- //#region ../mcp-core/dist/analyzer-0vRQplm0.js
30874
+ //#region ../mcp-core/dist/analyzer-C9y4AiMa.js
30230
30875
  /**
30231
30876
  * Analyzes flamegraph data to extract hot paths (most CPU-intensive call stacks).
30232
30877
  *
@@ -30485,7 +31130,7 @@ function hasProfileData(flamegraph) {
30485
31130
  }
30486
31131
 
30487
31132
  //#endregion
30488
- //#region ../mcp-core/dist/formatter-qXxzS7xS.js
31133
+ //#region ../mcp-core/dist/formatter-CNWrD7yi.js
30489
31134
  /**
30490
31135
  * Maps a change type to its corresponding status icon.
30491
31136
  */
@@ -30534,11 +31179,15 @@ function formatFlamegraphAnalysis(flamegraph, options) {
30534
31179
  sections.push(formatActionableSteps(hotPaths, options));
30535
31180
  return sections.join("\n\n");
30536
31181
  }
31182
+ function getFlamegraphProfileCount(flamegraph) {
31183
+ return flamegraph.shared.profiles.length || flamegraph.profiles.length;
31184
+ }
30537
31185
  /**
30538
31186
  * Formats transaction information section.
30539
31187
  */
30540
31188
  function formatTransactionInfo(flamegraph) {
30541
31189
  const profile = flamegraph.profiles[0];
31190
+ const profileCount = getFlamegraphProfileCount(flamegraph);
30542
31191
  const totalSamples = profile?.sample_counts.reduce((a, b) => a + b, 0) || 0;
30543
31192
  const totalDuration = profile?.sample_durations_ns.reduce((a, b) => a + b, 0) || 0;
30544
31193
  return [
@@ -30548,7 +31197,7 @@ function formatTransactionInfo(flamegraph) {
30548
31197
  `- **Transaction**: ${flamegraph.transactionName || "Unknown"}`,
30549
31198
  `- **Project ID**: ${flamegraph.projectID}`,
30550
31199
  `- **Platform**: ${flamegraph.platform || "Unknown"}`,
30551
- `- **Total Profiles**: ${flamegraph.shared.profiles.length}`,
31200
+ `- **Total Profiles**: ${profileCount}`,
30552
31201
  `- **Total Samples**: ${totalSamples.toLocaleString()}`,
30553
31202
  `- **Estimated Total Time**: ${formatDuration(totalDuration)}`
30554
31203
  ].join("\n");
@@ -30593,11 +31242,12 @@ function formatPerformanceSummary(flamegraph, options) {
30593
31242
  function formatHotPaths(hotPaths, flamegraph, options) {
30594
31243
  if (hotPaths.length === 0) return "## Hot Paths\n\nNo significant hot paths found.";
30595
31244
  const sections = ["## Top Hot Paths", ""];
31245
+ const profileCount = getFlamegraphProfileCount(flamegraph);
30596
31246
  hotPaths.forEach((path, idx) => {
30597
31247
  if (idx > 0) sections.push("---", "");
30598
31248
  sections.push(`### Path #${idx + 1}: ${formatPercentage(path.percentOfTotal)} of execution time`);
30599
31249
  sections.push("");
30600
- sections.push(`**${path.sampleCount.toLocaleString()} samples** across ${flamegraph.shared.profiles.length} profiles`);
31250
+ sections.push(`**${path.sampleCount.toLocaleString()} samples** across ${profileCount} profiles`);
30601
31251
  sections.push("");
30602
31252
  const framesToShow = options.focusOnUserCode ? path.userCodeFrames : path.callStack;
30603
31253
  if (framesToShow.length > 0) {
@@ -30699,9 +31349,214 @@ function formatFlamegraphComparison(baseline, current, options) {
30699
31349
  }
30700
31350
  return sections.join("\n");
30701
31351
  }
31352
+ /**
31353
+ * Formats raw profile chunk analysis.
31354
+ *
31355
+ * Produces markdown output with:
31356
+ * - Chunk metadata
31357
+ * - Sample summary
31358
+ * - Frame breakdown
31359
+ * - Thread information
31360
+ *
31361
+ * @param chunk Profile chunk data from API
31362
+ * @param options Formatting options
31363
+ * @returns Markdown-formatted analysis
31364
+ */
31365
+ function formatProfileChunkAnalysis(chunk, options) {
31366
+ const sections = [];
31367
+ sections.push("# Profile Chunk Details");
31368
+ sections.push("");
31369
+ sections.push("## Metadata");
31370
+ sections.push(`- **Chunk ID**: ${chunk.chunk_id}`);
31371
+ sections.push(`- **Profiler ID**: ${chunk.profiler_id}`);
31372
+ sections.push(`- **Platform**: ${chunk.platform}`);
31373
+ sections.push(`- **Release**: ${chunk.release}`);
31374
+ if (chunk.environment) sections.push(`- **Environment**: ${chunk.environment}`);
31375
+ sections.push("");
31376
+ sections.push("## Sample Summary");
31377
+ sections.push(`- **Total Frames**: ${chunk.profile.frames.length}`);
31378
+ sections.push(`- **Total Samples**: ${chunk.profile.samples.length}`);
31379
+ sections.push(`- **Total Stacks**: ${chunk.profile.stacks.length}`);
31380
+ sections.push(`- **Threads**: ${Object.keys(chunk.profile.thread_metadata).length}`);
31381
+ sections.push("");
31382
+ sections.push("## Thread Information");
31383
+ sections.push("");
31384
+ for (const [threadId, metadata] of Object.entries(chunk.profile.thread_metadata)) {
31385
+ const threadSamples = chunk.profile.samples.filter((s) => s.thread_id === threadId);
31386
+ sections.push(`- **Thread ${threadId}**: ${metadata.name || "unnamed"} (${threadSamples.length} samples)`);
31387
+ }
31388
+ sections.push("");
31389
+ const frameCounts = /* @__PURE__ */ new Map();
31390
+ for (const stack of chunk.profile.stacks) for (const frameIdx of stack) frameCounts.set(frameIdx, (frameCounts.get(frameIdx) || 0) + 1);
31391
+ const sortedFrames = Array.from(frameCounts.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10);
31392
+ if (sortedFrames.length > 0) {
31393
+ sections.push("## Top Frames by Occurrence");
31394
+ sections.push("");
31395
+ sections.push("| Function | File:Line | Count | Type |");
31396
+ sections.push("|----------|-----------|-------|------|");
31397
+ for (const [frameIdx, count] of sortedFrames) {
31398
+ const frame = chunk.profile.frames[frameIdx];
31399
+ if (!frame) continue;
31400
+ if (options.focusOnUserCode && !frame.in_app) continue;
31401
+ const funcName = frame.class_name ? `${frame.class_name}.${frame.function}` : frame.function;
31402
+ const rawLocation = frame.filename && frame.lineno ? `${frame.filename}:${frame.lineno}` : frame.module || frame.abs_path || "unknown";
31403
+ const location = truncateLocation(rawLocation, 40);
31404
+ const type = frame.in_app ? "User Code" : "Library";
31405
+ sections.push(`| \`${funcName}\` | ${location} | ${count} | ${type} |`);
31406
+ }
31407
+ }
31408
+ return sections.join("\n");
31409
+ }
31410
+
31411
+ //#endregion
31412
+ //#region ../mcp-core/dist/get-profile-details-37grNlzY.js
31413
+ var get_profile_details_default = defineTool({
31414
+ name: "get_profile_details",
31415
+ skills: ["inspect"],
31416
+ requiredScopes: ["event:read"],
31417
+ requiredCapabilities: ["profiles"],
31418
+ hideInExperimentalMode: true,
31419
+ description: [
31420
+ "Retrieve raw profile chunk data to inspect individual function calls, threads, and stack traces.",
31421
+ "",
31422
+ "USE THIS TOOL WHEN:",
31423
+ "- User wants to inspect raw profiling samples for a specific profiler session",
31424
+ "- User needs to see individual thread activity and stack traces",
31425
+ "- User wants detailed frame-level data (function names, file locations, call counts)",
31426
+ "",
31427
+ "RETURNS:",
31428
+ "- Profile chunk metadata (platform, release, environment)",
31429
+ "- Per-thread sample counts and names",
31430
+ "- Top frames by occurrence with file locations",
31431
+ "- User code vs library code breakdown",
31432
+ "",
31433
+ "NOTE: This tool requires a `profilerId` which identifies a specific profiling session.",
31434
+ "Use `get_profile` for aggregated flamegraph analysis by transaction name.",
31435
+ "",
31436
+ "<examples>",
31437
+ "### Inspect a profiler session",
31438
+ "```",
31439
+ "get_profile_details(",
31440
+ " organizationSlug='my-org',",
31441
+ " projectSlugOrId='backend',",
31442
+ " profilerId='041bde57b9844e36b8b7e5734efae5f7',",
31443
+ " start='2024-01-01T00:00:00',",
31444
+ " end='2024-01-01T01:00:00'",
31445
+ ")",
31446
+ "```",
31447
+ "</examples>",
31448
+ "",
31449
+ "<hints>",
31450
+ "- Use `focusOnUserCode: true` (default) to filter out library/system frames",
31451
+ "- The profilerId can be found in Sentry profile URLs or event data",
31452
+ "</hints>"
31453
+ ].join("\n"),
31454
+ inputSchema: {
31455
+ organizationSlug: ParamOrganizationSlug,
31456
+ regionUrl: ParamRegionUrl.nullable().default(null),
31457
+ projectSlugOrId: z.union([z.string(), z.number()]).describe("Project slug or numeric ID"),
31458
+ profilerId: z.string().trim().describe("Profiler session ID (UUID from Sentry profile data)"),
31459
+ start: z.string().trim().describe("Start time for the profile chunk query (ISO 8601 format, e.g., '2024-01-01T00:00:00')"),
31460
+ end: z.string().trim().describe("End time for the profile chunk query (ISO 8601 format, e.g., '2024-01-01T01:00:00')"),
31461
+ focusOnUserCode: z.boolean().default(true).describe("Show only user code (in_app: true). Set to false to include library code.")
31462
+ },
31463
+ annotations: {
31464
+ readOnlyHint: true,
31465
+ openWorldHint: false
31466
+ },
31467
+ async handler(params, context$1) {
31468
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
31469
+ const { organizationSlug, projectSlugOrId, profilerId, start, end, focusOnUserCode } = params;
31470
+ setTag("organization.slug", organizationSlug);
31471
+ setTag("profiler.id", profilerId);
31472
+ let projectId;
31473
+ if (typeof projectSlugOrId === "number" || isNumericId(String(projectSlugOrId))) {
31474
+ projectId = projectSlugOrId;
31475
+ setTag("project.id", String(projectSlugOrId));
31476
+ } else {
31477
+ const project = await apiService.getProject({
31478
+ organizationSlug,
31479
+ projectSlugOrId: String(projectSlugOrId)
31480
+ });
31481
+ projectId = project.id;
31482
+ setTag("project.slug", String(projectSlugOrId));
31483
+ setTag("project.id", String(project.id));
31484
+ }
31485
+ const chunk = await apiService.getProfileChunk({
31486
+ organizationSlug,
31487
+ profilerId,
31488
+ projectId,
31489
+ start,
31490
+ end
31491
+ });
31492
+ return formatProfileChunkAnalysis(chunk, { focusOnUserCode });
31493
+ }
31494
+ });
31495
+
31496
+ //#endregion
31497
+ //#region ../mcp-core/dist/breadcrumbs-BFIJah2q.js
31498
+ /**
31499
+ * Fetches breadcrumbs from the latest event for an issue and formats them.
31500
+ */
31501
+ async function fetchAndFormatBreadcrumbs(apiService, organizationSlug, issueId) {
31502
+ const event = await apiService.getLatestEventForIssue({
31503
+ organizationSlug,
31504
+ issueId
31505
+ });
31506
+ const breadcrumbEntry = event.entries.find((e) => e.type === "breadcrumbs");
31507
+ const entryData = breadcrumbEntry?.data;
31508
+ const breadcrumbs = entryData?.values ?? [];
31509
+ return formatBreadcrumbs(breadcrumbs, issueId, event.id);
31510
+ }
31511
+ function formatBreadcrumbs(breadcrumbs, issueId, eventId) {
31512
+ if (breadcrumbs.length === 0) return [
31513
+ `# Breadcrumbs for ${issueId}`,
31514
+ "",
31515
+ `**Event ID**: ${eventId}`,
31516
+ "",
31517
+ "No breadcrumbs found in the latest event for this issue."
31518
+ ].join("\n");
31519
+ const output = [
31520
+ `# Breadcrumbs for ${issueId}`,
31521
+ "",
31522
+ `**Event ID**: ${eventId}`,
31523
+ `**Total Breadcrumbs**: ${breadcrumbs.length}`,
31524
+ "",
31525
+ "```"
31526
+ ];
31527
+ for (const crumb of breadcrumbs) {
31528
+ const timestamp = crumb.timestamp ? new Date(crumb.timestamp).toISOString() : " ".repeat(24);
31529
+ const level = (crumb.level ?? "info").padEnd(7);
31530
+ const category = crumb.category ?? crumb.type ?? "-";
31531
+ const message = cleanAndTruncate(crumb.message ?? "", 120);
31532
+ const data = formatBreadcrumbData(crumb.data);
31533
+ const parts = [`${timestamp} ${level} [${category}]`];
31534
+ if (message) parts.push(message);
31535
+ if (data) parts.push(data);
31536
+ output.push(parts.join(" "));
31537
+ }
31538
+ output.push("```");
31539
+ output.push("", "Breadcrumbs show the trail of events leading up to the error, in chronological order.", `Use \`get_sentry_resource(resourceType='issue', organizationSlug='...', resourceId='${issueId}')\` for full issue details.`);
31540
+ return output.join("\n");
31541
+ }
31542
+ /**
31543
+ * Formats breadcrumb data as a compact inline JSON string.
31544
+ */
31545
+ function formatBreadcrumbData(data) {
31546
+ if (!data || Object.keys(data).length === 0) return "";
31547
+ return cleanAndTruncate(JSON.stringify(data), 200);
31548
+ }
31549
+ /**
31550
+ * Strips newlines and truncates a string to maxLen characters.
31551
+ */
31552
+ function cleanAndTruncate(str, maxLen) {
31553
+ const clean = str.replace(/[\r\n]+/g, " ");
31554
+ if (clean.length <= maxLen) return clean;
31555
+ return `${clean.slice(0, maxLen)}...`;
31556
+ }
30702
31557
 
30703
31558
  //#endregion
30704
- //#region ../mcp-core/dist/get-profile-xI9ajhRm.js
31559
+ //#region ../mcp-core/dist/get-profile-V33H4N5o.js
30705
31560
  /**
30706
31561
  * Resolves profile parameters from URL or explicit params.
30707
31562
  * URL takes precedence if provided and valid.
@@ -30798,8 +31653,8 @@ var get_profile_default = defineTool({
30798
31653
  readOnlyHint: true,
30799
31654
  openWorldHint: false
30800
31655
  },
30801
- async handler(params, context$2) {
30802
- const apiService = apiServiceFromContext(context$2, { regionUrl: params.regionUrl ?? void 0 });
31656
+ async handler(params, context$1) {
31657
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
30803
31658
  const resolved = resolveProfileParams({
30804
31659
  profileUrl: params.profileUrl,
30805
31660
  organizationSlug: params.organizationSlug,
@@ -30910,13 +31765,14 @@ var get_profile_default = defineTool({
30910
31765
  });
30911
31766
 
30912
31767
  //#endregion
30913
- //#region ../mcp-core/dist/get-sentry-resource-CCyDwFrY.js
31768
+ //#region ../mcp-core/dist/get-sentry-resource-B-80mk-4.js
30914
31769
  /** Types with full API integration. */
30915
31770
  const FULLY_SUPPORTED_TYPES = [
30916
31771
  "issue",
30917
31772
  "event",
30918
31773
  "trace",
30919
- "breadcrumbs"
31774
+ "breadcrumbs",
31775
+ "replay"
30920
31776
  ];
30921
31777
  function resolveResourceParams(params) {
30922
31778
  if (params.url) {
@@ -30951,6 +31807,11 @@ function resolveResourceParams(params) {
30951
31807
  organizationSlug,
30952
31808
  issueId: resourceId.toUpperCase()
30953
31809
  };
31810
+ case "replay": return {
31811
+ type: "replay",
31812
+ organizationSlug,
31813
+ replayId: resourceId
31814
+ };
30954
31815
  }
30955
31816
  }
30956
31817
  /**
@@ -31031,21 +31892,6 @@ function resolveFromParsedUrl(parsed, params) {
31031
31892
  function generateUnsupportedResourceMessage(resolved) {
31032
31893
  const { type, organizationSlug } = resolved;
31033
31894
  switch (type) {
31034
- case "replay": {
31035
- const replayUrl = `https://${organizationSlug}.sentry.io/replays/${resolved.replayId}/`;
31036
- return [
31037
- "# Replay Detected",
31038
- "",
31039
- `**Organization**: ${organizationSlug}`,
31040
- `**Replay ID**: ${resolved.replayId}`,
31041
- "",
31042
- "Session replay support is coming soon. In the meantime:",
31043
- "",
31044
- `- **View in Sentry**: [Open Replay](${replayUrl})`,
31045
- "- **Find related issues**: Use `search_issues` with the replay's time range",
31046
- `- **Search events**: Use \`search_events\` with query \`replay_id:${resolved.replayId}\` to find events associated with this replay`
31047
- ].join("\n");
31048
- }
31049
31895
  case "monitor": {
31050
31896
  const monitorPath = resolved.projectSlug ? `${resolved.projectSlug}/${resolved.monitorSlug}` : resolved.monitorSlug;
31051
31897
  const monitorUrl = `https://${organizationSlug}.sentry.io/crons/${monitorPath}/`;
@@ -31082,9 +31928,12 @@ function generateUnsupportedResourceMessage(resolved) {
31082
31928
  }
31083
31929
  var get_sentry_resource_default = defineTool({
31084
31930
  name: "get_sentry_resource",
31085
- skills: ["inspect"],
31931
+ skills: [
31932
+ "inspect",
31933
+ "triage",
31934
+ "seer"
31935
+ ],
31086
31936
  requiredScopes: ["event:read"],
31087
- experimental: true,
31088
31937
  description: [
31089
31938
  "Fetch a Sentry resource by URL or by type and ID.",
31090
31939
  "",
@@ -31105,7 +31954,8 @@ var get_sentry_resource_default = defineTool({
31105
31954
  "issue",
31106
31955
  "event",
31107
31956
  "trace",
31108
- "breadcrumbs"
31957
+ "breadcrumbs",
31958
+ "replay"
31109
31959
  ]).optional().describe("Resource type. With a URL, overrides the auto-detected type (e.g., 'breadcrumbs' on an issue URL)."),
31110
31960
  resourceId: z.string().trim().optional().describe("Resource identifier: issue shortId (e.g., 'PROJECT-123'), event ID, or trace ID. Required when not using a URL."),
31111
31961
  organizationSlug: ParamOrganizationSlug.optional()
@@ -31114,7 +31964,7 @@ var get_sentry_resource_default = defineTool({
31114
31964
  readOnlyHint: true,
31115
31965
  openWorldHint: true
31116
31966
  },
31117
- async handler(params, context$2) {
31967
+ async handler(params, context$1) {
31118
31968
  const resolved = resolveResourceParams({
31119
31969
  url: params.url,
31120
31970
  resourceType: params.resourceType,
@@ -31123,26 +31973,26 @@ var get_sentry_resource_default = defineTool({
31123
31973
  });
31124
31974
  setTag("resource.type", resolved.type);
31125
31975
  setTag("organization.slug", resolved.organizationSlug);
31126
- if (resolved.type === "replay" || resolved.type === "monitor" || resolved.type === "release") return generateUnsupportedResourceMessage(resolved);
31976
+ if (resolved.type === "monitor" || resolved.type === "release") return generateUnsupportedResourceMessage(resolved);
31127
31977
  switch (resolved.type) {
31128
31978
  case "issue": return get_issue_details_default.handler({
31129
31979
  organizationSlug: resolved.organizationSlug,
31130
31980
  issueId: resolved.issueId,
31131
31981
  regionUrl: null
31132
- }, context$2);
31982
+ }, context$1);
31133
31983
  case "event": return get_issue_details_default.handler({
31134
31984
  organizationSlug: resolved.organizationSlug,
31135
31985
  issueId: resolved.issueId,
31136
31986
  eventId: resolved.eventId,
31137
31987
  regionUrl: null
31138
- }, context$2);
31988
+ }, context$1);
31139
31989
  case "trace": return get_trace_details_default.handler({
31140
31990
  organizationSlug: resolved.organizationSlug,
31141
31991
  traceId: resolved.traceId,
31142
31992
  regionUrl: null
31143
- }, context$2);
31993
+ }, context$1);
31144
31994
  case "breadcrumbs": {
31145
- const apiService = apiServiceFromContext(context$2);
31995
+ const apiService = apiServiceFromContext(context$1);
31146
31996
  try {
31147
31997
  return await fetchAndFormatBreadcrumbs(apiService, resolved.organizationSlug, resolved.issueId);
31148
31998
  } catch (error) {
@@ -31153,6 +32003,11 @@ var get_sentry_resource_default = defineTool({
31153
32003
  throw error;
31154
32004
  }
31155
32005
  }
32006
+ case "replay": return get_replay_details_default.handler({
32007
+ replayUrl: params.url,
32008
+ organizationSlug: resolved.organizationSlug,
32009
+ replayId: resolved.replayId
32010
+ }, context$1);
31156
32011
  case "profile": return get_profile_default.handler({
31157
32012
  organizationSlug: resolved.organizationSlug,
31158
32013
  projectSlugOrId: resolved.projectSlug,
@@ -31161,7 +32016,7 @@ var get_sentry_resource_default = defineTool({
31161
32016
  statsPeriod: "7d",
31162
32017
  focusOnUserCode: true,
31163
32018
  maxHotPaths: 10
31164
- }, context$2);
32019
+ }, context$1);
31165
32020
  default: {
31166
32021
  const _exhaustiveCheck = resolved.type;
31167
32022
  throw new Error(`Unhandled resource type: ${_exhaustiveCheck}`);
@@ -31171,7 +32026,7 @@ var get_sentry_resource_default = defineTool({
31171
32026
  });
31172
32027
 
31173
32028
  //#endregion
31174
- //#region ../mcp-core/dist/error-handling-BZypB3Ti.js
32029
+ //#region ../mcp-core/dist/error-handling-BKuqJ6YS.js
31175
32030
  /**
31176
32031
  * Type guard to identify user input validation errors.
31177
32032
  */
@@ -31329,7 +32184,7 @@ async function formatErrorForUser(error, options) {
31329
32184
  }
31330
32185
 
31331
32186
  //#endregion
31332
- //#region ../mcp-core/dist/constraint-helpers-veeM2X-G.js
32187
+ //#region ../mcp-core/dist/constraint-helpers-DwbuhHth.js
31333
32188
  /**
31334
32189
  * Determines which tool parameter keys should be filtered out of the schema
31335
32190
  * because they will be injected from constraints.
@@ -33005,7 +33860,7 @@ var DefaultMCPClient = class {
33005
33860
  };
33006
33861
 
33007
33862
  //#endregion
33008
- //#region ../mcp-core/dist/server-CYjs-BCC.js
33863
+ //#region ../mcp-core/dist/server-D0-2RtQT.js
33009
33864
  /**
33010
33865
  * Format tool calls into a readable trace
33011
33866
  */
@@ -33066,15 +33921,15 @@ var handler_default$3 = defineTool({
33066
33921
  readOnlyHint: true,
33067
33922
  openWorldHint: true
33068
33923
  },
33069
- async handler(params, context$2) {
33924
+ async handler(params, context$1) {
33070
33925
  const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
33071
33926
  const toolsToExclude = new Set(["use_sentry", ...SIMPLE_REPLACEMENT_TOOLS]);
33072
- const toolsForAgent = Object.fromEntries(Object.entries(tools_default).filter(([key, tool$1]) => !toolsToExclude.has(key) && isToolVisibleInMode(tool$1, context$2.experimentalMode ?? false)));
33073
- const server$1 = buildServer({
33074
- context: context$2,
33927
+ const toolsForAgent = Object.fromEntries(Object.entries(tools_default).filter(([key, tool$1]) => !toolsToExclude.has(key) && isToolVisibleInMode(tool$1, context$1.experimentalMode ?? false)));
33928
+ const server = buildServer({
33929
+ context: context$1,
33075
33930
  tools: toolsForAgent
33076
33931
  });
33077
- await server$1.server.connect(serverTransport);
33932
+ await server.server.connect(serverTransport);
33078
33933
  const mcpClient = await createMCPClient({
33079
33934
  name: "mcp.sentry.dev (use-sentry)",
33080
33935
  transport: clientTransport
@@ -33093,7 +33948,7 @@ var handler_default$3 = defineTool({
33093
33948
  return output;
33094
33949
  } finally {
33095
33950
  await mcpClient.close();
33096
- await server$1.server.close();
33951
+ await server.server.close();
33097
33952
  }
33098
33953
  }
33099
33954
  });
@@ -33125,6 +33980,7 @@ var tools_default = {
33125
33980
  get_issue_details: get_issue_details_default,
33126
33981
  get_issue_tag_values: get_issue_tag_values_default,
33127
33982
  get_trace_details: get_trace_details_default,
33983
+ get_replay_details: get_replay_details_default,
33128
33984
  get_event_attachment: get_event_attachment_default,
33129
33985
  update_issue: update_issue_default,
33130
33986
  search_events: handler_default,
@@ -33142,6 +33998,7 @@ var tools_default = {
33142
33998
  list_issues: list_issues_default,
33143
33999
  list_events: list_events_default,
33144
34000
  list_issue_events: list_issue_events_default,
34001
+ get_profile_details: get_profile_details_default,
33145
34002
  get_sentry_resource: get_sentry_resource_default
33146
34003
  };
33147
34004
  /**
@@ -33171,28 +34028,33 @@ var tools_default = {
33171
34028
  * ```typescript
33172
34029
  * import { buildServer } from "@sentry/mcp-core/server";
33173
34030
  * import { createMcpHandler } from "agents/mcp";
34031
+ * import { CfWorkerJsonSchemaValidator } from "@modelcontextprotocol/sdk/validation/cfworker";
33174
34032
  *
33175
34033
  * const serverContext = buildContextFromOAuth();
33176
34034
  * // Context is captured in closures during buildServer()
33177
- * const server = buildServer({ context: serverContext });
34035
+ * // Use CfWorkerJsonSchemaValidator for Cloudflare Workers (ajv is not compatible)
34036
+ * const server = buildServer({
34037
+ * context: serverContext,
34038
+ * jsonSchemaValidator: new CfWorkerJsonSchemaValidator(),
34039
+ * });
33178
34040
  *
33179
34041
  * // Context already available to tool handlers via closures
33180
34042
  * return createMcpHandler(server, { route: "/mcp" })(request, env, ctx);
33181
34043
  * ```
33182
34044
  */
33183
- function buildServer({ context: context$2, agentMode = false, experimentalMode = false, tools: customTools }) {
33184
- const server$1 = new McpServer({
34045
+ function buildServer({ context: context$1, agentMode = false, experimentalMode = false, tools: customTools, jsonSchemaValidator }) {
34046
+ const server = new McpServer({
33185
34047
  name: MCP_SERVER_NAME,
33186
34048
  version: LIB_VERSION
33187
- });
34049
+ }, { jsonSchemaValidator });
33188
34050
  configureServer({
33189
- server: server$1,
33190
- context: context$2,
34051
+ server,
34052
+ context: context$1,
33191
34053
  agentMode,
33192
34054
  experimentalMode,
33193
34055
  tools: customTools
33194
34056
  });
33195
- return wrapMcpServerWithSentry(server$1);
34057
+ return wrapMcpServerWithSentry(server);
33196
34058
  }
33197
34059
  /**
33198
34060
  * Configures an MCP server with tools filtered by granted skills.
@@ -33203,7 +34065,7 @@ function buildServer({ context: context$2, agentMode = false, experimentalMode =
33203
34065
  *
33204
34066
  * In agent mode, only the use_sentry tool is registered, bypassing authorization checks.
33205
34067
  */
33206
- function configureServer({ server: server$1, context: context$2, agentMode = false, experimentalMode = false, tools: customTools }) {
34068
+ function configureServer({ server, context: context$1, agentMode = false, experimentalMode = false, tools: customTools }) {
33207
34069
  let toolsToRegister = agentMode ? { use_sentry: tools_default.use_sentry } : customTools ?? tools_default;
33208
34070
  if (!agentMode && !customTools) {
33209
34071
  const hasAgent = hasAgentProvider();
@@ -33211,8 +34073,8 @@ function configureServer({ server: server$1, context: context$2, agentMode = fal
33211
34073
  toolsToRegister = Object.fromEntries(Object.entries(toolsToRegister).filter(([key]) => !toolsToExclude.has(key)));
33212
34074
  }
33213
34075
  if (!agentMode) toolsToRegister = Object.fromEntries(Object.entries(toolsToRegister).filter(([, tool$1]) => isToolVisibleInMode(tool$1, experimentalMode)));
33214
- const grantedSkills = context$2.grantedSkills ? new Set(context$2.grantedSkills) : void 0;
33215
- server$1.server.onerror = (error) => {
34076
+ const grantedSkills = context$1.grantedSkills ? new Set(context$1.grantedSkills) : void 0;
34077
+ server.server.onerror = (error) => {
33216
34078
  const transportLogOptions = {
33217
34079
  loggerScope: ["server", "transport"],
33218
34080
  contexts: { transport: { phase: "server.onerror" } }
@@ -33248,32 +34110,32 @@ function configureServer({ server: server$1, context: context$2, agentMode = fal
33248
34110
  if (tool$1.skills && tool$1.skills.length > 0) allowed = isEnabledBySkills(grantedSkills, tool$1.skills);
33249
34111
  }
33250
34112
  if (!allowed) continue;
33251
- if (toolKey === "find_organizations" && context$2.constraints.organizationSlug || toolKey === "find_projects" && context$2.constraints.projectSlug) continue;
33252
- if (experimentalMode && context$2.constraints.projectSlug && context$2.constraints.projectCapabilities && tool$1.requiredCapabilities?.length) {
33253
- const caps = context$2.constraints.projectCapabilities;
34113
+ if (toolKey === "find_organizations" && context$1.constraints.organizationSlug || toolKey === "find_projects" && context$1.constraints.projectSlug) continue;
34114
+ if (experimentalMode && context$1.constraints.projectSlug && context$1.constraints.projectCapabilities && tool$1.requiredCapabilities?.length) {
34115
+ const caps = context$1.constraints.projectCapabilities;
33254
34116
  const hasAllCapabilities = tool$1.requiredCapabilities.every((cap) => caps[cap] === true);
33255
34117
  if (!hasAllCapabilities) continue;
33256
34118
  }
33257
- const constraintKeysToFilter = new Set(getConstraintKeysToFilter(context$2.constraints, tool$1.inputSchema));
34119
+ const constraintKeysToFilter = new Set(getConstraintKeysToFilter(context$1.constraints, tool$1.inputSchema));
33258
34120
  const filteredInputSchema = Object.fromEntries(Object.entries(tool$1.inputSchema).filter(([key]) => !constraintKeysToFilter.has(key)));
33259
34121
  const resolvedDescription = resolveDescription(tool$1.description, { experimentalMode });
33260
- server$1.tool(tool$1.name, resolvedDescription, filteredInputSchema, tool$1.annotations, async (params, extra) => {
34122
+ server.tool(tool$1.name, resolvedDescription, filteredInputSchema, tool$1.annotations, async (params, extra) => {
33261
34123
  const activeSpan = getActiveSpan();
33262
34124
  if (activeSpan) {
33263
- if (context$2.constraints.organizationSlug) activeSpan.setAttribute("sentry-mcp.constraint-organization", context$2.constraints.organizationSlug);
33264
- if (context$2.constraints.projectSlug) activeSpan.setAttribute("sentry-mcp.constraint-project", context$2.constraints.projectSlug);
34125
+ if (context$1.constraints.organizationSlug) activeSpan.setAttribute("sentry-mcp.constraint-organization", context$1.constraints.organizationSlug);
34126
+ if (context$1.constraints.projectSlug) activeSpan.setAttribute("sentry-mcp.constraint-project", context$1.constraints.projectSlug);
33265
34127
  }
33266
- if (context$2.userId) setUser({ id: context$2.userId });
33267
- if (context$2.clientId) setTag("client.id", context$2.clientId);
34128
+ if (context$1.userId) setUser({ id: context$1.userId });
34129
+ if (context$1.clientId) setTag("client.id", context$1.clientId);
33268
34130
  setTag("mode.agent", agentMode);
33269
34131
  setTag("mode.experimental", experimentalMode);
33270
34132
  try {
33271
- const applicableConstraints = getConstraintParametersToInject(context$2.constraints, tool$1.inputSchema);
34133
+ const applicableConstraints = getConstraintParametersToInject(context$1.constraints, tool$1.inputSchema);
33272
34134
  const paramsWithConstraints = {
33273
34135
  ...params,
33274
34136
  ...applicableConstraints
33275
34137
  };
33276
- const output = await tool$1.handler(paramsWithConstraints, context$2);
34138
+ const output = await tool$1.handler(paramsWithConstraints, context$1);
33277
34139
  if (activeSpan) activeSpan.setStatus({ code: 1 });
33278
34140
  if (typeof output === "string") return { content: [{
33279
34141
  type: "text",
@@ -33289,7 +34151,7 @@ function configureServer({ server: server$1, context: context$2, agentMode = fal
33289
34151
  return {
33290
34152
  content: [{
33291
34153
  type: "text",
33292
- text: await formatErrorForUser(error, { transport: context$2.transport })
34154
+ text: await formatErrorForUser(error, { transport: context$1.transport })
33293
34155
  }],
33294
34156
  isError: true
33295
34157
  };
@@ -33299,7 +34161,7 @@ function configureServer({ server: server$1, context: context$2, agentMode = fal
33299
34161
  }
33300
34162
 
33301
34163
  //#endregion
33302
- //#region ../mcp-core/dist/sentry-BvzNteNf.js
34164
+ //#region ../mcp-core/dist/sentry-DtgK-Kwi.js
33303
34165
  const SCRUB_PATTERNS = [
33304
34166
  {
33305
34167
  pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
@@ -33413,176 +34275,200 @@ function die(message) {
33413
34275
  console.error(usageText);
33414
34276
  process.exit(1);
33415
34277
  }
33416
- const cli = parseArgv(process.argv.slice(2));
33417
- if (cli.help) {
33418
- console.log(usageText);
33419
- process.exit(0);
33420
- }
33421
- if (cli.version) {
33422
- console.log(`${packageName} ${LIB_VERSION}`);
33423
- process.exit(0);
33424
- }
33425
- if (cli.unknownArgs.length > 0) {
33426
- console.error("Error: Invalid argument(s):", cli.unknownArgs.join(", "));
33427
- console.error(usageText);
33428
- process.exit(1);
33429
- }
33430
- const env = parseEnv(process.env);
33431
- const cfg = (() => {
33432
- try {
33433
- return finalize(merge(cli, env));
33434
- } catch (err) {
34278
+ async function main() {
34279
+ const rawArgs = process.argv.slice(2);
34280
+ if (rawArgs[0] === "auth") {
34281
+ await authCommand(rawArgs.slice(1));
34282
+ return;
34283
+ }
34284
+ const cli = parseArgv(rawArgs);
34285
+ if (cli.help) {
34286
+ console.log(usageText);
34287
+ process.exit(0);
34288
+ }
34289
+ if (cli.version) {
34290
+ console.log(`${packageName} ${LIB_VERSION}`);
34291
+ process.exit(0);
34292
+ }
34293
+ if (cli.unknownArgs.length > 0) {
34294
+ console.error("Error: Invalid argument(s):", cli.unknownArgs.join(", "));
34295
+ console.error(usageText);
34296
+ process.exit(1);
34297
+ }
34298
+ const env = parseEnv(process.env);
34299
+ const partialCfg = (() => {
34300
+ try {
34301
+ return finalize(merge(cli, env));
34302
+ } catch (err) {
34303
+ die(err instanceof Error ? err.message : String(err));
34304
+ }
34305
+ })();
34306
+ const cfg = await resolveAccessToken(partialCfg).catch((err) => {
33435
34307
  die(err instanceof Error ? err.message : String(err));
34308
+ });
34309
+ if (cfg.agentProvider) setAgentProvider(cfg.agentProvider);
34310
+ setProviderBaseUrls({
34311
+ openaiBaseUrl: cfg.openaiBaseUrl,
34312
+ anthropicBaseUrl: cfg.anthropicBaseUrl
34313
+ });
34314
+ if (cfg.openaiModel) process.env.OPENAI_MODEL = cfg.openaiModel;
34315
+ if (cfg.anthropicModel) process.env.ANTHROPIC_MODEL = cfg.anthropicModel;
34316
+ function hasProviderConflict() {
34317
+ const hasAnthropic = Boolean(process.env.ANTHROPIC_API_KEY);
34318
+ const hasOpenAI = Boolean(process.env.OPENAI_API_KEY);
34319
+ const hasExplicitProvider = cfg.agentProvider || process.env.EMBEDDED_AGENT_PROVIDER;
34320
+ return hasAnthropic && hasOpenAI && !hasExplicitProvider;
34321
+ }
34322
+ function getConfiguredProvider() {
34323
+ return cfg.agentProvider || process.env.EMBEDDED_AGENT_PROVIDER?.toLowerCase();
34324
+ }
34325
+ function hasProviderMismatch() {
34326
+ const configured = getConfiguredProvider();
34327
+ if (!configured) return { mismatch: false };
34328
+ const hasAnthropic = Boolean(process.env.ANTHROPIC_API_KEY);
34329
+ const hasOpenAI = Boolean(process.env.OPENAI_API_KEY);
34330
+ if ((configured === "openai" || configured === "azure-openai") && !hasOpenAI && hasAnthropic) return {
34331
+ mismatch: true,
34332
+ configured,
34333
+ availableKey: "ANTHROPIC_API_KEY"
34334
+ };
34335
+ if (configured === "anthropic" && !hasAnthropic && hasOpenAI) return {
34336
+ mismatch: true,
34337
+ configured: "anthropic",
34338
+ availableKey: "OPENAI_API_KEY"
34339
+ };
34340
+ return { mismatch: false };
33436
34341
  }
33437
- })();
33438
- if (cfg.agentProvider) setAgentProvider(cfg.agentProvider);
33439
- setProviderBaseUrls({
33440
- openaiBaseUrl: cfg.openaiBaseUrl,
33441
- anthropicBaseUrl: cfg.anthropicBaseUrl
33442
- });
33443
- if (cfg.openaiModel) process.env.OPENAI_MODEL = cfg.openaiModel;
33444
- if (cfg.anthropicModel) process.env.ANTHROPIC_MODEL = cfg.anthropicModel;
33445
- function hasProviderConflict() {
33446
- const hasAnthropic = Boolean(process.env.ANTHROPIC_API_KEY);
33447
- const hasOpenAI = Boolean(process.env.OPENAI_API_KEY);
33448
- const hasExplicitProvider = cfg.agentProvider || process.env.EMBEDDED_AGENT_PROVIDER;
33449
- return hasAnthropic && hasOpenAI && !hasExplicitProvider;
33450
- }
33451
- function getConfiguredProvider() {
33452
- return cfg.agentProvider || process.env.EMBEDDED_AGENT_PROVIDER?.toLowerCase();
33453
- }
33454
- function hasProviderMismatch() {
33455
- const configured = getConfiguredProvider();
33456
- if (!configured) return { mismatch: false };
33457
- const hasAnthropic = Boolean(process.env.ANTHROPIC_API_KEY);
33458
- const hasOpenAI = Boolean(process.env.OPENAI_API_KEY);
33459
- if (configured === "openai" && !hasOpenAI && hasAnthropic) return {
33460
- mismatch: true,
33461
- configured: "openai",
33462
- availableKey: "ANTHROPIC_API_KEY"
33463
- };
33464
- if (configured === "anthropic" && !hasAnthropic && hasOpenAI) return {
33465
- mismatch: true,
33466
- configured: "anthropic",
33467
- availableKey: "OPENAI_API_KEY"
33468
- };
33469
- return { mismatch: false };
33470
- }
33471
- function getProviderSource() {
33472
- if (cli.agentProvider) return "explicitly configured";
33473
- if (process.env.EMBEDDED_AGENT_PROVIDER) return "from EMBEDDED_AGENT_PROVIDER";
33474
- return "auto-detected";
33475
- }
33476
- const resolvedProvider = getResolvedProviderType();
33477
- if (!resolvedProvider) {
33478
- const mismatchInfo = hasProviderMismatch();
33479
- if (hasProviderConflict()) {
33480
- console.warn("Warning: Both ANTHROPIC_API_KEY and OPENAI_API_KEY are set, but no provider is explicitly configured.");
33481
- console.warn("Please set EMBEDDED_AGENT_PROVIDER='openai' or 'anthropic' to specify which provider to use.");
33482
- console.warn("AI-powered search tools will be unavailable until a provider is selected.");
33483
- } else if (mismatchInfo.mismatch) {
33484
- const expectedKey = mismatchInfo.configured === "openai" ? "OPENAI_API_KEY" : "ANTHROPIC_API_KEY";
33485
- const configuredViaCliFlag = Boolean(cli.agentProvider);
33486
- const providerSetting = configuredViaCliFlag ? `--agent-provider=${mismatchInfo.configured}` : `EMBEDDED_AGENT_PROVIDER='${mismatchInfo.configured}'`;
33487
- const changeProviderHint = configuredViaCliFlag ? "Change --agent-provider to match your available API key" : "Change EMBEDDED_AGENT_PROVIDER to match your available API key";
33488
- console.warn(`Warning: ${providerSetting} but ${expectedKey} is not set.`);
33489
- console.warn(`Found ${mismatchInfo.availableKey} instead. Either:`);
33490
- console.warn(` - Set ${expectedKey} to use the ${mismatchInfo.configured} provider, or`);
33491
- console.warn(` - ${changeProviderHint}`);
33492
- console.warn("AI-powered search tools will be unavailable until this is resolved.");
34342
+ function getProviderSource() {
34343
+ if (cli.agentProvider) return "explicitly configured";
34344
+ if (process.env.EMBEDDED_AGENT_PROVIDER) return "from EMBEDDED_AGENT_PROVIDER";
34345
+ return "auto-detected";
34346
+ }
34347
+ const resolvedProvider = getResolvedProviderType();
34348
+ if (!resolvedProvider) {
34349
+ const mismatchInfo = hasProviderMismatch();
34350
+ let providerConfigError;
34351
+ try {
34352
+ getAgentProvider();
34353
+ } catch (error) {
34354
+ providerConfigError = error instanceof Error ? error.message : String(error);
34355
+ }
34356
+ if (hasProviderConflict()) {
34357
+ console.warn("Warning: Both ANTHROPIC_API_KEY and OPENAI_API_KEY are set, but no provider is explicitly configured.");
34358
+ console.warn("Please set EMBEDDED_AGENT_PROVIDER='openai', 'azure-openai', or 'anthropic' to specify which provider to use.");
34359
+ console.warn("AI-powered search tools will be unavailable until a provider is selected.");
34360
+ } else if (mismatchInfo.mismatch) {
34361
+ const expectedKey = mismatchInfo.configured === "openai" || mismatchInfo.configured === "azure-openai" ? "OPENAI_API_KEY" : "ANTHROPIC_API_KEY";
34362
+ const configuredViaCliFlag = Boolean(cli.agentProvider);
34363
+ const providerSetting = configuredViaCliFlag ? `--agent-provider=${mismatchInfo.configured}` : `EMBEDDED_AGENT_PROVIDER='${mismatchInfo.configured}'`;
34364
+ const changeProviderHint = configuredViaCliFlag ? "Change --agent-provider to match your available API key" : "Change EMBEDDED_AGENT_PROVIDER to match your available API key";
34365
+ console.warn(`Warning: ${providerSetting} but ${expectedKey} is not set.`);
34366
+ console.warn(`Found ${mismatchInfo.availableKey} instead. Either:`);
34367
+ console.warn(` - Set ${expectedKey} to use the ${mismatchInfo.configured} provider, or`);
34368
+ console.warn(` - ${changeProviderHint}`);
34369
+ console.warn("AI-powered search tools will be unavailable until this is resolved.");
34370
+ } else if (providerConfigError && !providerConfigError.startsWith("No embedded agent provider configured")) {
34371
+ console.warn(`Warning: ${providerConfigError}`);
34372
+ console.warn("AI-powered search tools will be unavailable until this is resolved.");
34373
+ } else {
34374
+ console.warn("Warning: No LLM API key found (OPENAI_API_KEY or ANTHROPIC_API_KEY).");
34375
+ console.warn("The following AI-powered search tools will be unavailable:");
34376
+ console.warn(" - search_events, search_issues, search_issue_events, use_sentry");
34377
+ console.warn("Use list_issues and list_events for direct Sentry query syntax instead.");
34378
+ }
34379
+ console.warn("");
33493
34380
  } else {
33494
- console.warn("Warning: No LLM API key found (OPENAI_API_KEY or ANTHROPIC_API_KEY).");
33495
- console.warn("The following AI-powered search tools will be unavailable:");
33496
- console.warn(" - search_events, search_issues, search_issue_events, use_sentry");
33497
- console.warn("Use list_issues and list_events for direct Sentry query syntax instead.");
33498
- }
33499
- console.warn("");
33500
- } else {
33501
- const providerSource = getProviderSource();
33502
- console.warn(`Using ${resolvedProvider} for AI-powered search tools (${providerSource}).`);
33503
- if (providerSource === "auto-detected") {
33504
- console.warn("Deprecation warning: Auto-detection of LLM provider is deprecated.");
33505
- console.warn(`Please set EMBEDDED_AGENT_PROVIDER='${resolvedProvider}' explicitly.`);
33506
- console.warn("Auto-detection will be removed in a future release.");
33507
- }
33508
- console.warn("");
33509
- }
33510
- Sentry.init({
33511
- dsn: cfg.sentryDsn,
33512
- sendDefaultPii: true,
33513
- tracesSampleRate: 1,
33514
- beforeSend: sentryBeforeSend,
33515
- initialScope: { tags: {
33516
- "mcp.server_version": LIB_VERSION,
33517
- "mcp.transport": "stdio",
33518
- "mcp.agent_mode": cli.agent ? "true" : "false",
33519
- "mcp.experimental_mode": cli.experimental ? "true" : "false",
33520
- "sentry.host": cfg.sentryHost,
33521
- "mcp.mcp-url": cfg.mcpUrl
33522
- } },
33523
- release: process.env.SENTRY_RELEASE,
33524
- integrations: [
33525
- Sentry.consoleLoggingIntegration(),
33526
- Sentry.zodErrorsIntegration(),
33527
- Sentry.vercelAIIntegration({
33528
- recordInputs: true,
33529
- recordOutputs: true
33530
- })
33531
- ],
33532
- environment: "stdio"
33533
- });
33534
- if (cli.agent) {
33535
- console.warn("Agent mode enabled: Only use_sentry tool is available.");
33536
- console.warn("The use_sentry tool provides access to all Sentry operations through natural language.");
33537
- console.warn("");
33538
- }
33539
- if (cli.experimental) {
33540
- console.warn("Experimental mode enabled: Experimental tools are available.");
33541
- console.warn("");
33542
- }
33543
- const SENTRY_TIMEOUT = 5e3;
33544
- async function shutdown(signal) {
33545
- console.error(`${signal} received, shutting down...`);
33546
- await Sentry.flush(SENTRY_TIMEOUT);
33547
- process.exit(0);
33548
- }
33549
- process.on("SIGTERM", () => shutdown("SIGTERM"));
33550
- process.on("SIGINT", () => shutdown("SIGINT"));
33551
- process.on("uncaughtException", async (error) => {
33552
- console.error("Uncaught exception:", error);
33553
- Sentry.captureException(error);
33554
- await Sentry.flush(SENTRY_TIMEOUT);
33555
- process.exit(1);
33556
- });
33557
- process.on("unhandledRejection", async (reason) => {
33558
- console.error("Unhandled rejection:", reason);
33559
- Sentry.captureException(reason);
33560
- await Sentry.flush(SENTRY_TIMEOUT);
33561
- process.exit(1);
33562
- });
33563
- const context = {
33564
- accessToken: cfg.accessToken,
33565
- grantedSkills: cfg.finalSkills,
33566
- constraints: {
33567
- organizationSlug: cfg.organizationSlug ?? null,
33568
- projectSlug: cfg.projectSlug ?? null
33569
- },
33570
- sentryHost: cfg.sentryHost,
33571
- mcpUrl: cfg.mcpUrl,
33572
- openaiBaseUrl: cfg.openaiBaseUrl,
33573
- agentMode: cli.agent,
33574
- experimentalMode: cli.experimental,
33575
- transport: "stdio"
33576
- };
33577
- const server = buildServer({
33578
- context,
33579
- agentMode: cli.agent,
33580
- experimentalMode: cli.experimental
33581
- });
33582
- startStdio(server, context).catch(async (err) => {
33583
- console.error("Server error:", err);
33584
- Sentry.captureException(err);
33585
- await Sentry.flush(SENTRY_TIMEOUT);
34381
+ const providerSource = getProviderSource();
34382
+ const providerLabel = getAgentProvider().label;
34383
+ console.warn(`Using ${providerLabel} for AI-powered search tools (${providerSource}).`);
34384
+ if (providerSource === "auto-detected") {
34385
+ console.warn("Deprecation warning: Auto-detection of LLM provider is deprecated.");
34386
+ console.warn(`Please set EMBEDDED_AGENT_PROVIDER='${resolvedProvider}' explicitly.`);
34387
+ console.warn("Auto-detection will be removed in a future release.");
34388
+ }
34389
+ console.warn("");
34390
+ }
34391
+ Sentry.init({
34392
+ dsn: cfg.sentryDsn,
34393
+ sendDefaultPii: true,
34394
+ tracesSampleRate: 1,
34395
+ beforeSend: sentryBeforeSend,
34396
+ initialScope: { tags: {
34397
+ "mcp.server_version": LIB_VERSION,
34398
+ "mcp.transport": "stdio",
34399
+ "mcp.agent_mode": cli.agent ? "true" : "false",
34400
+ "mcp.experimental_mode": cli.experimental ? "true" : "false",
34401
+ "sentry.host": cfg.sentryHost,
34402
+ "mcp.mcp-url": cfg.mcpUrl
34403
+ } },
34404
+ release: process.env.SENTRY_RELEASE,
34405
+ integrations: [
34406
+ Sentry.consoleLoggingIntegration(),
34407
+ Sentry.zodErrorsIntegration(),
34408
+ Sentry.vercelAIIntegration({
34409
+ recordInputs: true,
34410
+ recordOutputs: true
34411
+ })
34412
+ ],
34413
+ environment: "stdio"
34414
+ });
34415
+ if (cli.agent) {
34416
+ console.warn("Agent mode enabled: Only use_sentry tool is available.");
34417
+ console.warn("The use_sentry tool provides access to all Sentry operations through natural language.");
34418
+ console.warn("");
34419
+ }
34420
+ if (cli.experimental) {
34421
+ console.warn("Experimental mode enabled: Forward-looking tool variants and experimental features are available.");
34422
+ console.warn("");
34423
+ }
34424
+ const SENTRY_TIMEOUT = 5e3;
34425
+ async function shutdown(signal) {
34426
+ console.error(`${signal} received, shutting down...`);
34427
+ await Sentry.flush(SENTRY_TIMEOUT);
34428
+ process.exit(0);
34429
+ }
34430
+ process.on("SIGTERM", () => shutdown("SIGTERM"));
34431
+ process.on("SIGINT", () => shutdown("SIGINT"));
34432
+ process.on("uncaughtException", async (error) => {
34433
+ console.error("Uncaught exception:", error);
34434
+ Sentry.captureException(error);
34435
+ await Sentry.flush(SENTRY_TIMEOUT);
34436
+ process.exit(1);
34437
+ });
34438
+ process.on("unhandledRejection", async (reason) => {
34439
+ console.error("Unhandled rejection:", reason);
34440
+ Sentry.captureException(reason);
34441
+ await Sentry.flush(SENTRY_TIMEOUT);
34442
+ process.exit(1);
34443
+ });
34444
+ const context$1 = {
34445
+ accessToken: cfg.accessToken,
34446
+ grantedSkills: cfg.finalSkills,
34447
+ constraints: {
34448
+ organizationSlug: cfg.organizationSlug ?? null,
34449
+ projectSlug: cfg.projectSlug ?? null
34450
+ },
34451
+ sentryHost: cfg.sentryHost,
34452
+ mcpUrl: cfg.mcpUrl,
34453
+ openaiBaseUrl: cfg.openaiBaseUrl,
34454
+ agentMode: cli.agent,
34455
+ experimentalMode: cli.experimental,
34456
+ transport: "stdio"
34457
+ };
34458
+ const server = buildServer({
34459
+ context: context$1,
34460
+ agentMode: cli.agent,
34461
+ experimentalMode: cli.experimental
34462
+ });
34463
+ startStdio(server, context$1).catch(async (err) => {
34464
+ console.error("Server error:", err);
34465
+ Sentry.captureException(err);
34466
+ await Sentry.flush(SENTRY_TIMEOUT);
34467
+ process.exit(1);
34468
+ });
34469
+ }
34470
+ main().catch((err) => {
34471
+ console.error("Fatal error:", err);
33586
34472
  process.exit(1);
33587
34473
  });
33588
34474