@sentry/mcp-server 0.37.0 → 0.39.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 (115) 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.d.cts +1 -1
  5. package/dist/auth/device-code-flow.d.ts +1 -1
  6. package/dist/auth/device-code-flow.js +3 -3
  7. package/dist/auth/resolve-token.cjs +4 -4
  8. package/dist/auth/resolve-token.d.cts +1 -1
  9. package/dist/auth/resolve-token.d.ts +1 -1
  10. package/dist/auth/resolve-token.js +4 -4
  11. package/dist/auth/token-cache.d.cts +1 -1
  12. package/dist/auth/token-cache.d.ts +1 -1
  13. package/dist/auth/types.d.cts +1 -1
  14. package/dist/auth/types.d.ts +1 -1
  15. package/dist/{auth-DMKQfLeC.js → auth-BmLsTuwM.js} +5 -5
  16. package/dist/{auth-DMKQfLeC.js.map → auth-BmLsTuwM.js.map} +1 -1
  17. package/dist/{auth-CoEHiogK.cjs → auth-CMwoYDhh.cjs} +5 -5
  18. package/dist/{auth-CoEHiogK.cjs.map → auth-CMwoYDhh.cjs.map} +1 -1
  19. package/dist/blob-utils-ByQZ_jqM.cjs +3 -0
  20. package/dist/{blob-utils-W1AQ3zH3-Dqg_Ruod.js → blob-utils-CdbE_jsd-9sHzy4nK.js} +2 -2
  21. package/dist/{blob-utils-W1AQ3zH3-Dqg_Ruod.js.map → blob-utils-CdbE_jsd-9sHzy4nK.js.map} +1 -1
  22. package/dist/{blob-utils-W1AQ3zH3-CbD1HBpG.cjs → blob-utils-CdbE_jsd-zazUDulT.cjs} +2 -2
  23. package/dist/{blob-utils-W1AQ3zH3-CbD1HBpG.cjs.map → blob-utils-CdbE_jsd-zazUDulT.cjs.map} +1 -1
  24. package/dist/blob-utils-KYOyFu79.js +3 -0
  25. package/dist/cli/commands/auth.cjs +6 -6
  26. package/dist/cli/commands/auth.js +6 -6
  27. package/dist/cli/parse.cjs +1 -1
  28. package/dist/cli/parse.d.cts +1 -1
  29. package/dist/cli/parse.d.ts +1 -1
  30. package/dist/cli/parse.js +1 -1
  31. package/dist/cli/resolve.cjs +2 -2
  32. package/dist/cli/resolve.d.cts +1 -1
  33. package/dist/cli/resolve.d.ts +1 -1
  34. package/dist/cli/resolve.js +2 -2
  35. package/dist/cli/types.d.cts +1 -1
  36. package/dist/cli/types.d.ts +1 -1
  37. package/dist/cli/usage.cjs +1 -1
  38. package/dist/cli/usage.js +1 -1
  39. package/dist/{config-8Hjp9aiG.js → config-BUwpc74z.js} +1 -1
  40. package/dist/{config-CUeobZnr-BYvJlg7Z.js → config-BqCCImAX-C9xxoOuk.js} +6 -2
  41. package/dist/config-BqCCImAX-C9xxoOuk.js.map +1 -0
  42. package/dist/{config-CUeobZnr-C1uLYu0T.cjs → config-BqCCImAX-CqsS5Qiu.cjs} +6 -2
  43. package/dist/config-BqCCImAX-CqsS5Qiu.cjs.map +1 -0
  44. package/dist/config-Md3ohhLy.cjs +7 -0
  45. package/dist/{constants-zNdapUB3.cjs → constants-BF1H5JLS.cjs} +19 -3
  46. package/dist/constants-BF1H5JLS.cjs.map +1 -0
  47. package/dist/{constants-D_84kMgg.js → constants-BZbaI-zR.js} +14 -4
  48. package/dist/constants-BZbaI-zR.js.map +1 -0
  49. package/dist/{device-code-flow-CcQul2R1.js → device-code-flow-BRSc_1Sh.js} +3 -3
  50. package/dist/{device-code-flow-CcQul2R1.js.map → device-code-flow-BRSc_1Sh.js.map} +1 -1
  51. package/dist/{device-code-flow-C8F3AhEF.cjs → device-code-flow-Btx7zPjy.cjs} +3 -3
  52. package/dist/{device-code-flow-C8F3AhEF.cjs.map → device-code-flow-Btx7zPjy.cjs.map} +1 -1
  53. package/dist/index.cjs +41507 -25507
  54. package/dist/index.cjs.map +1 -1
  55. package/dist/index.js +41496 -25496
  56. package/dist/index.js.map +1 -1
  57. package/dist/{parse-zwbX4Y-K.cjs → parse-CPY7-_2_.cjs} +5 -5
  58. package/dist/parse-CPY7-_2_.cjs.map +1 -0
  59. package/dist/{parse-Da-x492e.js → parse-Dd3OOgIq.js} +5 -5
  60. package/dist/parse-Dd3OOgIq.js.map +1 -0
  61. package/dist/{resolve-CZF3TTNf.cjs → resolve-BsYckCew.cjs} +8 -6
  62. package/dist/resolve-BsYckCew.cjs.map +1 -0
  63. package/dist/{resolve-8tYs_T8S.js → resolve-CS-Bms6W.js} +8 -6
  64. package/dist/resolve-CS-Bms6W.js.map +1 -0
  65. package/dist/{resolve-token-BZT0rfog.js → resolve-token-D8oZbjtT.js} +3 -3
  66. package/dist/{resolve-token-BZT0rfog.js.map → resolve-token-D8oZbjtT.js.map} +1 -1
  67. package/dist/{resolve-token-DVtQqc4m.cjs → resolve-token-TOq9-TtB.cjs} +3 -3
  68. package/dist/{resolve-token-DVtQqc4m.cjs.map → resolve-token-TOq9-TtB.cjs.map} +1 -1
  69. package/dist/{stdio-BuQ6IY8U.cjs → stdio-DFPpP3Gf.cjs} +2 -3
  70. package/dist/stdio-DFPpP3Gf.cjs.map +1 -0
  71. package/dist/{stdio-CFhXG3ra.js → stdio-DrtNVy01.js} +2 -3
  72. package/dist/stdio-DrtNVy01.js.map +1 -0
  73. package/dist/transports/stdio.cjs +2 -2
  74. package/dist/transports/stdio.d.cts +0 -1
  75. package/dist/transports/stdio.d.cts.map +1 -1
  76. package/dist/transports/stdio.d.ts +0 -1
  77. package/dist/transports/stdio.d.ts.map +1 -1
  78. package/dist/transports/stdio.js +2 -2
  79. package/dist/{types-BclC2DY0.d.ts → types-BGyk9F4G.d.ts} +6 -57
  80. package/dist/types-BGyk9F4G.d.ts.map +1 -0
  81. package/dist/{types-BJpeKPWI.d.cts → types-C9HgNyIE.d.cts} +6 -57
  82. package/dist/types-C9HgNyIE.d.cts.map +1 -0
  83. package/dist/{types-DcYSHvwR.d.cts → types-D-BIcaY4.d.ts} +3 -3
  84. package/dist/{types-Ky5RNldv.d.ts.map → types-D-BIcaY4.d.ts.map} +1 -1
  85. package/dist/{types-Ky5RNldv.d.ts → types-Dyacb-A8.d.cts} +3 -3
  86. package/dist/{types-DcYSHvwR.d.cts.map → types-Dyacb-A8.d.cts.map} +1 -1
  87. package/dist/{usage-QiSwuC5N.js → usage-Con424Df.js} +6 -4
  88. package/dist/usage-Con424Df.js.map +1 -0
  89. package/dist/{usage-D486x6Lh.cjs → usage-Crfzx1qJ.cjs} +6 -4
  90. package/dist/usage-Crfzx1qJ.cjs.map +1 -0
  91. package/dist/{version-CDrryFjP.cjs → version-BHLBRM5t.cjs} +3 -3
  92. package/dist/version-BHLBRM5t.cjs.map +1 -0
  93. package/dist/version-BWR2MRdi.js +7 -0
  94. package/dist/version-BWR2MRdi.js.map +1 -0
  95. package/package.json +7 -7
  96. package/dist/blob-utils-C7JBV2hl.js +0 -3
  97. package/dist/blob-utils-DaykNmFv.cjs +0 -3
  98. package/dist/config-BXJMmHuY.cjs +0 -7
  99. package/dist/config-CUeobZnr-BYvJlg7Z.js.map +0 -1
  100. package/dist/config-CUeobZnr-C1uLYu0T.cjs.map +0 -1
  101. package/dist/constants-D_84kMgg.js.map +0 -1
  102. package/dist/constants-zNdapUB3.cjs.map +0 -1
  103. package/dist/parse-Da-x492e.js.map +0 -1
  104. package/dist/parse-zwbX4Y-K.cjs.map +0 -1
  105. package/dist/resolve-8tYs_T8S.js.map +0 -1
  106. package/dist/resolve-CZF3TTNf.cjs.map +0 -1
  107. package/dist/stdio-BuQ6IY8U.cjs.map +0 -1
  108. package/dist/stdio-CFhXG3ra.js.map +0 -1
  109. package/dist/types-BJpeKPWI.d.cts.map +0 -1
  110. package/dist/types-BclC2DY0.d.ts.map +0 -1
  111. package/dist/usage-D486x6Lh.cjs.map +0 -1
  112. package/dist/usage-QiSwuC5N.js.map +0 -1
  113. package/dist/version-CDrryFjP.cjs.map +0 -1
  114. package/dist/version-COFS7UF2.js +0 -7
  115. package/dist/version-COFS7UF2.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ import { blobToBase64, createImagePreview, detectImageMimeType } from "./blob-utils-CdbE_jsd-9sHzy4nK.js";
2
+
3
+ export { detectImageMimeType };
@@ -1,11 +1,11 @@
1
- require('../../resolve-CZF3TTNf.cjs');
2
- require('../../constants-zNdapUB3.cjs');
3
- require('../../version-CDrryFjP.cjs');
4
- require('../../parse-zwbX4Y-K.cjs');
1
+ require('../../resolve-BsYckCew.cjs');
2
+ require('../../constants-BF1H5JLS.cjs');
3
+ require('../../version-BHLBRM5t.cjs');
4
+ require('../../parse-CPY7-_2_.cjs');
5
5
  require('../../types-dghCRFW4.cjs');
6
- require('../../device-code-flow-C8F3AhEF.cjs');
6
+ require('../../device-code-flow-Btx7zPjy.cjs');
7
7
  require('../../token-cache-ATUcs1cg.cjs');
8
- const require_auth = require('../../auth-CoEHiogK.cjs');
8
+ const require_auth = require('../../auth-CMwoYDhh.cjs');
9
9
 
10
10
  exports.authCommand = require_auth.authCommand;
11
11
  exports.parseFlag = require_auth.parseFlag;
@@ -1,10 +1,10 @@
1
- import "../../resolve-8tYs_T8S.js";
2
- import "../../constants-D_84kMgg.js";
3
- import "../../version-COFS7UF2.js";
4
- import "../../parse-Da-x492e.js";
1
+ import "../../resolve-CS-Bms6W.js";
2
+ import "../../constants-BZbaI-zR.js";
3
+ import "../../version-BWR2MRdi.js";
4
+ import "../../parse-Dd3OOgIq.js";
5
5
  import "../../types-BCSxlxZI.js";
6
- import "../../device-code-flow-CcQul2R1.js";
6
+ import "../../device-code-flow-BRSc_1Sh.js";
7
7
  import "../../token-cache-DbZp4rvg.js";
8
- import { authCommand, parseFlag } from "../../auth-DMKQfLeC.js";
8
+ import { authCommand, parseFlag } from "../../auth-BmLsTuwM.js";
9
9
 
10
10
  export { authCommand, parseFlag };
@@ -1,4 +1,4 @@
1
- const require_parse = require('../parse-zwbX4Y-K.cjs');
1
+ const require_parse = require('../parse-CPY7-_2_.cjs');
2
2
 
3
3
  exports.merge = require_parse.merge;
4
4
  exports.parseArgv = require_parse.parseArgv;
@@ -1,4 +1,4 @@
1
- import { CliArgs, EnvArgs, MergedArgs } from "../types-DcYSHvwR.cjs";
1
+ import { CliArgs, EnvArgs, MergedArgs } from "../types-Dyacb-A8.cjs";
2
2
 
3
3
  //#region src/cli/parse.d.ts
4
4
  declare function parseArgv(argv: string[]): CliArgs;
@@ -1,4 +1,4 @@
1
- import { CliArgs, EnvArgs, MergedArgs } from "../types-Ky5RNldv.js";
1
+ import { CliArgs, EnvArgs, MergedArgs } from "../types-D-BIcaY4.js";
2
2
 
3
3
  //#region src/cli/parse.d.ts
4
4
  declare function parseArgv(argv: string[]): CliArgs;
package/dist/cli/parse.js CHANGED
@@ -1,3 +1,3 @@
1
- import { merge, parseArgv, parseEnv } from "../parse-Da-x492e.js";
1
+ import { merge, parseArgv, parseEnv } from "../parse-Dd3OOgIq.js";
2
2
 
3
3
  export { merge, parseArgv, parseEnv };
@@ -1,5 +1,5 @@
1
- const require_resolve = require('../resolve-CZF3TTNf.cjs');
2
- require('../constants-zNdapUB3.cjs');
1
+ const require_resolve = require('../resolve-BsYckCew.cjs');
2
+ require('../constants-BF1H5JLS.cjs');
3
3
 
4
4
  exports.finalize = require_resolve.finalize;
5
5
  exports.formatInvalidSkills = require_resolve.formatInvalidSkills;
@@ -1,4 +1,4 @@
1
- import { MergedArgs, PartiallyResolvedConfig } from "../types-DcYSHvwR.cjs";
1
+ import { MergedArgs, PartiallyResolvedConfig } from "../types-Dyacb-A8.cjs";
2
2
 
3
3
  //#region src/cli/resolve.d.ts
4
4
  declare function formatInvalidSkills(invalid: string[], source?: string): string;
@@ -1,4 +1,4 @@
1
- import { MergedArgs, PartiallyResolvedConfig } from "../types-Ky5RNldv.js";
1
+ import { MergedArgs, PartiallyResolvedConfig } from "../types-D-BIcaY4.js";
2
2
 
3
3
  //#region src/cli/resolve.d.ts
4
4
  declare function formatInvalidSkills(invalid: string[], source?: string): string;
@@ -1,4 +1,4 @@
1
- import { finalize, formatInvalidSkills, resolveHost } from "../resolve-8tYs_T8S.js";
2
- import "../constants-D_84kMgg.js";
1
+ import { finalize, formatInvalidSkills, resolveHost } from "../resolve-CS-Bms6W.js";
2
+ import "../constants-BZbaI-zR.js";
3
3
 
4
4
  export { finalize, formatInvalidSkills, resolveHost };
@@ -1,2 +1,2 @@
1
- import { CliAgentProvider, CliArgs, EnvArgs, MergedArgs, PartiallyResolvedConfig, ResolvedConfig } from "../types-DcYSHvwR.cjs";
1
+ import { CliAgentProvider, CliArgs, EnvArgs, MergedArgs, PartiallyResolvedConfig, ResolvedConfig } from "../types-Dyacb-A8.cjs";
2
2
  export { CliAgentProvider, CliArgs, EnvArgs, MergedArgs, PartiallyResolvedConfig, ResolvedConfig };
@@ -1,2 +1,2 @@
1
- import { CliAgentProvider, CliArgs, EnvArgs, MergedArgs, PartiallyResolvedConfig, ResolvedConfig } from "../types-Ky5RNldv.js";
1
+ import { CliAgentProvider, CliArgs, EnvArgs, MergedArgs, PartiallyResolvedConfig, ResolvedConfig } from "../types-D-BIcaY4.js";
2
2
  export { CliAgentProvider, CliArgs, EnvArgs, MergedArgs, PartiallyResolvedConfig, ResolvedConfig };
@@ -1,3 +1,3 @@
1
- const require_usage = require('../usage-D486x6Lh.cjs');
1
+ const require_usage = require('../usage-Crfzx1qJ.cjs');
2
2
 
3
3
  exports.buildUsage = require_usage.buildUsage;
package/dist/cli/usage.js CHANGED
@@ -1,3 +1,3 @@
1
- import { buildUsage } from "../usage-QiSwuC5N.js";
1
+ import { buildUsage } from "../usage-Con424Df.js";
2
2
 
3
3
  export { buildUsage };
@@ -1,3 +1,3 @@
1
- import { BASE_COMMON_FIELDS, DATASET_EXAMPLES, DATASET_FIELDS, NUMERIC_FIELDS, RECOMMENDED_FIELDS, TRACE_METRICS_SAMPLE_IDENTITY_FIELDS, systemPrompt } from "./config-CUeobZnr-BYvJlg7Z.js";
1
+ import { BASE_COMMON_FIELDS, DATASET_EXAMPLES, DATASET_FIELDS, NUMERIC_FIELDS, RECOMMENDED_FIELDS, TRACE_METRICS_SAMPLE_IDENTITY_FIELDS, systemPrompt } from "./config-BqCCImAX-C9xxoOuk.js";
2
2
 
