@sentry/mcp-server 0.34.0 → 0.35.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 (51) hide show
  1. package/dist/auth/constants.cjs +1 -1
  2. package/dist/auth/constants.js +1 -1
  3. package/dist/auth/device-code-flow.cjs +3 -3
  4. package/dist/auth/device-code-flow.js +3 -3
  5. package/dist/auth/resolve-token.cjs +4 -4
  6. package/dist/auth/resolve-token.js +4 -4
  7. package/dist/{auth-BFtSFR07.cjs → auth-DeUVu86q.cjs} +4 -4
  8. package/dist/{auth-BFtSFR07.cjs.map → auth-DeUVu86q.cjs.map} +1 -1
  9. package/dist/{auth-A9SbZrVW.js → auth-NuILycy3.js} +4 -4
  10. package/dist/{auth-A9SbZrVW.js.map → auth-NuILycy3.js.map} +1 -1
  11. package/dist/cli/commands/auth.cjs +5 -5
  12. package/dist/cli/commands/auth.js +5 -5
  13. package/dist/cli/parse.d.ts.map +1 -1
  14. package/dist/cli/resolve.cjs +2 -2
  15. package/dist/cli/resolve.js +2 -2
  16. package/dist/{constants-DxEbVScP.cjs → constants-Bgs-7WBj.cjs} +18 -2
  17. package/dist/constants-Bgs-7WBj.cjs.map +1 -0
  18. package/dist/{constants-CR1eH5g2.js → constants-BjQ5jCEg.js} +13 -3
  19. package/dist/constants-BjQ5jCEg.js.map +1 -0
  20. package/dist/{device-code-flow-C5A4Ubww.js → device-code-flow-CltWJnOC.js} +3 -3
  21. package/dist/{device-code-flow-C5A4Ubww.js.map → device-code-flow-CltWJnOC.js.map} +1 -1
  22. package/dist/{device-code-flow-DmHR9gAX.cjs → device-code-flow-b6KaQzNJ.cjs} +3 -3
  23. package/dist/{device-code-flow-DmHR9gAX.cjs.map → device-code-flow-b6KaQzNJ.cjs.map} +1 -1
  24. package/dist/index.cjs +483 -66
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.js +483 -66
  27. package/dist/index.js.map +1 -1
  28. package/dist/{resolve-BOBiWoGW.cjs → resolve-D4TZw-d-.cjs} +2 -2
  29. package/dist/{resolve-BOBiWoGW.cjs.map → resolve-D4TZw-d-.cjs.map} +1 -1
  30. package/dist/{resolve-rfTy87TT.js → resolve-D9XJMdCX.js} +2 -2
  31. package/dist/{resolve-rfTy87TT.js.map → resolve-D9XJMdCX.js.map} +1 -1
  32. package/dist/{resolve-token-D3Ti8TJ_.cjs → resolve-token-BfHulcsU.cjs} +3 -3
  33. package/dist/{resolve-token-D3Ti8TJ_.cjs.map → resolve-token-BfHulcsU.cjs.map} +1 -1
  34. package/dist/{resolve-token-BBveHRyr.js → resolve-token-DitlJMRA.js} +3 -3
  35. package/dist/{resolve-token-BBveHRyr.js.map → resolve-token-DitlJMRA.js.map} +1 -1
  36. package/dist/{stdio-CNiKUCkA.cjs → stdio-CHTzpWeM.cjs} +2 -2
  37. package/dist/{stdio-CNiKUCkA.cjs.map → stdio-CHTzpWeM.cjs.map} +1 -1
  38. package/dist/{stdio-MUSHk0bq.js → stdio-Eif0LiAU.js} +2 -2
  39. package/dist/{stdio-MUSHk0bq.js.map → stdio-Eif0LiAU.js.map} +1 -1
  40. package/dist/transports/stdio.cjs +2 -2
  41. package/dist/transports/stdio.js +2 -2
  42. package/dist/version-BbMRHfZS.js +7 -0
  43. package/dist/version-BbMRHfZS.js.map +1 -0
  44. package/dist/{version-B6ykl6YN.cjs → version-BsYB56vP.cjs} +3 -3
  45. package/dist/version-BsYB56vP.cjs.map +1 -0
  46. package/package.json +4 -4
  47. package/dist/constants-CR1eH5g2.js.map +0 -1
  48. package/dist/constants-DxEbVScP.cjs.map +0 -1
  49. package/dist/version-B6ykl6YN.cjs.map +0 -1
  50. package/dist/version-DsnkzOWJ.js +0 -7
  51. package/dist/version-DsnkzOWJ.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
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, isEnabledBySkills } from "./resolve-rfTy87TT.js";
4
- import { PUBLIC_EVENTS_DATASETS, getContinuousProfileUrl, getIssueUrl, getIssuesSearchUrl, getMonitorUrl, getProfileUrl, getProfilingExplorerUrl, getReleaseUrl, getReplayUrl, getReplaysSearchUrl, getTraceMetricsExploreUrl, getTraceUrl, isMetricsDataset, isProfilesDataset, isSentryHost, normalizeEventsDataset } from "./constants-CR1eH5g2.js";
5
- import { LIB_VERSION, USER_AGENT } from "./version-DsnkzOWJ.js";
3
+ import { ALL_SKILLS, SKILLS, finalize, isEnabledBySkills } from "./resolve-D9XJMdCX.js";
4
+ import { PUBLIC_EVENTS_DATASETS, getAIConversationUrl, getContinuousProfileUrl, getIssueUrl, getIssuesSearchUrl, getMonitorUrl, getProfileUrl, getProfilingExplorerUrl, getReleaseUrl, getReplayUrl, getReplaysSearchUrl, getTraceMetricsExploreUrl, getTraceUrl, isMetricsDataset, isProfilesDataset, isSentryHost, normalizeEventsDataset } from "./constants-BjQ5jCEg.js";
5
+ import { LIB_VERSION, USER_AGENT } from "./version-BbMRHfZS.js";
6
6
  import { blobToBase64 } from "./blob-utils-CGHZbDNh-Dhzb2_wT.js";
7
7
  import { RECOMMENDED_FIELDS, TRACE_METRICS_SAMPLE_IDENTITY_FIELDS, systemPrompt } from "./config-YHBj037H-DRbUBG2X.js";
8
- import { startStdio } from "./stdio-MUSHk0bq.js";
8
+ import { startStdio } from "./stdio-Eif0LiAU.js";
9
9
  import { buildUsage } from "./usage-CyXue87B.js";
10
10
  import { merge, parseArgv, parseEnv } from "./parse-BSFxOAQG.js";
11
11
  import "./types-nsyASfJr.js";
12
- import "./device-code-flow-C5A4Ubww.js";
12
+ import "./device-code-flow-CltWJnOC.js";
13
13
  import "./token-cache-DHBN2ixb.js";
14
- import { resolveAccessToken } from "./resolve-token-BBveHRyr.js";
15
- import { authCommand } from "./auth-A9SbZrVW.js";
14
+ import { resolveAccessToken } from "./resolve-token-DitlJMRA.js";
15
+ import { authCommand } from "./auth-NuILycy3.js";
16
16
  import { z } from "zod";
17
17
  import { captureException, captureMessage, getActiveSpan, logger, setTag, setUser, withScope, wrapMcpServerWithSentry } from "@sentry/core";
18
18
  import util from "node:util";
@@ -1686,7 +1686,7 @@ function safeJsonStringify$1(value) {
1686
1686
  return void 0;
1687
1687
  }
1688
1688
  }