3
3
  export { BASE_COMMON_FIELDS, DATASET_EXAMPLES, DATASET_FIELDS, NUMERIC_FIELDS, RECOMMENDED_FIELDS };
@@ -1,10 +1,11 @@
1
- //#region ../mcp-core/dist/config-CUeobZnr.js
1
+ //#region ../mcp-core/dist/config-BqCCImAX.js
2
2
  const systemPrompt = `You are a Sentry query translator. You need to:
3
3
  1. FIRST determine which dataset (spans, errors, logs, metrics, profiles, or replays) is most appropriate for the query
4
4
  2. Query the available attributes for that dataset using the datasetAttributes tool for spans/errors/logs/metrics/profiles, or the replayFields tool for replays
5
5
  3. Use the otelSemantics tool if you need OpenTelemetry semantic conventions
6
6
  4. Convert the natural language query to Sentry's search syntax (NOT SQL syntax)
7
7
  5. Decide which fields to return in the results
8
+ 6. For non-replay datasets, call validateSearch on the candidate request and fix failures before returning
8
9
 
9
10
  CRITICAL: Sentry does NOT use SQL syntax. Do NOT generate SQL-like queries.
10
11
 
@@ -40,6 +41,8 @@ TOOL USAGE GUIDELINES:
40
41
  5. IMPORTANT: For ambiguous terms like "user agents", "browser", "client" - use the appropriate field discovery tool instead of guessing field names
41
42
  6. When the user already supplied Sentry search syntax for spans/logs/metrics, call datasetAttributes with substringMatch or query filters from the request before dropping or renaming fields
42
43
  7. Use datasetAttributes substringMatch, query, and attributeTypes for targeted lookup when broad field discovery is truncated
44
+ 8. For non-replay datasets, call validateSearch after constructing the candidate request. If invalid, fix and validate again in this same pass
45
+ 9. NEVER replace a structured field:value filter with message/log.body/full-text matching. If an explicit field is unavailable on the dataset, keep it and let validation fail instead of inventing a weaker query
43
46
 
44
47
  CRITICAL - TOOL RESPONSE HANDLING:
45
48
  All tools return responses in this format: {error?: string, result?: data}
@@ -236,6 +239,7 @@ PROCESS:
236
239
  3. Use datasetAttributes or replayFields to discover available fields
237
240
  4. Use otelSemantics tool if needed for OpenTelemetry attributes
238
241
  5. Construct the final query with proper fields, sort parameters, and replay environment when needed
242
+ 6. For non-replay datasets, validateSearch the candidate and only return after it passes (or after you cannot fix it without weakening structured filters)
239
243
 
240
244
  COMMON ERRORS TO AVOID:
241
245
  - Using SQL syntax (IS NOT NULL, IS NULL, yesterday(), today(), etc.) - Use has: operator and timeRange instead
@@ -877,4 +881,4 @@ const TRACE_METRICS_SAMPLE_IDENTITY_FIELDS = [
877
881
 
878
882
  //#endregion
879
883
  export { BASE_COMMON_FIELDS, DATASET_EXAMPLES, DATASET_FIELDS, NUMERIC_FIELDS, RECOMMENDED_FIELDS, TRACE_METRICS_SAMPLE_IDENTITY_FIELDS, systemPrompt };
880
- //# sourceMappingURL=config-CUeobZnr-BYvJlg7Z.js.map
884
+ //# sourceMappingURL=config-BqCCImAX-C9xxoOuk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-BqCCImAX-C9xxoOuk.js","names":[],"sources":["../../mcp-core/dist/config-BqCCImAX.js"],"sourcesContent":["//#region src/tools/support/search-events/config.ts\nconst systemPrompt = `You are a Sentry query translator. You need to:\n1. FIRST determine which dataset (spans, errors, logs, metrics, profiles, or replays) is most appropriate for the query\n2. Query the available attributes for that dataset using the datasetAttributes tool for spans/errors/logs/metrics/profiles, or the replayFields tool for replays\n3. Use the otelSemantics tool if you need OpenTelemetry semantic conventions\n4. Convert the natural language query to Sentry's search syntax (NOT SQL syntax)\n5. Decide which fields to return in the results\n6. For non-replay datasets, call validateSearch on the candidate request and fix failures before returning\n\nCRITICAL: Sentry does NOT use SQL syntax. Do NOT generate SQL-like queries.\n\nDATASET SELECTION GUIDELINES:\n- spans: Raw trace/span events for performance, AI/LLM calls, database queries, HTTP requests, token usage, costs, user agent data, \"XYZ calls\", ambiguous operations (richest attribute set)\n- errors: Exceptions, crashes, stack traces, unhandled errors, browser/client errors; these usually become Sentry issues\n- logs: Application log entries, log messages, severity levels, debugging information; error-severity logs are still logs\n- metrics: Metric rows and aggregates, especially named metrics, counters, gauges, distributions, metric values, and queries that explicitly mention metric names/types\n- profiles: Transaction and continuous profile results, profile IDs, profile durations, releases, platforms, and profile-related transactions\n- replays: Session replay results, clicked elements, rage/dead clicks, visited pages, replay users, browsers, and releases\n\nFor ambiguous queries like \"calls using XYZ\", prefer spans dataset first as it contains the most comprehensive telemetry data.\nFor queries that explicitly ask about a metric name, metric type, counter/gauge/distribution, or newer span metrics, prefer metrics.\nFor queries about captured profiles, profile IDs, flamegraphs, or profiled transactions, prefer profiles.\nFor queries about session replays, clicked UI elements, rage clicks, dead clicks, visited URLs/screens, or replay users/sessions, prefer replays.\nIf the user says logs, log messages, error logs, or warning logs, choose logs instead of errors.\n\nCRITICAL - FIELD VERIFICATION REQUIREMENT:\nBefore constructing ANY query, you MUST verify field availability:\n1. You CANNOT assume ANY field exists without checking - not even common ones\n2. This includes ALL fields: custom attributes, database fields, HTTP fields, AI fields, user fields, etc.\n3. Fields vary by project based on what data is being sent to Sentry\n4. Using an unverified field WILL cause your query to fail with \"field not found\" errors\n5. For spans, logs, and metrics, datasetAttributes can list likely fields using substringMatch/query/attributeTypes\n6. A broad datasetAttributes listing is a discovery preview and may be truncated; do not treat absence from the preview as proof that a user-supplied field is invalid\n7. Replay fields vary by project too, so use replayFields before constructing replay queries\n\nTOOL USAGE GUIDELINES:\n1. Use datasetAttributes tool to discover available fields for your chosen dataset\n2. Use replayFields tool to discover available replay fields and custom replay tags\n3. Use otelSemantics tool when you need specific OpenTelemetry semantic convention attributes\n4. Use whoami tool when queries contain \"me\" references for user.id or user.email fields\n5. IMPORTANT: For ambiguous terms like \"user agents\", \"browser\", \"client\" - use the appropriate field discovery tool instead of guessing field names\n6. When the user already supplied Sentry search syntax for spans/logs/metrics, call datasetAttributes with substringMatch or query filters from the request before dropping or renaming fields\n7. Use datasetAttributes substringMatch, query, and attributeTypes for targeted lookup when broad field discovery is truncated\n8. For non-replay datasets, call validateSearch after constructing the candidate request. If invalid, fix and validate again in this same pass\n9. NEVER replace a structured field:value filter with message/log.body/full-text matching. If an explicit field is unavailable on the dataset, keep it and let validation fail instead of inventing a weaker query\n\nCRITICAL - TOOL RESPONSE HANDLING:\nAll tools return responses in this format: {error?: string, result?: data}\n- If 'error' is present: The tool failed - analyze the error message and potentially retry with corrections\n- If 'result' is present: The tool succeeded - use the result data for your query construction\n- Always check for errors before using results\n\nCRITICAL - HANDLING \"DISTINCT\" OR \"UNIQUE VALUES\" QUERIES:\nWhen user asks for \"distinct\", \"unique\", \"all values of\", or \"what are the X\" queries:\n1. This ALWAYS requires an AGGREGATE query with count() function\n2. Pattern: fields=['field_name', 'count()'] to show distinct values with counts\n3. Sort by \"-count()\" to show most common values first\n4. Use datasetAttributes tool to verify the field exists before constructing query\n5. Examples:\n - \"distinct categories\" → fields=['category.name', 'count()'], sort='-count()'\n - \"unique types\" → fields=['item.type', 'count()'], sort='-count()'\n\nCRITICAL - TRAFFIC/VOLUME/COUNT QUERIES:\nWhen user asks about \"traffic\", \"volume\", \"how much\", \"how many\" (without specific metrics):\n1. This ALWAYS requires an AGGREGATE query with count() function\n2. For total counts: fields=['count()']\n3. For grouped counts: fields=['grouping_field', 'count()']\n4. Always include timeRange for period-specific queries\n5. Examples:\n - \"how much traffic in last 30 days\" → fields=['count()'], timeRange: {\"statsPeriod\": \"30d\"}\n - \"traffic on mcp-server\" → query: \"project:mcp-server\", fields=['count()']\n\nCRITICAL - HANDLING \"ME\" REFERENCES:\n- If the query contains \"me\", \"my\", \"myself\", or \"affecting me\" in the context of user.id or user.email fields, use the whoami tool to get the user's ID and email\n- For assignedTo fields, you can use \"me\" directly without translation (e.g., assignedTo:me works as-is)\n- After calling whoami, replace \"me\" references with the actual user.id or user.email values\n- If whoami fails, return an error explaining the issue\n\nQUERY MODES:\n1. INDIVIDUAL EVENTS (default): Returns raw event data\n - Used when fields contain no function() calls\n - Include recommended fields plus any user-requested fields\n\n2. AGGREGATE QUERIES: Grouping and aggregation (NOT SQL)\n - Activated when ANY field contains a function() call\n - Fields should ONLY include: aggregate functions + groupBy fields\n - Automatically groups by ALL non-function fields\n - For aggregate queries, ONLY include the aggregate functions and groupBy fields - do NOT include default fields like timestamp, id, etc.\n - You SHOULD sort aggregate results by \"-function_name()\" for descending order (highest values first)\n - For equations in aggregate queries: You SHOULD use \"-equation|...\" prefix unless user wants lowest values\n - When user asks \"how many total\", \"sum of\", or similar: They want the highest/total value, use descending sort\n\n3. REPLAY SEARCH RESULTS:\n - Replays return a LIST of replay sessions, not aggregations\n - For replays, set dataset to \"replays\"\n - For replays, return fields: []\n - For replays, use replay query syntax like count_errors:>0, url:*checkout*, click.textContent:\"Save\"\n - For replays, put environment in the separate \"environment\" field, NOT inside query\n - For replay environment filters, use a string for one environment or an array of strings for multiple environments\n - For replays, use sorts like -started_at, -count_errors, -count_rage_clicks, -count_dead_clicks, -duration\n - Replays do NOT support count()/avg()/sum() aggregations through this path\n\nCRITICAL LIMITATION - TIME SERIES NOT SUPPORTED:\n- Queries asking for data \"over time\", \"by hour\", \"by day\", \"time series\", or similar temporal groupings are NOT currently supported\n- If user asks for \"X over time\", return an error explaining: \"Time series aggregations are not currently supported.\"\n\nCRITICAL - DO NOT USE SQL SYNTAX:\n- NEVER use SQL functions like yesterday(), today(), now(), IS NOT NULL, IS NULL\n- NEVER use SQL date functions - use timeRange parameter instead\n- For \"yesterday\": Use timeRange: {\"statsPeriod\": \"24h\"}, NOT timestamp >= yesterday()\n- For field existence: Use has:field_name, NOT field_name IS NOT NULL\n- For field absence: Use !has:field_name, NOT field_name IS NULL\n\nREPLAY SEARCH RULES:\n- Use replayFields when dataset is replays\n- For replay environment filtering, set the separate \"environment\" field to a string or array of strings\n- Replay time filtering must use \"timeRange\", not query fields\n- Replay queries should not include event-search-only syntax like has:field_name\n- Replay sort must still go in the separate \"sort\" field\n- If the user asks about replays they have viewed, prefer viewed_by_me:true\n- If the user asks about replay users and says \"me\", use whoami and translate to user.email:<actual email>\n\nMATHEMATICAL QUERY PATTERNS:\nWhen user asks mathematical questions like \"how many X\", \"total Y used\", \"sum of Z\":\n- Identify the appropriate dataset based on context\n- Use datasetAttributes tool to find available numeric fields\n- Use sum() function for totals, avg() for averages, count() for counts\n- For time-based queries (\"today\", \"yesterday\", \"this week\"), use timeRange parameter\n- For \"total\" or \"how many\" questions: Users typically want highest values first (descending sort)\n\nDERIVED METRICS AND CALCULATIONS (SPANS ONLY):\nWhen user asks for calculated metrics, ratios, or conversions:\n- Use equation fields with \"equation|\" prefix\n- Examples:\n - \"duration in milliseconds\" → fields: [\"equation|avg(span.duration) * 1000\"], sort: \"-equation|avg(span.duration) * 1000\"\n - \"combined metric total\" → fields: [\"equation|sum(metric.a) + sum(metric.b)\"], sort: \"-equation|sum(metric.a) + sum(metric.b)\"\n - \"error rate percentage\" → fields: [\"equation|failure_rate() * 100\"], sort: \"-equation|failure_rate() * 100\"\n - \"events per second\" → fields: [\"equation|count() / 3600\"], sort: \"-equation|count() / 3600\"\n- IMPORTANT: Equations are ONLY supported in the spans dataset, NOT in errors, logs, or metrics\n- IMPORTANT: When sorting by equations, use \"-equation|...\" for descending order (highest values first)\n\nTRACE METRICS AGGREGATES (TRACEMETRICS DATASET):\nWhen querying metrics aggregates, prefer aggregate functions that fully encode the target metric:\n- Format: fn(value,metric.name,metric.type,metric.unit)\n- Counter examples: \"sum(value,my.counter,counter,-)\", \"per_second(value,my.counter,counter,-)\"\n- Gauge examples: \"avg(value,cpu.usage,gauge,percent)\", \"max(value,cpu.usage,gauge,percent)\"\n- Distribution examples: \"p95(value,http.request.duration,distribution,millisecond)\", \"avg(value,http.request.duration,distribution,millisecond)\"\n- IMPORTANT: Use the exact metric.name, metric.type, and metric.unit values when they are available\n- IMPORTANT: Tracemetrics do NOT support equation| fields\n\nPERFORMANCE INVESTIGATION STRATEGY:\nWhen users ask about \"performance problems\", \"slow pages\", \"slow endpoints\", \"latency issues\",\n\"web vitals\", \"LCP\", \"CLS\", \"INP\", \"page speed\", \"load time\", \"response time\", or similar:\n\n1. ALWAYS use AGGREGATE queries first - individual samples are misleading for performance analysis\n2. Use p75() as the primary percentile for consistent performance measurement\n3. Group by transaction to identify which pages/endpoints have problems\n4. Include count() to understand sample size (low count = unreliable data)\n5. Sort by the worst-performing metric (descending with \"-\" prefix)\n\nCRITICAL: For performance investigations, return AGGREGATES grouped by the span's transaction attribute, NOT individual events.\n\nSPAN QUERY PHILOSOPHY - DUCK TYPING:\nUse \"has:attribute\" to find spans by their characteristics, NOT \"is_transaction:true\".\nThe is_transaction:true filter ONLY returns transaction boundaries (request entry/exit points).\nMost performance queries want specific span types, not just boundaries.\n\nPerformance Query Patterns (use duck typing):\n- Web Vitals: has:measurements.lcp, has:measurements.cls, has:measurements.inp\n- Database: has:db.statement or has:db.system\n- HTTP/API calls: has:http.method or has:http.url\n- External Services: has:http.url (for outbound calls)\n- AI/LLM: has:gen_ai.provider.name or has:gen_ai.request.model\n- MCP Tools: has:gen_ai.tool.name\n\nWHEN TO USE is_transaction:true (rare):\n- ONLY when you specifically need transaction boundaries (full request/response cycle)\n- Example: \"total request duration by endpoint\" - you want the outermost span\n- For most queries about \"slow X\" or \"X performance\", use duck typing instead\n\nWeb Vitals Thresholds (for context when reporting):\n- LCP: Good < 2500ms, Needs Improvement 2500-4000ms, Poor >= 4000ms\n- CLS: Good < 0.1, Needs Improvement 0.1-0.25, Poor >= 0.25\n- INP: Good < 200ms, Needs Improvement 200-500ms, Poor >= 500ms\n- FCP: Good < 1800ms, Needs Improvement 1800-3000ms, Poor >= 3000ms\n- TTFB: Good < 800ms, Needs Improvement 800-1800ms, Poor >= 1800ms\n\nSORTING RULES (CRITICAL - YOU MUST ALWAYS SPECIFY A SORT):\n1. CRITICAL: Sort MUST go in the separate \"sort\" field, NEVER in the \"query\" field\n - WRONG: query: \"level:error sort:-timestamp\" ← Sort syntax in query field is FORBIDDEN\n - CORRECT: query: \"level:error\", sort: \"-timestamp\" ← Sort in separate field\n\n2. DEFAULT SORTING:\n - errors dataset: Use \"-timestamp\" (newest first)\n - spans dataset: Use \"-span.duration\" (slowest first) \n - logs dataset: Use \"-timestamp\" (newest first)\n - metrics dataset: Use \"-timestamp\" for samples, or sort by the selected aggregate for grouped metric results\n - profiles dataset: Use \"-timestamp\" for samples, or sort by the selected aggregate for grouped profile results\n - replays dataset: Use \"-started_at\" (most recent replay first)\n\n3. SORTING SYNTAX:\n - Use \"-\" prefix for descending order (e.g., \"-timestamp\" for newest first)\n - Use field name without prefix for ascending order\n - For aggregate queries: sort by aggregate function results (e.g., \"-count()\" for highest count first)\n - For equation fields: You SHOULD use \"-equation|...\" for descending order (e.g., \"-equation|sum(field1) + sum(field2)\")\n - Only omit the \"-\" prefix if the user clearly wants lowest values first (rare)\n\n4. IMPORTANT SORTING REQUIREMENTS:\n - YOU MUST ALWAYS INCLUDE A SORT PARAMETER\n - CRITICAL: The field you sort by MUST be included in your fields array\n - If sorting by \"-timestamp\", include \"timestamp\" in fields\n - If sorting by \"-count()\", include \"count()\" in fields\n - This is MANDATORY - Sentry will reject queries where sort field is not in the selected fields\n\nYOUR RESPONSE FORMAT:\nReturn a JSON object with these fields:\n- \"dataset\": Which dataset you determined to use (\"spans\", \"errors\", \"logs\", \"metrics\", \"profiles\", or \"replays\")\n- \"query\": The Sentry query string for filtering results (use empty string \"\" for no filters)\n- \"fields\": Array of field names to return in results\n - For individual event queries: OPTIONAL (will use recommended fields if not provided)\n - For aggregate queries: REQUIRED (must include aggregate functions AND any groupBy fields)\n - For replay queries: return []\n- \"sort\": Sort parameter for results (REQUIRED - YOU MUST ALWAYS SPECIFY THIS)\n- \"environment\": Separate environment filter for replays, as a string or array of strings, or null when not needed\n- \"timeRange\": Time range parameters (optional)\n - Relative: {\"statsPeriod\": \"24h\"} for last 24 hours, \"7d\" for last 7 days, etc.\n - Absolute: {\"start\": \"2025-06-19T07:00:00\", \"end\": \"2025-06-20T06:59:59\"} for specific date ranges\n- \"explanation\": Brief explanation of how you translated this query\n\nCORRECT QUERY PATTERNS (FOLLOW THESE):\n- For field existence: Use has:field_name (NOT field_name IS NOT NULL)\n- For field absence: Use !has:field_name (NOT field_name IS NULL)\n- For time periods: Use timeRange parameter (NOT SQL date functions)\n- Example: \"items processed yesterday\" → query: \"has:item.processed\", timeRange: {\"statsPeriod\": \"24h\"}\n\nPROCESS:\n1. Analyze the user's query\n2. Determine appropriate dataset\n3. Use datasetAttributes or replayFields to discover available fields\n4. Use otelSemantics tool if needed for OpenTelemetry attributes\n5. Construct the final query with proper fields, sort parameters, and replay environment when needed\n6. For non-replay datasets, validateSearch the candidate and only return after it passes (or after you cannot fix it without weakening structured filters)\n\nCOMMON ERRORS TO AVOID:\n- Using SQL syntax (IS NOT NULL, IS NULL, yesterday(), today(), etc.) - Use has: operator and timeRange instead\n- Using numeric functions (sum, avg, min, max, percentiles) on non-numeric fields\n- Using incorrect field names (use the otelSemantics tool to look up correct names)\n- Missing required fields in the fields array for aggregate queries\n- Invalid sort parameter not included in fields array\n- Putting replay environment filters inside the replay query instead of the separate environment field\n- For field existence: Use has:field_name (NOT field_name IS NOT NULL)\n- For field absence: Use !has:field_name (NOT field_name IS NULL)\n- For time periods: Use timeRange parameter (NOT SQL date functions like yesterday())`;\nconst BASE_COMMON_FIELDS = {\n\tproject: \"Project slug\",\n\ttimestamp: \"When the event occurred\",\n\tenvironment: \"Environment (production, staging, development)\",\n\trelease: \"Release version\",\n\tplatform: \"Platform (javascript, python, etc.)\",\n\t\"user.id\": \"User ID\",\n\t\"user.email\": \"User email\",\n\t\"sdk.name\": \"SDK name\",\n\t\"sdk.version\": \"SDK version\"\n};\nconst NUMERIC_FIELDS = {\n\tspans: new Set([\n\t\t\"span.duration\",\n\t\t\"span.self_time\",\n\t\t\"transaction.duration\",\n\t\t\"http.status_code\",\n\t\t\"gen_ai.usage.input_tokens\",\n\t\t\"gen_ai.usage.output_tokens\",\n\t\t\"gen_ai.request.max_tokens\",\n\t\t\"measurements.lcp\",\n\t\t\"measurements.cls\",\n\t\t\"measurements.inp\",\n\t\t\"measurements.fcp\",\n\t\t\"measurements.ttfb\"\n\t]),\n\terrors: new Set([\"stack.lineno\"]),\n\tlogs: new Set([\"severity_number\", \"sentry.observed_timestamp_nanos\"]),\n\ttracemetrics: new Set([\n\t\t\"value\",\n\t\t\"timestamp_precise\",\n\t\t\"observed_timestamp\",\n\t\t\"payload_size\"\n\t]),\n\tprofiles: new Set([\"profile.duration\", \"transaction.duration\"])\n};\nconst DATASET_FIELDS = {\n\tspans: {\n\t\t\"span.op\": \"Span operation type (e.g., http.client, db.query, cache.get)\",\n\t\t\"span.description\": \"Detailed description of the span operation\",\n\t\t\"span.duration\": \"Duration of the span in milliseconds\",\n\t\t\"span.status\": \"Span status (ok, cancelled, unknown, etc.)\",\n\t\t\"span.self_time\": \"Time spent in this span excluding child spans\",\n\t\ttransaction: \"Transaction name/route\",\n\t\t\"transaction.duration\": \"Total transaction duration in milliseconds\",\n\t\t\"transaction.op\": \"Transaction operation type\",\n\t\t\"transaction.status\": \"Transaction status\",\n\t\tis_transaction: \"Whether this span is a transaction (true/false)\",\n\t\ttrace: \"Trace ID\",\n\t\t\"trace.span_id\": \"Span ID within the trace\",\n\t\t\"trace.parent_span_id\": \"Parent span ID\",\n\t\t\"http.method\": \"HTTP method (GET, POST, etc.)\",\n\t\t\"http.status_code\": \"HTTP response status code\",\n\t\t\"http.url\": \"Full HTTP URL\",\n\t\t\"db.system\": \"Database system (postgresql, mysql, etc.)\",\n\t\t\"db.operation\": \"Database operation (SELECT, INSERT, etc.)\",\n\t\t\"gen_ai.provider.name\": \"AI provider name (e.g., anthropic, openai)\",\n\t\t\"gen_ai.request.model\": \"Model name (e.g., claude-3-5-sonnet-20241022)\",\n\t\t\"gen_ai.operation.name\": \"Operation type (e.g., chat, completion)\",\n\t\t\"gen_ai.usage.input_tokens\": \"Number of input tokens (numeric)\",\n\t\t\"gen_ai.usage.output_tokens\": \"Number of output tokens (numeric)\",\n\t\t\"gen_ai.tool.name\": \"Tool name (e.g., search_issues, search_events)\",\n\t\t\"mcp.method.name\": \"MCP request or notification method\",\n\t\t\"mcp.protocol.version\": \"MCP protocol version\",\n\t\t\"mcp.resource.uri\": \"MCP resource URI\",\n\t\t\"mcp.session.id\": \"MCP session identifier\",\n\t\t\"measurements.lcp\": \"Largest Contentful Paint - time until largest content element is visible (ms). Good < 2500ms\",\n\t\t\"measurements.cls\": \"Cumulative Layout Shift - visual stability score (unitless). Good < 0.1\",\n\t\t\"measurements.inp\": \"Interaction to Next Paint - responsiveness to user input (ms). Good < 200ms\",\n\t\t\"measurements.fcp\": \"First Contentful Paint - time until first content is visible (ms). Good < 1800ms\",\n\t\t\"measurements.ttfb\": \"Time to First Byte - server response time (ms). Good < 800ms\",\n\t\t\"count()\": \"Count of spans\",\n\t\t\"count_unique(field)\": \"Count of unique values, e.g. count_unique(user.id)\",\n\t\t\"avg(field)\": \"Average of numeric field, e.g. avg(span.duration)\",\n\t\t\"sum(field)\": \"Sum of numeric field, e.g. sum(span.self_time)\",\n\t\t\"min(field)\": \"Minimum of numeric field, e.g. min(span.duration)\",\n\t\t\"max(field)\": \"Maximum of numeric field, e.g. max(span.duration)\",\n\t\t\"p50(field)\": \"50th percentile (median), e.g. p50(span.duration)\",\n\t\t\"p75(field)\": \"75th percentile - standard for performance analysis, e.g. p75(span.duration)\",\n\t\t\"p90(field)\": \"90th percentile, e.g. p90(span.duration)\",\n\t\t\"p95(field)\": \"95th percentile, e.g. p95(span.duration)\",\n\t\t\"p99(field)\": \"99th percentile, e.g. p99(span.duration)\",\n\t\t\"p100(field)\": \"100th percentile (max), e.g. p100(span.duration)\",\n\t\t\"epm()\": \"Events per minute rate\",\n\t\t\"failure_rate()\": \"Percentage of failed spans\"\n\t},\n\terrors: {\n\t\tmessage: \"Error message\",\n\t\tlevel: \"Error level (error, warning, info, debug)\",\n\t\t\"error.type\": \"Error type/exception class\",\n\t\t\"error.value\": \"Error value/description\",\n\t\t\"error.handled\": \"Whether the error was handled (true/false)\",\n\t\tculprit: \"Code location that caused the error\",\n\t\ttitle: \"Error title/grouping\",\n\t\t\"stack.filename\": \"File where error occurred\",\n\t\t\"stack.function\": \"Function where error occurred\",\n\t\t\"stack.module\": \"Module where error occurred\",\n\t\t\"stack.abs_path\": \"Absolute path to file\",\n\t\t\"os.name\": \"Operating system name\",\n\t\t\"browser.name\": \"Browser name\",\n\t\t\"device.family\": \"Device family\",\n\t\t\"count()\": \"Count of error events\",\n\t\t\"count_unique(field)\": \"Count of unique values, e.g. count_unique(user.id)\",\n\t\t\"count_if(field,equals,value)\": \"Conditional count, e.g. count_if(error.handled,equals,false)\",\n\t\t\"last_seen()\": \"Most recent timestamp of the group\",\n\t\t\"eps()\": \"Events per second rate\",\n\t\t\"epm()\": \"Events per minute rate\"\n\t},\n\tlogs: {\n\t\tmessage: \"Log message\",\n\t\tseverity: \"Log severity level (trace, debug, info, warn, error, fatal)\",\n\t\tseverity_number: \"Numeric severity level\",\n\t\t\"sentry.item_id\": \"Sentry item ID\",\n\t\t\"sentry.observed_timestamp_nanos\": \"Observed timestamp in nanoseconds\",\n\t\ttrace: \"Trace ID\",\n\t\t\"count()\": \"Count of log entries\",\n\t\t\"count_unique(field)\": \"Count of unique values, e.g. count_unique(user.id)\",\n\t\t\"avg(field)\": \"Average of numeric field, e.g. avg(severity_number)\",\n\t\t\"sum(field)\": \"Sum of numeric field\",\n\t\t\"min(field)\": \"Minimum of numeric field\",\n\t\t\"max(field)\": \"Maximum of numeric field\",\n\t\t\"p50(field)\": \"50th percentile (median)\",\n\t\t\"p75(field)\": \"75th percentile\",\n\t\t\"p90(field)\": \"90th percentile\",\n\t\t\"p95(field)\": \"95th percentile\",\n\t\t\"p99(field)\": \"99th percentile\",\n\t\t\"p100(field)\": \"100th percentile (max)\",\n\t\t\"epm()\": \"Events per minute rate\"\n\t},\n\ttracemetrics: {\n\t\t\"metric.name\": \"Metric name for the newer span metrics dataset\",\n\t\t\"metric.type\": \"Metric type (counter, gauge, distribution)\",\n\t\t\"metric.unit\": \"Metric unit if present (for example millisecond, byte, percent)\",\n\t\tvalue: \"Raw metric value (numeric)\",\n\t\ttrace: \"Trace ID\",\n\t\tspan_id: \"Span ID that emitted the metric\",\n\t\t\"trace.parent_span_id\": \"Parent span ID\",\n\t\ttimestamp: \"When the metric sample occurred\",\n\t\ttimestamp_precise: \"High precision timestamp (numeric)\",\n\t\tobserved_timestamp: \"Observed timestamp (numeric)\",\n\t\t\"sum(value,metric.name,metric.type,metric.unit)\": \"Sum a specific metric, e.g. sum(value,request_count,counter,-)\",\n\t\t\"avg(value,metric.name,metric.type,metric.unit)\": \"Average a specific metric, e.g. avg(value,http.request.duration,distribution,millisecond)\",\n\t\t\"min(value,metric.name,metric.type,metric.unit)\": \"Minimum metric value for a specific metric\",\n\t\t\"max(value,metric.name,metric.type,metric.unit)\": \"Maximum metric value for a specific metric\",\n\t\t\"count(value,metric.name,metric.type,metric.unit)\": \"Count samples for a specific metric\",\n\t\t\"p50(value,metric.name,metric.type,metric.unit)\": \"Median for a distribution metric\",\n\t\t\"p75(value,metric.name,metric.type,metric.unit)\": \"75th percentile for a distribution metric\",\n\t\t\"p90(value,metric.name,metric.type,metric.unit)\": \"90th percentile for a distribution metric\",\n\t\t\"p95(value,metric.name,metric.type,metric.unit)\": \"95th percentile for a distribution metric\",\n\t\t\"p99(value,metric.name,metric.type,metric.unit)\": \"99th percentile for a distribution metric\",\n\t\t\"per_second(value,metric.name,metric.type,metric.unit)\": \"Per-second rate for a metric, typically counters\",\n\t\t\"per_minute(value,metric.name,metric.type,metric.unit)\": \"Per-minute rate for a metric, typically counters\"\n\t},\n\tprofiles: {\n\t\t\"profile.id\": \"Transaction profile ID for a specific captured profile\",\n\t\t\"profiler.id\": \"Continuous profiler session ID for chunk-based profile captures\",\n\t\t\"thread.id\": \"Thread ID associated with a continuous profile result when available\",\n\t\ttimestamp: \"When the profile was captured\",\n\t\ttransaction: \"Transaction name associated with the profile when available\",\n\t\ttrace: \"Trace ID linked to the profiled transaction\",\n\t\trelease: \"Release version associated with the profile\",\n\t\tenvironment: \"Environment for the profile\",\n\t\tproject: \"Project slug\",\n\t\t\"project.name\": \"Project name\",\n\t\t\"platform.name\": \"Runtime or SDK platform name\",\n\t\t\"device.model\": \"Device model for mobile or device-bound profiles\",\n\t\t\"device.classification\": \"Device performance classification\",\n\t\t\"device.arch\": \"Device architecture\",\n\t\t\"profile.duration\": \"Total profile duration in nanoseconds for a captured profile\",\n\t\t\"transaction.duration\": \"Transaction duration represented by the profile in nanoseconds\",\n\t\t\"precise.start_ts\": \"Continuous profile precise start timestamp when available\",\n\t\t\"precise.finish_ts\": \"Continuous profile precise finish timestamp when available\",\n\t\t\"count()\": \"Count of matching profiles\",\n\t\t\"last_seen()\": \"Most recent timestamp of the matching profile group\",\n\t\t\"p50()\": \"Median profile duration for the selected grouping\",\n\t\t\"p75()\": \"75th percentile profile duration\",\n\t\t\"p95()\": \"95th percentile profile duration\",\n\t\t\"p99()\": \"99th percentile profile duration\"\n\t}\n};\nconst DATASET_EXAMPLES = {\n\tspans: [\n\t\t{\n\t\t\tdescription: \"web vitals performance problems\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:measurements.lcp\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"p75(measurements.lcp)\",\n\t\t\t\t\t\"p75(measurements.cls)\",\n\t\t\t\t\t\"p75(measurements.inp)\",\n\t\t\t\t\t\"count()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p75(measurements.lcp)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"slowest database queries\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:db.statement\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"db.system\",\n\t\t\t\t\t\"db.statement\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"p75(span.duration)\",\n\t\t\t\t\t\"p95(span.duration)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p75(span.duration)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"total request duration by endpoint (transaction boundaries)\",\n\t\t\toutput: {\n\t\t\t\tquery: \"is_transaction:true\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"avg(span.duration)\",\n\t\t\t\t\t\"p95(span.duration)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-avg(span.duration)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"slow API calls over 5 seconds\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:request.url AND span.duration:>5000\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"span.op\",\n\t\t\t\t\t\"span.description\",\n\t\t\t\t\t\"span.duration\",\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-span.duration\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"token usage by AI model\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:gen_ai.usage.input_tokens\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"gen_ai.request.model\",\n\t\t\t\t\t\"sum(gen_ai.usage.input_tokens)\",\n\t\t\t\t\t\"sum(gen_ai.usage.output_tokens)\",\n\t\t\t\t\t\"count()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-sum(gen_ai.usage.input_tokens)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"top MCP tool calls by usage\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:gen_ai.tool.name\",\n\t\t\t\tfields: [\"gen_ai.tool.name\", \"count()\"],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"HTTP requests by user agent\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:http.method AND has:user_agent.original\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"user_agent.original\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"avg(span.duration)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"frontend performance overview\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:measurements.lcp\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"p75(span.duration)\",\n\t\t\t\t\t\"p75(measurements.lcp)\",\n\t\t\t\t\t\"p75(measurements.fcp)\",\n\t\t\t\t\t\"p75(measurements.ttfb)\",\n\t\t\t\t\t\"count()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p75(span.duration)\"\n\t\t\t}\n\t\t}\n\t],\n\terrors: [\n\t\t{\n\t\t\tdescription: \"unhandled errors in production\",\n\t\t\toutput: {\n\t\t\t\tquery: \"error.handled:false AND environment:production\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"issue\",\n\t\t\t\t\t\"title\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"message\",\n\t\t\t\t\t\"error.type\",\n\t\t\t\t\t\"culprit\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"count errors by type\",\n\t\t\toutput: {\n\t\t\t\tquery: \"level:error\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"error.type\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"last_seen()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"errors in specific file\",\n\t\t\toutput: {\n\t\t\t\tquery: \"stack.filename:\\\"**/Button.tsx\\\"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"issue\",\n\t\t\t\t\t\"title\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"message\",\n\t\t\t\t\t\"stack.filename\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"most common errors\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\"title\", \"count()\"],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"unique users affected by errors\",\n\t\t\toutput: {\n\t\t\t\tquery: \"level:error\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"error.type\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"count_unique(user.id)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count_unique(user.id)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"errors by browser/user agent\",\n\t\t\toutput: {\n\t\t\t\tquery: \"level:error AND has:user_agent.original\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"user_agent.original\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"count_unique(user.id)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t}\n\t],\n\tlogs: [\n\t\t{\n\t\t\tdescription: \"error logs about database\",\n\t\t\toutput: {\n\t\t\t\tquery: \"severity:error AND message:\\\"*database*\\\"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"message\",\n\t\t\t\t\t\"severity\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"count logs by severity\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\"severity\", \"count()\"],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"most common log messages\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\"message\", \"count()\"],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"log volume by project\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"epm()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"warning logs about memory\",\n\t\t\toutput: {\n\t\t\t\tquery: \"severity:warn AND message:\\\"*memory*\\\"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"message\",\n\t\t\t\t\t\"severity\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t}\n\t],\n\ttracemetrics: [\n\t\t{\n\t\t\tdescription: \"request duration percentiles by route\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"p75(value,http.request.duration,distribution,millisecond)\",\n\t\t\t\t\t\"p95(value,http.request.duration,distribution,millisecond)\",\n\t\t\t\t\t\"count(value,http.request.duration,distribution,millisecond)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p95(value,http.request.duration,distribution,millisecond)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"throughput by endpoint from a counter metric\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\"transaction\", \"per_minute(value,http.server.request.count,counter,-)\"],\n\t\t\t\tsort: \"-per_minute(value,http.server.request.count,counter,-)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"latest samples for a specific metric\",\n\t\t\toutput: {\n\t\t\t\tquery: \"metric.name:http.request.duration AND metric.type:distribution\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"metric.name\",\n\t\t\t\t\t\"metric.type\",\n\t\t\t\t\t\"metric.unit\",\n\t\t\t\t\t\"value\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"largest payload size metrics\",\n\t\t\toutput: {\n\t\t\t\tquery: \"metric.name:payload.size\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"max(value,payload.size,gauge,byte)\",\n\t\t\t\t\t\"avg(value,payload.size,gauge,byte)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-max(value,payload.size,gauge,byte)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"metric value grouped by environment\",\n\t\t\toutput: {\n\t\t\t\tquery: \"metric.name:http.request.duration AND metric.type:distribution\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"environment\",\n\t\t\t\t\t\"avg(value,http.request.duration,distribution,millisecond)\",\n\t\t\t\t\t\"count(value,http.request.duration,distribution,millisecond)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-avg(value,http.request.duration,distribution,millisecond)\"\n\t\t\t}\n\t\t}\n\t],\n\tprofiles: [\n\t\t{\n\t\t\tdescription: \"latest profiles for a transaction\",\n\t\t\toutput: {\n\t\t\t\tquery: \"transaction:/api/users\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"profile.id\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"transaction.duration\",\n\t\t\t\t\t\"release\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"count profiles by release\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"release\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"last_seen()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"slowest profiled transactions\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"p95()\",\n\t\t\t\t\t\"count()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p95()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"continuous profiles for a profiler session\",\n\t\t\toutput: {\n\t\t\t\tquery: \"profiler.id:041bde57b9844e36b8b7e5734efae5f7\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"profiler.id\",\n\t\t\t\t\t\"thread.id\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"precise.start_ts\",\n\t\t\t\t\t\"precise.finish_ts\",\n\t\t\t\t\t\"release\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"profiles grouped by environment\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"environment\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"p95()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t}\n\t]\n};\nconst RECOMMENDED_FIELDS = {\n\terrors: {\n\t\tbasic: [\n\t\t\t\"issue\",\n\t\t\t\"title\",\n\t\t\t\"project\",\n\t\t\t\"timestamp\",\n\t\t\t\"level\",\n\t\t\t\"message\",\n\t\t\t\"error.type\",\n\t\t\t\"culprit\",\n\t\t\t\"user.email\",\n\t\t\t\"user.id\"\n\t\t],\n\t\tdescription: \"Basic error information including issue ID, title, timestamp, severity, and location\"\n\t},\n\tlogs: {\n\t\tbasic: [\n\t\t\t\"timestamp\",\n\t\t\t\"project\",\n\t\t\t\"message\",\n\t\t\t\"severity\",\n\t\t\t\"trace\"\n\t\t],\n\t\tdescription: \"Essential log entry information\"\n\t},\n\tspans: {\n\t\tbasic: [\n\t\t\t\"id\",\n\t\t\t\"span.op\",\n\t\t\t\"span.description\",\n\t\t\t\"span.duration\",\n\t\t\t\"transaction\",\n\t\t\t\"timestamp\",\n\t\t\t\"project\",\n\t\t\t\"trace\"\n\t\t],\n\t\tdescription: \"Core span/trace information including span ID, operation, duration, and trace context\"\n\t},\n\ttracemetrics: {\n\t\tbasic: [\n\t\t\t\"id\",\n\t\t\t\"timestamp\",\n\t\t\t\"project\",\n\t\t\t\"trace\",\n\t\t\t\"metric.name\",\n\t\t\t\"metric.type\",\n\t\t\t\"metric.unit\",\n\t\t\t\"value\"\n\t\t],\n\t\tdescription: \"Core trace metric sample information including metric identity, value, and trace context\"\n\t},\n\tprofiles: {\n\t\tbasic: [\n\t\t\t\"project\",\n\t\t\t\"profile.id\",\n\t\t\t\"profiler.id\",\n\t\t\t\"thread.id\",\n\t\t\t\"timestamp\",\n\t\t\t\"transaction\",\n\t\t\t\"transaction.duration\",\n\t\t\t\"release\",\n\t\t\t\"environment\",\n\t\t\t\"trace\",\n\t\t\t\"precise.start_ts\",\n\t\t\t\"precise.finish_ts\"\n\t\t],\n\t\tdescription: \"Core profiling information including profile identifiers, transaction context, timing, and trace linkage\"\n\t}\n};\nconst TRACE_METRICS_SAMPLE_IDENTITY_FIELDS = [\n\t\"metric.name\",\n\t\"metric.type\",\n\t\"metric.unit\"\n];\n\n//#endregion\nexport { BASE_COMMON_FIELDS, DATASET_EXAMPLES, DATASET_FIELDS, NUMERIC_FIELDS, RECOMMENDED_FIELDS, TRACE_METRICS_SAMPLE_IDENTITY_FIELDS, systemPrompt };\n//# sourceMappingURL=config-BqCCImAX.js.map"],"mappings":";AACA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AClB,gBAAgB;EAChB,kBAAkB;EAClB,WAAW;EACX,gBAAgB;EAChB,iBAAiB;EACjB,WAAW;EACX,uBAAuB;EACvB,gCAAgC;EAChC,eAAe;EACf,SAAS;EACT,SAAS;CACT;CACD,MAAM;EACL,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,kBAAkB;EAClB,mCAAmC;EACnC,OAAO;EACP,WAAW;EACX,uBAAuB;EACvB,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,eAAe;EACf,SAAS;CACT;CACD,cAAc;EACb,eAAe;EACf,eAAe;EACf,eAAe;EACf,OAAO;EACP,OAAO;EACP,SAAS;EACT,wBAAwB;EACxB,WAAW;EACX,mBAAmB;EACnB,oBAAoB;EACpB,kDAAkD;EAClD,kDAAkD;EAClD,kDAAkD;EAClD,kDAAkD;EAClD,oDAAoD;EACpD,kDAAkD;EAClD,kDAAkD;EAClD,kDAAkD;EAClD,kDAAkD;EAClD,kDAAkD;EAClD,yDAAyD;EACzD,yDAAyD;CACzD;CACD,UAAU;EACT,cAAc;EACd,eAAe;EACf,aAAa;EACb,WAAW;EACX,aAAa;EACb,OAAO;EACP,SAAS;EACT,aAAa;EACb,SAAS;EACT,gBAAgB;EAChB,iBAAiB;EACjB,gBAAgB;EAChB,yBAAyB;EACzB,eAAe;EACf,oBAAoB;EACpB,wBAAwB;EACxB,oBAAoB;EACpB,qBAAqB;EACrB,WAAW;EACX,eAAe;EACf,SAAS;EACT,SAAS;EACT,SAAS;EACT,SAAS;CACT;AACD;AACD,MAAM,mBAAmB;CACxB,OAAO;EACN;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,oBAAoB,SAAU;IACvC,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;CACD,QAAQ;EACP;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,SAAS,SAAU;IAC5B,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;CACD,MAAM;EACL;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,YAAY,SAAU;IAC/B,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,WAAW,SAAU;IAC9B,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;CACD,cAAc;EACb;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,eAAe,uDAAwD;IAChF,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;CACD,UAAU;EACT;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;AACD;AACD,MAAM,qBAAqB;CAC1B,QAAQ;EACP,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;CACD,MAAM;EACL,OAAO;GACN;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;CACD,OAAO;EACN,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;CACD,cAAc;EACb,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;CACD,UAAU;EACT,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;AACD;AACD,MAAM,uCAAuC;CAC5C;CACA;CACA;AACA"}
@@ -1,11 +1,12 @@
1
1
 
2
- //#region ../mcp-core/dist/config-CUeobZnr.js
2
+ //#region ../mcp-core/dist/config-BqCCImAX.js
3
3
  const systemPrompt = `You are a Sentry query translator. You need to:
4
4
  1. FIRST determine which dataset (spans, errors, logs, metrics, profiles, or replays) is most appropriate for the query
5
5
  2. Query the available attributes for that dataset using the datasetAttributes tool for spans/errors/logs/metrics/profiles, or the replayFields tool for replays
6
6
  3. Use the otelSemantics tool if you need OpenTelemetry semantic conventions
7
7
  4. Convert the natural language query to Sentry's search syntax (NOT SQL syntax)
8
8
  5. Decide which fields to return in the results
9
+ 6. For non-replay datasets, call validateSearch on the candidate request and fix failures before returning
9
10
 
10
11
  CRITICAL: Sentry does NOT use SQL syntax. Do NOT generate SQL-like queries.
11
12
 
@@ -41,6 +42,8 @@ TOOL USAGE GUIDELINES:
41
42
  5. IMPORTANT: For ambiguous terms like "user agents", "browser", "client" - use the appropriate field discovery tool instead of guessing field names
42
43
  6. When the user already supplied Sentry search syntax for spans/logs/metrics, call datasetAttributes with substringMatch or query filters from the request before dropping or renaming fields
43
44
  7. Use datasetAttributes substringMatch, query, and attributeTypes for targeted lookup when broad field discovery is truncated
45
+ 8. For non-replay datasets, call validateSearch after constructing the candidate request. If invalid, fix and validate again in this same pass
46
+ 9. NEVER replace a structured field:value filter with message/log.body/full-text matching. If an explicit field is unavailable on the dataset, keep it and let validation fail instead of inventing a weaker query
44
47
 
45
48
  CRITICAL - TOOL RESPONSE HANDLING:
46
49
  All tools return responses in this format: {error?: string, result?: data}
@@ -237,6 +240,7 @@ PROCESS:
237
240
  3. Use datasetAttributes or replayFields to discover available fields
238
241
  4. Use otelSemantics tool if needed for OpenTelemetry attributes
239
242
  5. Construct the final query with proper fields, sort parameters, and replay environment when needed
243
+ 6. For non-replay datasets, validateSearch the candidate and only return after it passes (or after you cannot fix it without weakening structured filters)
240
244
 
241
245
  COMMON ERRORS TO AVOID:
242
246
  - Using SQL syntax (IS NOT NULL, IS NULL, yesterday(), today(), etc.) - Use has: operator and timeRange instead
@@ -919,4 +923,4 @@ Object.defineProperty(exports, 'systemPrompt', {
919
923
  return systemPrompt;
920
924
  }
921
925
  });
922
- //# sourceMappingURL=config-CUeobZnr-C1uLYu0T.cjs.map
926
+ //# sourceMappingURL=config-BqCCImAX-CqsS5Qiu.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-BqCCImAX-CqsS5Qiu.cjs","names":[],"sources":["../../mcp-core/dist/config-BqCCImAX.js"],"sourcesContent":["//#region src/tools/support/search-events/config.ts\nconst systemPrompt = `You are a Sentry query translator. You need to:\n1. FIRST determine which dataset (spans, errors, logs, metrics, profiles, or replays) is most appropriate for the query\n2. Query the available attributes for that dataset using the datasetAttributes tool for spans/errors/logs/metrics/profiles, or the replayFields tool for replays\n3. Use the otelSemantics tool if you need OpenTelemetry semantic conventions\n4. Convert the natural language query to Sentry's search syntax (NOT SQL syntax)\n5. Decide which fields to return in the results\n6. For non-replay datasets, call validateSearch on the candidate request and fix failures before returning\n\nCRITICAL: Sentry does NOT use SQL syntax. Do NOT generate SQL-like queries.\n\nDATASET SELECTION GUIDELINES:\n- spans: Raw trace/span events for performance, AI/LLM calls, database queries, HTTP requests, token usage, costs, user agent data, \"XYZ calls\", ambiguous operations (richest attribute set)\n- errors: Exceptions, crashes, stack traces, unhandled errors, browser/client errors; these usually become Sentry issues\n- logs: Application log entries, log messages, severity levels, debugging information; error-severity logs are still logs\n- metrics: Metric rows and aggregates, especially named metrics, counters, gauges, distributions, metric values, and queries that explicitly mention metric names/types\n- profiles: Transaction and continuous profile results, profile IDs, profile durations, releases, platforms, and profile-related transactions\n- replays: Session replay results, clicked elements, rage/dead clicks, visited pages, replay users, browsers, and releases\n\nFor ambiguous queries like \"calls using XYZ\", prefer spans dataset first as it contains the most comprehensive telemetry data.\nFor queries that explicitly ask about a metric name, metric type, counter/gauge/distribution, or newer span metrics, prefer metrics.\nFor queries about captured profiles, profile IDs, flamegraphs, or profiled transactions, prefer profiles.\nFor queries about session replays, clicked UI elements, rage clicks, dead clicks, visited URLs/screens, or replay users/sessions, prefer replays.\nIf the user says logs, log messages, error logs, or warning logs, choose logs instead of errors.\n\nCRITICAL - FIELD VERIFICATION REQUIREMENT:\nBefore constructing ANY query, you MUST verify field availability:\n1. You CANNOT assume ANY field exists without checking - not even common ones\n2. This includes ALL fields: custom attributes, database fields, HTTP fields, AI fields, user fields, etc.\n3. Fields vary by project based on what data is being sent to Sentry\n4. Using an unverified field WILL cause your query to fail with \"field not found\" errors\n5. For spans, logs, and metrics, datasetAttributes can list likely fields using substringMatch/query/attributeTypes\n6. A broad datasetAttributes listing is a discovery preview and may be truncated; do not treat absence from the preview as proof that a user-supplied field is invalid\n7. Replay fields vary by project too, so use replayFields before constructing replay queries\n\nTOOL USAGE GUIDELINES:\n1. Use datasetAttributes tool to discover available fields for your chosen dataset\n2. Use replayFields tool to discover available replay fields and custom replay tags\n3. Use otelSemantics tool when you need specific OpenTelemetry semantic convention attributes\n4. Use whoami tool when queries contain \"me\" references for user.id or user.email fields\n5. IMPORTANT: For ambiguous terms like \"user agents\", \"browser\", \"client\" - use the appropriate field discovery tool instead of guessing field names\n6. When the user already supplied Sentry search syntax for spans/logs/metrics, call datasetAttributes with substringMatch or query filters from the request before dropping or renaming fields\n7. Use datasetAttributes substringMatch, query, and attributeTypes for targeted lookup when broad field discovery is truncated\n8. For non-replay datasets, call validateSearch after constructing the candidate request. If invalid, fix and validate again in this same pass\n9. NEVER replace a structured field:value filter with message/log.body/full-text matching. If an explicit field is unavailable on the dataset, keep it and let validation fail instead of inventing a weaker query\n\nCRITICAL - TOOL RESPONSE HANDLING:\nAll tools return responses in this format: {error?: string, result?: data}\n- If 'error' is present: The tool failed - analyze the error message and potentially retry with corrections\n- If 'result' is present: The tool succeeded - use the result data for your query construction\n- Always check for errors before using results\n\nCRITICAL - HANDLING \"DISTINCT\" OR \"UNIQUE VALUES\" QUERIES:\nWhen user asks for \"distinct\", \"unique\", \"all values of\", or \"what are the X\" queries:\n1. This ALWAYS requires an AGGREGATE query with count() function\n2. Pattern: fields=['field_name', 'count()'] to show distinct values with counts\n3. Sort by \"-count()\" to show most common values first\n4. Use datasetAttributes tool to verify the field exists before constructing query\n5. Examples:\n - \"distinct categories\" → fields=['category.name', 'count()'], sort='-count()'\n - \"unique types\" → fields=['item.type', 'count()'], sort='-count()'\n\nCRITICAL - TRAFFIC/VOLUME/COUNT QUERIES:\nWhen user asks about \"traffic\", \"volume\", \"how much\", \"how many\" (without specific metrics):\n1. This ALWAYS requires an AGGREGATE query with count() function\n2. For total counts: fields=['count()']\n3. For grouped counts: fields=['grouping_field', 'count()']\n4. Always include timeRange for period-specific queries\n5. Examples:\n - \"how much traffic in last 30 days\" → fields=['count()'], timeRange: {\"statsPeriod\": \"30d\"}\n - \"traffic on mcp-server\" → query: \"project:mcp-server\", fields=['count()']\n\nCRITICAL - HANDLING \"ME\" REFERENCES:\n- If the query contains \"me\", \"my\", \"myself\", or \"affecting me\" in the context of user.id or user.email fields, use the whoami tool to get the user's ID and email\n- For assignedTo fields, you can use \"me\" directly without translation (e.g., assignedTo:me works as-is)\n- After calling whoami, replace \"me\" references with the actual user.id or user.email values\n- If whoami fails, return an error explaining the issue\n\nQUERY MODES:\n1. INDIVIDUAL EVENTS (default): Returns raw event data\n - Used when fields contain no function() calls\n - Include recommended fields plus any user-requested fields\n\n2. AGGREGATE QUERIES: Grouping and aggregation (NOT SQL)\n - Activated when ANY field contains a function() call\n - Fields should ONLY include: aggregate functions + groupBy fields\n - Automatically groups by ALL non-function fields\n - For aggregate queries, ONLY include the aggregate functions and groupBy fields - do NOT include default fields like timestamp, id, etc.\n - You SHOULD sort aggregate results by \"-function_name()\" for descending order (highest values first)\n - For equations in aggregate queries: You SHOULD use \"-equation|...\" prefix unless user wants lowest values\n - When user asks \"how many total\", \"sum of\", or similar: They want the highest/total value, use descending sort\n\n3. REPLAY SEARCH RESULTS:\n - Replays return a LIST of replay sessions, not aggregations\n - For replays, set dataset to \"replays\"\n - For replays, return fields: []\n - For replays, use replay query syntax like count_errors:>0, url:*checkout*, click.textContent:\"Save\"\n - For replays, put environment in the separate \"environment\" field, NOT inside query\n - For replay environment filters, use a string for one environment or an array of strings for multiple environments\n - For replays, use sorts like -started_at, -count_errors, -count_rage_clicks, -count_dead_clicks, -duration\n - Replays do NOT support count()/avg()/sum() aggregations through this path\n\nCRITICAL LIMITATION - TIME SERIES NOT SUPPORTED:\n- Queries asking for data \"over time\", \"by hour\", \"by day\", \"time series\", or similar temporal groupings are NOT currently supported\n- If user asks for \"X over time\", return an error explaining: \"Time series aggregations are not currently supported.\"\n\nCRITICAL - DO NOT USE SQL SYNTAX:\n- NEVER use SQL functions like yesterday(), today(), now(), IS NOT NULL, IS NULL\n- NEVER use SQL date functions - use timeRange parameter instead\n- For \"yesterday\": Use timeRange: {\"statsPeriod\": \"24h\"}, NOT timestamp >= yesterday()\n- For field existence: Use has:field_name, NOT field_name IS NOT NULL\n- For field absence: Use !has:field_name, NOT field_name IS NULL\n\nREPLAY SEARCH RULES:\n- Use replayFields when dataset is replays\n- For replay environment filtering, set the separate \"environment\" field to a string or array of strings\n- Replay time filtering must use \"timeRange\", not query fields\n- Replay queries should not include event-search-only syntax like has:field_name\n- Replay sort must still go in the separate \"sort\" field\n- If the user asks about replays they have viewed, prefer viewed_by_me:true\n- If the user asks about replay users and says \"me\", use whoami and translate to user.email:<actual email>\n\nMATHEMATICAL QUERY PATTERNS:\nWhen user asks mathematical questions like \"how many X\", \"total Y used\", \"sum of Z\":\n- Identify the appropriate dataset based on context\n- Use datasetAttributes tool to find available numeric fields\n- Use sum() function for totals, avg() for averages, count() for counts\n- For time-based queries (\"today\", \"yesterday\", \"this week\"), use timeRange parameter\n- For \"total\" or \"how many\" questions: Users typically want highest values first (descending sort)\n\nDERIVED METRICS AND CALCULATIONS (SPANS ONLY):\nWhen user asks for calculated metrics, ratios, or conversions:\n- Use equation fields with \"equation|\" prefix\n- Examples:\n - \"duration in milliseconds\" → fields: [\"equation|avg(span.duration) * 1000\"], sort: \"-equation|avg(span.duration) * 1000\"\n - \"combined metric total\" → fields: [\"equation|sum(metric.a) + sum(metric.b)\"], sort: \"-equation|sum(metric.a) + sum(metric.b)\"\n - \"error rate percentage\" → fields: [\"equation|failure_rate() * 100\"], sort: \"-equation|failure_rate() * 100\"\n - \"events per second\" → fields: [\"equation|count() / 3600\"], sort: \"-equation|count() / 3600\"\n- IMPORTANT: Equations are ONLY supported in the spans dataset, NOT in errors, logs, or metrics\n- IMPORTANT: When sorting by equations, use \"-equation|...\" for descending order (highest values first)\n\nTRACE METRICS AGGREGATES (TRACEMETRICS DATASET):\nWhen querying metrics aggregates, prefer aggregate functions that fully encode the target metric:\n- Format: fn(value,metric.name,metric.type,metric.unit)\n- Counter examples: \"sum(value,my.counter,counter,-)\", \"per_second(value,my.counter,counter,-)\"\n- Gauge examples: \"avg(value,cpu.usage,gauge,percent)\", \"max(value,cpu.usage,gauge,percent)\"\n- Distribution examples: \"p95(value,http.request.duration,distribution,millisecond)\", \"avg(value,http.request.duration,distribution,millisecond)\"\n- IMPORTANT: Use the exact metric.name, metric.type, and metric.unit values when they are available\n- IMPORTANT: Tracemetrics do NOT support equation| fields\n\nPERFORMANCE INVESTIGATION STRATEGY:\nWhen users ask about \"performance problems\", \"slow pages\", \"slow endpoints\", \"latency issues\",\n\"web vitals\", \"LCP\", \"CLS\", \"INP\", \"page speed\", \"load time\", \"response time\", or similar:\n\n1. ALWAYS use AGGREGATE queries first - individual samples are misleading for performance analysis\n2. Use p75() as the primary percentile for consistent performance measurement\n3. Group by transaction to identify which pages/endpoints have problems\n4. Include count() to understand sample size (low count = unreliable data)\n5. Sort by the worst-performing metric (descending with \"-\" prefix)\n\nCRITICAL: For performance investigations, return AGGREGATES grouped by the span's transaction attribute, NOT individual events.\n\nSPAN QUERY PHILOSOPHY - DUCK TYPING:\nUse \"has:attribute\" to find spans by their characteristics, NOT \"is_transaction:true\".\nThe is_transaction:true filter ONLY returns transaction boundaries (request entry/exit points).\nMost performance queries want specific span types, not just boundaries.\n\nPerformance Query Patterns (use duck typing):\n- Web Vitals: has:measurements.lcp, has:measurements.cls, has:measurements.inp\n- Database: has:db.statement or has:db.system\n- HTTP/API calls: has:http.method or has:http.url\n- External Services: has:http.url (for outbound calls)\n- AI/LLM: has:gen_ai.provider.name or has:gen_ai.request.model\n- MCP Tools: has:gen_ai.tool.name\n\nWHEN TO USE is_transaction:true (rare):\n- ONLY when you specifically need transaction boundaries (full request/response cycle)\n- Example: \"total request duration by endpoint\" - you want the outermost span\n- For most queries about \"slow X\" or \"X performance\", use duck typing instead\n\nWeb Vitals Thresholds (for context when reporting):\n- LCP: Good < 2500ms, Needs Improvement 2500-4000ms, Poor >= 4000ms\n- CLS: Good < 0.1, Needs Improvement 0.1-0.25, Poor >= 0.25\n- INP: Good < 200ms, Needs Improvement 200-500ms, Poor >= 500ms\n- FCP: Good < 1800ms, Needs Improvement 1800-3000ms, Poor >= 3000ms\n- TTFB: Good < 800ms, Needs Improvement 800-1800ms, Poor >= 1800ms\n\nSORTING RULES (CRITICAL - YOU MUST ALWAYS SPECIFY A SORT):\n1. CRITICAL: Sort MUST go in the separate \"sort\" field, NEVER in the \"query\" field\n - WRONG: query: \"level:error sort:-timestamp\" ← Sort syntax in query field is FORBIDDEN\n - CORRECT: query: \"level:error\", sort: \"-timestamp\" ← Sort in separate field\n\n2. DEFAULT SORTING:\n - errors dataset: Use \"-timestamp\" (newest first)\n - spans dataset: Use \"-span.duration\" (slowest first) \n - logs dataset: Use \"-timestamp\" (newest first)\n - metrics dataset: Use \"-timestamp\" for samples, or sort by the selected aggregate for grouped metric results\n - profiles dataset: Use \"-timestamp\" for samples, or sort by the selected aggregate for grouped profile results\n - replays dataset: Use \"-started_at\" (most recent replay first)\n\n3. SORTING SYNTAX:\n - Use \"-\" prefix for descending order (e.g., \"-timestamp\" for newest first)\n - Use field name without prefix for ascending order\n - For aggregate queries: sort by aggregate function results (e.g., \"-count()\" for highest count first)\n - For equation fields: You SHOULD use \"-equation|...\" for descending order (e.g., \"-equation|sum(field1) + sum(field2)\")\n - Only omit the \"-\" prefix if the user clearly wants lowest values first (rare)\n\n4. IMPORTANT SORTING REQUIREMENTS:\n - YOU MUST ALWAYS INCLUDE A SORT PARAMETER\n - CRITICAL: The field you sort by MUST be included in your fields array\n - If sorting by \"-timestamp\", include \"timestamp\" in fields\n - If sorting by \"-count()\", include \"count()\" in fields\n - This is MANDATORY - Sentry will reject queries where sort field is not in the selected fields\n\nYOUR RESPONSE FORMAT:\nReturn a JSON object with these fields:\n- \"dataset\": Which dataset you determined to use (\"spans\", \"errors\", \"logs\", \"metrics\", \"profiles\", or \"replays\")\n- \"query\": The Sentry query string for filtering results (use empty string \"\" for no filters)\n- \"fields\": Array of field names to return in results\n - For individual event queries: OPTIONAL (will use recommended fields if not provided)\n - For aggregate queries: REQUIRED (must include aggregate functions AND any groupBy fields)\n - For replay queries: return []\n- \"sort\": Sort parameter for results (REQUIRED - YOU MUST ALWAYS SPECIFY THIS)\n- \"environment\": Separate environment filter for replays, as a string or array of strings, or null when not needed\n- \"timeRange\": Time range parameters (optional)\n - Relative: {\"statsPeriod\": \"24h\"} for last 24 hours, \"7d\" for last 7 days, etc.\n - Absolute: {\"start\": \"2025-06-19T07:00:00\", \"end\": \"2025-06-20T06:59:59\"} for specific date ranges\n- \"explanation\": Brief explanation of how you translated this query\n\nCORRECT QUERY PATTERNS (FOLLOW THESE):\n- For field existence: Use has:field_name (NOT field_name IS NOT NULL)\n- For field absence: Use !has:field_name (NOT field_name IS NULL)\n- For time periods: Use timeRange parameter (NOT SQL date functions)\n- Example: \"items processed yesterday\" → query: \"has:item.processed\", timeRange: {\"statsPeriod\": \"24h\"}\n\nPROCESS:\n1. Analyze the user's query\n2. Determine appropriate dataset\n3. Use datasetAttributes or replayFields to discover available fields\n4. Use otelSemantics tool if needed for OpenTelemetry attributes\n5. Construct the final query with proper fields, sort parameters, and replay environment when needed\n6. For non-replay datasets, validateSearch the candidate and only return after it passes (or after you cannot fix it without weakening structured filters)\n\nCOMMON ERRORS TO AVOID:\n- Using SQL syntax (IS NOT NULL, IS NULL, yesterday(), today(), etc.) - Use has: operator and timeRange instead\n- Using numeric functions (sum, avg, min, max, percentiles) on non-numeric fields\n- Using incorrect field names (use the otelSemantics tool to look up correct names)\n- Missing required fields in the fields array for aggregate queries\n- Invalid sort parameter not included in fields array\n- Putting replay environment filters inside the replay query instead of the separate environment field\n- For field existence: Use has:field_name (NOT field_name IS NOT NULL)\n- For field absence: Use !has:field_name (NOT field_name IS NULL)\n- For time periods: Use timeRange parameter (NOT SQL date functions like yesterday())`;\nconst BASE_COMMON_FIELDS = {\n\tproject: \"Project slug\",\n\ttimestamp: \"When the event occurred\",\n\tenvironment: \"Environment (production, staging, development)\",\n\trelease: \"Release version\",\n\tplatform: \"Platform (javascript, python, etc.)\",\n\t\"user.id\": \"User ID\",\n\t\"user.email\": \"User email\",\n\t\"sdk.name\": \"SDK name\",\n\t\"sdk.version\": \"SDK version\"\n};\nconst NUMERIC_FIELDS = {\n\tspans: new Set([\n\t\t\"span.duration\",\n\t\t\"span.self_time\",\n\t\t\"transaction.duration\",\n\t\t\"http.status_code\",\n\t\t\"gen_ai.usage.input_tokens\",\n\t\t\"gen_ai.usage.output_tokens\",\n\t\t\"gen_ai.request.max_tokens\",\n\t\t\"measurements.lcp\",\n\t\t\"measurements.cls\",\n\t\t\"measurements.inp\",\n\t\t\"measurements.fcp\",\n\t\t\"measurements.ttfb\"\n\t]),\n\terrors: new Set([\"stack.lineno\"]),\n\tlogs: new Set([\"severity_number\", \"sentry.observed_timestamp_nanos\"]),\n\ttracemetrics: new Set([\n\t\t\"value\",\n\t\t\"timestamp_precise\",\n\t\t\"observed_timestamp\",\n\t\t\"payload_size\"\n\t]),\n\tprofiles: new Set([\"profile.duration\", \"transaction.duration\"])\n};\nconst DATASET_FIELDS = {\n\tspans: {\n\t\t\"span.op\": \"Span operation type (e.g., http.client, db.query, cache.get)\",\n\t\t\"span.description\": \"Detailed description of the span operation\",\n\t\t\"span.duration\": \"Duration of the span in milliseconds\",\n\t\t\"span.status\": \"Span status (ok, cancelled, unknown, etc.)\",\n\t\t\"span.self_time\": \"Time spent in this span excluding child spans\",\n\t\ttransaction: \"Transaction name/route\",\n\t\t\"transaction.duration\": \"Total transaction duration in milliseconds\",\n\t\t\"transaction.op\": \"Transaction operation type\",\n\t\t\"transaction.status\": \"Transaction status\",\n\t\tis_transaction: \"Whether this span is a transaction (true/false)\",\n\t\ttrace: \"Trace ID\",\n\t\t\"trace.span_id\": \"Span ID within the trace\",\n\t\t\"trace.parent_span_id\": \"Parent span ID\",\n\t\t\"http.method\": \"HTTP method (GET, POST, etc.)\",\n\t\t\"http.status_code\": \"HTTP response status code\",\n\t\t\"http.url\": \"Full HTTP URL\",\n\t\t\"db.system\": \"Database system (postgresql, mysql, etc.)\",\n\t\t\"db.operation\": \"Database operation (SELECT, INSERT, etc.)\",\n\t\t\"gen_ai.provider.name\": \"AI provider name (e.g., anthropic, openai)\",\n\t\t\"gen_ai.request.model\": \"Model name (e.g., claude-3-5-sonnet-20241022)\",\n\t\t\"gen_ai.operation.name\": \"Operation type (e.g., chat, completion)\",\n\t\t\"gen_ai.usage.input_tokens\": \"Number of input tokens (numeric)\",\n\t\t\"gen_ai.usage.output_tokens\": \"Number of output tokens (numeric)\",\n\t\t\"gen_ai.tool.name\": \"Tool name (e.g., search_issues, search_events)\",\n\t\t\"mcp.method.name\": \"MCP request or notification method\",\n\t\t\"mcp.protocol.version\": \"MCP protocol version\",\n\t\t\"mcp.resource.uri\": \"MCP resource URI\",\n\t\t\"mcp.session.id\": \"MCP session identifier\",\n\t\t\"measurements.lcp\": \"Largest Contentful Paint - time until largest content element is visible (ms). Good < 2500ms\",\n\t\t\"measurements.cls\": \"Cumulative Layout Shift - visual stability score (unitless). Good < 0.1\",\n\t\t\"measurements.inp\": \"Interaction to Next Paint - responsiveness to user input (ms). Good < 200ms\",\n\t\t\"measurements.fcp\": \"First Contentful Paint - time until first content is visible (ms). Good < 1800ms\",\n\t\t\"measurements.ttfb\": \"Time to First Byte - server response time (ms). Good < 800ms\",\n\t\t\"count()\": \"Count of spans\",\n\t\t\"count_unique(field)\": \"Count of unique values, e.g. count_unique(user.id)\",\n\t\t\"avg(field)\": \"Average of numeric field, e.g. avg(span.duration)\",\n\t\t\"sum(field)\": \"Sum of numeric field, e.g. sum(span.self_time)\",\n\t\t\"min(field)\": \"Minimum of numeric field, e.g. min(span.duration)\",\n\t\t\"max(field)\": \"Maximum of numeric field, e.g. max(span.duration)\",\n\t\t\"p50(field)\": \"50th percentile (median), e.g. p50(span.duration)\",\n\t\t\"p75(field)\": \"75th percentile - standard for performance analysis, e.g. p75(span.duration)\",\n\t\t\"p90(field)\": \"90th percentile, e.g. p90(span.duration)\",\n\t\t\"p95(field)\": \"95th percentile, e.g. p95(span.duration)\",\n\t\t\"p99(field)\": \"99th percentile, e.g. p99(span.duration)\",\n\t\t\"p100(field)\": \"100th percentile (max), e.g. p100(span.duration)\",\n\t\t\"epm()\": \"Events per minute rate\",\n\t\t\"failure_rate()\": \"Percentage of failed spans\"\n\t},\n\terrors: {\n\t\tmessage: \"Error message\",\n\t\tlevel: \"Error level (error, warning, info, debug)\",\n\t\t\"error.type\": \"Error type/exception class\",\n\t\t\"error.value\": \"Error value/description\",\n\t\t\"error.handled\": \"Whether the error was handled (true/false)\",\n\t\tculprit: \"Code location that caused the error\",\n\t\ttitle: \"Error title/grouping\",\n\t\t\"stack.filename\": \"File where error occurred\",\n\t\t\"stack.function\": \"Function where error occurred\",\n\t\t\"stack.module\": \"Module where error occurred\",\n\t\t\"stack.abs_path\": \"Absolute path to file\",\n\t\t\"os.name\": \"Operating system name\",\n\t\t\"browser.name\": \"Browser name\",\n\t\t\"device.family\": \"Device family\",\n\t\t\"count()\": \"Count of error events\",\n\t\t\"count_unique(field)\": \"Count of unique values, e.g. count_unique(user.id)\",\n\t\t\"count_if(field,equals,value)\": \"Conditional count, e.g. count_if(error.handled,equals,false)\",\n\t\t\"last_seen()\": \"Most recent timestamp of the group\",\n\t\t\"eps()\": \"Events per second rate\",\n\t\t\"epm()\": \"Events per minute rate\"\n\t},\n\tlogs: {\n\t\tmessage: \"Log message\",\n\t\tseverity: \"Log severity level (trace, debug, info, warn, error, fatal)\",\n\t\tseverity_number: \"Numeric severity level\",\n\t\t\"sentry.item_id\": \"Sentry item ID\",\n\t\t\"sentry.observed_timestamp_nanos\": \"Observed timestamp in nanoseconds\",\n\t\ttrace: \"Trace ID\",\n\t\t\"count()\": \"Count of log entries\",\n\t\t\"count_unique(field)\": \"Count of unique values, e.g. count_unique(user.id)\",\n\t\t\"avg(field)\": \"Average of numeric field, e.g. avg(severity_number)\",\n\t\t\"sum(field)\": \"Sum of numeric field\",\n\t\t\"min(field)\": \"Minimum of numeric field\",\n\t\t\"max(field)\": \"Maximum of numeric field\",\n\t\t\"p50(field)\": \"50th percentile (median)\",\n\t\t\"p75(field)\": \"75th percentile\",\n\t\t\"p90(field)\": \"90th percentile\",\n\t\t\"p95(field)\": \"95th percentile\",\n\t\t\"p99(field)\": \"99th percentile\",\n\t\t\"p100(field)\": \"100th percentile (max)\",\n\t\t\"epm()\": \"Events per minute rate\"\n\t},\n\ttracemetrics: {\n\t\t\"metric.name\": \"Metric name for the newer span metrics dataset\",\n\t\t\"metric.type\": \"Metric type (counter, gauge, distribution)\",\n\t\t\"metric.unit\": \"Metric unit if present (for example millisecond, byte, percent)\",\n\t\tvalue: \"Raw metric value (numeric)\",\n\t\ttrace: \"Trace ID\",\n\t\tspan_id: \"Span ID that emitted the metric\",\n\t\t\"trace.parent_span_id\": \"Parent span ID\",\n\t\ttimestamp: \"When the metric sample occurred\",\n\t\ttimestamp_precise: \"High precision timestamp (numeric)\",\n\t\tobserved_timestamp: \"Observed timestamp (numeric)\",\n\t\t\"sum(value,metric.name,metric.type,metric.unit)\": \"Sum a specific metric, e.g. sum(value,request_count,counter,-)\",\n\t\t\"avg(value,metric.name,metric.type,metric.unit)\": \"Average a specific metric, e.g. avg(value,http.request.duration,distribution,millisecond)\",\n\t\t\"min(value,metric.name,metric.type,metric.unit)\": \"Minimum metric value for a specific metric\",\n\t\t\"max(value,metric.name,metric.type,metric.unit)\": \"Maximum metric value for a specific metric\",\n\t\t\"count(value,metric.name,metric.type,metric.unit)\": \"Count samples for a specific metric\",\n\t\t\"p50(value,metric.name,metric.type,metric.unit)\": \"Median for a distribution metric\",\n\t\t\"p75(value,metric.name,metric.type,metric.unit)\": \"75th percentile for a distribution metric\",\n\t\t\"p90(value,metric.name,metric.type,metric.unit)\": \"90th percentile for a distribution metric\",\n\t\t\"p95(value,metric.name,metric.type,metric.unit)\": \"95th percentile for a distribution metric\",\n\t\t\"p99(value,metric.name,metric.type,metric.unit)\": \"99th percentile for a distribution metric\",\n\t\t\"per_second(value,metric.name,metric.type,metric.unit)\": \"Per-second rate for a metric, typically counters\",\n\t\t\"per_minute(value,metric.name,metric.type,metric.unit)\": \"Per-minute rate for a metric, typically counters\"\n\t},\n\tprofiles: {\n\t\t\"profile.id\": \"Transaction profile ID for a specific captured profile\",\n\t\t\"profiler.id\": \"Continuous profiler session ID for chunk-based profile captures\",\n\t\t\"thread.id\": \"Thread ID associated with a continuous profile result when available\",\n\t\ttimestamp: \"When the profile was captured\",\n\t\ttransaction: \"Transaction name associated with the profile when available\",\n\t\ttrace: \"Trace ID linked to the profiled transaction\",\n\t\trelease: \"Release version associated with the profile\",\n\t\tenvironment: \"Environment for the profile\",\n\t\tproject: \"Project slug\",\n\t\t\"project.name\": \"Project name\",\n\t\t\"platform.name\": \"Runtime or SDK platform name\",\n\t\t\"device.model\": \"Device model for mobile or device-bound profiles\",\n\t\t\"device.classification\": \"Device performance classification\",\n\t\t\"device.arch\": \"Device architecture\",\n\t\t\"profile.duration\": \"Total profile duration in nanoseconds for a captured profile\",\n\t\t\"transaction.duration\": \"Transaction duration represented by the profile in nanoseconds\",\n\t\t\"precise.start_ts\": \"Continuous profile precise start timestamp when available\",\n\t\t\"precise.finish_ts\": \"Continuous profile precise finish timestamp when available\",\n\t\t\"count()\": \"Count of matching profiles\",\n\t\t\"last_seen()\": \"Most recent timestamp of the matching profile group\",\n\t\t\"p50()\": \"Median profile duration for the selected grouping\",\n\t\t\"p75()\": \"75th percentile profile duration\",\n\t\t\"p95()\": \"95th percentile profile duration\",\n\t\t\"p99()\": \"99th percentile profile duration\"\n\t}\n};\nconst DATASET_EXAMPLES = {\n\tspans: [\n\t\t{\n\t\t\tdescription: \"web vitals performance problems\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:measurements.lcp\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"p75(measurements.lcp)\",\n\t\t\t\t\t\"p75(measurements.cls)\",\n\t\t\t\t\t\"p75(measurements.inp)\",\n\t\t\t\t\t\"count()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p75(measurements.lcp)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"slowest database queries\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:db.statement\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"db.system\",\n\t\t\t\t\t\"db.statement\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"p75(span.duration)\",\n\t\t\t\t\t\"p95(span.duration)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p75(span.duration)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"total request duration by endpoint (transaction boundaries)\",\n\t\t\toutput: {\n\t\t\t\tquery: \"is_transaction:true\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"avg(span.duration)\",\n\t\t\t\t\t\"p95(span.duration)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-avg(span.duration)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"slow API calls over 5 seconds\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:request.url AND span.duration:>5000\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"span.op\",\n\t\t\t\t\t\"span.description\",\n\t\t\t\t\t\"span.duration\",\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-span.duration\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"token usage by AI model\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:gen_ai.usage.input_tokens\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"gen_ai.request.model\",\n\t\t\t\t\t\"sum(gen_ai.usage.input_tokens)\",\n\t\t\t\t\t\"sum(gen_ai.usage.output_tokens)\",\n\t\t\t\t\t\"count()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-sum(gen_ai.usage.input_tokens)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"top MCP tool calls by usage\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:gen_ai.tool.name\",\n\t\t\t\tfields: [\"gen_ai.tool.name\", \"count()\"],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"HTTP requests by user agent\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:http.method AND has:user_agent.original\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"user_agent.original\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"avg(span.duration)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"frontend performance overview\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:measurements.lcp\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"p75(span.duration)\",\n\t\t\t\t\t\"p75(measurements.lcp)\",\n\t\t\t\t\t\"p75(measurements.fcp)\",\n\t\t\t\t\t\"p75(measurements.ttfb)\",\n\t\t\t\t\t\"count()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p75(span.duration)\"\n\t\t\t}\n\t\t}\n\t],\n\terrors: [\n\t\t{\n\t\t\tdescription: \"unhandled errors in production\",\n\t\t\toutput: {\n\t\t\t\tquery: \"error.handled:false AND environment:production\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"issue\",\n\t\t\t\t\t\"title\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"message\",\n\t\t\t\t\t\"error.type\",\n\t\t\t\t\t\"culprit\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"count errors by type\",\n\t\t\toutput: {\n\t\t\t\tquery: \"level:error\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"error.type\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"last_seen()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"errors in specific file\",\n\t\t\toutput: {\n\t\t\t\tquery: \"stack.filename:\\\"**/Button.tsx\\\"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"issue\",\n\t\t\t\t\t\"title\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"message\",\n\t\t\t\t\t\"stack.filename\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"most common errors\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\"title\", \"count()\"],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"unique users affected by errors\",\n\t\t\toutput: {\n\t\t\t\tquery: \"level:error\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"error.type\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"count_unique(user.id)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count_unique(user.id)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"errors by browser/user agent\",\n\t\t\toutput: {\n\t\t\t\tquery: \"level:error AND has:user_agent.original\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"user_agent.original\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"count_unique(user.id)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t}\n\t],\n\tlogs: [\n\t\t{\n\t\t\tdescription: \"error logs about database\",\n\t\t\toutput: {\n\t\t\t\tquery: \"severity:error AND message:\\\"*database*\\\"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"message\",\n\t\t\t\t\t\"severity\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"count logs by severity\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\"severity\", \"count()\"],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"most common log messages\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\"message\", \"count()\"],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"log volume by project\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"epm()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"warning logs about memory\",\n\t\t\toutput: {\n\t\t\t\tquery: \"severity:warn AND message:\\\"*memory*\\\"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"message\",\n\t\t\t\t\t\"severity\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t}\n\t],\n\ttracemetrics: [\n\t\t{\n\t\t\tdescription: \"request duration percentiles by route\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"p75(value,http.request.duration,distribution,millisecond)\",\n\t\t\t\t\t\"p95(value,http.request.duration,distribution,millisecond)\",\n\t\t\t\t\t\"count(value,http.request.duration,distribution,millisecond)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p95(value,http.request.duration,distribution,millisecond)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"throughput by endpoint from a counter metric\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\"transaction\", \"per_minute(value,http.server.request.count,counter,-)\"],\n\t\t\t\tsort: \"-per_minute(value,http.server.request.count,counter,-)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"latest samples for a specific metric\",\n\t\t\toutput: {\n\t\t\t\tquery: \"metric.name:http.request.duration AND metric.type:distribution\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"metric.name\",\n\t\t\t\t\t\"metric.type\",\n\t\t\t\t\t\"metric.unit\",\n\t\t\t\t\t\"value\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"largest payload size metrics\",\n\t\t\toutput: {\n\t\t\t\tquery: \"metric.name:payload.size\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"max(value,payload.size,gauge,byte)\",\n\t\t\t\t\t\"avg(value,payload.size,gauge,byte)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-max(value,payload.size,gauge,byte)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"metric value grouped by environment\",\n\t\t\toutput: {\n\t\t\t\tquery: \"metric.name:http.request.duration AND metric.type:distribution\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"environment\",\n\t\t\t\t\t\"avg(value,http.request.duration,distribution,millisecond)\",\n\t\t\t\t\t\"count(value,http.request.duration,distribution,millisecond)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-avg(value,http.request.duration,distribution,millisecond)\"\n\t\t\t}\n\t\t}\n\t],\n\tprofiles: [\n\t\t{\n\t\t\tdescription: \"latest profiles for a transaction\",\n\t\t\toutput: {\n\t\t\t\tquery: \"transaction:/api/users\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"profile.id\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"transaction.duration\",\n\t\t\t\t\t\"release\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"count profiles by release\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"release\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"last_seen()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"slowest profiled transactions\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"p95()\",\n\t\t\t\t\t\"count()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p95()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"continuous profiles for a profiler session\",\n\t\t\toutput: {\n\t\t\t\tquery: \"profiler.id:041bde57b9844e36b8b7e5734efae5f7\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"profiler.id\",\n\t\t\t\t\t\"thread.id\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"precise.start_ts\",\n\t\t\t\t\t\"precise.finish_ts\",\n\t\t\t\t\t\"release\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"profiles grouped by environment\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"environment\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"p95()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t}\n\t]\n};\nconst RECOMMENDED_FIELDS = {\n\terrors: {\n\t\tbasic: [\n\t\t\t\"issue\",\n\t\t\t\"title\",\n\t\t\t\"project\",\n\t\t\t\"timestamp\",\n\t\t\t\"level\",\n\t\t\t\"message\",\n\t\t\t\"error.type\",\n\t\t\t\"culprit\",\n\t\t\t\"user.email\",\n\t\t\t\"user.id\"\n\t\t],\n\t\tdescription: \"Basic error information including issue ID, title, timestamp, severity, and location\"\n\t},\n\tlogs: {\n\t\tbasic: [\n\t\t\t\"timestamp\",\n\t\t\t\"project\",\n\t\t\t\"message\",\n\t\t\t\"severity\",\n\t\t\t\"trace\"\n\t\t],\n\t\tdescription: \"Essential log entry information\"\n\t},\n\tspans: {\n\t\tbasic: [\n\t\t\t\"id\",\n\t\t\t\"span.op\",\n\t\t\t\"span.description\",\n\t\t\t\"span.duration\",\n\t\t\t\"transaction\",\n\t\t\t\"timestamp\",\n\t\t\t\"project\",\n\t\t\t\"trace\"\n\t\t],\n\t\tdescription: \"Core span/trace information including span ID, operation, duration, and trace context\"\n\t},\n\ttracemetrics: {\n\t\tbasic: [\n\t\t\t\"id\",\n\t\t\t\"timestamp\",\n\t\t\t\"project\",\n\t\t\t\"trace\",\n\t\t\t\"metric.name\",\n\t\t\t\"metric.type\",\n\t\t\t\"metric.unit\",\n\t\t\t\"value\"\n\t\t],\n\t\tdescription: \"Core trace metric sample information including metric identity, value, and trace context\"\n\t},\n\tprofiles: {\n\t\tbasic: [\n\t\t\t\"project\",\n\t\t\t\"profile.id\",\n\t\t\t\"profiler.id\",\n\t\t\t\"thread.id\",\n\t\t\t\"timestamp\",\n\t\t\t\"transaction\",\n\t\t\t\"transaction.duration\",\n\t\t\t\"release\",\n\t\t\t\"environment\",\n\t\t\t\"trace\",\n\t\t\t\"precise.start_ts\",\n\t\t\t\"precise.finish_ts\"\n\t\t],\n\t\tdescription: \"Core profiling information including profile identifiers, transaction context, timing, and trace linkage\"\n\t}\n};\nconst TRACE_METRICS_SAMPLE_IDENTITY_FIELDS = [\n\t\"metric.name\",\n\t\"metric.type\",\n\t\"metric.unit\"\n];\n\n//#endregion\nexport { BASE_COMMON_FIELDS, DATASET_EXAMPLES, DATASET_FIELDS, NUMERIC_FIELDS, RECOMMENDED_FIELDS, T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ACf,oBAAoB;EACpB,wBAAwB;EACxB,oBAAoB;EACpB,qBAAqB;EACrB,WAAW;EACX,eAAe;EACf,SAAS;EACT,SAAS;EACT,SAAS;EACT,SAAS;CACT;AACD;AACD,MAAM,mBAAmB;CACxB,OAAO;EACN;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,oBAAoB,SAAU;IACvC,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;CACD,QAAQ;EACP;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,SAAS,SAAU;IAC5B,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;CACD,MAAM;EACL;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,YAAY,SAAU;IAC/B,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,WAAW,SAAU;IAC9B,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;CACD,cAAc;EACb;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,eAAe,uDAAwD;IAChF,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;CACD,UAAU;EACT;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;AACD;AACD,MAAM,qBAAqB;CAC1B,QAAQ;EACP,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;CACD,MAAM;EACL,OAAO;GACN;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;CACD,OAAO;EACN,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;CACD,cAAc;EACb,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;CACD,UAAU;EACT,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;AACD;AACD,MAAM,uCAAuC;CAC5C;CACA;CACA;AACA"}
@@ -0,0 +1,7 @@
1
+ const require_config_BqCCImAX = require('./config-BqCCImAX-CqsS5Qiu.cjs');
2
+
3
+ exports.BASE_COMMON_FIELDS = require_config_BqCCImAX.BASE_COMMON_FIELDS;
4
+ exports.DATASET_EXAMPLES = require_config_BqCCImAX.DATASET_EXAMPLES;
5
+ exports.DATASET_FIELDS = require_config_BqCCImAX.DATASET_FIELDS;
6
+ exports.NUMERIC_FIELDS = require_config_BqCCImAX.NUMERIC_FIELDS;
7
+ exports.RECOMMENDED_FIELDS = require_config_BqCCImAX.RECOMMENDED_FIELDS;
@@ -1,5 +1,5 @@
1
1
 
2
- //#region ../mcp-core/dist/events-datasets-DTs4kChz.js
2
+ //#region ../mcp-core/dist/events-datasets-Cu37u43g.js
3
3
  const PUBLIC_EVENTS_DATASETS = [
4
4
  "spans",
5
5
  "errors",
@@ -25,7 +25,7 @@ function normalizeEventsDataset(dataset) {
25
25
  }
26
26
 
27
27
  //#endregion
28
- //#region ../mcp-core/dist/url-utils-t-bdCfoW.js
28
+ //#region ../mcp-core/dist/url-utils-CYEhmNHi.js
29
29
  /**
30
30
  * Determines if a Sentry instance is SaaS or self-hosted based on the host.
31
31
  * @param host The Sentry host (e.g., "sentry.io" or "sentry.company.com")
@@ -218,6 +218,16 @@ function getMonitorUrl(host, organizationSlug, monitorSlug, protocol = "https",
218
218
  * @param releaseVersion Release version identifier
219
219
  * @returns The complete release URL
220
220
  */
221
+ /**
222
+ * Generates a Sentry uptime monitor URL.
223
+ *
224
+ * Uses the monitors UI path (`/monitors/{id}/`), which is the current home for
225
+ * uptime detectors in Sentry.
226
+ */
227
+ function getUptimeMonitorUrl(host, organizationSlug, uptimeMonitorId, protocol = "https") {
228
+ const encodedId = encodeURIComponent(String(uptimeMonitorId));
229
+ return getSentryWebBaseUrl(host, organizationSlug, `/monitors/${encodedId}/`, protocol);
230
+ }
221
231
  function getReleaseUrl(host, organizationSlug, releaseVersion, protocol = "https") {
222
232
  const encodedReleaseVersion = encodeURIComponent(releaseVersion);
223
233
  return getSentryWebBaseUrl(host, organizationSlug, `/releases/${encodedReleaseVersion}/`, protocol);
@@ -574,6 +584,12 @@ Object.defineProperty(exports, 'getTraceUrl', {
574
584
  return getTraceUrl;
575
585
  }
576
586
  });
587
+ Object.defineProperty(exports, 'getUptimeMonitorUrl', {
588
+ enumerable: true,
589
+ get: function () {
590
+ return getUptimeMonitorUrl;
591
+ }
592
+ });
577
593
  Object.defineProperty(exports, 'isMetricsDataset', {
578
594
  enumerable: true,
579
595
  get: function () {
@@ -616,4 +632,4 @@ Object.defineProperty(exports, 'validateSentryHostThrows', {
616
632
  return validateSentryHostThrows;
617
633
  }
618
634
  });
619
- //# sourceMappingURL=constants-zNdapUB3.cjs.map
635
+ //# sourceMappingURL=constants-BF1H5JLS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-BF1H5JLS.cjs","names":[],"sources":["../../mcp-core/dist/events-datasets-Cu37u43g.js","../../mcp-core/dist/url-utils-CYEhmNHi.js","../../mcp-core/dist/scopes.js","../src/auth/constants.ts"],"sourcesContent":["//#region src/utils/events-datasets.ts\nconst PUBLIC_EVENTS_DATASETS = [\n\t\"spans\",\n\t\"errors\",\n\t\"logs\",\n\t\"metrics\",\n\t\"profiles\"\n];\nfunction isMetricsDataset(dataset) {\n\treturn dataset === \"metrics\" || dataset === \"tracemetrics\";\n}\nfunction isProfilesDataset(dataset) {\n\treturn dataset === \"profiles\";\n}\n/**\n* Sentry's product-facing Explore schemas already call this dataset \"metrics\",\n* but the current `/events/` and `/trace-items/attributes/` APIs still expect\n* the legacy `tracemetrics` identifier. Keep MCP aligned with the UI-facing\n* schema and swap only at the transport boundary until the upstream API name\n* catches up.\n*/\nfunction normalizeEventsDataset(dataset) {\n\treturn dataset === \"metrics\" ? \"tracemetrics\" : dataset;\n}\n\n//#endregion\nexport { PUBLIC_EVENTS_DATASETS, isMetricsDataset, isProfilesDataset, normalizeEventsDataset };\n//# sourceMappingURL=events-datasets-Cu37u43g.js.map","import { isMetricsDataset, isProfilesDataset } from \"./events-datasets-Cu37u43g.js\";\n\n//#region src/utils/url-utils.ts\n/**\n* Determines if a Sentry instance is SaaS or self-hosted based on the host.\n* @param host The Sentry host (e.g., \"sentry.io\" or \"sentry.company.com\")\n* @returns true if SaaS instance, false if self-hosted\n*/\nfunction isSentryHost(host) {\n\treturn host === \"sentry.io\" || host.endsWith(\".sentry.io\");\n}\nfunction deriveSelectedFields(fields, aggregateFunctions, groupByFields) {\n\tif (fields && fields.length > 0) return fields;\n\treturn Array.from(new Set([...groupByFields ?? [], ...aggregateFunctions ?? []]));\n}\nfunction getSentryWebBaseUrl(host, organizationSlug, path, protocol = \"https\") {\n\tconst isSaas = isSentryHost(host);\n\tconst webHost = isSaas ? \"sentry.io\" : host;\n\treturn isSaas ? `${protocol}://${organizationSlug}.${webHost}${path}` : `${protocol}://${host}/organizations/${organizationSlug}${path}`;\n}\nfunction normalizeTraceMetric(metric) {\n\tif (!metric?.name || !metric.type) return null;\n\treturn {\n\t\tname: metric.name,\n\t\ttype: metric.type,\n\t\tunit: metric.unit && metric.unit !== \"-\" ? metric.unit : void 0\n\t};\n}\nfunction extractTraceMetricFromAggregate(field) {\n\tconst match = field.match(/^[^(]+\\((.*)\\)$/);\n\tif (!match) return null;\n\tconst args = match[1].split(\",\").map((arg) => arg.trim()).filter((arg) => arg.length > 0);\n\tif (args.length < 4) return null;\n\treturn normalizeTraceMetric({\n\t\tname: args[1],\n\t\ttype: args[2],\n\t\tunit: args[3]\n\t});\n}\nfunction extractTraceMetricFromQuery(query) {\n\tconst extractValue = (field) => {\n\t\tconst quotedMatch = query.match(new RegExp(`${field}:\"([^\"]+)\"`, \"i\"));\n\t\tif (quotedMatch?.[1]) return quotedMatch[1];\n\t\tconst unquotedMatch = query.match(new RegExp(`${field}:([^\\\\s]+)`, \"i\"));\n\t\treturn unquotedMatch?.[1] ?? null;\n\t};\n\treturn normalizeTraceMetric({\n\t\tname: extractValue(\"metric\\\\.name\") ?? \"\",\n\t\ttype: extractValue(\"metric\\\\.type\") ?? \"\",\n\t\tunit: extractValue(\"metric\\\\.unit\") ?? void 0\n\t});\n}\nfunction dedupeTraceMetrics(metrics) {\n\tconst deduped = /* @__PURE__ */ new Map();\n\tfor (const metric of metrics) {\n\t\tconst normalizedMetric = normalizeTraceMetric(metric);\n\t\tif (!normalizedMetric) continue;\n\t\tconst key = `${normalizedMetric.name}|${normalizedMetric.type}|${normalizedMetric.unit ?? \"\"}`;\n\t\tdeduped.set(key, normalizedMetric);\n\t}\n\treturn [...deduped.values()];\n}\nfunction buildMetricQueryState(params) {\n\treturn JSON.stringify({\n\t\tmetric: params.metric,\n\t\tquery: params.query,\n\t\taggregateFields: [...params.yAxes.map((yAxis) => ({ yAxes: [yAxis] })), ...(params.groupByFields ?? []).map((field) => ({ groupBy: field }))],\n\t\taggregateSortBys: params.aggregateSortBys ?? [],\n\t\tmode: params.mode\n\t});\n}\nfunction getTraceMetricsExploreUrl(host, organizationSlug, options, protocol = \"https\") {\n\tconst { query, projectId, statsPeriod, start, end, sort, aggregateFunctions, groupByFields, traceMetrics } = options;\n\tconst urlParams = new URLSearchParams();\n\tif (projectId) urlParams.set(\"project\", projectId);\n\tif (start && end) {\n\t\turlParams.set(\"start\", start);\n\t\turlParams.set(\"end\", end);\n\t} else urlParams.set(\"statsPeriod\", statsPeriod || \"24h\");\n\tconst aggregateFields = aggregateFunctions ?? [];\n\tconst aggregateGroupByFields = groupByFields ?? [];\n\tconst isAggregateQuery = aggregateFields.length > 0;\n\tconst sortField = sort?.startsWith(\"-\") ? sort.slice(1) : sort;\n\tconst sortKind = sort?.startsWith(\"-\") ? \"desc\" : \"asc\";\n\tif (isAggregateQuery) {\n\t\tconst metricQueries = /* @__PURE__ */ new Map();\n\t\tfor (const aggregateField of aggregateFields) {\n\t\t\tconst metric = extractTraceMetricFromAggregate(aggregateField);\n\t\t\tif (!metric) continue;\n\t\t\tconst key = `${metric.name}|${metric.type}|${metric.unit ?? \"\"}`;\n\t\t\tconst existing = metricQueries.get(key);\n\t\t\tif (existing) existing.yAxes.push(aggregateField);\n\t\t\telse metricQueries.set(key, {\n\t\t\t\tmetric,\n\t\t\t\tyAxes: [aggregateField]\n\t\t\t});\n\t\t}\n\t\tfor (const { metric, yAxes } of metricQueries.values()) {\n\t\t\tconst aggregateSortBys = sortField && (yAxes.includes(sortField) || aggregateGroupByFields.includes(sortField)) ? [{\n\t\t\t\tfield: sortField,\n\t\t\t\tkind: sortKind\n\t\t\t}] : [];\n\t\t\turlParams.append(\"metric\", buildMetricQueryState({\n\t\t\t\tmetric,\n\t\t\t\tquery,\n\t\t\t\tmode: \"aggregate\",\n\t\t\t\tyAxes,\n\t\t\t\tgroupByFields: aggregateGroupByFields,\n\t\t\t\taggregateSortBys\n\t\t\t}));\n\t\t}\n\t} else {\n\t\tconst sampleMetrics = dedupeTraceMetrics([...traceMetrics ?? [], extractTraceMetricFromQuery(query)]);\n\t\tfor (const metric of sampleMetrics) urlParams.append(\"metric\", buildMetricQueryState({\n\t\t\tmetric,\n\t\t\tquery,\n\t\t\tmode: \"samples\",\n\t\t\tyAxes: [\"sum(value)\"],\n\t\t\taggregateSortBys: [{\n\t\t\t\tfield: \"sum(value)\",\n\t\t\t\tkind: \"desc\"\n\t\t\t}]\n\t\t}));\n\t}\n\treturn `${getSentryWebBaseUrl(host, organizationSlug, \"/explore/metrics/\", protocol)}?${urlParams.toString()}`;\n}\nfunction getProfilingExplorerUrl(host, organizationSlug, options, protocol = \"https\") {\n\tconst { query, projectId, statsPeriod, start, end, sort, fields, aggregateFunctions, groupByFields } = options;\n\tconst urlParams = new URLSearchParams();\n\tif (query) urlParams.set(\"query\", query);\n\tif (projectId) urlParams.set(\"project\", projectId);\n\tif (sort) urlParams.set(\"sort\", sort);\n\tfor (const field of deriveSelectedFields(fields, aggregateFunctions, groupByFields)) urlParams.append(\"field\", field);\n\tif (start && end) {\n\t\turlParams.set(\"start\", start);\n\t\turlParams.set(\"end\", end);\n\t} else urlParams.set(\"statsPeriod\", statsPeriod || \"24h\");\n\treturn `${getSentryWebBaseUrl(host, organizationSlug, \"/explore/profiling/\", protocol)}?${urlParams.toString()}`;\n}\n/**\n* Generates a Sentry issue URL.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param issueId Issue identifier (e.g., \"PROJECT-123\")\n* @returns The complete issue URL\n*/\nfunction getIssueUrl(host, organizationSlug, issueId, protocol = \"https\") {\n\treturn getSentryWebBaseUrl(host, organizationSlug, `/issues/${issueId}`, protocol);\n}\n/**\n* Generates a Sentry dashboard URL.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param dashboardId Dashboard ID\n* @param options Optional dashboard view query parameters\n* @param protocol Protocol to use when building the web URL\n* @returns The complete dashboard URL\n*/\nfunction getDashboardUrl(host, organizationSlug, dashboardId, options = {}, protocol = \"https\") {\n\tconst encodedDashboardId = encodeURIComponent(dashboardId);\n\tconst params = new URLSearchParams();\n\tif (options.projectId !== null && options.projectId !== void 0) params.set(\"project\", String(options.projectId));\n\tif (options.statsPeriod) params.set(\"statsPeriod\", options.statsPeriod);\n\tconst queryString = params.toString();\n\treturn `${getSentryWebBaseUrl(host, organizationSlug, `/dashboard/${encodedDashboardId}/`, protocol)}${queryString ? `?${queryString}` : \"\"}`;\n}\n/**\n* Generates a Sentry preprod snapshot URL.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param snapshotId Preprod snapshot artifact ID\n* @returns The complete snapshot URL\n*/\nfunction getPreprodSnapshotUrl(host, organizationSlug, snapshotId, protocol = \"https\") {\n\treturn getSentryWebBaseUrl(host, organizationSlug, `/preprod/snapshots/${snapshotId}/`, protocol);\n}\n/**\n* Generates a Sentry cron monitor URL.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param monitorSlug Monitor slug\n* @param projectSlug Optional project slug to disambiguate monitors with the same slug\n* @returns The complete monitor URL\n*/\nfunction getMonitorUrl(host, organizationSlug, monitorSlug, protocol = \"https\", projectSlug) {\n\tconst monitorPath = (projectSlug ? [projectSlug, monitorSlug] : [monitorSlug]).map((segment) => encodeURIComponent(segment)).join(\"/\");\n\treturn getSentryWebBaseUrl(host, organizationSlug, `/crons/${monitorPath}/`, protocol);\n}\n/**\n* Generates a Sentry release URL.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param releaseVersion Release version identifier\n* @returns The complete release URL\n*/\n/**\n* Generates a Sentry uptime monitor URL.\n*\n* Uses the monitors UI path (`/monitors/{id}/`), which is the current home for\n* uptime detectors in Sentry.\n*/\nfunction getUptimeMonitorUrl(host, organizationSlug, uptimeMonitorId, protocol = \"https\") {\n\tconst encodedId = encodeURIComponent(String(uptimeMonitorId));\n\treturn getSentryWebBaseUrl(host, organizationSlug, `/monitors/${encodedId}/`, protocol);\n}\nfunction getReleaseUrl(host, organizationSlug, releaseVersion, protocol = \"https\") {\n\tconst encodedReleaseVersion = encodeURIComponent(releaseVersion);\n\treturn getSentryWebBaseUrl(host, organizationSlug, `/releases/${encodedReleaseVersion}/`, protocol);\n}\n/**\n* Generates a Sentry issues search URL.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param query Optional search query\n* @param projectSlugOrId Optional project slug or ID\n* @returns The complete issues search URL\n*/\nfunction getIssuesSearchUrl(host, organizationSlug, query, projectSlugOrId, protocol = \"https\") {\n\tlet url = getSentryWebBaseUrl(host, organizationSlug, \"/issues/\", protocol);\n\tconst params = new URLSearchParams();\n\tif (projectSlugOrId) params.append(\"project\", projectSlugOrId);\n\tif (query) params.append(\"query\", query);\n\tconst queryString = params.toString();\n\tif (queryString) url += `?${queryString}`;\n\treturn url;\n}\n/**\n* Generates a Sentry replay search URL.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param options Replay search options\n* @returns The complete replay search URL\n*/\nfunction getReplaysSearchUrl(host, organizationSlug, options = {}, protocol = \"https\") {\n\tconst { query, projectSlugOrId, environment, sort, statsPeriod, start, end } = options;\n\tlet url = getSentryWebBaseUrl(host, organizationSlug, \"/explore/replays/\", protocol);\n\tconst params = new URLSearchParams();\n\tif (projectSlugOrId) params.append(\"project\", projectSlugOrId);\n\tif (query) params.append(\"query\", query);\n\tif (environment) {\n\t\tconst environments = Array.isArray(environment) ? environment : [environment];\n\t\tfor (const value of environments) params.append(\"environment\", value);\n\t}\n\tif (sort) params.append(\"sort\", sort);\n\tif (start && end) {\n\t\tparams.append(\"start\", start);\n\t\tparams.append(\"end\", end);\n\t} else if (statsPeriod) params.append(\"statsPeriod\", statsPeriod);\n\tconst queryString = params.toString();\n\tif (queryString) url += `?${queryString}`;\n\treturn url;\n}\n/**\n* Generates a Sentry trace URL for performance investigation.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param traceId Trace identifier\n* @returns The complete trace URL\n*/\nfunction getTraceUrl(host, organizationSlug, traceId, protocol = \"https\") {\n\treturn getSentryWebBaseUrl(host, organizationSlug, `/explore/traces/trace/${traceId}`, protocol);\n}\n/**\n* Generates a Sentry replay URL.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param replayId Replay identifier\n* @returns The complete replay URL\n*/\nfunction getReplayUrl(host, organizationSlug, replayId, protocol = \"https\") {\n\treturn getSentryWebBaseUrl(host, organizationSlug, `/explore/replays/${replayId}/`, protocol);\n}\n/**\n* Generates a Sentry AI conversation URL.\n* @param host The Sentry host\n* @param organizationSlug Organization identifier\n* @param conversationId AI conversation identifier\n* @returns The complete AI conversation URL\n*/\nfunction getAIConversationUrl(host, organizationSlug, conversationId, protocol = \"https\") {\n\treturn getSentryWebBaseUrl(host, organizationSlug, `/explore/conversations/${encodeURIComponent(conversationId)}/`, protocol);\n}\n/**\n* Extract a single non-negated AI conversation ID from a Sentry search query\n* that filters on `gen_ai.conversation.id`. Returns undefined when the query\n* does not contain exactly one such filter or contains a negated filter.\n*/\nfunction extractConversationIdFromSearchQuery(query) {\n\tif (!query) return void 0;\n\tif (/!gen_ai\\.conversation\\.id:|\\bNOT\\s+(?:\\(\\s*)?gen_ai\\.conversation\\.id:/i.test(query)) return void 0;\n\tconst pattern = /gen_ai\\.conversation\\.id:(?:\"([^\"]+)\"|([^\\s)]+))/g;\n\tconst matches = [...query.matchAll(pattern)];\n\tif (matches.length !== 1) return void 0;\n\tconst conversationId = matches[0][1] ?? matches[0][2];\n\tif (conversationId.startsWith(\"[\")) return void 0;\n\treturn conversationId;\n}\n/**\n* Generates a Sentry AI conversations list URL with optional search filters.\n*/\nfunction getAIConversationsUrl(host, organizationSlug, options = {}, protocol = \"https\") {\n\tconst urlParams = new URLSearchParams();\n\tif (options.query) urlParams.set(\"query\", options.query);\n\tfor (const projectId of options.project ?? []) urlParams.append(\"project\", projectId);\n\tconst environments = Array.isArray(options.environment) ? options.environment : options.environment ? [options.environment] : [];\n\tfor (const environmentName of environments) urlParams.append(\"environment\", environmentName);\n\tif (options.start && options.end) {\n\t\turlParams.set(\"start\", options.start);\n\t\turlParams.set(\"end\", options.end);\n\t} else if (options.statsPeriod) urlParams.set(\"statsPeriod\", options.statsPeriod);\n\tconst baseUrl = getSentryWebBaseUrl(host, organizationSlug, \"/explore/conversations/\", protocol);\n\tconst queryString = urlParams.toString();\n\treturn queryString ? `${baseUrl}?${queryString}` : baseUrl;\n}\nfunction getProfileUrl(host, organizationSlug, projectSlug, profileId, protocol = \"https\") {\n\treturn getSentryWebBaseUrl(host, organizationSlug, `/explore/profiling/profile/${projectSlug}/${profileId}/flamegraph/`, protocol);\n}\nfunction getContinuousProfileUrl(host, organizationSlug, projectSlug, options, protocol = \"https\") {\n\tconst url = new URL(getSentryWebBaseUrl(host, organizationSlug, `/explore/profiling/profile/${projectSlug}/flamegraph/`, protocol));\n\turl.searchParams.set(\"profilerId\", options.profilerId);\n\turl.searchParams.set(\"start\", options.start);\n\turl.searchParams.set(\"end\", options.end);\n\treturn url.toString();\n}\n/**\n* Generates a Sentry events explorer URL.\n* @param host The Sentry host (may include regional subdomain for API access)\n* @param organizationSlug Organization identifier\n* @param query Search query\n* @param dataset Dataset type\n* @param projectSlug Optional project slug\n* @param fields Optional fields to display\n* @returns The complete events explorer URL\n*/\nfunction getEventsExplorerUrl(host, organizationSlug, query, dataset = \"spans\", projectSlugOrId, fields, explorerOptions, protocol = \"https\") {\n\tif (isMetricsDataset(dataset)) {\n\t\tconst derivedAggregateFunctions = explorerOptions?.aggregateFunctions ?? fields?.filter((field) => field.includes(\"(\") && field.includes(\")\"));\n\t\tconst derivedGroupByFields = explorerOptions?.groupByFields ?? fields?.filter((field) => !field.includes(\"(\") && !field.includes(\")\"));\n\t\treturn getTraceMetricsExploreUrl(host, organizationSlug, {\n\t\t\t...explorerOptions,\n\t\t\tquery,\n\t\t\tprojectId: projectSlugOrId,\n\t\t\taggregateFunctions: derivedAggregateFunctions,\n\t\t\tgroupByFields: derivedGroupByFields\n\t\t}, protocol);\n\t}\n\tif (isProfilesDataset(dataset)) {\n\t\tconst derivedAggregateFunctions = explorerOptions?.aggregateFunctions ?? fields?.filter((field) => field.includes(\"(\") && field.includes(\")\"));\n\t\tconst derivedGroupByFields = explorerOptions?.groupByFields ?? fields?.filter((field) => !field.includes(\"(\") && !field.includes(\")\"));\n\t\treturn getProfilingExplorerUrl(host, organizationSlug, {\n\t\t\tquery,\n\t\t\tprojectId: projectSlugOrId,\n\t\t\tfields,\n\t\t\tsort: explorerOptions?.sort,\n\t\t\tstatsPeriod: explorerOptions?.statsPeriod,\n\t\t\tstart: explorerOptions?.start,\n\t\t\tend: explorerOptions?.end,\n\t\t\taggregateFunctions: derivedAggregateFunctions,\n\t\t\tgroupByFields: derivedGroupByFields\n\t\t}, protocol);\n\t}\n\tlet url = getSentryWebBaseUrl(host, organizationSlug, \"/explore/\", protocol);\n\tconst params = new URLSearchParams();\n\tparams.append(\"query\", query);\n\tparams.append(\"dataset\", dataset);\n\tparams.append(\"layout\", \"table\");\n\tif (projectSlugOrId) params.append(\"project\", projectSlugOrId);\n\tif (fields && fields.length > 0) for (const field of fields) params.append(\"field\", field);\n\turl += `?${params.toString()}`;\n\treturn url;\n}\n/**\n* Internal validation function that checks if a SENTRY_HOST value contains only hostname (no protocol).\n* Throws an error if validation fails instead of exiting the process.\n*\n* @param host The hostname to validate\n* @throws {Error} If the host contains a protocol\n*/\nfunction _validateSentryHostInternal(host) {\n\tif (host.startsWith(\"http://\") || host.startsWith(\"https://\")) throw new Error(\"SENTRY_HOST should only contain a hostname (e.g., sentry.example.com). Use SENTRY_URL if you want to provide a full URL.\");\n}\n/**\n* Internal validation function that checks if a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.\n* Throws an error if validation fails instead of exiting the process.\n*\n* @param url The HTTPS URL to validate and parse\n* @returns The extracted hostname from the URL\n* @throws {Error} If the URL is invalid or not HTTPS\n*/\nfunction _validateAndParseSentryUrlInternal(url) {\n\tif (!url.startsWith(\"https://\")) throw new Error(\"SENTRY_URL must be a full HTTPS URL (e.g., https://sentry.example.com).\");\n\ttry {\n\t\tconst parsedUrl = new URL(url);\n\t\treturn parsedUrl.host;\n\t} catch (error) {\n\t\tthrow new Error(\"SENTRY_URL must be a valid HTTPS URL (e.g., https://sentry.example.com).\");\n\t}\n}\n/**\n* Validates that a SENTRY_HOST value contains only hostname (no protocol).\n* Exits the process with error code 1 if validation fails (CLI behavior).\n*\n* @param host The hostname to validate\n*/\nfunction validateSentryHost(host) {\n\ttry {\n\t\t_validateSentryHostInternal(host);\n\t} catch (error) {\n\t\tconsole.error(`Error: ${error.message}`);\n\t\tprocess.exit(1);\n\t}\n}\n/**\n* Validates that a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.\n* Exits the process with error code 1 if validation fails (CLI behavior).\n*\n* @param url The HTTPS URL to validate and parse\n* @returns The extracted hostname from the URL\n*/\nfunction validateAndParseSentryUrl(url) {\n\ttry {\n\t\treturn _validateAndParseSentryUrlInternal(url);\n\t} catch (error) {\n\t\tconsole.error(`Error: ${error.message}`);\n\t\tprocess.exit(1);\n\t}\n}\n/**\n* Validates that a SENTRY_HOST value contains only hostname (no protocol).\n* Throws an error instead of exiting the process (for testing).\n*\n* @param host The hostname to validate\n* @throws {Error} If the host contains a protocol\n*/\nfunction validateSentryHostThrows(host) {\n\t_validateSentryHostInternal(host);\n}\n/**\n* Validates that a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.\n* Throws an error instead of exiting the process (for testing).\n*\n* @param url The HTTPS URL to validate and parse\n* @returns The extracted hostname from the URL\n* @throws {Error} If the URL is invalid or not HTTPS\n*/\nfunction validateAndParseSentryUrlThrows(url) {\n\treturn _validateAndParseSentryUrlInternal(url);\n}\n/**\n* Validates that the provided OpenAI base URL is a valid HTTP(S) URL and returns a normalized string.\n*\n* @param url The URL to validate and normalize\n* @returns The normalized URL string\n* @throws {Error} If the URL is empty, invalid, or uses an unsupported protocol\n*/\nfunction validateOpenAiBaseUrlThrows(url) {\n\tconst trimmed = url.trim();\n\tif (trimmed.length === 0) throw new Error(\"OPENAI base URL must not be empty.\");\n\tlet parsed;\n\ttry {\n\t\tparsed = new URL(trimmed);\n\t} catch (error) {\n\t\tthrow new Error(\"OPENAI base URL must be a valid HTTP or HTTPS URL (e.g., https://example.com/v1).\", { cause: error });\n\t}\n\tif (parsed.protocol !== \"https:\" && parsed.protocol !== \"http:\") throw new Error(\"OPENAI base URL must use http or https scheme (e.g., https://example.com/v1).\");\n\treturn parsed.toString();\n}\n\n//#endregion\nexport { extractConversationIdFromSearchQuery, getAIConversationUrl, getAIConversationsUrl, getContinuousProfileUrl, getDashboardUrl, getEventsExplorerUrl, getIssueUrl, getIssuesSearchUrl, getMonitorUrl, getPreprodSnapshotUrl, getProfileUrl, getProfilingExplorerUrl, getReleaseUrl, getReplayUrl, getReplaysSearchUrl, getTraceMetricsExploreUrl, getTraceUrl, getUptimeMonitorUrl, isSentryHost, validateAndParseSentryUrl, validateAndParseSentryUrlThrows, validateOpenAiBaseUrlThrows, validateSentryHost, validateSentryHostThrows };\n//# sourceMappingURL=url-utils-CYEhmNHi.js.map","//#region src/scopes.ts\nconst SCOPES = {\n\t\"org:read\": \"Read organization data\",\n\t\"project:write\": \"Write project data\",\n\t\"team:write\": \"Write team data\",\n\t\"event:write\": \"Write event data\"\n};\n\n//#endregion\nexport { SCOPES };\n//# sourceMappingURL=scopes.js.map","import { SCOPES } from \"@sentry/mcp-core/scopes\";\nimport { isSentryHost } from \"@sentry/mcp-core/utils/url-utils\";\n\n/**\n * Public OAuth app registered on sentry.io for the stdio device code flow.\n * No client secret — device code grant is a public client flow.\n * The Cloudflare transport uses a separate OAuth app with a secret.\n * Override via SENTRY_CLIENT_ID environment variable.\n * See docs/operations/stdio-auth.md for the full credential architecture.\n */\nexport const DEFAULT_SENTRY_CLIENT_ID =\n \"0acbeba7d07d58076dd7dbde8cea2fed8ab525ce3713bda604988009ab35d765\";\n\nexport const DEVICE_CODE_ENDPOINT = \"/oauth/device/code/\";\nexport const TOKEN_ENDPOINT = \"/oauth/token/\";\nexport const DEVICE_CODE_SCOPES = Object.keys(SCOPES).join(\" \");\n\n/** Interval increment on slow_down response (RFC 8628). */\nexport const SLOW_DOWN_INCREMENT_SEC = 5;\n\n/**\n * Whether device code auth is available for this host.\n * Supports sentry.io and regional subdomains (us.sentry.io, eu.sentry.io).\n */\nexport { isSentryHost as isSentryIo };\n\n/**\n * OAuth endpoints live on sentry.io regardless of regional host.\n * Always use this as the host for device code and token requests.\n */\nexport const OAUTH_HOST = \"sentry.io\";\n"],"mappings":";;AACA,MAAM,yBAAyB;CAC9B;CACA;CACA;CACA;CACA;AACA;AACD,SAAS,iBAAiB,SAAS;AAClC,QAAO,YAAY,aAAa,YAAY;AAC5C;AACD,SAAS,kBAAkB,SAAS;AACnC,QAAO,YAAY;AACnB;;;;;;;;AAQD,SAAS,uBAAuB,SAAS;AACxC,QAAO,YAAY,YAAY,iBAAiB;AAChD;;;;;;;;;ACfD,SAAS,aAAa,MAAM;AAC3B,QAAO,SAAS,eAAe,KAAK,SAAS,aAAa;AAC1D;AACD,SAAS,qBAAqB,QAAQ,oBAAoB,eAAe;AACxE,KAAI,UAAU,OAAO,SAAS,EAAG,QAAO;AACxC,QAAO,MAAM,KAAK,IAAI,I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