1689
- function truncate(text$1, maxLength = 1024) {
1689
+ function truncate$1(text$1, maxLength = 1024) {
1690
1690
  if (text$1.length <= maxLength) return text$1;
1691
1691
  return `${text$1.slice(0, maxLength - 1)}…`;
1692
1692
  }
@@ -1695,7 +1695,7 @@ function coerceMessage(value) {
1695
1695
  if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return value.toString();
1696
1696
  if (value === null || value === void 0) return String(value);
1697
1697
  const json$1 = safeJsonStringify$1(value);
1698
- if (json$1) return truncate(json$1);
1698
+ if (json$1) return truncate$1(json$1);
1699
1699
  return Object.prototype.toString.call(value);
1700
1700
  }
1701
1701
  function serializeError(value, depth = 0) {
@@ -1803,7 +1803,7 @@ function logIssue(error, contextsOrOptions, attachmentsArg) {
1803
1803
  }
1804
1804
 
1805
1805
  //#endregion
1806
- //#region ../mcp-core/dist/schema-DX1lGjAs.js
1806
+ //#region ../mcp-core/dist/schema-CBV6nj_V.js
1807
1807
  /**
1808
1808
  * Schema for Sentry API error responses.
1809
1809
  *
@@ -2527,6 +2527,46 @@ const TraceIssueSchema = z.object({
2527
2527
  * - `src/sentry/snuba/trace.py` (`SerializedSpan`, `SerializedIssue`)
2528
2528
  */
2529
2529
  const TraceSchema = z.array(z.union([TraceSpanSchema, TraceIssueSchema]));
2530
+ const NullableStringOrNumberSchema = z.union([z.string(), z.number()]).nullable().optional();
2531
+ const NullableOptionalStringSchema = z.string().nullable().optional().transform((value) => value ?? void 0);
2532
+ const AIConversationSpanSchema = z.object({
2533
+ "gen_ai.conversation.id": z.string(),
2534
+ span_id: z.string(),
2535
+ trace: z.string(),
2536
+ parent_span: z.string().nullable().optional(),
2537
+ "precise.start_ts": z.number(),
2538
+ "precise.finish_ts": z.number(),
2539
+ project: z.string(),
2540
+ "project.id": z.union([z.string(), z.number()]),
2541
+ "span.name": NullableOptionalStringSchema,
2542
+ "span.status": NullableOptionalStringSchema,
2543
+ "span.op": NullableOptionalStringSchema,
2544
+ "span.description": NullableOptionalStringSchema,
2545
+ "span.duration": z.number().optional(),
2546
+ transaction: NullableOptionalStringSchema,
2547
+ is_transaction: z.boolean().optional(),
2548
+ "gen_ai.cost.total_tokens": NullableStringOrNumberSchema,
2549
+ "gen_ai.operation.type": NullableOptionalStringSchema,
2550
+ "gen_ai.input.messages": NullableOptionalStringSchema,
2551
+ "gen_ai.output.messages": NullableOptionalStringSchema,
2552
+ "gen_ai.system_instructions": NullableOptionalStringSchema,
2553
+ "gen_ai.tool.definitions": NullableOptionalStringSchema,
2554
+ "gen_ai.request.messages": NullableOptionalStringSchema,
2555
+ "gen_ai.response.object": NullableOptionalStringSchema,
2556
+ "gen_ai.response.text": NullableOptionalStringSchema,
2557
+ "gen_ai.tool.name": NullableOptionalStringSchema,
2558
+ "gen_ai.tool.call.arguments": NullableOptionalStringSchema,
2559
+ "gen_ai.tool.input": NullableOptionalStringSchema,
2560
+ "gen_ai.usage.total_tokens": NullableStringOrNumberSchema,
2561
+ "gen_ai.request.model": NullableOptionalStringSchema,
2562
+ "gen_ai.response.model": NullableOptionalStringSchema,
2563
+ "gen_ai.agent.name": NullableOptionalStringSchema,
2564
+ "user.id": NullableOptionalStringSchema,
2565
+ "user.email": NullableOptionalStringSchema,
2566
+ "user.username": NullableOptionalStringSchema,
2567
+ "user.ip": NullableOptionalStringSchema
2568
+ }).passthrough();
2569
+ const AIConversationSpanListSchema = z.array(AIConversationSpanSchema);
2530
2570
  /**
2531
2571
  * Schema for individual frames in a flamegraph.
2532
2572
  *
@@ -3011,7 +3051,7 @@ function isApiAuthenticationErrorDeep(error) {
3011
3051
  }
3012
3052
 
3013
3053
  //#endregion
3014
- //#region ../mcp-core/dist/client-B8HqjgY7.js
3054
+ //#region ../mcp-core/dist/client-B-fPHCKZ.js
3015
3055
  /**
3016
3056
  * Mapping of common network error codes to user-friendly messages.
3017
3057
  * These help users understand and resolve connection issues.
@@ -3023,6 +3063,15 @@ const NETWORK_ERROR_MESSAGES = {
3023
3063
  ETIMEDOUT: "Connection timed out. Check network connectivity.",
3024
3064
  ECONNRESET: "Connection reset. Try again in a moment."
3025
3065
  };
3066
+ function getNextCursor(linkHeader) {
3067
+ if (!linkHeader) return null;
3068
+ for (const link of linkHeader.split(",")) {
3069
+ if (!link.includes("rel=\"next\"") || !link.includes("results=\"true\"")) continue;
3070
+ const cursorMatch = link.match(/cursor="([^"]+)"/);
3071
+ if (cursorMatch?.[1]) return cursorMatch[1];
3072
+ }
3073
+ return null;
3074
+ }
3026
3075
  function isRecord$1(value) {
3027
3076
  return typeof value === "object" && value !== null && !Array.isArray(value);
3028
3077
  }
@@ -3336,6 +3385,9 @@ var SentryApiService = class {
3336
3385
  getReplayUrl(organizationSlug, replayId) {
3337
3386
  return getReplayUrl(this.host, organizationSlug, replayId, this.protocol);
3338
3387
  }
3388
+ getAIConversationUrl(organizationSlug, conversationId) {
3389
+ return getAIConversationUrl(this.host, organizationSlug, conversationId, this.protocol);
3390
+ }
3339
3391
  getProfileUrl(organizationSlug, projectSlug, profileId) {
3340
3392
  return getProfileUrl(this.host, organizationSlug, projectSlug, profileId, this.protocol);
3341
3393
  }
@@ -3925,7 +3977,7 @@ var SentryApiService = class {
3925
3977
  const sentryQuery = [];
3926
3978
  if (query) sentryQuery.push(query);
3927
3979
  const queryParams = new URLSearchParams();
3928
- queryParams.set("per_page", String(limit));
3980
+ queryParams.set("limit", String(limit));
3929
3981
  if (sortBy) queryParams.set("sort", sortBy);
3930
3982
  queryParams.set("statsPeriod", "24h");
3931
3983
  queryParams.set("query", sentryQuery.join(" "));
@@ -4313,6 +4365,24 @@ var SentryApiService = class {
4313
4365
  const body = await this.requestJSON(`/organizations/${organizationSlug}/trace/${traceId}/?${queryParams.toString()}`, void 0, opts);
4314
4366
  return TraceSchema.parse(body);
4315
4367
  }
4368
+ async getAIConversation({ organizationSlug, conversationId, project = "-1", statsPeriod = "30d", perPage = 1e3, maxPages = 10 }, opts) {
4369
+ const spans = [];
4370
+ let cursor = null;
4371
+ for (let page = 0; page < maxPages; page++) {
4372
+ const queryParams = new URLSearchParams();
4373
+ queryParams.set("per_page", String(perPage));
4374
+ queryParams.set("statsPeriod", statsPeriod);
4375
+ const projects = Array.isArray(project) ? project : [project];
4376
+ for (const projectId of projects) queryParams.append("project", projectId);
4377
+ if (cursor) queryParams.set("cursor", cursor);
4378
+ const response = await this.request(`/organizations/${organizationSlug}/ai-conversations/${encodeURIComponent(conversationId)}/?${queryParams.toString()}`, void 0, opts);
4379
+ const body = await this.parseJsonResponse(response);
4380
+ spans.push(...AIConversationSpanListSchema.parse(body));
4381
+ cursor = getNextCursor(response.headers.get("link"));
4382
+ if (!cursor) break;
4383
+ }
4384
+ return spans;
4385
+ }
4316
4386
  /**
4317
4387
  * Retrieves flamegraph data for a transaction.
4318
4388
  *
@@ -12182,7 +12252,7 @@ function validateRegionUrl(regionUrl, baseHost) {
12182
12252
  }
12183
12253
 
12184
12254
  //#endregion
12185
- //#region ../mcp-core/dist/api-CFg-mvfQ.js
12255
+ //#region ../mcp-core/dist/api-DetGxepz.js
12186
12256
  /**
12187
12257
  * Create a Sentry API service from server context with optional region override
12188
12258
  * @param context - Server context containing host and access token
@@ -12204,7 +12274,7 @@ function apiServiceFromContext(context$1, opts = {}) {
12204
12274
  }
12205
12275
 
12206
12276
  //#endregion
12207
- //#region ../mcp-core/dist/whoami-B4jAc2XJ.js
12277
+ //#region ../mcp-core/dist/whoami-B7PEkXBF.js
12208
12278
  var whoami_default = defineTool({
12209
12279
  name: "whoami",
12210
12280
  description: [
@@ -12237,7 +12307,7 @@ var whoami_default = defineTool({
12237
12307
  });
12238
12308
 
12239
12309
  //#endregion
12240
- //#region ../mcp-core/dist/find-organizations-BRTdXrmS.js
12310
+ //#region ../mcp-core/dist/find-organizations-C_pGE5Di.js
12241
12311
  const RESULT_LIMIT$2 = 25;
12242
12312
  var find_organizations_default = defineTool({
12243
12313
  name: "find_organizations",
@@ -12289,7 +12359,7 @@ var find_organizations_default = defineTool({
12289
12359
  });
12290
12360
 
12291
12361
  //#endregion
12292
- //#region ../mcp-core/dist/find-teams-DuZzY9r2.js
12362
+ //#region ../mcp-core/dist/find-teams-CA7XC0Zh.js
12293
12363
  const RESULT_LIMIT$1 = 25;
12294
12364
  var find_teams_default = defineTool({
12295
12365
  name: "find_teams",
@@ -12337,7 +12407,7 @@ var find_teams_default = defineTool({
12337
12407
  });
12338
12408
 
12339
12409
  //#endregion
12340
- //#region ../mcp-core/dist/find-projects-Bd4fZCQ6.js
12410
+ //#region ../mcp-core/dist/find-projects-CL-P0hlB.js
12341
12411
  const RESULT_LIMIT = 25;
12342
12412
  var find_projects_default = defineTool({
12343
12413
  name: "find_projects",
@@ -12381,7 +12451,7 @@ var find_projects_default = defineTool({
12381
12451
  });
12382
12452
 
12383
12453
  //#endregion
12384
- //#region ../mcp-core/dist/find-releases-DoOdUHqk.js
12454
+ //#region ../mcp-core/dist/find-releases-Bym_690n.js
12385
12455
  var find_releases_default = defineTool({
12386
12456
  name: "find_releases",
12387
12457
  skills: ["inspect"],
@@ -13843,7 +13913,7 @@ function enhanceNotFoundError(error, params) {
13843
13913
  }
13844
13914
 
13845
13915
  //#endregion
13846
- //#region ../mcp-core/dist/get-issue-details-CfpitG7O.js
13916
+ //#region ../mcp-core/dist/get-issue-details-BVJbAdXh.js
13847
13917
  var get_issue_details_default = defineTool({
13848
13918
  name: "get_issue_details",
13849
13919
  skills: [
@@ -14072,7 +14142,7 @@ function getReplayDataSource(issue) {
14072
14142
  }
14073
14143
 
14074
14144
  //#endregion
14075
- //#region ../mcp-core/dist/get-issue-tag-values-BT2oPttB.js
14145
+ //#region ../mcp-core/dist/get-issue-tag-values-CcOtwemx.js
14076
14146
  var get_issue_tag_values_default = defineTool({
14077
14147
  name: "get_issue_tag_values",
14078
14148
  skills: ["inspect"],
@@ -18818,7 +18888,7 @@ function createOpenAI(options = {}) {
18818
18888
  var openai = createOpenAI();
18819
18889
 
18820
18890
  //#endregion
18821
- //#region ../mcp-core/dist/azure-openai-provider-s0kz4Zim.js
18891
+ //#region ../mcp-core/dist/azure-openai-provider-BkPulYnG.js
18822
18892
  const DEFAULT_OPENAI_MODEL$1 = "gpt-5";
18823
18893
  let configuredBaseUrl$2;
18824
18894
  function setAzureOpenAIBaseUrl(baseUrl) {
@@ -18876,7 +18946,7 @@ function getAzureOpenAIModel(model) {
18876
18946
  }
18877
18947
 
18878
18948
  //#endregion
18879
- //#region ../mcp-core/dist/openai-provider-B0d15AyT.js
18949
+ //#region ../mcp-core/dist/openai-provider-Cus3dH3U.js
18880
18950
  const DEFAULT_OPENAI_MODEL = "gpt-5";
18881
18951
  let configuredBaseUrl$1;
18882
18952
  /**
@@ -22426,7 +22496,7 @@ function createAnthropic(options = {}) {
22426
22496
  var anthropic = createAnthropic();
22427
22497
 
22428
22498
  //#endregion
22429
- //#region ../mcp-core/dist/anthropic-provider-bz-B_TTg.js
22499
+ //#region ../mcp-core/dist/anthropic-provider-VAc6OLfs.js
22430
22500
  const DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-5";
22431
22501
  let configuredBaseUrl;
22432
22502
  /**
@@ -22454,7 +22524,7 @@ function getAnthropicModel(model) {
22454
22524
  }
22455
22525
 
22456
22526
  //#endregion
22457
- //#region ../mcp-core/dist/provider-factory-DdDvJNZA.js
22527
+ //#region ../mcp-core/dist/provider-factory-klNSplm9.js
22458
22528
  let configuredProvider;
22459
22529
  /**
22460
22530
  * Configure the embedded agent provider explicitly.
@@ -22586,7 +22656,7 @@ function getResolvedProviderType() {
22586
22656
  }
22587
22657
 
22588
22658
  //#endregion
22589
- //#region ../mcp-core/dist/resolve-region-url-CssKZYYq.js
22659
+ //#region ../mcp-core/dist/resolve-region-url-DkHsea2T.js
22590
22660
  const regionUrlCache = /* @__PURE__ */ new WeakMap();
22591
22661
  function getRegionUrlCache(context$1) {
22592
22662
  let cache = regionUrlCache.get(context$1);
@@ -23013,7 +23083,7 @@ function formatDisplayPart(value, maxLength) {
23013
23083
  }
23014
23084
 
23015
23085
  //#endregion
23016
- //#region ../mcp-core/dist/get-trace-details-B0ZI3RFa.js
23086
+ //#region ../mcp-core/dist/get-trace-details-DUasZcNv.js
23017
23087
  const MAX_TRACE_FETCH_LIMIT = 1e3;
23018
23088
  const MAX_FOCUSED_TRACE_FETCH_LIMIT = 1e4;
23019
23089
  const MIN_TRACE_FETCH_LIMIT = 50;
@@ -23486,8 +23556,8 @@ function formatFocusedSpanOutput({ organizationSlug, traceId, spanId, summary, t
23486
23556
  sections.push(`**Project**: ${focusedSpan.project_slug ?? "unknown"}`);
23487
23557
  sections.push(`**Operation**: ${focusedSpan.op ?? "unknown"}`);
23488
23558
  sections.push(`**Description**: ${formatTraceSpanDescription(focusedSpan)}`);
23489
- sections.push(`**Duration**: ${formatDuration$1(focusedSpan.duration)}`);
23490
- if (typeof focusedSpan.exclusive_time === "number") sections.push(`**Exclusive Time**: ${formatDuration$1(focusedSpan.exclusive_time)}`);
23559
+ sections.push(`**Duration**: ${formatDuration$2(focusedSpan.duration)}`);
23560
+ if (typeof focusedSpan.exclusive_time === "number") sections.push(`**Exclusive Time**: ${formatDuration$2(focusedSpan.exclusive_time)}`);
23491
23561
  sections.push(`**Status**: ${focusedSpan.status ?? (focusedSpan.is_transaction ? "transaction" : "unknown")}`);
23492
23562
  sections.push(`**Parent Span ID**: ${focusedSpan.parent_span_id ?? "None (root span)"}`);
23493
23563
  sections.push(`**Child Spans**: ${getTraceSpanChildren(focusedSpan).length}`);
@@ -23547,7 +23617,7 @@ function countSelectedDescendants(span) {
23547
23617
  }
23548
23618
  return count;
23549
23619
  }
23550
- function formatDuration$1(durationMs) {
23620
+ function formatDuration$2(durationMs) {
23551
23621
  if (typeof durationMs !== "number") return "unknown";
23552
23622
  return `${Math.round(durationMs)}ms`;
23553
23623
  }
@@ -23633,7 +23703,7 @@ function buildTraceNextSteps({ organizationSlug, traceId, spanFocused = false })
23633
23703
  }
23634
23704
 
23635
23705
  //#endregion
23636
- //#region ../mcp-core/dist/url-helpers-SkYkdd3e.js
23706
+ //#region ../mcp-core/dist/url-helpers-CE0UG38E.js
23637
23707
  /**
23638
23708
  * Parses a Sentry URL and extracts resource type and identifiers.
23639
23709
  *
@@ -23643,6 +23713,7 @@ function buildTraceNextSteps({ organizationSlug, traceId, spanFocused = false })
23643
23713
  * - Trace: `/explore/traces/trace/{traceId}` or `/performance/trace/{traceId}`
23644
23714
  * - Profile: `/explore/profiling/profile/{project}/{profileId}/flamegraph/`
23645
23715
  * - Continuous profile: `/explore/profiling/profile/{project}/flamegraph/` with query params
23716
+ * - AI conversation: `/explore/conversations/{conversationId}/`
23646
23717
  * - Replay: `/explore/replays/{replayId}/` or `/replays/{replayId}/`
23647
23718
  * - Monitor: `/crons/{monitorSlug}/` or `/monitors/{monitorSlug}/`
23648
23719
  * - Release: `/releases/{version}/`
@@ -23725,6 +23796,18 @@ function extractOrganizationSlug(parsedUrl, pathParts) {
23725
23796
  if (hostParts.length >= 2 && !regionPrefixes.includes(hostParts[0])) return hostParts[0];
23726
23797
  throw new UserInputError("Invalid Sentry URL. Could not determine organization from URL.");
23727
23798
  }
23799
+ function escapeRegex(value) {
23800
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
23801
+ }
23802
+ function extractPathGroup(pathParts, patterns, groupName) {
23803
+ const path = pathParts.join("/");
23804
+ for (const pattern of patterns) {
23805
+ const match = pattern.exec(path);
23806
+ const value = match?.groups?.[groupName];
23807
+ if (value) return value;
23808
+ }
23809
+ return void 0;
23810
+ }
23728
23811
  /**
23729
23812
  * Identifies the resource type and extracts relevant identifiers.
23730
23813
  */
@@ -23747,6 +23830,16 @@ function identifyResource(parsedUrl, pathParts, organizationSlug) {
23747
23830
  end
23748
23831
  };
23749
23832
  }
23833
+ const conversationId = extractPathGroup(pathParts, [
23834
+ /^explore\/conversations\/(?<conversationId>[^/]+)$/,
23835
+ /^organizations\/[^/]+\/explore\/conversations\/(?<conversationId>[^/]+)$/,
23836
+ /* @__PURE__ */ new RegExp(`^${escapeRegex(organizationSlug)}\\/explore\\/conversations\\/(?<conversationId>[^/]+)$`)
23837
+ ], "conversationId");
23838
+ if (conversationId) return {
23839
+ type: "ai_conversation",
23840
+ organizationSlug,
23841
+ conversationId
23842
+ };
23750
23843
  const replaysIndex = pathParts.indexOf("replays");
23751
23844
  if (replaysIndex !== -1) {
23752
23845
  const replayId = pathParts[replaysIndex + 1];
@@ -23890,7 +23983,7 @@ function isProfileUrl(url) {
23890
23983
  }
23891
23984
 
23892
23985
  //#endregion
23893
- //#region ../mcp-core/dist/get-replay-details-B2lU8kfd.js
23986
+ //#region ../mcp-core/dist/get-replay-details-BemPSZ63.js
23894
23987
  const MAX_ACTIVITY_EVENTS = 6;
23895
23988
  const MAX_RELATED_ERRORS = 3;
23896
23989
  const MAX_RELATED_TRACES = 2;
@@ -24230,7 +24323,7 @@ function quoteDetail(value) {
24230
24323
  }
24231
24324
 
24232
24325
  //#endregion
24233
- //#region ../mcp-core/dist/get-event-attachment-D4Gb9_9Y.js
24326
+ //#region ../mcp-core/dist/get-event-attachment-5og2x9A9.js
24234
24327
  var get_event_attachment_default = defineTool({
24235
24328
  name: "get_event_attachment",
24236
24329
  skills: ["inspect"],
@@ -24376,7 +24469,7 @@ function formatAssignedTo(assignedTo) {
24376
24469
  }
24377
24470
 
24378
24471
  //#endregion
24379
- //#region ../mcp-core/dist/update-issue-BHO3jztc.js
24472
+ //#region ../mcp-core/dist/update-issue-CyQr8c1n.js
24380
24473
  function pluralize(value, noun) {
24381
24474
  return `${value} ${noun}${value === 1 ? "" : "s"}`;
24382
24475
  }
@@ -24782,7 +24875,7 @@ var update_issue_default = defineTool({
24782
24875
  });
24783
24876
 
24784
24877
  //#endregion
24785
- //#region ../mcp-core/dist/callEmbeddedAgent-DNUEB1Ov.js
24878
+ //#region ../mcp-core/dist/callEmbeddedAgent-BWwuj2hz.js
24786
24879
  /**
24787
24880
  * Call an embedded agent with tool call capture
24788
24881
  * This is the standard way to call embedded AI agents within MCP tools
@@ -30616,7 +30709,7 @@ Use these examples as patterns for constructing your query.`;
30616
30709
  }
30617
30710
 
30618
30711
  //#endregion
30619
- //#region ../mcp-core/dist/agent-DkmIlfIV.js
30712
+ //#region ../mcp-core/dist/agent-DCyCn4Wz.js
30620
30713
  const SEARCH_EVENTS_DATASETS$1 = [...PUBLIC_EVENTS_DATASETS, "replays"];
30621
30714
  const searchEventsAgentOutputSchema = z.object({
30622
30715
  dataset: z.enum(SEARCH_EVENTS_DATASETS$1).describe("Which dataset to use for the query"),
@@ -30685,7 +30778,7 @@ const SECOND = 1e9;
30685
30778
  * @param ns Duration in nanoseconds
30686
30779
  * @returns Formatted duration string (e.g., "157ms", "1.2s")
30687
30780
  */
30688
- function formatDuration(ns) {
30781
+ function formatDuration$1(ns) {
30689
30782
  if (ns < MILLISECOND) return `${(ns / MICROSECOND).toFixed(0)}µs`;
30690
30783
  if (ns < SECOND) return `${(ns / MILLISECOND).toFixed(0)}ms`;
30691
30784
  return `${(ns / SECOND).toFixed(1)}s`;
@@ -30967,7 +31060,7 @@ function formatSpanResults(params) {
30967
31060
  return output;
30968
31061
  }
30969
31062
  function getProfileDurationLabel(field, value) {
30970
- if ((field === "transaction.duration" || field === "profile.duration") && typeof value === "number") return formatDuration(value);
31063
+ if ((field === "transaction.duration" || field === "profile.duration") && typeof value === "number") return formatDuration$1(value);
30971
31064
  return void 0;
30972
31065
  }
30973
31066
  function getProfileProject(event) {
@@ -31208,7 +31301,7 @@ function formatReplayResults(params) {
31208
31301
  `${replay.count_dead_clicks ?? 0} dead click${replay.count_dead_clicks === 1 ? "" : "s"}`
31209
31302
  ].join(" · ");
31210
31303
  output += `## ${index + 1}. [${replay.id}](${replayUrl})\n\n`;
31211
- output += `- **Started**: ${formatTimestamp(replay.started_at)}\n`;
31304
+ output += `- **Started**: ${formatTimestamp$1(replay.started_at)}\n`;
31212
31305
  output += `- **Duration**: ${formatDurationSeconds(replay.duration)}\n`;
31213
31306
  output += `- **User**: ${user}\n`;
31214
31307
  output += `- **Summary**: ${clickSummary}\n`;
@@ -31244,14 +31337,14 @@ function formatNameVersion(name$5, version) {
31244
31337
  if (name$5 && version) return `${name$5} ${version}`;
31245
31338
  return name$5 ?? version ?? "Unknown";
31246
31339
  }
31247
- function formatTimestamp(value) {
31340
+ function formatTimestamp$1(value) {
31248
31341
  if (!value) return "Unknown";
31249
31342
  return value.replace("T", " ").replace("Z", " UTC");
31250
31343
  }
31251
31344
  function formatTimeRange(timeRange) {
31252
31345
  if (!timeRange) return "Last 14 days";
31253
31346
  if (timeRange.statsPeriod) return `Last ${timeRange.statsPeriod}`;
31254
- if (timeRange.start && timeRange.end) return `${formatTimestamp(timeRange.start)} to ${formatTimestamp(timeRange.end)}`;
31347
+ if (timeRange.start && timeRange.end) return `${formatTimestamp$1(timeRange.start)} to ${formatTimestamp$1(timeRange.end)}`;
31255
31348
  return "Last 14 days";
31256
31349
  }
31257
31350
  function formatReplayEnvironment(environment) {
@@ -31259,7 +31352,7 @@ function formatReplayEnvironment(environment) {
31259
31352
  }
31260
31353
 
31261
31354
  //#endregion
31262
- //#region ../mcp-core/dist/handler-D3lN-Dlo.js
31355
+ //#region ../mcp-core/dist/handler-C5reF8mC.js
31263
31356
  const SEARCH_EVENTS_DATASETS = [...PUBLIC_EVENTS_DATASETS, "replays"];
31264
31357
  const DEFAULT_EVENTS_SORT = "-timestamp";
31265
31358
  function defaultSortForDataset(dataset) {
@@ -31611,7 +31704,7 @@ var handler_default = defineTool({
31611
31704
  });
31612
31705
 
31613
31706
  //#endregion
31614
- //#region ../mcp-core/dist/create-team-DlG5s8ZP.js
31707
+ //#region ../mcp-core/dist/create-team-BHhvmrM5.js
31615
31708
  var create_team_default = defineTool({
31616
31709
  name: "create_team",
31617
31710
  skills: ["project-management"],
@@ -31666,7 +31759,7 @@ var create_team_default = defineTool({
31666
31759
  });
31667
31760
 
31668
31761
  //#endregion
31669
- //#region ../mcp-core/dist/create-project-CagEEmMa.js
31762
+ //#region ../mcp-core/dist/create-project-DniPha-E.js
31670
31763
  var create_project_default = defineTool({
31671
31764
  name: "create_project",
31672
31765
  skills: ["project-management"],
@@ -31743,7 +31836,7 @@ var create_project_default = defineTool({
31743
31836
  });
31744
31837
 
31745
31838
  //#endregion
31746
- //#region ../mcp-core/dist/update-project-AvbEfojJ.js
31839
+ //#region ../mcp-core/dist/update-project-C8iFjDBl.js
31747
31840
  var update_project_default = defineTool({
31748
31841
  name: "update_project",
31749
31842
  skills: ["project-management"],
@@ -31861,7 +31954,7 @@ var update_project_default = defineTool({
31861
31954
  });
31862
31955
 
31863
31956
  //#endregion
31864
- //#region ../mcp-core/dist/create-dsn-DQmGpyf0.js
31957
+ //#region ../mcp-core/dist/create-dsn-DYAflxcz.js
31865
31958
  var create_dsn_default = defineTool({
31866
31959
  name: "create_dsn",
31867
31960
  skills: ["project-management"],
@@ -31921,7 +32014,7 @@ var create_dsn_default = defineTool({
31921
32014
  });
31922
32015
 
31923
32016
  //#endregion
31924
- //#region ../mcp-core/dist/find-dsns-BH6iszAq.js
32017
+ //#region ../mcp-core/dist/find-dsns-BaIqw7FA.js
31925
32018
  var find_dsns_default = defineTool({
31926
32019
  name: "find_dsns",
31927
32020
  skills: ["project-management"],
@@ -32022,7 +32115,7 @@ async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, should
32022
32115
  }
32023
32116
 
32024
32117
  //#endregion
32025
- //#region ../mcp-core/dist/analyze-issue-with-seer-CrhyiCYF.js
32118
+ //#region ../mcp-core/dist/analyze-issue-with-seer-CpTw4rB6.js
32026
32119
  var analyze_issue_with_seer_default = defineTool({
32027
32120
  name: "analyze_issue_with_seer",
32028
32121
  skills: ["seer"],
@@ -32299,7 +32392,7 @@ var search_docs_default = defineTool({
32299
32392
  });
32300
32393
 
32301
32394
  //#endregion
32302
- //#region ../mcp-core/dist/get-doc-DHPqLiq6.js
32395
+ //#region ../mcp-core/dist/get-doc-DTyocFpe.js
32303
32396
  var get_doc_default = defineTool({
32304
32397
  name: "get_doc",
32305
32398
  skills: ["docs"],
@@ -32468,7 +32561,7 @@ Always use the issueFields tool to discover available fields when needed.
32468
32561
  Use the whoami tool when you need to resolve 'me' references.`;
32469
32562
 
32470
32563
  //#endregion
32471
- //#region ../mcp-core/dist/agent-wjTu92rF.js
32564
+ //#region ../mcp-core/dist/agent-CU3Gi0ju.js
32472
32565
  const searchIssuesAgentOutputSchema = z.object({
32473
32566
  query: z.string().describe("The Sentry issue search query"),
32474
32567
  sort: z.enum([
@@ -32501,7 +32594,7 @@ async function searchIssuesAgent(options) {
32501
32594
  }
32502
32595
 
32503
32596
  //#endregion
32504
- //#region ../mcp-core/dist/formatters-CwgShhuU.js
32597
+ //#region ../mcp-core/dist/formatters-CcWAiRlK.js
32505
32598
  /**
32506
32599
  * Format an explanation for how the input query was translated
32507
32600
  */
@@ -32588,7 +32681,7 @@ function formatDate(dateString) {
32588
32681
  }
32589
32682
 
32590
32683
  //#endregion
32591
- //#region ../mcp-core/dist/handler-C6yPHj4h.js
32684
+ //#region ../mcp-core/dist/handler-DsSKCEhJ.js
32592
32685
  function buildIssueSearchRepairPrompt(params) {
32593
32686
  return [
32594
32687
  "Fix this Sentry issue search request.",
@@ -33156,7 +33249,7 @@ Received: ${params.issueUrl}`);
33156
33249
  }
33157
33250
 
33158
33251
  //#endregion
33159
- //#region ../mcp-core/dist/agent--Ic_wsit.js
33252
+ //#region ../mcp-core/dist/agent-DBkxVUy-.js
33160
33253
  const searchIssueEventsAgentOutputSchema = z.object({
33161
33254
  query: z.string().describe("Sentry query filters for tags/fields (NOT including issue: prefix - handler adds that)"),
33162
33255
  fields: z.array(z.string()).describe("Array of field names to return in results"),
@@ -33198,7 +33291,7 @@ async function searchIssueEventsAgent(options) {
33198
33291
  }
33199
33292
 
33200
33293
  //#endregion
33201
- //#region ../mcp-core/dist/handler-BUGuYYmw.js
33294
+ //#region ../mcp-core/dist/handler-Xt0He66k.js
33202
33295
  function buildIssueEventSearchRepairPrompt(params) {
33203
33296
  return [
33204
33297
  "Fix this Sentry issue event search request.",
@@ -33359,7 +33452,7 @@ The user may include various parameters to pass to those tools in their prompt.
33359
33452
  You MUST return tool results directly without interpreting them.`;
33360
33453
 
33361
33454
  //#endregion
33362
- //#region ../mcp-core/dist/agent-CxEiqIIB.js
33455
+ //#region ../mcp-core/dist/agent-DdDHDTYx.js
33363
33456
  /**
33364
33457
  * Output schema for the embedded agent.
33365
33458
  * The agent returns the final result string directly from its tool calls.
@@ -33460,7 +33553,7 @@ function formatTransactionProfileAnalysis(profile, options) {
33460
33553
  sections.push(`- **Transaction**: ${transactionName}`);
33461
33554
  if (profile.transaction?.trace_id) sections.push(`- **Trace ID**: ${profile.transaction.trace_id}`);
33462
33555
  if (options.traceUrl) sections.push(`- **Trace URL**: ${options.traceUrl}`);
33463
- if (durationNs != null) sections.push(`- **Duration**: ${formatDuration(durationNs)}`);
33556
+ if (durationNs != null) sections.push(`- **Duration**: ${formatDuration$1(durationNs)}`);
33464
33557
  sections.push(`- **Platform**: ${profile.platform}`);
33465
33558
  sections.push(`- **Release**: ${release}`);
33466
33559
  if (profile.environment) sections.push(`- **Environment**: ${profile.environment}`);
@@ -33567,7 +33660,7 @@ function formatSdkSummary(profile) {
33567
33660
  }
33568
33661
 
33569
33662
  //#endregion
33570
- //#region ../mcp-core/dist/get-profile-details-DPIGKtPc.js
33663
+ //#region ../mcp-core/dist/get-profile-details-S7TmoKDv.js
33571
33664
  function resolveProfileDetailsParams(params) {
33572
33665
  if (params.profileUrl) {
33573
33666
  if (!isProfileUrl(params.profileUrl)) throw new UserInputError("Invalid profile URL. URL must point to a Sentry profile resource.");
@@ -33794,7 +33887,7 @@ var get_profile_details_default = defineTool({
33794
33887
  });
33795
33888
 
33796
33889
  //#endregion
33797
- //#region ../mcp-core/dist/get-snapshot-details-DOe75tIs.js
33890
+ //#region ../mcp-core/dist/get-snapshot-details-DL7SrtHW.js
33798
33891
  function getImageDisplayName(img) {
33799
33892
  return img.display_name || img.image_file_name || "unknown";
33800
33893
  }
@@ -34000,6 +34093,307 @@ async function fetchSnapshotSummary(apiService, organizationSlug, snapshotId, sn
34000
34093
  return sections.join("\n");
34001
34094
  }
34002
34095
 
34096
+ //#endregion
34097
+ //#region ../mcp-core/dist/get-ai-conversation-details-D1ZvIg7N.js
34098
+ function numeric(value) {
34099
+ if (typeof value === "number") return value;
34100
+ if (typeof value === "string") {
34101
+ const parsed = Number(value);
34102
+ return Number.isFinite(parsed) ? parsed : 0;
34103
+ }
34104
+ return 0;
34105
+ }
34106
+ function getOperationType(span) {
34107
+ const explicit = span["gen_ai.operation.type"];
34108
+ if (explicit) return explicit;
34109
+ const spanName = span["span.name"];
34110
+ if (!spanName?.startsWith("gen_ai.")) return void 0;
34111
+ if (spanName === "gen_ai.execute_tool") return "tool";
34112
+ if (spanName === "gen_ai.invoke_agent" || spanName === "gen_ai.create_agent") return "agent";
34113
+ if (spanName === "gen_ai.handoff") return "handoff";
34114
+ return "ai_client";
34115
+ }
34116
+ function parseJson(value) {
34117
+ try {
34118
+ return JSON.parse(value);
34119
+ } catch {
34120
+ return value;
34121
+ }
34122
+ }
34123
+ function stringifyContent(value) {
34124
+ if (typeof value === "string") return value;
34125
+ if (Array.isArray(value)) {
34126
+ const parts = value.map((part) => {
34127
+ if (typeof part === "string") return part;
34128
+ if (part && typeof part === "object") {
34129
+ const record = part;
34130
+ if (typeof record.text === "string") return record.text;
34131
+ if (typeof record.content === "string") return record.content;
34132
+ }
34133
+ return null;
34134
+ }).filter((part) => Boolean(part));
34135
+ return parts.length > 0 ? parts.join("\n") : null;
34136
+ }
34137
+ if (value && typeof value === "object") {
34138
+ const record = value;
34139
+ if (typeof record.text === "string") return record.text;
34140
+ if (typeof record.content === "string") return record.content;
34141
+ if (typeof record.message === "string") return record.message;
34142
+ }
34143
+ return value == null ? null : JSON.stringify(value);
34144
+ }
34145
+ function collectMessages(value) {
34146
+ const source = value && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.messages) ? value.messages : value;
34147
+ if (!Array.isArray(source)) {
34148
+ const content = stringifyContent(source);
34149
+ return content ? [{ content }] : [];
34150
+ }
34151
+ return source.map((message) => {
34152
+ if (typeof message === "string") return { content: message };
34153
+ if (!message || typeof message !== "object") return null;
34154
+ const record = message;
34155
+ const content = stringifyContent(record.content ?? record.text ?? record);
34156
+ if (!content) return null;
34157
+ return {
34158
+ role: typeof record.role === "string" ? record.role : void 0,
34159
+ content
34160
+ };
34161
+ }).filter((message) => Boolean(message));
34162
+ }
34163
+ function extractUserContent(span) {
34164
+ const raw = span["gen_ai.input.messages"] ?? span["gen_ai.request.messages"] ?? null;
34165
+ if (!raw) return null;
34166
+ if (raw === "[Filtered]") return raw;
34167
+ const messages = collectMessages(parseJson(raw));
34168
+ const userMessage = messages.findLast((message) => message.role === "user");
34169
+ return userMessage?.content ?? messages.at(-1)?.content ?? null;
34170
+ }
34171
+ function extractAssistantContent(span) {
34172
+ const outputMessages = span["gen_ai.output.messages"];
34173
+ if (outputMessages) {
34174
+ if (outputMessages === "[Filtered]") return outputMessages;
34175
+ const messages = collectMessages(parseJson(outputMessages));
34176
+ const assistantMessage = messages.findLast((message) => message.role === "assistant");
34177
+ const content = assistantMessage?.content ?? messages.at(-1)?.content;
34178
+ if (content) return content;
34179
+ }
34180
+ return span["gen_ai.response.text"] ?? span["gen_ai.response.object"] ?? null;
34181
+ }
34182
+ function buildToolCall(span) {
34183
+ const name$5 = span["gen_ai.tool.name"];
34184
+ if (!name$5) return null;
34185
+ return {
34186
+ name: name$5,
34187
+ spanId: span.span_id,
34188
+ timestamp: span["precise.start_ts"],
34189
+ durationMs: Math.round((span["precise.finish_ts"] - span["precise.start_ts"]) * 1e3),
34190
+ status: span["span.status"],
34191
+ arguments: span["gen_ai.tool.call.arguments"],
34192
+ input: span["gen_ai.tool.input"]
34193
+ };
34194
+ }
34195
+ function extractTurns(spans) {
34196
+ const sorted = [...spans].sort((a, b) => a["precise.start_ts"] - b["precise.start_ts"]);
34197
+ const aiClientSpans = sorted.filter((span) => getOperationType(span) === "ai_client");
34198
+ const toolSpans = sorted.filter((span) => getOperationType(span) === "tool");
34199
+ return aiClientSpans.map((span, index) => {
34200
+ const nextTimestamp = index < aiClientSpans.length - 1 ? aiClientSpans[index + 1]["precise.start_ts"] : Number.POSITIVE_INFINITY;
34201
+ const toolCalls = toolSpans.filter((toolSpan) => {
34202
+ const timestamp = toolSpan["precise.start_ts"];
34203
+ return timestamp >= span["precise.start_ts"] && timestamp < nextTimestamp;
34204
+ }).map(buildToolCall).filter((toolCall) => toolCall !== null);
34205
+ const userContent = extractUserContent(span);
34206
+ const assistantContent = extractAssistantContent(span);
34207
+ return {
34208
+ turn: index + 1,
34209
+ spanId: span.span_id,
34210
+ traceId: span.trace,
34211
+ project: span.project,
34212
+ started: span["precise.start_ts"],
34213
+ ended: span["precise.finish_ts"],
34214
+ durationMs: Math.round((span["precise.finish_ts"] - span["precise.start_ts"]) * 1e3),
34215
+ user: userContent ? {
34216
+ role: "user",
34217
+ content: userContent,
34218
+ timestamp: span["precise.start_ts"],
34219
+ spanId: span.span_id,
34220
+ userEmail: span["user.email"]
34221
+ } : void 0,
34222
+ assistant: assistantContent ? {
34223
+ role: "assistant",
34224
+ content: assistantContent,
34225
+ timestamp: span["precise.finish_ts"],
34226
+ spanId: span.span_id
34227
+ } : void 0,
34228
+ toolCalls,
34229
+ metadata: {
34230
+ agentName: span["gen_ai.agent.name"],
34231
+ model: span["gen_ai.response.model"] ?? span["gen_ai.request.model"],
34232
+ totalTokens: numeric(span["gen_ai.usage.total_tokens"]),
34233
+ status: span["span.status"]
34234
+ }
34235
+ };
34236
+ });
34237
+ }
34238
+ function flattenMessages(turns) {
34239
+ const messages = [];
34240
+ for (const turn of turns) {
34241
+ if (turn.user) messages.push(turn.user);
34242
+ if (turn.assistant) messages.push(turn.assistant);
34243
+ }
34244
+ return messages;
34245
+ }
34246
+ function formatTimestamp(timestamp) {
34247
+ return (/* @__PURE__ */ new Date(timestamp * 1e3)).toISOString();
34248
+ }
34249
+ function truncate(value, maxLength = 600) {
34250
+ if (value.length <= maxLength) return value;
34251
+ return `${value.slice(0, maxLength - 3)}...`;
34252
+ }
34253
+ function formatDuration(ms) {
34254
+ if (ms < 1e3) return `${ms}ms`;
34255
+ return `${(ms / 1e3).toFixed(ms % 1e3 === 0 ? 0 : 1)}s`;
34256
+ }
34257
+ function formatMaybeJson(value) {
34258
+ const parsed = parseJson(value);
34259
+ const formatted = typeof parsed === "string" ? parsed : JSON.stringify(parsed, null, 2);
34260
+ return truncate(formatted, 1200);
34261
+ }
34262
+ function formatIndentedCodeBlock(value) {
34263
+ return [
34264
+ " ```json",
34265
+ ...formatMaybeJson(value).split("\n").map((line) => ` ${line}`),
34266
+ " ```"
34267
+ ];
34268
+ }
34269
+ function formatTurn(turn) {
34270
+ const metadata = [
34271
+ turn.metadata.model,
34272
+ turn.metadata.agentName,
34273
+ turn.metadata.totalTokens > 0 ? `${turn.metadata.totalTokens} tokens` : null,
34274
+ formatDuration(turn.durationMs),
34275
+ turn.metadata.status
34276
+ ].filter((item) => Boolean(item));
34277
+ const output = [
34278
+ `### Turn ${turn.turn} - ${formatTimestamp(turn.started)}`,
34279
+ "",
34280
+ metadata.length > 0 ? `_${metadata.join(" | ")}_` : null,
34281
+ metadata.length > 0 ? "" : null,
34282
+ turn.user ? "**User**" : null,
34283
+ turn.user ? "" : null,
34284
+ turn.user ? truncate(turn.user.content) : null,
34285
+ turn.user ? "" : null,
34286
+ turn.assistant ? "**Assistant**" : null,
34287
+ turn.assistant ? "" : null,
34288
+ turn.assistant ? truncate(turn.assistant.content) : null,
34289
+ turn.assistant ? "" : null
34290
+ ].filter((line) => line !== null);
34291
+ if (turn.toolCalls.length > 0) {
34292
+ output.push("**Tools**", "");
34293
+ for (const toolCall of turn.toolCalls) {
34294
+ output.push(`- ${toolCall.name} (${toolCall.spanId})${toolCall.status ? ` - ${toolCall.status}` : ""} - ${formatDuration(toolCall.durationMs)}`);
34295
+ if (toolCall.arguments) output.push("", " Arguments:", "", ...formatIndentedCodeBlock(toolCall.arguments));
34296
+ if (toolCall.input && toolCall.input !== toolCall.arguments) output.push("", " Input:", "", ...formatIndentedCodeBlock(toolCall.input));
34297
+ }
34298
+ output.push("");
34299
+ }
34300
+ return output;
34301
+ }
34302
+ function buildConversationArtifact(apiService, organizationSlug, conversationId, spans) {
34303
+ const turns = extractTurns(spans);
34304
+ const messages = flattenMessages(turns);
34305
+ const traceIds = [...new Set(spans.map((span) => span.trace))].sort();
34306
+ const projects = [...new Set(spans.map((span) => span.project))].sort();
34307
+ const startTimestamp = Math.min(...spans.map((span) => span["precise.start_ts"]));
34308
+ const endTimestamp = Math.max(...spans.map((span) => span["precise.finish_ts"]));
34309
+ return {
34310
+ conversationId,
34311
+ organizationSlug,
34312
+ url: apiService.getAIConversationUrl(organizationSlug, conversationId),
34313
+ startTimestamp,
34314
+ endTimestamp,
34315
+ traceIds,
34316
+ projects,
34317
+ spanCount: spans.length,
34318
+ turnCount: turns.length,
34319
+ messageCount: messages.length,
34320
+ toolCallCount: turns.reduce((sum, turn) => sum + turn.toolCalls.length, 0),
34321
+ totalTokens: spans.reduce((sum, span) => sum + numeric(span["gen_ai.usage.total_tokens"]), 0),
34322
+ turns,
34323
+ messages,
34324
+ spanIds: spans.map((span) => span.span_id)
34325
+ };
34326
+ }
34327
+ var get_ai_conversation_details_default = defineTool({
34328
+ name: "get_ai_conversation_details",
34329
+ skills: [
34330
+ "inspect",
34331
+ "triage",
34332
+ "seer"
34333
+ ],
34334
+ internalOnly: true,
34335
+ requiredScopes: ["event:read", "project:read"],
34336
+ description: "Fetch a structured AI conversation transcript by conversation ID.",
34337
+ inputSchema: {
34338
+ organizationSlug: ParamOrganizationSlug,
34339
+ conversationId: z.string().trim().describe("The AI conversation ID from gen_ai.conversation.id."),
34340
+ regionUrl: ParamRegionUrl.optional()
34341
+ },
34342
+ annotations: {
34343
+ readOnlyHint: true,
34344
+ openWorldHint: true
34345
+ },
34346
+ async handler(params, context$1) {
34347
+ setTag("organization.slug", params.organizationSlug);
34348
+ setTag("ai_conversation.id", params.conversationId);
34349
+ const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
34350
+ const constrainedProject = context$1.constraints.projectSlug ? await apiService.getProject({
34351
+ organizationSlug: params.organizationSlug,
34352
+ projectSlugOrId: context$1.constraints.projectSlug
34353
+ }) : null;
34354
+ const spans = await apiService.getAIConversation({
34355
+ organizationSlug: params.organizationSlug,
34356
+ conversationId: params.conversationId,
34357
+ project: constrainedProject ? String(constrainedProject.id) : "-1"
34358
+ }, void 0);
34359
+ if (spans.length === 0) return [
34360
+ `# AI Conversation \`${params.conversationId}\` in **${params.organizationSlug}**`,
34361
+ "",
34362
+ "No AI spans found for this conversation in the last 30 days."
34363
+ ].join("\n");
34364
+ const artifact = buildConversationArtifact(apiService, params.organizationSlug, params.conversationId, spans);
34365
+ const output = [
34366
+ `# AI Conversation \`${params.conversationId}\` in **${params.organizationSlug}**`,
34367
+ "",
34368
+ "## Summary",
34369
+ "",
34370
+ `**Started**: ${formatTimestamp(artifact.startTimestamp)}`,
34371
+ `**Ended**: ${formatTimestamp(artifact.endTimestamp)}`,
34372
+ `**Projects**: ${artifact.projects.join(", ") || "None"}`,
34373
+ `**Trace IDs**: ${artifact.traceIds.join(", ") || "None"}`,
34374
+ `**Turns**: ${artifact.turnCount}`,
34375
+ `**Messages**: ${artifact.messageCount}`,
34376
+ `**Tool Calls**: ${artifact.toolCallCount}`,
34377
+ `**Spans**: ${artifact.spanCount}`,
34378
+ `**Total Tokens**: ${artifact.totalTokens}`,
34379
+ "",
34380
+ "## View in Sentry",
34381
+ "",
34382
+ artifact.url,
34383
+ "",
34384
+ "## Transcript",
34385
+ "",
34386
+ ...artifact.turns.flatMap(formatTurn),
34387
+ "## Structured Artifact",
34388
+ "",
34389
+ "```json",
34390
+ JSON.stringify(artifact, null, 2),
34391
+ "```"
34392
+ ];
34393
+ return output.join("\n");
34394
+ }
34395
+ });
34396
+
34003
34397
  //#endregion
34004
34398
  //#region ../mcp-core/dist/breadcrumbs-32rz__d_.js
34005
34399
  /**
@@ -34063,13 +34457,14 @@ function cleanAndTruncate(str, maxLen) {
34063
34457
  }
34064
34458
 
34065
34459
  //#endregion
34066
- //#region ../mcp-core/dist/get-sentry-resource-C8TW-Mht.js
34460
+ //#region ../mcp-core/dist/get-sentry-resource-3W_kn-4y.js
34067
34461
  /** Types with full API integration. */
34068
34462
  const FULLY_SUPPORTED_TYPES = [
34069
34463
  "issue",
34070
34464
  "event",
34071
34465
  "trace",
34072
34466
  "span",
34467
+ "ai_conversation",
34073
34468
  "breadcrumbs",
34074
34469
  "replay"
34075
34470
  ];
@@ -34110,6 +34505,11 @@ function resolveResourceParams(params) {
34110
34505
  spanId
34111
34506
  };
34112
34507
  }
34508
+ case "ai_conversation": return {
34509
+ type: "ai_conversation",
34510
+ organizationSlug,
34511
+ conversationId: resourceId
34512
+ };
34113
34513
  case "breadcrumbs": return {
34114
34514
  type: "breadcrumbs",
34115
34515
  organizationSlug,
@@ -34135,7 +34535,7 @@ function resolveFromParsedUrl(parsed, params) {
34135
34535
  });
34136
34536
  if (detectedType === "unknown") {
34137
34537
  if (parsed.transaction) throw new UserInputError(`Detected a performance summary URL for transaction "${parsed.transaction}". Use \`search_events\` to find traces and performance data for this transaction.`);
34138
- throw new UserInputError("Could not determine resource type from URL. Supported URL patterns: issues, events, traces, profiles, replays, monitors, and releases.");
34538
+ throw new UserInputError("Could not determine resource type from URL. Supported URL patterns: issues, events, traces, AI conversations, profiles, replays, monitors, and releases.");
34139
34539
  }
34140
34540
  if (params.resourceType && params.resourceType !== detectedType) {
34141
34541
  if (params.resourceType === "trace" && detectedType === "span") {
@@ -34186,6 +34586,13 @@ function resolveFromParsedUrl(parsed, params) {
34186
34586
  traceId: parsed.traceId,
34187
34587
  spanId: parsed.spanId
34188
34588
  };
34589
+ case "ai_conversation":
34590
+ if (!parsed.conversationId) throw new UserInputError("Could not extract AI conversation ID from URL.");
34591
+ return {
34592
+ type: "ai_conversation",
34593
+ organizationSlug,
34594
+ conversationId: parsed.conversationId
34595
+ };
34189
34596
  case "profile":
34190
34597
  if (!parsed.projectSlug) throw new UserInputError("Could not extract project slug from profile URL.");
34191
34598
  return {
@@ -34294,7 +34701,7 @@ var get_sentry_resource_default = defineTool({
34294
34701
  description: [
34295
34702
  "Fetch a Sentry resource by URL or by type and ID. Pass a Sentry URL directly and the resource type is auto-detected.",
34296
34703
  "",
34297
- "Supports issues, events, traces, spans, replays, breadcrumbs, and preprod snapshots.",
34704
+ "Supports issues, events, traces, spans, AI conversations, replays, breadcrumbs, and preprod snapshots.",
34298
34705
  "Sentry URLs require authentication that this tool handles.",
34299
34706
  "Trace lookups return a condensed overview by default.",
34300
34707
  "",
@@ -34320,6 +34727,9 @@ var get_sentry_resource_default = defineTool({
34320
34727
  "### Replay by ID",
34321
34728
  "get_sentry_resource(resourceType='replay', organizationSlug='my-org', resourceId='7e07485f-12f9-416b-8b14-26260799b51f')",
34322
34729
  "",
34730
+ "### AI conversation by ID",
34731
+ "get_sentry_resource(resourceType='ai_conversation', organizationSlug='my-org', resourceId='conversation-123')",
34732
+ "",
34323
34733
  "### Investigate a failed snapshot test from CI",
34324
34734
  "get_sentry_resource(url='https://sentry.sentry.io/preprod/snapshots/241539/')",
34325
34735
  "",
@@ -34334,10 +34744,11 @@ var get_sentry_resource_default = defineTool({
34334
34744
  "event",
34335
34745
  "trace",
34336
34746
  "span",
34747
+ "ai_conversation",
34337
34748
  "breadcrumbs",
34338
34749
  "replay"
34339
34750
  ]).optional().describe("Resource type. With a URL, can override the auto-detected type for breadcrumbs on an issue/event URL or for `trace` on a span-focused trace URL."),
34340
- resourceId: z.string().trim().optional().describe("Resource identifier: issue shortId (e.g., 'PROJECT-123'), event ID, trace ID, replay ID, or `traceId:spanId` for span resources. Required when not using a URL."),
34751
+ resourceId: z.string().trim().optional().describe("Resource identifier: issue shortId (e.g., 'PROJECT-123'), event ID, trace ID, AI conversation ID, replay ID, or `traceId:spanId` for span resources. Required when not using a URL."),
34341
34752
  organizationSlug: ParamOrganizationSlug.optional()
34342
34753
  },
34343
34754
  annotations: {
@@ -34383,6 +34794,11 @@ var get_sentry_resource_default = defineTool({
34383
34794
  spanId: resolved.spanId,
34384
34795
  regionUrl: context$1.constraints.regionUrl ?? null
34385
34796
  }, context$1);
34797
+ case "ai_conversation": return get_ai_conversation_details_default.handler({
34798
+ organizationSlug: resolved.organizationSlug,
34799
+ conversationId: resolved.conversationId,
34800
+ regionUrl: context$1.constraints.regionUrl ?? void 0
34801
+ }, context$1);
34386
34802
  case "breadcrumbs": {
34387
34803
  const apiService = apiServiceFromContext(context$1, { regionUrl: context$1.constraints.regionUrl ?? void 0 });
34388
34804
  try {
@@ -34434,7 +34850,7 @@ var get_sentry_resource_default = defineTool({
34434
34850
  });
34435
34851
 
34436
34852
  //#endregion
34437
- //#region ../mcp-core/dist/get-latest-base-snapshot-D5KTK7zO.js
34853
+ //#region ../mcp-core/dist/get-latest-base-snapshot-D_Fdn0Dw.js
34438
34854
  var get_latest_base_snapshot_default = defineTool({
34439
34855
  name: "get_latest_base_snapshot",
34440
34856
  skills: ["preprod"],
@@ -36142,7 +36558,7 @@ var DefaultMCPClient = class {
36142
36558
  };
36143
36559
 
36144
36560
  //#endregion
36145
- //#region ../mcp-core/dist/server-CZKFu-K9.js
36561
+ //#region ../mcp-core/dist/server-BJzi-w7y.js
36146
36562
  /**
36147
36563
  * Format tool calls into a readable trace
36148
36564
  */
@@ -36262,10 +36678,11 @@ var tools_default = {
36262
36678
  get_profile_details: get_profile_details_default,
36263
36679
  get_sentry_resource: get_sentry_resource_default,
36264
36680
  get_snapshot_details: get_snapshot_details_default,
36265
- get_latest_base_snapshot: get_latest_base_snapshot_default
36681
+ get_latest_base_snapshot: get_latest_base_snapshot_default,
36682
+ get_ai_conversation_details: get_ai_conversation_details_default
36266
36683
  };
36267
36684
  function getSkillGrantedAttributeName(skill) {
36268
- return `app.oauth.skill.${skill.replaceAll("-", "_")}.granted`;
36685
+ return `app.consent.skill.${skill.replaceAll("-", "_")}.granted`;
36269
36686
  }
36270
36687
  /**
36271
36688
  * Creates and configures a complete MCP server with Sentry instrumentation.
@@ -36437,7 +36854,7 @@ function configureServer({ server, context: context$1, agentMode = false, experi
36437
36854
  }
36438
36855
 
36439
36856
  //#endregion
36440
- //#region ../mcp-core/dist/sentry-CpCiY00X.js
36857
+ //#region ../mcp-core/dist/sentry-4T-sLvO8.js
36441
36858
  const SCRUB_PATTERNS = [
36442
36859
  {
36443
36860
  pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,