@sentry/mcp-server 0.38.0 → 0.40.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.
- package/dist/auth/constants.cjs +1 -1
- package/dist/auth/constants.js +1 -1
- package/dist/auth/device-code-flow.cjs +3 -3
- package/dist/auth/device-code-flow.js +3 -3
- package/dist/auth/resolve-token.cjs +4 -4
- package/dist/auth/resolve-token.js +4 -4
- package/dist/{auth-BlhX8Vom.cjs → auth-CmmVlYDi.cjs} +4 -4
- package/dist/{auth-BlhX8Vom.cjs.map → auth-CmmVlYDi.cjs.map} +1 -1
- package/dist/{auth-CmWwtW3L.js → auth-CpyUfxVa.js} +4 -4
- package/dist/{auth-CmWwtW3L.js.map → auth-CpyUfxVa.js.map} +1 -1
- package/dist/blob-utils-CJyQkdm-.js +3 -0
- package/dist/blob-utils-DGsI5_gF.cjs +3 -0
- package/dist/{blob-utils-CdbE_jsd-zazUDulT.cjs → blob-utils-DgVug_Di-B5c8BuPf.cjs} +17 -2
- package/dist/{blob-utils-CdbE_jsd-zazUDulT.cjs.map → blob-utils-DgVug_Di-B5c8BuPf.cjs.map} +1 -1
- package/dist/{blob-utils-CdbE_jsd-9sHzy4nK.js → blob-utils-DgVug_Di-DaP7N_l-.js} +12 -3
- package/dist/{blob-utils-CdbE_jsd-9sHzy4nK.js.map → blob-utils-DgVug_Di-DaP7N_l-.js.map} +1 -1
- package/dist/cli/commands/auth.cjs +5 -5
- package/dist/cli/commands/auth.js +5 -5
- package/dist/cli/parse.d.ts.map +1 -1
- package/dist/cli/resolve.cjs +2 -2
- package/dist/cli/resolve.js +2 -2
- package/dist/{config-BqCCImAX-CqsS5Qiu.cjs → config-B-l88mOS-DNM_M--P.cjs} +8 -6
- package/dist/config-B-l88mOS-DNM_M--P.cjs.map +1 -0
- package/dist/{config-BqCCImAX-C9xxoOuk.js → config-B-l88mOS-v5IBYyQU.js} +8 -6
- package/dist/config-B-l88mOS-v5IBYyQU.js.map +1 -0
- package/dist/config-DRWtJff1.cjs +7 -0
- package/dist/{config-BUwpc74z.js → config-_di9BWJ0.js} +1 -1
- package/dist/{constants-BZbaI-zR.js → constants-CS0iQGX_.js} +3 -3
- package/dist/{constants-BZbaI-zR.js.map → constants-CS0iQGX_.js.map} +1 -1
- package/dist/{constants-BF1H5JLS.cjs → constants-DyDxXiYc.cjs} +3 -3
- package/dist/{constants-BF1H5JLS.cjs.map → constants-DyDxXiYc.cjs.map} +1 -1
- package/dist/{device-code-flow-D8_wFtpA.js → device-code-flow-CARIuIzP.js} +3 -3
- package/dist/{device-code-flow-D8_wFtpA.js.map → device-code-flow-CARIuIzP.js.map} +1 -1
- package/dist/{device-code-flow-R-ZBimNL.cjs → device-code-flow-D1UFW6dK.cjs} +3 -3
- package/dist/{device-code-flow-R-ZBimNL.cjs.map → device-code-flow-D1UFW6dK.cjs.map} +1 -1
- package/dist/index.cjs +1902 -807
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1896 -801
- package/dist/index.js.map +1 -1
- package/dist/{resolve-CS-Bms6W.js → resolve-C9Uf3wka.js} +2 -2
- package/dist/{resolve-CS-Bms6W.js.map → resolve-C9Uf3wka.js.map} +1 -1
- package/dist/{resolve-BsYckCew.cjs → resolve-D3vntNua.cjs} +2 -2
- package/dist/{resolve-BsYckCew.cjs.map → resolve-D3vntNua.cjs.map} +1 -1
- package/dist/{resolve-token-6Nwn0wwt.js → resolve-token-CYqj4HQ5.js} +3 -3
- package/dist/{resolve-token-6Nwn0wwt.js.map → resolve-token-CYqj4HQ5.js.map} +1 -1
- package/dist/{resolve-token-D8ViFyUf.cjs → resolve-token-DKvK-YrS.cjs} +3 -3
- package/dist/{resolve-token-D8ViFyUf.cjs.map → resolve-token-DKvK-YrS.cjs.map} +1 -1
- package/dist/{stdio-BAG9vDZV.cjs → stdio-BhYLPDOA.cjs} +2 -2
- package/dist/{stdio-BAG9vDZV.cjs.map → stdio-BhYLPDOA.cjs.map} +1 -1
- package/dist/{stdio-DFJbp9zP.js → stdio-iZJ0t3f6.js} +2 -2
- package/dist/{stdio-DFJbp9zP.js.map → stdio-iZJ0t3f6.js.map} +1 -1
- package/dist/transports/stdio.cjs +2 -2
- package/dist/transports/stdio.js +2 -2
- package/dist/{version-CXUk1-K3.cjs → version-CDZpvmqM.cjs} +3 -3
- package/dist/version-CDZpvmqM.cjs.map +1 -0
- package/dist/version-a8th87fY.js +7 -0
- package/dist/version-a8th87fY.js.map +1 -0
- package/package.json +7 -7
- package/dist/blob-utils-ByQZ_jqM.cjs +0 -3
- package/dist/blob-utils-KYOyFu79.js +0 -3
- package/dist/config-BqCCImAX-C9xxoOuk.js.map +0 -1
- package/dist/config-BqCCImAX-CqsS5Qiu.cjs.map +0 -1
- package/dist/config-Md3ohhLy.cjs +0 -7
- package/dist/version-CXUk1-K3.cjs.map +0 -1
- package/dist/version-Duuvuy5h.js +0 -7
- package/dist/version-Duuvuy5h.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { __commonJS, __export, __toDynamicImportESM, __toESM } from "./chunk-CunrlGP7.js";
|
|
3
|
-
import { ALL_SKILLS, SKILLS, finalize, isEnabledBySkills } from "./resolve-
|
|
4
|
-
import { PUBLIC_EVENTS_DATASETS, extractConversationIdFromSearchQuery, getAIConversationUrl, getAIConversationsUrl, getContinuousProfileUrl, getDashboardUrl, getIssueUrl, getIssuesSearchUrl, getMonitorUrl, getPreprodSnapshotUrl, getProfileUrl, getProfilingExplorerUrl, getReleaseUrl, getReplayUrl, getReplaysSearchUrl, getTraceMetricsExploreUrl, getTraceUrl, getUptimeMonitorUrl, isMetricsDataset, isProfilesDataset, isSentryHost, normalizeEventsDataset } from "./constants-
|
|
5
|
-
import { LIB_VERSION, USER_AGENT } from "./version-
|
|
3
|
+
import { ALL_SKILLS, SKILLS, finalize, isEnabledBySkills } from "./resolve-C9Uf3wka.js";
|
|
4
|
+
import { PUBLIC_EVENTS_DATASETS, extractConversationIdFromSearchQuery, getAIConversationUrl, getAIConversationsUrl, getContinuousProfileUrl, getDashboardUrl, getIssueUrl, getIssuesSearchUrl, getMonitorUrl, getPreprodSnapshotUrl, getProfileUrl, getProfilingExplorerUrl, getReleaseUrl, getReplayUrl, getReplaysSearchUrl, getTraceMetricsExploreUrl, getTraceUrl, getUptimeMonitorUrl, isMetricsDataset, isProfilesDataset, isSentryHost, normalizeEventsDataset } from "./constants-CS0iQGX_.js";
|
|
5
|
+
import { LIB_VERSION, USER_AGENT } from "./version-a8th87fY.js";
|
|
6
6
|
import { require_token_error } from "./token-error-CBmJNKLY.js";
|
|
7
|
-
import { blobToBase64, createImagePreview } from "./blob-utils-
|
|
8
|
-
import { RECOMMENDED_FIELDS, TRACE_METRICS_SAMPLE_IDENTITY_FIELDS, systemPrompt } from "./config-
|
|
9
|
-
import { startStdio } from "./stdio-
|
|
7
|
+
import { blobToBase64, bytesToBase64, createImagePreview } from "./blob-utils-DgVug_Di-DaP7N_l-.js";
|
|
8
|
+
import { RECOMMENDED_FIELDS, TRACE_METRICS_SAMPLE_IDENTITY_FIELDS, systemPrompt } from "./config-B-l88mOS-v5IBYyQU.js";
|
|
9
|
+
import { startStdio } from "./stdio-iZJ0t3f6.js";
|
|
10
10
|
import { buildUsage } from "./usage-Con424Df.js";
|
|
11
11
|
import { printCliLine } from "./output-A_-7o7gV.js";
|
|
12
12
|
import { merge, parseArgv, parseEnv } from "./parse-Dd3OOgIq.js";
|
|
13
13
|
import "./types-BCSxlxZI.js";
|
|
14
|
-
import "./device-code-flow-
|
|
14
|
+
import "./device-code-flow-CARIuIzP.js";
|
|
15
15
|
import "./token-cache-DbZp4rvg.js";
|
|
16
|
-
import { resolveAccessToken } from "./resolve-token-
|
|
17
|
-
import { authCommand } from "./auth-
|
|
16
|
+
import { resolveAccessToken } from "./resolve-token-CYqj4HQ5.js";
|
|
17
|
+
import { authCommand } from "./auth-CpyUfxVa.js";
|
|
18
18
|
import { z } from "zod";
|
|
19
|
-
import { captureException, captureMessage, getActiveSpan, logger, setTag, setUser, startSpan, withScope
|
|
19
|
+
import { captureException, captureMessage, getActiveSpan, logger, setAttribute, setTag, setUser, startSpan, withScope } from "@sentry/core";
|
|
20
20
|
import util from "node:util";
|
|
21
21
|
import * as z4 from "zod/v4";
|
|
22
22
|
import { z as z$1 } from "zod/v4";
|
|
23
23
|
import { ZodFirstPartyTypeKind } from "zod/v3";
|
|
24
24
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
25
|
+
import { wrapMcpServerWithSentry } from "@sentry/core/server";
|
|
25
26
|
import * as Sentry from "@sentry/node";
|
|
26
27
|
|
|
27
28
|
//#region ../mcp-core/dist/constants-CEZaLsGe.js
|
|
@@ -399,7 +400,7 @@ function validateSlugOrId(val, ctx) {
|
|
|
399
400
|
}
|
|
400
401
|
|
|
401
402
|
//#endregion
|
|
402
|
-
//#region ../mcp-core/dist/schema-
|
|
403
|
+
//#region ../mcp-core/dist/schema-BPiG3cQY.js
|
|
403
404
|
const ParamOrganizationSlug = z.string().trim().superRefine(validateSlug).describe("The organization's slug. You can find a existing list of organizations you have access to using the `find_organizations()` tool.");
|
|
404
405
|
const ParamTeamSlug = z.string().trim().superRefine(validateSlug).describe("The team's slug. You can find a list of existing teams in an organization with the Sentry tool `find_teams`.");
|
|
405
406
|
const ParamProjectSlug = z.string().trim().superRefine(validateSlug).describe("The project's slug. You can find a list of existing projects in an organization using the `find_projects()` tool.");
|
|
@@ -446,7 +447,7 @@ const ParamIssueIgnoreMode = z.enum([
|
|
|
446
447
|
"untilOccurrenceCount",
|
|
447
448
|
"untilUserCount"
|
|
448
449
|
]).describe("How ignored issues should behave. Use 'untilEscalating' to match the Sentry UI default, 'forever' for a permanent ignore, 'forDuration' with ignoreDurationMinutes, 'untilOccurrenceCount' with ignoreCount and optional ignoreWindowMinutes, or 'untilUserCount' with ignoreUserCount and optional ignoreUserWindowMinutes.");
|
|
449
|
-
const ParamAssignedTo = z.string().trim().describe("The assignee in format 'user:ID' or 'team:ID_OR_SLUG' where ID is numeric. Example: 'user:123456', 'team:789', or 'team:my-team-slug'. Use `execute_sentry_tool(name='whoami', arguments={})` to find your user ID.");
|
|
450
|
+
const ParamAssignedTo = z.string().trim().min(1).nullable().describe("The assignee in format 'user:ID' or 'team:ID_OR_SLUG' where ID is numeric. Pass null to unassign the issue. Example: 'user:123456', 'team:789', or 'team:my-team-slug'. Use `execute_sentry_tool(name='whoami', arguments={})` to find your user ID.");
|
|
450
451
|
const ParamIgnoreDurationMinutes = z.number().int().positive().describe("How many minutes to ignore the issue when ignoreMode is 'forDuration'.");
|
|
451
452
|
const ParamIgnoreCount = z.number().int().positive().describe("How many times the issue must occur before it stops being ignored when ignoreMode is 'untilOccurrenceCount'.");
|
|
452
453
|
const ParamIgnoreWindowMinutes = z.number().int().positive().max(7 * 24 * 60).describe("Optional time window in minutes for ignoreCount. If omitted, Sentry counts all future occurrences.");
|
|
@@ -462,6 +463,56 @@ const ParamEventId = z.string().trim().regex(/^[0-9a-fA-F]{32}$/, "Event ID must
|
|
|
462
463
|
const ParamEventIdOrLatest = z.union([z.literal("latest"), ParamEventId]).default("latest").describe("The event ID for the issue, or `latest`. Defaults to `latest`.");
|
|
463
464
|
const ParamAttachmentId = z.string().trim().superRefine(validateResourceId).describe("The ID of the attachment to download.");
|
|
464
465
|
|
|
466
|
+
//#endregion
|
|
467
|
+
//#region ../mcp-core/dist/fetch-utils-CowPZ6ZQ.js
|
|
468
|
+
/**
|
|
469
|
+
* Fetch with timeout using AbortController
|
|
470
|
+
* @param url - The URL to fetch
|
|
471
|
+
* @param options - Standard fetch options
|
|
472
|
+
* @param timeoutMs - Timeout in milliseconds (default: 30000)
|
|
473
|
+
* @returns Promise<Response>
|
|
474
|
+
* @throws Error if request times out
|
|
475
|
+
*/
|
|
476
|
+
async function fetchWithTimeout(url, options = {}, timeoutMs = 3e4) {
|
|
477
|
+
const controller = new AbortController();
|
|
478
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
479
|
+
try {
|
|
480
|
+
const response = await fetch(url, {
|
|
481
|
+
...options,
|
|
482
|
+
signal: controller.signal
|
|
483
|
+
});
|
|
484
|
+
return response;
|
|
485
|
+
} catch (error) {
|
|
486
|
+
if (error instanceof Error && error.name === "AbortError") throw new Error(`Request timeout after ${timeoutMs}ms`);
|
|
487
|
+
throw error;
|
|
488
|
+
} finally {
|
|
489
|
+
clearTimeout(timeoutId);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Retry a function with exponential backoff
|
|
494
|
+
* @param fn - The async function to retry
|
|
495
|
+
* @param options - Retry options
|
|
496
|
+
* @param options.maxRetries - Maximum number of retries (default: 3)
|
|
497
|
+
* @param options.initialDelay - Initial delay in milliseconds (default: 1000)
|
|
498
|
+
* @param options.shouldRetry - Predicate to determine if error should be retried (default: always retry)
|
|
499
|
+
* @returns Promise with the function result
|
|
500
|
+
* @throws The last error if all retries are exhausted
|
|
501
|
+
*/
|
|
502
|
+
async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, shouldRetry = (error) => true } = {}) {
|
|
503
|
+
let lastError;
|
|
504
|
+
let delay$1 = initialDelay;
|
|
505
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) try {
|
|
506
|
+
return await fn();
|
|
507
|
+
} catch (error) {
|
|
508
|
+
lastError = error;
|
|
509
|
+
if (attempt === maxRetries || !shouldRetry(error)) throw error;
|
|
510
|
+
await new Promise((resolve$1) => setTimeout(resolve$1, delay$1));
|
|
511
|
+
delay$1 = Math.min(delay$1 * 2, 3e4);
|
|
512
|
+
}
|
|
513
|
+
throw lastError;
|
|
514
|
+
}
|
|
515
|
+
|
|
465
516
|
//#endregion
|
|
466
517
|
//#region ../../node_modules/.pnpm/@logtape+logtape@1.1.1/node_modules/@logtape/logtape/dist/filter.js
|
|
467
518
|
/**
|
|
@@ -1627,7 +1678,7 @@ var ConfigError = class extends Error {
|
|
|
1627
1678
|
};
|
|
1628
1679
|
|
|
1629
1680
|
//#endregion
|
|
1630
|
-
//#region ../mcp-core/dist/logging-
|
|
1681
|
+
//#region ../mcp-core/dist/logging-dXuBsQDs.js
|
|
1631
1682
|
const ROOT_LOG_CATEGORY = ["sentry", "mcp"];
|
|
1632
1683
|
const STDERR_CONSOLE_LEVEL_MAP = {
|
|
1633
1684
|
trace: "error",
|
|
@@ -1850,7 +1901,7 @@ function logIssue(error, options = {}) {
|
|
|
1850
1901
|
}
|
|
1851
1902
|
|
|
1852
1903
|
//#endregion
|
|
1853
|
-
//#region ../mcp-core/dist/api-path-
|
|
1904
|
+
//#region ../mcp-core/dist/api-path-CjJMa7Rg.js
|
|
1854
1905
|
/**
|
|
1855
1906
|
* Builds an API request path, confining each interpolated value to one path segment.
|
|
1856
1907
|
*
|
|
@@ -1877,7 +1928,7 @@ function apiPath(strings, ...values) {
|
|
|
1877
1928
|
}
|
|
1878
1929
|
|
|
1879
1930
|
//#endregion
|
|
1880
|
-
//#region ../mcp-core/dist/errors-
|
|
1931
|
+
//#region ../mcp-core/dist/errors-Dj_qmFqH.js
|
|
1881
1932
|
/**
|
|
1882
1933
|
* API Error Class Hierarchy
|
|
1883
1934
|
*
|
|
@@ -2108,7 +2159,7 @@ function isApiAuthenticationErrorDeep(error) {
|
|
|
2108
2159
|
}
|
|
2109
2160
|
|
|
2110
2161
|
//#endregion
|
|
2111
|
-
//#region ../mcp-core/dist/schema-
|
|
2162
|
+
//#region ../mcp-core/dist/schema-y99KGEDP.js
|
|
2112
2163
|
/**
|
|
2113
2164
|
* Schema for Sentry API error responses.
|
|
2114
2165
|
*
|
|
@@ -2282,6 +2333,61 @@ const IssueAlertRuleSchema = z.object({
|
|
|
2282
2333
|
lastTriggered: z.string().nullable().optional()
|
|
2283
2334
|
}).passthrough();
|
|
2284
2335
|
const IssueAlertRuleListSchema = z.array(IssueAlertRuleSchema);
|
|
2336
|
+
const AlertRuleProjectScopeSchema = z.object({
|
|
2337
|
+
projectIds: z.array(z.string()),
|
|
2338
|
+
includesAllProjects: z.boolean()
|
|
2339
|
+
});
|
|
2340
|
+
const AlertActionOptionSchema = z.object({
|
|
2341
|
+
type: z.string(),
|
|
2342
|
+
handlerGroup: z.string(),
|
|
2343
|
+
configSchema: z.record(z.string(), z.unknown()),
|
|
2344
|
+
dataSchema: z.record(z.string(), z.unknown()),
|
|
2345
|
+
integrations: z.array(z.object({
|
|
2346
|
+
id: z.string(),
|
|
2347
|
+
name: z.string(),
|
|
2348
|
+
services: z.array(z.object({
|
|
2349
|
+
id: z.string(),
|
|
2350
|
+
name: z.string()
|
|
2351
|
+
})).optional()
|
|
2352
|
+
})).optional(),
|
|
2353
|
+
services: z.array(z.object({
|
|
2354
|
+
slug: z.string(),
|
|
2355
|
+
name: z.string()
|
|
2356
|
+
})).optional(),
|
|
2357
|
+
sentryApp: z.object({
|
|
2358
|
+
id: z.string(),
|
|
2359
|
+
name: z.string(),
|
|
2360
|
+
installationId: z.string(),
|
|
2361
|
+
installationUuid: z.string(),
|
|
2362
|
+
status: z.number(),
|
|
2363
|
+
settings: z.record(z.string(), z.unknown()).optional(),
|
|
2364
|
+
title: z.string().optional()
|
|
2365
|
+
}).optional()
|
|
2366
|
+
});
|
|
2367
|
+
const AlertConditionOptionSchema = z.object({
|
|
2368
|
+
type: z.string(),
|
|
2369
|
+
handlerGroup: z.string(),
|
|
2370
|
+
handlerSubgroup: z.string().optional(),
|
|
2371
|
+
comparisonJsonSchema: z.record(z.string(), z.unknown())
|
|
2372
|
+
});
|
|
2373
|
+
const DetectorSchema = z.object({
|
|
2374
|
+
id: z.string(),
|
|
2375
|
+
projectId: z.string().nullable(),
|
|
2376
|
+
name: z.string(),
|
|
2377
|
+
type: z.string(),
|
|
2378
|
+
enabled: z.boolean(),
|
|
2379
|
+
config: z.record(z.string(), z.unknown()),
|
|
2380
|
+
conditionGroup: AlertRuleComponentSchema.nullable(),
|
|
2381
|
+
dataSources: z.array(AlertRuleComponentSchema).nullable(),
|
|
2382
|
+
workflowIds: z.array(z.string()).nullable(),
|
|
2383
|
+
description: z.string().nullable().optional(),
|
|
2384
|
+
owner: z.unknown().optional(),
|
|
2385
|
+
createdBy: z.string().nullable().optional(),
|
|
2386
|
+
dateCreated: z.string(),
|
|
2387
|
+
dateUpdated: z.string(),
|
|
2388
|
+
alertRuleId: z.number().nullable().optional(),
|
|
2389
|
+
ruleId: z.number().nullable().optional()
|
|
2390
|
+
}).passthrough();
|
|
2285
2391
|
const MetricAlertRuleSchema = z.object({
|
|
2286
2392
|
id: z.union([z.string(), z.number()]),
|
|
2287
2393
|
name: z.string(),
|
|
@@ -2809,7 +2915,11 @@ const BaseEventSchema = z.object({
|
|
|
2809
2915
|
geo: z.record(z.string(), z.union([z.string(), z.null()])).nullable().optional()
|
|
2810
2916
|
}).passthrough().nullable().optional(),
|
|
2811
2917
|
_meta: z.unknown().optional(),
|
|
2812
|
-
dateReceived: z.string().datetime().nullish()
|
|
2918
|
+
dateReceived: z.string().datetime().nullish(),
|
|
2919
|
+
formatted: z.object({
|
|
2920
|
+
format: z.string(),
|
|
2921
|
+
content: z.string()
|
|
2922
|
+
}).optional()
|
|
2813
2923
|
});
|
|
2814
2924
|
const ErrorEventSchema = BaseEventSchema.omit({ type: true }).extend({
|
|
2815
2925
|
type: z.literal("error"),
|
|
@@ -2951,15 +3061,21 @@ const AutofixBlockSchema = z.object({
|
|
|
2951
3061
|
* - `src/sentry/seer/endpoints/group_ai_autofix.py`
|
|
2952
3062
|
* - `src/sentry/seer/agent/client_models.py` (`SeerRunState`)
|
|
2953
3063
|
*/
|
|
2954
|
-
const AutofixRunStateSchema = z.object({
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
3064
|
+
const AutofixRunStateSchema = z.object({
|
|
3065
|
+
autofix: z.object({
|
|
3066
|
+
run_id: z.number(),
|
|
3067
|
+
updated_at: z.string().nullable().optional(),
|
|
3068
|
+
status: AutofixStatusSchema,
|
|
3069
|
+
blocks: z.array(AutofixBlockSchema).default([]),
|
|
3070
|
+
pending_user_input: z.unknown().nullable().optional(),
|
|
3071
|
+
repo_pr_states: z.record(z.string(), z.object({ pr_url: z.string().nullable().optional() }).passthrough()).optional(),
|
|
3072
|
+
coding_agents: z.record(z.string(), z.unknown()).optional()
|
|
3073
|
+
}).passthrough().nullable(),
|
|
3074
|
+
formatted: z.object({
|
|
3075
|
+
format: z.string(),
|
|
3076
|
+
content: z.string()
|
|
3077
|
+
}).optional()
|
|
3078
|
+
});
|
|
2963
3079
|
const EventAttachmentSchema = z.object({
|
|
2964
3080
|
id: z.string(),
|
|
2965
3081
|
name: z.string(),
|
|
@@ -2970,6 +3086,11 @@ const EventAttachmentSchema = z.object({
|
|
|
2970
3086
|
headers: z.record(z.string(), z.string()).optional()
|
|
2971
3087
|
});
|
|
2972
3088
|
const EventAttachmentListSchema = z.array(EventAttachmentSchema);
|
|
3089
|
+
const OrganizationEnvironmentSchema = z.object({
|
|
3090
|
+
id: z.string(),
|
|
3091
|
+
name: z.string()
|
|
3092
|
+
});
|
|
3093
|
+
const OrganizationEnvironmentListSchema = z.array(OrganizationEnvironmentSchema);
|
|
2973
3094
|
/**
|
|
2974
3095
|
* Schema for individual tag values within an issue's tag distribution.
|
|
2975
3096
|
*
|
|
@@ -3532,11 +3653,27 @@ const AgenticOnboardingStageStatusUpdateSchema = z.enum([
|
|
|
3532
3653
|
"skipped",
|
|
3533
3654
|
"failed"
|
|
3534
3655
|
]);
|
|
3535
|
-
const
|
|
3536
|
-
|
|
3656
|
+
const AgenticOnboardingCreateProjectExtraSchema = z.object({ projectSlugs: z.array(z.string().trim().min(1)) }).strict();
|
|
3657
|
+
const AgenticOnboardingVerificationErrorExtraSchema = z.object({ issueIds: z.array(z.string().trim().min(1)) }).strict();
|
|
3658
|
+
const AgenticOnboardingStageWithoutExtraSchema = AgenticOnboardingStageSchema.exclude(["create_project", "receive_verification_error"]);
|
|
3659
|
+
const AgenticOnboardingStageStateBaseSchema = z.object({
|
|
3537
3660
|
status: AgenticOnboardingStageStatusSchema.nullable(),
|
|
3538
3661
|
eventNote: z.string().nullable()
|
|
3539
3662
|
});
|
|
3663
|
+
const AgenticOnboardingStageStateSchema = z.discriminatedUnion("stage", [
|
|
3664
|
+
AgenticOnboardingStageStateBaseSchema.extend({
|
|
3665
|
+
stage: z.literal("create_project"),
|
|
3666
|
+
extra: AgenticOnboardingCreateProjectExtraSchema.nullable()
|
|
3667
|
+
}),
|
|
3668
|
+
AgenticOnboardingStageStateBaseSchema.extend({
|
|
3669
|
+
stage: z.literal("receive_verification_error"),
|
|
3670
|
+
extra: AgenticOnboardingVerificationErrorExtraSchema.nullable()
|
|
3671
|
+
}),
|
|
3672
|
+
AgenticOnboardingStageStateBaseSchema.extend({
|
|
3673
|
+
stage: AgenticOnboardingStageWithoutExtraSchema,
|
|
3674
|
+
extra: z.null()
|
|
3675
|
+
})
|
|
3676
|
+
]);
|
|
3540
3677
|
const AgenticOnboardingRunStatusSchema = z.enum([
|
|
3541
3678
|
"active",
|
|
3542
3679
|
"completed",
|
|
@@ -3544,16 +3681,28 @@ const AgenticOnboardingRunStatusSchema = z.enum([
|
|
|
3544
3681
|
"cancelled"
|
|
3545
3682
|
]);
|
|
3546
3683
|
const AgenticOnboardingRunStatusUpdateSchema = z.enum(["completed", "failed"]);
|
|
3547
|
-
const
|
|
3684
|
+
const AgenticOnboardingRunTokenSchema = z.string().regex(/^[A-Za-z0-9]{10}$/);
|
|
3685
|
+
const AgenticOnboardingStatusUpdateBaseSchema = z.object({
|
|
3548
3686
|
schemaVersion: z.literal(1),
|
|
3549
|
-
runToken:
|
|
3550
|
-
stage: AgenticOnboardingStageSchema,
|
|
3687
|
+
runToken: AgenticOnboardingRunTokenSchema,
|
|
3551
3688
|
status: AgenticOnboardingStageStatusUpdateSchema,
|
|
3552
3689
|
runStatus: AgenticOnboardingRunStatusUpdateSchema.optional(),
|
|
3553
|
-
eventNote: z.string().trim().min(1).max(256).optional()
|
|
3554
|
-
projectSlugs: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
|
|
3555
|
-
issueIds: z.array(z.string().trim().min(1)).min(1).max(100).optional()
|
|
3690
|
+
eventNote: z.string().trim().min(1).max(256).optional()
|
|
3556
3691
|
});
|
|
3692
|
+
const AgenticOnboardingStatusUpdateSchema = z.discriminatedUnion("stage", [
|
|
3693
|
+
AgenticOnboardingStatusUpdateBaseSchema.extend({
|
|
3694
|
+
stage: z.literal("create_project"),
|
|
3695
|
+
extra: AgenticOnboardingCreateProjectExtraSchema.optional()
|
|
3696
|
+
}),
|
|
3697
|
+
AgenticOnboardingStatusUpdateBaseSchema.extend({
|
|
3698
|
+
stage: z.literal("receive_verification_error"),
|
|
3699
|
+
extra: AgenticOnboardingVerificationErrorExtraSchema.optional()
|
|
3700
|
+
}),
|
|
3701
|
+
AgenticOnboardingStatusUpdateBaseSchema.extend({
|
|
3702
|
+
stage: AgenticOnboardingStageWithoutExtraSchema,
|
|
3703
|
+
extra: z.never().optional()
|
|
3704
|
+
})
|
|
3705
|
+
]);
|
|
3557
3706
|
const AgenticOnboardingRunSchema = z.object({
|
|
3558
3707
|
schemaVersion: z.literal(1),
|
|
3559
3708
|
runId: z.string(),
|
|
@@ -3565,13 +3714,21 @@ const AgenticOnboardingRunSchema = z.object({
|
|
|
3565
3714
|
expiresAt: z.string(),
|
|
3566
3715
|
continueUpdates: z.boolean(),
|
|
3567
3716
|
runStatus: AgenticOnboardingRunStatusSchema,
|
|
3568
|
-
projectSlugs: z.array(z.string()).nullable().transform((projectSlugs) => projectSlugs ?? []),
|
|
3569
|
-
issueIds: z.array(z.string()).nullable().transform((issueIds) => issueIds ?? []),
|
|
3570
3717
|
stages: z.array(AgenticOnboardingStageStateSchema)
|
|
3571
3718
|
});
|
|
3719
|
+
/**
|
|
3720
|
+
* Response from the events-stats (timeseries) endpoint for a single yAxis:
|
|
3721
|
+
* a series of `[unixTimestampSeconds, [{ count }]]` buckets. `count` holds the
|
|
3722
|
+
* yAxis value for that bucket regardless of the aggregate function.
|
|
3723
|
+
*/
|
|
3724
|
+
const EventsStatsResponseSchema = z.object({
|
|
3725
|
+
data: z.array(z.tuple([z.number(), z.array(z.object({ count: z.number().nullish() }).passthrough())])),
|
|
3726
|
+
start: z.number().optional(),
|
|
3727
|
+
end: z.number().optional()
|
|
3728
|
+
}).passthrough();
|
|
3572
3729
|
|
|
3573
3730
|
//#endregion
|
|
3574
|
-
//#region ../mcp-core/dist/client-
|
|
3731
|
+
//#region ../mcp-core/dist/client-BXJ5ud71.js
|
|
3575
3732
|
const SENTRY_MCP_SEARCH_EVENTS_REFERRER = "api.mcp.search-events";
|
|
3576
3733
|
/**
|
|
3577
3734
|
* Mapping of common network error codes to user-friendly messages.
|
|
@@ -3592,9 +3749,6 @@ function formatWorkflowNameQuery(query) {
|
|
|
3592
3749
|
const escapedQuery = query.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
3593
3750
|
return `name:"*${escapedQuery}*"`;
|
|
3594
3751
|
}
|
|
3595
|
-
function filterAttachedIssueAlertRules(rules) {
|
|
3596
|
-
return rules.filter((rule) => (rule.detectorIds ?? []).length > 0);
|
|
3597
|
-
}
|
|
3598
3752
|
function parseStatsPeriod(statsPeriod) {
|
|
3599
3753
|
const match = /^(\d+)([smhdw])$/.exec(statsPeriod);
|
|
3600
3754
|
if (!match) throw new ApiValidationError("statsPeriod must use a supported relative time format, such as `24h`, `7d`, or `2w`.");
|
|
@@ -3612,6 +3766,24 @@ function getNextCursor(linkHeader) {
|
|
|
3612
3766
|
}
|
|
3613
3767
|
return null;
|
|
3614
3768
|
}
|
|
3769
|
+
/**
|
|
3770
|
+
* Automatic retry policy for transient upstream gateway failures (502/503/504).
|
|
3771
|
+
*
|
|
3772
|
+
* Sentry's edge intermittently returns short-lived gateway errors (e.g.
|
|
3773
|
+
* "upstream connect error or disconnect/reset before headers") that clear on a
|
|
3774
|
+
* retry. We retry only idempotent GET requests so an automatic retry can never
|
|
3775
|
+
* replay a mutation, and keep the budget small so a still-failing tool call
|
|
3776
|
+
* resolves quickly under the Cloudflare Workers request lifetime.
|
|
3777
|
+
*/
|
|
3778
|
+
const RETRYABLE_REQUEST_MAX_RETRIES = 2;
|
|
3779
|
+
const RETRYABLE_REQUEST_INITIAL_DELAY_MS = 250;
|
|
3780
|
+
/**
|
|
3781
|
+
* Default cap for returning attachment bytes inline over the MCP transport.
|
|
3782
|
+
* A 30 MB attachment takes ~80 MB in memory once base64-encoded and serialized,
|
|
3783
|
+
* which fits the Cloudflare Worker's 128 MB isolate with room for the rest of the
|
|
3784
|
+
* request; above it, getEventAttachment returns a reference instead of the bytes.
|
|
3785
|
+
*/
|
|
3786
|
+
const DEFAULT_MAX_INLINE_ATTACHMENT_BYTES = 30 * 1024 * 1024;
|
|
3615
3787
|
const TraceItemAttributeTypeSchema = z.enum([
|
|
3616
3788
|
"string",
|
|
3617
3789
|
"number",
|
|
@@ -3845,6 +4017,32 @@ var SentryApiService = class {
|
|
|
3845
4017
|
if (resolutionSeconds !== void 0) queryParams.set("resolution", `${resolutionSeconds}s`);
|
|
3846
4018
|
}
|
|
3847
4019
|
/**
|
|
4020
|
+
* Makes an authenticated request to the Sentry API, transparently retrying
|
|
4021
|
+
* transient upstream gateway failures (502/503/504).
|
|
4022
|
+
*
|
|
4023
|
+
* Retries are limited to idempotent GET requests so an automatic retry can
|
|
4024
|
+
* never replay a mutation, and are gated on `ApiServerError.isGatewayError()`
|
|
4025
|
+
* so persistent 500s, 4xx client errors, and network/configuration errors
|
|
4026
|
+
* fail fast without waiting. Callers that opt a 5xx into `allowStatuses`
|
|
4027
|
+
* receive the raw response from `requestOnce` and are never retried.
|
|
4028
|
+
*
|
|
4029
|
+
* @param path API endpoint path (without /api/0 prefix)
|
|
4030
|
+
* @param options Fetch options
|
|
4031
|
+
* @param requestOptions Additional request configuration
|
|
4032
|
+
* @returns Promise resolving to Response object
|
|
4033
|
+
* @throws {ApiError} Enhanced API errors with user-friendly messages
|
|
4034
|
+
* @throws {Error} Network or parsing errors
|
|
4035
|
+
*/
|
|
4036
|
+
async request(path, options = {}, requestOptions = {}) {
|
|
4037
|
+
const method = (options.method ?? "GET").toUpperCase();
|
|
4038
|
+
const isIdempotent = method === "GET";
|
|
4039
|
+
return retryWithBackoff(() => this.requestOnce(path, options, requestOptions), {
|
|
4040
|
+
maxRetries: isIdempotent ? RETRYABLE_REQUEST_MAX_RETRIES : 0,
|
|
4041
|
+
initialDelay: RETRYABLE_REQUEST_INITIAL_DELAY_MS,
|
|
4042
|
+
shouldRetry: (error) => error instanceof ApiServerError && error.isGatewayError()
|
|
4043
|
+
});
|
|
4044
|
+
}
|
|
4045
|
+
/**
|
|
3848
4046
|
* Internal method for making authenticated requests to Sentry API.
|
|
3849
4047
|
*
|
|
3850
4048
|
* Handles:
|
|
@@ -3860,7 +4058,7 @@ var SentryApiService = class {
|
|
|
3860
4058
|
* @throws {ApiError} Enhanced API errors with user-friendly messages
|
|
3861
4059
|
* @throws {Error} Network or parsing errors
|
|
3862
4060
|
*/
|
|
3863
|
-
async
|
|
4061
|
+
async requestOnce(path, options = {}, { host, allowStatuses } = {}) {
|
|
3864
4062
|
const url = host ? `${this.protocol}://${host}/api/0${path}` : `${this.apiPrefix}${path}`;
|
|
3865
4063
|
const headers = {
|
|
3866
4064
|
"Content-Type": "application/json",
|
|
@@ -4296,7 +4494,7 @@ var SentryApiService = class {
|
|
|
4296
4494
|
const queryString = queryParams.toString();
|
|
4297
4495
|
const path = `/organizations/?${queryString}`;
|
|
4298
4496
|
let host = void 0;
|
|
4299
|
-
if (this.isSaas()) host = "sentry.io";
|
|
4497
|
+
if (this.isSaas() && !this.host.endsWith(".my.sentry.io")) host = "sentry.io";
|
|
4300
4498
|
const body = await this.requestJSON(path, void 0, { host });
|
|
4301
4499
|
return OrganizationListSchema.parse(body);
|
|
4302
4500
|
}
|
|
@@ -4485,45 +4683,77 @@ var SentryApiService = class {
|
|
|
4485
4683
|
return page.rules;
|
|
4486
4684
|
}
|
|
4487
4685
|
async listIssueAlertRulesPage({ organizationSlug, projectSlug: projectSlug$1, query, cursor, limit }, opts) {
|
|
4488
|
-
const
|
|
4686
|
+
const searchQuery = new URLSearchParams({ sortBy: "-id" });
|
|
4687
|
+
if (projectSlug$1) searchQuery.set("projectSlug", projectSlug$1);
|
|
4688
|
+
if (query) searchQuery.set("query", formatWorkflowNameQuery(query));
|
|
4689
|
+
if (cursor) searchQuery.set("cursor", cursor);
|
|
4690
|
+
if (limit !== void 0) searchQuery.set("per_page", String(limit));
|
|
4691
|
+
const response = await this.request(apiPath`/organizations/${organizationSlug}/workflows/` + `?${searchQuery.toString()}`, void 0, opts);
|
|
4692
|
+
const rules = IssueAlertRuleListSchema.parse(await this.parseJsonResponse(response));
|
|
4489
4693
|
const targetLimit = limit ?? 100;
|
|
4490
|
-
let currentCursor = cursor;
|
|
4491
|
-
let nextCursor = null;
|
|
4492
|
-
do {
|
|
4493
|
-
const searchQuery = new URLSearchParams();
|
|
4494
|
-
searchQuery.append("projectSlug", projectSlug$1);
|
|
4495
|
-
searchQuery.set("sortBy", "-id");
|
|
4496
|
-
if (query) searchQuery.set("query", formatWorkflowNameQuery(query));
|
|
4497
|
-
if (currentCursor) searchQuery.set("cursor", currentCursor);
|
|
4498
|
-
if (limit !== void 0) searchQuery.set("per_page", String(targetLimit - rules.length));
|
|
4499
|
-
const response = await this.request(apiPath`/organizations/${organizationSlug}/workflows/` + `?${searchQuery.toString()}`, void 0, opts);
|
|
4500
|
-
const body = await this.parseJsonResponse(response);
|
|
4501
|
-
const attachedRules = filterAttachedIssueAlertRules(IssueAlertRuleListSchema.parse(body));
|
|
4502
|
-
const remaining = targetLimit - rules.length;
|
|
4503
|
-
if (attachedRules.length > remaining) {
|
|
4504
|
-
rules.push(...attachedRules.slice(0, remaining));
|
|
4505
|
-
nextCursor = null;
|
|
4506
|
-
break;
|
|
4507
|
-
}
|
|
4508
|
-
rules.push(...attachedRules);
|
|
4509
|
-
nextCursor = getNextCursor(response.headers.get("link"));
|
|
4510
|
-
currentCursor = nextCursor;
|
|
4511
|
-
} while (rules.length < targetLimit && nextCursor);
|
|
4512
4694
|
return {
|
|
4513
|
-
rules,
|
|
4514
|
-
nextCursor
|
|
4695
|
+
rules: rules.slice(0, targetLimit),
|
|
4696
|
+
nextCursor: rules.length > targetLimit ? null : getNextCursor(response.headers.get("link"))
|
|
4515
4697
|
};
|
|
4516
4698
|
}
|
|
4517
4699
|
async getIssueAlertRule({ organizationSlug, projectSlug: projectSlug$1, ruleId }, opts) {
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4700
|
+
if (projectSlug$1) {
|
|
4701
|
+
const [project, scope] = await Promise.all([this.getProject({
|
|
4702
|
+
organizationSlug,
|
|
4703
|
+
projectSlugOrId: projectSlug$1
|
|
4704
|
+
}, opts), this.getAlertRuleProjectScope({
|
|
4705
|
+
organizationSlug,
|
|
4706
|
+
ruleId
|
|
4707
|
+
}, opts)]);
|
|
4708
|
+
if (!scope.includesAllProjects && !scope.projectIds.includes(String(project.id))) throw new ApiNotFoundError("Workflow not found in this project", void 0, void 0, "workflow", String(ruleId));
|
|
4709
|
+
}
|
|
4710
|
+
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/workflows/${ruleId}/`, void 0, opts);
|
|
4711
|
+
return IssueAlertRuleSchema.parse(body);
|
|
4712
|
+
}
|
|
4713
|
+
/** Private Sentry endpoint: keep the complete association check separate from filtered lists. */
|
|
4714
|
+
async getAlertRuleProjectScope({ organizationSlug, ruleId }, opts) {
|
|
4715
|
+
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/workflows/${ruleId}/project-scope/`, void 0, opts);
|
|
4716
|
+
return AlertRuleProjectScopeSchema.parse(body);
|
|
4717
|
+
}
|
|
4718
|
+
async getDetector({ organizationSlug, detectorId }, opts) {
|
|
4719
|
+
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/detectors/${detectorId}/`, void 0, opts);
|
|
4720
|
+
return DetectorSchema.parse(body);
|
|
4721
|
+
}
|
|
4722
|
+
async listDetectorsPage({ organizationSlug, projectId, types, query, cursor, limit = 25 }, opts) {
|
|
4723
|
+
const search = new URLSearchParams({
|
|
4724
|
+
project: projectId ?? "-1",
|
|
4725
|
+
per_page: String(limit)
|
|
4726
|
+
});
|
|
4727
|
+
for (const type of types ?? []) search.append("type", type);
|
|
4728
|
+
if (query) search.set("query", query);
|
|
4729
|
+
if (cursor) search.set("cursor", cursor);
|
|
4730
|
+
const response = await this.request(`${apiPath`/organizations/${organizationSlug}/detectors/`}?${search}`, void 0, opts);
|
|
4731
|
+
return {
|
|
4732
|
+
detectors: z.array(DetectorSchema).parse(await this.parseJsonResponse(response)),
|
|
4733
|
+
nextCursor: getNextCursor(response.headers.get("link"))
|
|
4734
|
+
};
|
|
4735
|
+
}
|
|
4736
|
+
async listAvailableAlertActionsPage({ organizationSlug, types, cursor, limit = 25 }, opts) {
|
|
4737
|
+
const search = new URLSearchParams({ per_page: String(limit) });
|
|
4738
|
+
for (const type of types ?? []) search.append("type", type);
|
|
4739
|
+
if (cursor) search.set("cursor", cursor);
|
|
4740
|
+
const response = await this.request(`${apiPath`/organizations/${organizationSlug}/available-actions/`}?${search}`, void 0, opts);
|
|
4741
|
+
return {
|
|
4742
|
+
actions: z.array(AlertActionOptionSchema).parse(await this.parseJsonResponse(response)),
|
|
4743
|
+
nextCursor: getNextCursor(response.headers.get("link"))
|
|
4744
|
+
};
|
|
4745
|
+
}
|
|
4746
|
+
async listAlertConditionsPage({ organizationSlug, group, cursor, limit = 25 }, opts) {
|
|
4747
|
+
const search = new URLSearchParams({
|
|
4748
|
+
group,
|
|
4749
|
+
per_page: String(limit)
|
|
4750
|
+
});
|
|
4751
|
+
if (cursor) search.set("cursor", cursor);
|
|
4752
|
+
const response = await this.request(`${apiPath`/organizations/${organizationSlug}/data-conditions/`}?${search}`, void 0, opts);
|
|
4753
|
+
return {
|
|
4754
|
+
conditions: z.array(AlertConditionOptionSchema).parse(await this.parseJsonResponse(response)),
|
|
4755
|
+
nextCursor: getNextCursor(response.headers.get("link"))
|
|
4756
|
+
};
|
|
4527
4757
|
}
|
|
4528
4758
|
async listMetricAlertRules(params, opts) {
|
|
4529
4759
|
const page = await this.listMetricAlertRulesPage(params, opts);
|
|
@@ -5010,6 +5240,20 @@ var SentryApiService = class {
|
|
|
5010
5240
|
const body = await this.parseJsonResponse(response);
|
|
5011
5241
|
return EventsValidationResponseSchema.parse(body);
|
|
5012
5242
|
}
|
|
5243
|
+
/**
|
|
5244
|
+
* List the organization's visible environments, optionally scoped to a
|
|
5245
|
+
* project. The endpoint (`GET /organizations/{org}/environments/`) already
|
|
5246
|
+
* filters to visible environments and excludes the empty-name "No Environment"
|
|
5247
|
+
* pseudo-env; passing `project` narrows the list (verified against
|
|
5248
|
+
* getsentry/sentry `OrganizationEnvironmentsEndpoint`).
|
|
5249
|
+
*/
|
|
5250
|
+
async listEnvironments({ organizationSlug, projectId }, opts) {
|
|
5251
|
+
const queryParams = new URLSearchParams();
|
|
5252
|
+
if (projectId) queryParams.set("project", projectId);
|
|
5253
|
+
const suffix = queryParams.toString();
|
|
5254
|
+
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/environments/` + (suffix ? `?${suffix}` : ""), void 0, opts);
|
|
5255
|
+
return OrganizationEnvironmentListSchema.parse(body);
|
|
5256
|
+
}
|
|
5013
5257
|
async fetchTraceItemAttributes(organizationSlug, itemType, project, statsPeriod, start, end, substringMatch, query, opts) {
|
|
5014
5258
|
const queryParams = new URLSearchParams();
|
|
5015
5259
|
queryParams.set("itemType", itemType);
|
|
@@ -5132,7 +5376,7 @@ var SentryApiService = class {
|
|
|
5132
5376
|
};
|
|
5133
5377
|
}
|
|
5134
5378
|
async getEventForIssue({ organizationSlug, issueId, eventId }, opts) {
|
|
5135
|
-
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/issues/${issueId}/events/${eventId}
|
|
5379
|
+
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/issues/${issueId}/events/${eventId}/` + `?llmFormat=json`, void 0, opts);
|
|
5136
5380
|
const parseResult = EventSchema.safeParse(body);
|
|
5137
5381
|
if (parseResult.success) {
|
|
5138
5382
|
const rawEvent = parseResult.data;
|
|
@@ -5205,22 +5449,52 @@ var SentryApiService = class {
|
|
|
5205
5449
|
const body = await this.requestJSON(apiPath`/projects/${organizationSlug}/${projectSlug$1}/events/${eventId}/attachments/`, void 0, opts);
|
|
5206
5450
|
return EventAttachmentListSchema.parse(body);
|
|
5207
5451
|
}
|
|
5208
|
-
async getEventAttachment({ organizationSlug, projectSlug: projectSlug$1, eventId, attachmentId }, opts) {
|
|
5452
|
+
async getEventAttachment({ organizationSlug, projectSlug: projectSlug$1, eventId, attachmentId, maxInlineBytes = DEFAULT_MAX_INLINE_ATTACHMENT_BYTES }, opts) {
|
|
5209
5453
|
const attachmentsData = await this.requestJSON(apiPath`/projects/${organizationSlug}/${projectSlug$1}/events/${eventId}/attachments/`, void 0, opts);
|
|
5210
5454
|
const attachments = EventAttachmentListSchema.parse(attachmentsData);
|
|
5211
5455
|
const attachment = attachments.find((att) => att.id === attachmentId);
|
|
5212
5456
|
if (!attachment) throw new ApiNotFoundError(`Attachment with ID ${attachmentId} not found for event ${eventId}`);
|
|
5213
|
-
const
|
|
5214
|
-
|
|
5457
|
+
const downloadPath = apiPath`/projects/${organizationSlug}/${projectSlug$1}/events/${eventId}/attachments/${attachmentId}/` + `?download=1`;
|
|
5458
|
+
if (attachment.size > maxInlineBytes) {
|
|
5459
|
+
const directDownloadUrl = await this.resolveDirectDownloadUrl(downloadPath, opts);
|
|
5460
|
+
return {
|
|
5461
|
+
attachment,
|
|
5462
|
+
downloadUrl: `${this.apiPrefix}${downloadPath}`,
|
|
5463
|
+
directDownloadUrl,
|
|
5464
|
+
filename: attachment.name,
|
|
5465
|
+
bytes: null,
|
|
5466
|
+
contentType: attachment.mimetype || "application/octet-stream"
|
|
5467
|
+
};
|
|
5468
|
+
}
|
|
5469
|
+
const downloadResponse = await this.request(downloadPath, { method: "GET" }, opts);
|
|
5215
5470
|
const contentType = downloadResponse.headers.get("content-type")?.split(";")[0].trim() || attachment.mimetype || "application/octet-stream";
|
|
5471
|
+
const bytes = new Uint8Array(await downloadResponse.arrayBuffer());
|
|
5216
5472
|
return {
|
|
5217
5473
|
attachment,
|
|
5218
5474
|
downloadUrl: downloadResponse.url,
|
|
5475
|
+
directDownloadUrl: null,
|
|
5219
5476
|
filename: attachment.name,
|
|
5220
|
-
|
|
5477
|
+
bytes,
|
|
5221
5478
|
contentType
|
|
5222
5479
|
};
|
|
5223
5480
|
}
|
|
5481
|
+
/**
|
|
5482
|
+
* Probe the download endpoint for a presigned URL without buffering the file.
|
|
5483
|
+
*
|
|
5484
|
+
* Objectstore attachments redirect to a presigned URL (returned here); legacy
|
|
5485
|
+
* ones stream a 200 with no redirect, so there is no direct URL. The body is
|
|
5486
|
+
* discarded either way — we only need the URL.
|
|
5487
|
+
*/
|
|
5488
|
+
async resolveDirectDownloadUrl(downloadPath, opts) {
|
|
5489
|
+
try {
|
|
5490
|
+
const response = await this.request(downloadPath, { method: "GET" }, opts);
|
|
5491
|
+
const directUrl = response.redirected ? response.url : null;
|
|
5492
|
+
response.body?.cancel().catch(() => {});
|
|
5493
|
+
return directUrl;
|
|
5494
|
+
} catch {
|
|
5495
|
+
return null;
|
|
5496
|
+
}
|
|
5497
|
+
}
|
|
5224
5498
|
async getReplayDetails({ organizationSlug, replayId }, opts) {
|
|
5225
5499
|
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/replays/${replayId}/`, void 0, opts);
|
|
5226
5500
|
return z.object({ data: ReplayDetailsSchema }).parse(body).data;
|
|
@@ -5244,7 +5518,7 @@ var SentryApiService = class {
|
|
|
5244
5518
|
async updateIssue({ organizationSlug, issueId, status, assignedTo, substatus, ignoreDuration, ignoreCount, ignoreWindow, ignoreUserCount, ignoreUserWindow }, opts) {
|
|
5245
5519
|
const updateData = {};
|
|
5246
5520
|
if (status !== void 0) updateData.status = status;
|
|
5247
|
-
if (assignedTo !== void 0) updateData.assignedTo = assignedTo;
|
|
5521
|
+
if (assignedTo !== void 0) updateData.assignedTo = assignedTo ?? "";
|
|
5248
5522
|
if (substatus !== void 0) updateData.substatus = substatus;
|
|
5249
5523
|
if (ignoreDuration !== void 0) updateData.ignoreDuration = ignoreDuration;
|
|
5250
5524
|
if (ignoreCount !== void 0) updateData.ignoreCount = ignoreCount;
|
|
@@ -5392,6 +5666,27 @@ var SentryApiService = class {
|
|
|
5392
5666
|
const apiUrl = apiPath`/organizations/${organizationSlug}/events/` + `?${queryParams.toString()}`;
|
|
5393
5667
|
return await this.requestJSON(apiUrl, void 0, opts);
|
|
5394
5668
|
}
|
|
5669
|
+
/**
|
|
5670
|
+
* Fetch a timeseries (events-stats) for a single yAxis, bucketed over time.
|
|
5671
|
+
*
|
|
5672
|
+
* `interval` is optional: omit it to let Sentry pick a sensible bucket size
|
|
5673
|
+
* for the range (mirrors get_interval_from_range in the Sentry source).
|
|
5674
|
+
* Environment and other filters travel in `query`, same as searchEvents.
|
|
5675
|
+
*/
|
|
5676
|
+
async getEventsTimeSeries({ organizationSlug, query, yAxis, interval, projectId, dataset = "errors", statsPeriod, start, end }, opts) {
|
|
5677
|
+
const queryParams = new URLSearchParams();
|
|
5678
|
+
queryParams.set("dataset", normalizeEventsDataset(dataset));
|
|
5679
|
+
queryParams.set("query", query);
|
|
5680
|
+
queryParams.set("yAxis", yAxis);
|
|
5681
|
+
if (interval) queryParams.set("interval", interval);
|
|
5682
|
+
this.applyTimeParams(queryParams, statsPeriod, start, end);
|
|
5683
|
+
if (projectId) queryParams.set("project", projectId);
|
|
5684
|
+
queryParams.set("partial", "1");
|
|
5685
|
+
queryParams.set("referrer", SENTRY_MCP_SEARCH_EVENTS_REFERRER);
|
|
5686
|
+
const apiUrl = apiPath`/organizations/${organizationSlug}/events-stats/` + `?${queryParams.toString()}`;
|
|
5687
|
+
const body = await this.requestJSON(apiUrl, void 0, opts);
|
|
5688
|
+
return EventsStatsResponseSchema.parse(body);
|
|
5689
|
+
}
|
|
5395
5690
|
async startAutofix({ organizationSlug, issueId, eventId, instruction = "" }, opts) {
|
|
5396
5691
|
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/issues/${issueId}/autofix/`, {
|
|
5397
5692
|
method: "POST",
|
|
@@ -5403,7 +5698,7 @@ var SentryApiService = class {
|
|
|
5403
5698
|
return AutofixRunSchema.parse(body);
|
|
5404
5699
|
}
|
|
5405
5700
|
async getAutofixState({ organizationSlug, issueId }, opts) {
|
|
5406
|
-
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/issues/${issueId}/autofix
|
|
5701
|
+
const body = await this.requestJSON(apiPath`/organizations/${organizationSlug}/issues/${issueId}/autofix/` + `?llmFormat=markdown`, void 0, opts);
|
|
5407
5702
|
return AutofixRunStateSchema.parse(body);
|
|
5408
5703
|
}
|
|
5409
5704
|
/**
|
|
@@ -5481,7 +5776,7 @@ var SentryApiService = class {
|
|
|
5481
5776
|
const projects = Array.isArray(project) ? project : [project];
|
|
5482
5777
|
for (const projectId of projects) queryParams.append("project", projectId);
|
|
5483
5778
|
if (cursor) queryParams.set("cursor", cursor);
|
|
5484
|
-
const response = await this.request(apiPath`/organizations/${organizationSlug}/
|
|
5779
|
+
const response = await this.request(apiPath`/organizations/${organizationSlug}/agents/conversations/${conversationId}/` + `?${queryParams.toString()}`, void 0, opts);
|
|
5485
5780
|
const body = await this.parseJsonResponse(response);
|
|
5486
5781
|
const details = AIConversationDetailsResponseSchema.parse(body);
|
|
5487
5782
|
title = details.title;
|
|
@@ -5513,7 +5808,7 @@ var SentryApiService = class {
|
|
|
5513
5808
|
this.applyTimeParams(queryParams, statsPeriod, start, end);
|
|
5514
5809
|
if (limit !== void 0) queryParams.set("per_page", String(limit));
|
|
5515
5810
|
if (cursor) queryParams.set("cursor", cursor);
|
|
5516
|
-
const response = await this.request(apiPath`/organizations/${organizationSlug}/
|
|
5811
|
+
const response = await this.request(apiPath`/organizations/${organizationSlug}/agents/conversations/` + `?${queryParams.toString()}`, void 0, opts);
|
|
5517
5812
|
const body = await this.parseJsonResponse(response);
|
|
5518
5813
|
return {
|
|
5519
5814
|
conversations: AIConversationSummaryListSchema.parse(body),
|
|
@@ -5634,7 +5929,7 @@ var SentryApiService = class {
|
|
|
5634
5929
|
const blob = await response.blob();
|
|
5635
5930
|
let contentType = response.headers.get("content-type") ?? "";
|
|
5636
5931
|
if (!contentType.startsWith("image/")) {
|
|
5637
|
-
const { detectImageMimeType } = await import("./blob-utils-
|
|
5932
|
+
const { detectImageMimeType } = await import("./blob-utils-CJyQkdm-.js");
|
|
5638
5933
|
contentType = await detectImageMimeType(blob) ?? contentType;
|
|
5639
5934
|
}
|
|
5640
5935
|
return {
|
|
@@ -13131,7 +13426,7 @@ var _a19;
|
|
|
13131
13426
|
_a19 = symbol19;
|
|
13132
13427
|
|
|
13133
13428
|
//#endregion
|
|
13134
|
-
//#region ../mcp-core/dist/error-handling-
|
|
13429
|
+
//#region ../mcp-core/dist/error-handling-ChAIYsge.js
|
|
13135
13430
|
/**
|
|
13136
13431
|
* Type guard to identify user input validation errors.
|
|
13137
13432
|
*/
|
|
@@ -13333,9 +13628,19 @@ async function formatErrorForUser(error, options) {
|
|
|
13333
13628
|
}
|
|
13334
13629
|
return parts.join("\n\n");
|
|
13335
13630
|
}
|
|
13631
|
+
/**
|
|
13632
|
+
* Invoke a tool's onError hook for failure telemetry, isolated so a misbehaving
|
|
13633
|
+
* hook can't disrupt the surrounding error handling. Call this at every point
|
|
13634
|
+
* where a tool handler is run and may throw.
|
|
13635
|
+
*/
|
|
13636
|
+
function recordToolFailure(tool$1, error, params, context$1) {
|
|
13637
|
+
try {
|
|
13638
|
+
tool$1.onError?.(error, params, context$1);
|
|
13639
|
+
} catch {}
|
|
13640
|
+
}
|
|
13336
13641
|
|
|
13337
13642
|
//#endregion
|
|
13338
|
-
//#region ../mcp-core/dist/constraint-helpers-
|
|
13643
|
+
//#region ../mcp-core/dist/constraint-helpers-DQeAySy6.js
|
|
13339
13644
|
/**
|
|
13340
13645
|
* Determines which tool parameter keys should be filtered out of the schema
|
|
13341
13646
|
* because they will be injected from constraints.
|
|
@@ -13397,7 +13702,7 @@ function getConstraintParametersToInject(constraints, toolInputSchema) {
|
|
|
13397
13702
|
}
|
|
13398
13703
|
|
|
13399
13704
|
//#endregion
|
|
13400
|
-
//#region ../mcp-core/dist/surfaces-
|
|
13705
|
+
//#region ../mcp-core/dist/surfaces-DCc7zT-1.js
|
|
13401
13706
|
/**
|
|
13402
13707
|
* Central policy for direct MCP exposure.
|
|
13403
13708
|
*
|
|
@@ -13432,7 +13737,7 @@ function isCatalogInfrastructureToolName(toolName) {
|
|
|
13432
13737
|
}
|
|
13433
13738
|
|
|
13434
13739
|
//#endregion
|
|
13435
|
-
//#region ../mcp-core/dist/types-
|
|
13740
|
+
//#region ../mcp-core/dist/types-DzNDeR5X.js
|
|
13436
13741
|
/**
|
|
13437
13742
|
* Resolves a tool description to a string.
|
|
13438
13743
|
* Handles both static strings and dynamic description functions.
|
|
@@ -13450,7 +13755,7 @@ function isToolVisibleInMode(tool$1, experimentalMode) {
|
|
|
13450
13755
|
}
|
|
13451
13756
|
|
|
13452
13757
|
//#endregion
|
|
13453
|
-
//#region ../mcp-core/dist/availability-
|
|
13758
|
+
//#region ../mcp-core/dist/availability-KeZ7TRFd.js
|
|
13454
13759
|
function getToolPlacement({ key, experimentalMode, useDefaultSurfacePolicy }) {
|
|
13455
13760
|
if (useDefaultSurfacePolicy) return {
|
|
13456
13761
|
isCatalogTool: !isOutsideCatalogToolName(key),
|
|
@@ -13548,13 +13853,13 @@ function resolveToolDescription(tool$1, context$1) {
|
|
|
13548
13853
|
}
|
|
13549
13854
|
|
|
13550
13855
|
//#endregion
|
|
13551
|
-
//#region ../mcp-core/dist/define-
|
|
13856
|
+
//#region ../mcp-core/dist/define-CmkKwzq9.js
|
|
13552
13857
|
function defineTool(config) {
|
|
13553
13858
|
return config;
|
|
13554
13859
|
}
|
|
13555
13860
|
|
|
13556
13861
|
//#endregion
|
|
13557
|
-
//#region ../mcp-core/dist/validate-region-url-
|
|
13862
|
+
//#region ../mcp-core/dist/validate-region-url-DbvSZfG2.js
|
|
13558
13863
|
/**
|
|
13559
13864
|
* Validates that a regionUrl is valid.
|
|
13560
13865
|
* Prevents SSRF attacks by only allowing the base host itself or domains from an allowlist.
|
|
@@ -13586,7 +13891,7 @@ function validateRegionUrl(regionUrl, baseHost) {
|
|
|
13586
13891
|
}
|
|
13587
13892
|
|
|
13588
13893
|
//#endregion
|
|
13589
|
-
//#region ../mcp-core/dist/api-
|
|
13894
|
+
//#region ../mcp-core/dist/api-D4GH5wp9.js
|
|
13590
13895
|
/**
|
|
13591
13896
|
* Create a Sentry API service from server context with optional region override
|
|
13592
13897
|
* @param context - Server context containing host and access token
|
|
@@ -13612,17 +13917,35 @@ function apiServiceFromContext(context$1, opts = {}) {
|
|
|
13612
13917
|
}
|
|
13613
13918
|
|
|
13614
13919
|
//#endregion
|
|
13615
|
-
//#region ../mcp-core/dist/results-
|
|
13920
|
+
//#region ../mcp-core/dist/results-zMvHfnlV.js
|
|
13921
|
+
/**
|
|
13922
|
+
* Tool result packing policy
|
|
13923
|
+
*
|
|
13924
|
+
* - `structuredContent` is the source of truth when present.
|
|
13925
|
+
* - `content` text is a compatibility view of that same answer.
|
|
13926
|
+
* - Never put unique product data in only one side. If both fields are present,
|
|
13927
|
+
* they must be equivalent. Form-only differences (JSON vs pretty text of the
|
|
13928
|
+
* same payload) are fine; a second answer that exists in only one field is a
|
|
13929
|
+
* bug.
|
|
13930
|
+
* - Prefer `structuredResult(payload)` for data tools. The server generates
|
|
13931
|
+
* `content` as pretty JSON of the same payload.
|
|
13932
|
+
* - Markdown-only tools should return markdown and omit `structuredContent`
|
|
13933
|
+
* until they have a real structured payload. Do not attach sparse structured
|
|
13934
|
+
* side-channels (for example suggestedActions alone) on top of markdown.
|
|
13935
|
+
*/
|
|
13616
13936
|
/**
|
|
13617
13937
|
* Marks a tool result as structured-only. The server generates compatibility
|
|
13618
13938
|
* text for clients that do not read structuredContent yet.
|
|
13939
|
+
*
|
|
13940
|
+
* The returned payload is the full answer. Do not use this helper to ship a
|
|
13941
|
+
* partial hint while leaving the real answer only in handwritten markdown.
|
|
13619
13942
|
*/
|
|
13620
13943
|
function structuredResult(structuredContent) {
|
|
13621
13944
|
return { structuredContent };
|
|
13622
13945
|
}
|
|
13623
13946
|
|
|
13624
13947
|
//#endregion
|
|
13625
|
-
//#region ../mcp-core/dist/whoami-
|
|
13948
|
+
//#region ../mcp-core/dist/whoami-DthGP5fH.js
|
|
13626
13949
|
const whoamiOutputSchema = z.object({
|
|
13627
13950
|
user: z.object({
|
|
13628
13951
|
id: z.string(),
|
|
@@ -13673,7 +13996,33 @@ var whoami_default = defineTool({
|
|
|
13673
13996
|
});
|
|
13674
13997
|
|
|
13675
13998
|
//#endregion
|
|
13676
|
-
//#region ../mcp-core/dist/
|
|
13999
|
+
//#region ../mcp-core/dist/get-sentry-mcp-info-Dg-_VZlQ.js
|
|
14000
|
+
const getSentryMcpInfoOutputSchema = z.object({ version: z.string().describe("The Sentry MCP server version.") });
|
|
14001
|
+
var get_sentry_mcp_info_default = defineTool({
|
|
14002
|
+
name: "get_sentry_mcp_info",
|
|
14003
|
+
description: [
|
|
14004
|
+
"Get information about the running Sentry MCP server.",
|
|
14005
|
+
"",
|
|
14006
|
+
"Use this tool when you need to:",
|
|
14007
|
+
"- Check the Sentry MCP server version",
|
|
14008
|
+
"- Verify compatibility with a Skill or integration"
|
|
14009
|
+
].join("\n"),
|
|
14010
|
+
inputSchema: {},
|
|
14011
|
+
outputSchema: getSentryMcpInfoOutputSchema,
|
|
14012
|
+
skills: ALL_SKILLS,
|
|
14013
|
+
requiredScopes: [],
|
|
14014
|
+
annotations: {
|
|
14015
|
+
readOnlyHint: true,
|
|
14016
|
+
destructiveHint: false,
|
|
14017
|
+
openWorldHint: false
|
|
14018
|
+
},
|
|
14019
|
+
async handler() {
|
|
14020
|
+
return structuredResult({ version: LIB_VERSION });
|
|
14021
|
+
}
|
|
14022
|
+
});
|
|
14023
|
+
|
|
14024
|
+
//#endregion
|
|
14025
|
+
//#region ../mcp-core/dist/find-organizations-BjoY7_gy.js
|
|
13677
14026
|
const RESULT_LIMIT$3 = 25;
|
|
13678
14027
|
const findOrganizationsOutputSchema = z.object({
|
|
13679
14028
|
organizations: z.array(z.object({
|
|
@@ -13725,7 +14074,14 @@ var find_organizations_default = defineTool({
|
|
|
13725
14074
|
});
|
|
13726
14075
|
|
|
13727
14076
|
//#endregion
|
|
13728
|
-
//#region ../mcp-core/dist/
|
|
14077
|
+
//#region ../mcp-core/dist/organization-KfwiyEVH.js
|
|
14078
|
+
function setOrganizationContext(organizationSlug) {
|
|
14079
|
+
setAttribute("organization.slug", organizationSlug);
|
|
14080
|
+
setTag("organization.slug", organizationSlug);
|
|
14081
|
+
}
|
|
14082
|
+
|
|
14083
|
+
//#endregion
|
|
14084
|
+
//#region ../mcp-core/dist/find-teams-C5yde5nc.js
|
|
13729
14085
|
const RESULT_LIMIT$2 = 25;
|
|
13730
14086
|
const findTeamsOutputSchema = z.object({
|
|
13731
14087
|
teams: z.array(z.object({
|
|
@@ -13767,7 +14123,7 @@ var find_teams_default = defineTool({
|
|
|
13767
14123
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
13768
14124
|
const organizationSlug = params.organizationSlug;
|
|
13769
14125
|
if (!organizationSlug) throw new UserInputError("Organization slug is required. Please provide an organizationSlug parameter.");
|
|
13770
|
-
|
|
14126
|
+
setOrganizationContext(organizationSlug);
|
|
13771
14127
|
const teams = await apiService.listTeams(organizationSlug, {
|
|
13772
14128
|
query: params.query ?? void 0,
|
|
13773
14129
|
limit: RESULT_LIMIT$2 + 1
|
|
@@ -13783,7 +14139,7 @@ var find_teams_default = defineTool({
|
|
|
13783
14139
|
});
|
|
13784
14140
|
|
|
13785
14141
|
//#endregion
|
|
13786
|
-
//#region ../mcp-core/dist/find-projects-
|
|
14142
|
+
//#region ../mcp-core/dist/find-projects-DBOb3oe-.js
|
|
13787
14143
|
const RESULT_LIMIT$1 = 25;
|
|
13788
14144
|
const findProjectsOutputSchema = z.object({
|
|
13789
14145
|
projects: z.array(z.object({ slug: z.string() })),
|
|
@@ -13818,7 +14174,7 @@ var find_projects_default = defineTool({
|
|
|
13818
14174
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
13819
14175
|
const organizationSlug = params.organizationSlug;
|
|
13820
14176
|
if (!organizationSlug) throw new UserInputError("Organization slug is required. Please provide an organizationSlug parameter.");
|
|
13821
|
-
|
|
14177
|
+
setOrganizationContext(organizationSlug);
|
|
13822
14178
|
const projects = await apiService.listProjects(organizationSlug, {
|
|
13823
14179
|
query: params.query ?? void 0,
|
|
13824
14180
|
limit: RESULT_LIMIT$1 + 1
|
|
@@ -13831,7 +14187,7 @@ var find_projects_default = defineTool({
|
|
|
13831
14187
|
});
|
|
13832
14188
|
|
|
13833
14189
|
//#endregion
|
|
13834
|
-
//#region ../mcp-core/dist/find-releases-
|
|
14190
|
+
//#region ../mcp-core/dist/find-releases-BF8-U7mW.js
|
|
13835
14191
|
const RESULT_LIMIT = 25;
|
|
13836
14192
|
const findReleasesOutputSchema = z.object({
|
|
13837
14193
|
releases: z.array(z.object({
|
|
@@ -13904,7 +14260,7 @@ var find_releases_default = defineTool({
|
|
|
13904
14260
|
async handler(params, context$1) {
|
|
13905
14261
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
13906
14262
|
const organizationSlug = params.organizationSlug;
|
|
13907
|
-
|
|
14263
|
+
setOrganizationContext(organizationSlug);
|
|
13908
14264
|
const releases = await apiService.listReleases({
|
|
13909
14265
|
organizationSlug,
|
|
13910
14266
|
projectSlug: params.projectSlug ?? void 0,
|
|
@@ -13939,13 +14295,13 @@ var find_releases_default = defineTool({
|
|
|
13939
14295
|
});
|
|
13940
14296
|
|
|
13941
14297
|
//#endregion
|
|
13942
|
-
//#region ../mcp-core/dist/type-guards-
|
|
14298
|
+
//#region ../mcp-core/dist/type-guards-CsRf3nQI.js
|
|
13943
14299
|
function isPlainObject$3(value) {
|
|
13944
14300
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13945
14301
|
}
|
|
13946
14302
|
|
|
13947
14303
|
//#endregion
|
|
13948
|
-
//#region ../mcp-core/dist/api-formatting-
|
|
14304
|
+
//#region ../mcp-core/dist/api-formatting-Czl92Wir.js
|
|
13949
14305
|
function formatId(value) {
|
|
13950
14306
|
return value === void 0 || value === null ? "unknown" : String(value);
|
|
13951
14307
|
}
|
|
@@ -13982,7 +14338,7 @@ function compactLines(lines) {
|
|
|
13982
14338
|
}
|
|
13983
14339
|
|
|
13984
14340
|
//#endregion
|
|
13985
|
-
//#region ../mcp-core/dist/project-constraints-
|
|
14341
|
+
//#region ../mcp-core/dist/project-constraints-B-KhJpNB.js
|
|
13986
14342
|
function projectConstraintError(resourceLabel, projectSlug$1) {
|
|
13987
14343
|
return new UserInputError(`${resourceLabel} is outside the active project constraint. Expected project "${projectSlug$1}".`);
|
|
13988
14344
|
}
|
|
@@ -14000,7 +14356,7 @@ function assertProjectListContainsConstraint({ resourceLabel, scopedProjectSlug,
|
|
|
14000
14356
|
}
|
|
14001
14357
|
|
|
14002
14358
|
//#endregion
|
|
14003
|
-
//#region ../mcp-core/dist/get-release-details-
|
|
14359
|
+
//#region ../mcp-core/dist/get-release-details-DvY_TDet.js
|
|
14004
14360
|
function formatProjects(release) {
|
|
14005
14361
|
if (!release.projects || release.projects.length === 0) return null;
|
|
14006
14362
|
return release.projects.map((project) => project.slug ?? project.name).join(", ");
|
|
@@ -14072,7 +14428,7 @@ var get_release_details_default = defineTool({
|
|
|
14072
14428
|
async handler(params, context$1) {
|
|
14073
14429
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14074
14430
|
const organizationSlug = params.organizationSlug;
|
|
14075
|
-
|
|
14431
|
+
setOrganizationContext(organizationSlug);
|
|
14076
14432
|
setTag("release.version", params.releaseVersion);
|
|
14077
14433
|
const scopedProjectSlug = context$1.constraints.projectSlug ?? void 0;
|
|
14078
14434
|
const requestedProjectSlugOrId = params.projectSlugOrId ?? void 0;
|
|
@@ -14152,7 +14508,7 @@ var get_release_details_default = defineTool({
|
|
|
14152
14508
|
});
|
|
14153
14509
|
|
|
14154
14510
|
//#endregion
|
|
14155
|
-
//#region ../mcp-core/dist/dashboards-
|
|
14511
|
+
//#region ../mcp-core/dist/dashboards-CHADwOiv.js
|
|
14156
14512
|
function formatList(values) {
|
|
14157
14513
|
if (!values || values.length === 0) return null;
|
|
14158
14514
|
return values.map(String).join(", ");
|
|
@@ -14284,7 +14640,7 @@ async function resolveDashboardId({ apiService, organizationSlug, dashboardIdOrT
|
|
|
14284
14640
|
}
|
|
14285
14641
|
|
|
14286
14642
|
//#endregion
|
|
14287
|
-
//#region ../mcp-core/dist/find-dashboards-
|
|
14643
|
+
//#region ../mcp-core/dist/find-dashboards-oyqvVv8a.js
|
|
14288
14644
|
const PROJECT_DASHBOARD_CURSOR_PREFIX = "mcp-dashboard-project:";
|
|
14289
14645
|
const dashboardSummarySchema = z.object({
|
|
14290
14646
|
id: z.string(),
|
|
@@ -14443,7 +14799,7 @@ var find_dashboards_default = defineTool({
|
|
|
14443
14799
|
async handler(params, context$1) {
|
|
14444
14800
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14445
14801
|
const organizationSlug = params.organizationSlug;
|
|
14446
|
-
|
|
14802
|
+
setOrganizationContext(organizationSlug);
|
|
14447
14803
|
const scopedProject = await resolveDashboardProjectConstraint({
|
|
14448
14804
|
apiService,
|
|
14449
14805
|
organizationSlug,
|
|
@@ -14495,7 +14851,7 @@ var find_dashboards_default = defineTool({
|
|
|
14495
14851
|
});
|
|
14496
14852
|
|
|
14497
14853
|
//#endregion
|
|
14498
|
-
//#region ../mcp-core/dist/get-dashboard-details-
|
|
14854
|
+
//#region ../mcp-core/dist/get-dashboard-details-D_U6hOFe.js
|
|
14499
14855
|
var get_dashboard_details_default = defineTool({
|
|
14500
14856
|
name: "get_dashboard_details",
|
|
14501
14857
|
skills: ["inspect"],
|
|
@@ -14532,7 +14888,7 @@ var get_dashboard_details_default = defineTool({
|
|
|
14532
14888
|
async handler(params, context$1) {
|
|
14533
14889
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14534
14890
|
const organizationSlug = params.organizationSlug;
|
|
14535
|
-
|
|
14891
|
+
setOrganizationContext(organizationSlug);
|
|
14536
14892
|
const scopedProject = await resolveDashboardProjectConstraint({
|
|
14537
14893
|
apiService,
|
|
14538
14894
|
organizationSlug,
|
|
@@ -14569,7 +14925,7 @@ var get_dashboard_details_default = defineTool({
|
|
|
14569
14925
|
});
|
|
14570
14926
|
|
|
14571
14927
|
//#endregion
|
|
14572
|
-
//#region ../mcp-core/dist/find-monitors-
|
|
14928
|
+
//#region ../mcp-core/dist/find-monitors-CwXZsdiJ.js
|
|
14573
14929
|
const ENVIRONMENT_LIMIT = 5;
|
|
14574
14930
|
const monitorScheduleOutputSchema = z.object({
|
|
14575
14931
|
type: z.string().nullable(),
|
|
@@ -14701,7 +15057,7 @@ var find_monitors_default = defineTool({
|
|
|
14701
15057
|
async handler(params, context$1) {
|
|
14702
15058
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14703
15059
|
const organizationSlug = params.organizationSlug;
|
|
14704
|
-
|
|
15060
|
+
setOrganizationContext(organizationSlug);
|
|
14705
15061
|
const requestedProjectSlug = params.projectSlug && params.projectSlug !== "all" ? params.projectSlug : void 0;
|
|
14706
15062
|
if (requestedProjectSlug) assertProjectRefWithinConstraint({
|
|
14707
15063
|
resourceLabel: "Monitor list",
|
|
@@ -14747,7 +15103,7 @@ var find_monitors_default = defineTool({
|
|
|
14747
15103
|
});
|
|
14748
15104
|
|
|
14749
15105
|
//#endregion
|
|
14750
|
-
//#region ../mcp-core/dist/get-monitor-details-
|
|
15106
|
+
//#region ../mcp-core/dist/get-monitor-details-CDcHPW6x.js
|
|
14751
15107
|
function formatProject(monitor) {
|
|
14752
15108
|
if (!monitor.project) return null;
|
|
14753
15109
|
return monitor.project.slug ?? monitor.project.name ?? null;
|
|
@@ -14812,7 +15168,7 @@ var get_monitor_details_default = defineTool({
|
|
|
14812
15168
|
async handler(params, context$1) {
|
|
14813
15169
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
14814
15170
|
const organizationSlug = params.organizationSlug;
|
|
14815
|
-
|
|
15171
|
+
setOrganizationContext(organizationSlug);
|
|
14816
15172
|
setTag("monitor.slug", params.monitorSlug);
|
|
14817
15173
|
const requestedProjectSlugOrId = params.projectSlugOrId ?? void 0;
|
|
14818
15174
|
const projectSlugOrId = requestedProjectSlugOrId ?? context$1.constraints.projectSlug ?? null;
|
|
@@ -14907,7 +15263,7 @@ var get_monitor_details_default = defineTool({
|
|
|
14907
15263
|
});
|
|
14908
15264
|
|
|
14909
15265
|
//#endregion
|
|
14910
|
-
//#region ../mcp-core/dist/uptime-monitors-
|
|
15266
|
+
//#region ../mcp-core/dist/uptime-monitors-D7xvJsr1.js
|
|
14911
15267
|
/** Verified against UptimeSubscription.IntervalSeconds in getsentry/sentry. */
|
|
14912
15268
|
const UPTIME_INTERVAL_SECONDS = [
|
|
14913
15269
|
60,
|
|
@@ -15040,7 +15396,7 @@ function toUptimeMonitorSummary(monitor, webUrl) {
|
|
|
15040
15396
|
}
|
|
15041
15397
|
|
|
15042
15398
|
//#endregion
|
|
15043
|
-
//#region ../mcp-core/dist/find-uptime-monitors-
|
|
15399
|
+
//#region ../mcp-core/dist/find-uptime-monitors-B5dw0P9D.js
|
|
15044
15400
|
const findUptimeMonitorsOutputSchema = z.object({
|
|
15045
15401
|
monitors: z.array(uptimeMonitorListItemSchema),
|
|
15046
15402
|
hasMore: z.boolean()
|
|
@@ -15083,7 +15439,7 @@ var find_uptime_monitors_default = defineTool({
|
|
|
15083
15439
|
async handler(params, context$1) {
|
|
15084
15440
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15085
15441
|
const organizationSlug = params.organizationSlug;
|
|
15086
|
-
|
|
15442
|
+
setOrganizationContext(organizationSlug);
|
|
15087
15443
|
const requestedProjectSlug = params.projectSlug && params.projectSlug !== "all" ? params.projectSlug : void 0;
|
|
15088
15444
|
if (requestedProjectSlug) assertProjectRefWithinConstraint({
|
|
15089
15445
|
resourceLabel: "Uptime monitor list",
|
|
@@ -15108,7 +15464,7 @@ var find_uptime_monitors_default = defineTool({
|
|
|
15108
15464
|
});
|
|
15109
15465
|
|
|
15110
15466
|
//#endregion
|
|
15111
|
-
//#region ../mcp-core/dist/get-uptime-monitor-details-
|
|
15467
|
+
//#region ../mcp-core/dist/get-uptime-monitor-details-B40FMp1m.js
|
|
15112
15468
|
function formatCheck(check, monitorEnvironment) {
|
|
15113
15469
|
const time = formatDate(check.timestamp) ?? formatDate(check.scheduledCheckTime) ?? "unknown time";
|
|
15114
15470
|
const status = check.checkStatus ?? "unknown";
|
|
@@ -15161,7 +15517,7 @@ var get_uptime_monitor_details_default = defineTool({
|
|
|
15161
15517
|
async handler(params, context$1) {
|
|
15162
15518
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15163
15519
|
const organizationSlug = params.organizationSlug;
|
|
15164
|
-
|
|
15520
|
+
setOrganizationContext(organizationSlug);
|
|
15165
15521
|
setTag("project.slug", params.projectSlug);
|
|
15166
15522
|
setTag("uptime.monitor_id", params.uptimeMonitorId);
|
|
15167
15523
|
assertProjectRefWithinConstraint({
|
|
@@ -15230,7 +15586,7 @@ var get_uptime_monitor_details_default = defineTool({
|
|
|
15230
15586
|
});
|
|
15231
15587
|
|
|
15232
15588
|
//#endregion
|
|
15233
|
-
//#region ../mcp-core/dist/create-uptime-monitor-
|
|
15589
|
+
//#region ../mcp-core/dist/create-uptime-monitor-BarA-8c1.js
|
|
15234
15590
|
const createUptimeMonitorOutputSchema = z.object({ monitor: uptimeMonitorSummarySchema });
|
|
15235
15591
|
var create_uptime_monitor_default = defineTool({
|
|
15236
15592
|
name: "create_uptime_monitor",
|
|
@@ -15281,7 +15637,7 @@ var create_uptime_monitor_default = defineTool({
|
|
|
15281
15637
|
async handler(params, context$1) {
|
|
15282
15638
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15283
15639
|
const organizationSlug = params.organizationSlug;
|
|
15284
|
-
|
|
15640
|
+
setOrganizationContext(organizationSlug);
|
|
15285
15641
|
setTag("project.slug", params.projectSlug);
|
|
15286
15642
|
assertProjectRefWithinConstraint({
|
|
15287
15643
|
resourceLabel: "Uptime monitor",
|
|
@@ -15311,7 +15667,7 @@ var create_uptime_monitor_default = defineTool({
|
|
|
15311
15667
|
});
|
|
15312
15668
|
|
|
15313
15669
|
//#endregion
|
|
15314
|
-
//#region ../mcp-core/dist/update-uptime-monitor-
|
|
15670
|
+
//#region ../mcp-core/dist/update-uptime-monitor-Borxg5io.js
|
|
15315
15671
|
const updateUptimeMonitorOutputSchema = z.object({ monitor: uptimeMonitorSummarySchema });
|
|
15316
15672
|
function hasDefinedUpdate(value) {
|
|
15317
15673
|
return value !== void 0;
|
|
@@ -15368,7 +15724,7 @@ var update_uptime_monitor_default = defineTool({
|
|
|
15368
15724
|
async handler(params, context$1) {
|
|
15369
15725
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15370
15726
|
const organizationSlug = params.organizationSlug;
|
|
15371
|
-
|
|
15727
|
+
setOrganizationContext(organizationSlug);
|
|
15372
15728
|
setTag("project.slug", params.projectSlug);
|
|
15373
15729
|
setTag("uptime.monitor_id", params.uptimeMonitorId);
|
|
15374
15730
|
assertProjectRefWithinConstraint({
|
|
@@ -15402,7 +15758,7 @@ var update_uptime_monitor_default = defineTool({
|
|
|
15402
15758
|
});
|
|
15403
15759
|
|
|
15404
15760
|
//#endregion
|
|
15405
|
-
//#region ../mcp-core/dist/delete-uptime-monitor-
|
|
15761
|
+
//#region ../mcp-core/dist/delete-uptime-monitor-CpzZ4G3P.js
|
|
15406
15762
|
const deleteUptimeMonitorOutputSchema = z.object({
|
|
15407
15763
|
success: z.literal(true),
|
|
15408
15764
|
uptimeMonitorId: z.string(),
|
|
@@ -15439,7 +15795,7 @@ var delete_uptime_monitor_default = defineTool({
|
|
|
15439
15795
|
async handler(params, context$1) {
|
|
15440
15796
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15441
15797
|
const organizationSlug = params.organizationSlug;
|
|
15442
|
-
|
|
15798
|
+
setOrganizationContext(organizationSlug);
|
|
15443
15799
|
setTag("project.slug", params.projectSlug);
|
|
15444
15800
|
setTag("uptime.monitor_id", params.uptimeMonitorId);
|
|
15445
15801
|
assertProjectRefWithinConstraint({
|
|
@@ -15461,12 +15817,12 @@ var delete_uptime_monitor_default = defineTool({
|
|
|
15461
15817
|
});
|
|
15462
15818
|
|
|
15463
15819
|
//#endregion
|
|
15464
|
-
//#region ../mcp-core/dist/find-alert-rules-
|
|
15820
|
+
//#region ../mcp-core/dist/find-alert-rules-Dc55EgzE.js
|
|
15465
15821
|
const AlertRuleKind$1 = z.enum([
|
|
15466
15822
|
"all",
|
|
15467
15823
|
"issue",
|
|
15468
15824
|
"metric"
|
|
15469
|
-
]).describe("Which alert rule family to search. Use `all` to include
|
|
15825
|
+
]).describe("Which alert rule family to search. Use `all` to include Alerts (workflows) and legacy metric alerts.");
|
|
15470
15826
|
const issueAlertRuleSummarySchema = z.object({
|
|
15471
15827
|
id: z.string(),
|
|
15472
15828
|
name: z.string(),
|
|
@@ -15502,9 +15858,10 @@ const findAlertRulesOutputSchema = z.object({
|
|
|
15502
15858
|
pagination: z.object({
|
|
15503
15859
|
issue: paginationStateSchema.nullable(),
|
|
15504
15860
|
metric: paginationStateSchema.nullable()
|
|
15505
|
-
})
|
|
15861
|
+
}),
|
|
15862
|
+
warnings: z.array(z.string()).optional()
|
|
15506
15863
|
});
|
|
15507
|
-
function getIssueAlertRuleFrequency
|
|
15864
|
+
function getIssueAlertRuleFrequency(rule) {
|
|
15508
15865
|
if (typeof rule.frequency === "number") return rule.frequency;
|
|
15509
15866
|
const frequency = rule.config.frequency;
|
|
15510
15867
|
return typeof frequency === "number" ? frequency : null;
|
|
@@ -15525,7 +15882,7 @@ var find_alert_rules_default = defineTool({
|
|
|
15525
15882
|
"Find Sentry alert rules.",
|
|
15526
15883
|
"",
|
|
15527
15884
|
"Use this tool when you need to:",
|
|
15528
|
-
"- List
|
|
15885
|
+
"- List Alerts (workflows) for an organization or project, including Alerts without connected sources",
|
|
15529
15886
|
"- List metric alert rules for an organization or project",
|
|
15530
15887
|
"- Find an alert rule ID by name before inspecting it",
|
|
15531
15888
|
"- Check alert conditions, queries, triggers, actions, owner, or environment",
|
|
@@ -15537,8 +15894,8 @@ var find_alert_rules_default = defineTool({
|
|
|
15537
15894
|
"</examples>",
|
|
15538
15895
|
"",
|
|
15539
15896
|
"<hints>",
|
|
15540
|
-
"-
|
|
15541
|
-
"-
|
|
15897
|
+
"- Omit `projectSlug` to search organization-wide. A project filter finds connected Alerts, which may also cover other projects.",
|
|
15898
|
+
"- With `kind='all'`, an unavailable legacy metric alert API is reported in `warnings`; the returned Alerts are still usable.",
|
|
15542
15899
|
"- Issue and metric alert rules have independent pagination state. Reuse a nextCursor only with its matching kind.",
|
|
15543
15900
|
"</hints>"
|
|
15544
15901
|
].join("\n"),
|
|
@@ -15565,15 +15922,14 @@ var find_alert_rules_default = defineTool({
|
|
|
15565
15922
|
project: { slug: requestedProjectSlug }
|
|
15566
15923
|
});
|
|
15567
15924
|
const projectSlug$1 = context$1.constraints.projectSlug ?? requestedProjectSlug;
|
|
15568
|
-
if (params.kind === "issue" && !projectSlug$1) throw new UserInputError("projectSlug is required when searching issue alert rules.");
|
|
15569
15925
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15570
15926
|
const organizationSlug = params.organizationSlug;
|
|
15571
|
-
|
|
15927
|
+
setOrganizationContext(organizationSlug);
|
|
15572
15928
|
if (projectSlug$1) setTag("project.slug", projectSlug$1);
|
|
15573
|
-
const includeIssue = params.kind !== "metric"
|
|
15929
|
+
const includeIssue = params.kind !== "metric";
|
|
15574
15930
|
const includeMetric = params.kind !== "issue";
|
|
15575
15931
|
if (params.cursor && includeIssue && includeMetric) throw new UserInputError("cursor cannot be used with `kind='all'` when both issue and metric alert rules are included. Retry with `kind='issue'` or `kind='metric'` using a cursor from the same alert rule family.");
|
|
15576
|
-
const issuePage = includeIssue
|
|
15932
|
+
const issuePage = includeIssue ? await apiService.listIssueAlertRulesPage({
|
|
15577
15933
|
organizationSlug,
|
|
15578
15934
|
projectSlug: projectSlug$1,
|
|
15579
15935
|
query: params.query ?? void 0,
|
|
@@ -15583,16 +15939,18 @@ var find_alert_rules_default = defineTool({
|
|
|
15583
15939
|
rules: [],
|
|
15584
15940
|
nextCursor: null
|
|
15585
15941
|
};
|
|
15942
|
+
const warnings = [];
|
|
15586
15943
|
const metricPage = includeMetric ? await apiService.listMetricAlertRulesPage({
|
|
15587
15944
|
organizationSlug,
|
|
15588
15945
|
projectSlug: projectSlug$1,
|
|
15589
15946
|
query: params.query ?? void 0,
|
|
15590
15947
|
cursor: params.cursor ?? void 0,
|
|
15591
15948
|
limit: params.limit
|
|
15592
|
-
})
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
|
|
15949
|
+
}).catch((error) => {
|
|
15950
|
+
if (params.kind !== "all" || !(error instanceof ApiError) || error.status !== 410) throw error;
|
|
15951
|
+
warnings.push("Metric alerts could not be listed: Sentry's legacy metric alert API is no longer available for this organization.");
|
|
15952
|
+
return null;
|
|
15953
|
+
}) : null;
|
|
15596
15954
|
return structuredResult({
|
|
15597
15955
|
issueRules: issuePage.rules.map((rule) => ({
|
|
15598
15956
|
id: String(rule.id),
|
|
@@ -15600,7 +15958,7 @@ var find_alert_rules_default = defineTool({
|
|
|
15600
15958
|
status: getIssueAlertRuleStatus(rule),
|
|
15601
15959
|
actionMatch: rule.actionMatch ?? null,
|
|
15602
15960
|
filterMatch: rule.filterMatch ?? null,
|
|
15603
|
-
frequencyMinutes: getIssueAlertRuleFrequency
|
|
15961
|
+
frequencyMinutes: getIssueAlertRuleFrequency(rule),
|
|
15604
15962
|
environment: rule.environment ?? null,
|
|
15605
15963
|
owner: getOwner(rule.owner),
|
|
15606
15964
|
dateCreated: formatDate(rule.dateCreated),
|
|
@@ -15608,7 +15966,7 @@ var find_alert_rules_default = defineTool({
|
|
|
15608
15966
|
lastTriggered: formatDate(rule.lastTriggered),
|
|
15609
15967
|
webUrl: apiService.getIssueAlertRuleUrl(organizationSlug, rule.id)
|
|
15610
15968
|
})),
|
|
15611
|
-
metricRules: metricPage
|
|
15969
|
+
metricRules: (metricPage?.rules ?? []).map((rule) => ({
|
|
15612
15970
|
id: String(rule.id),
|
|
15613
15971
|
name: rule.name,
|
|
15614
15972
|
status: rule.status ?? null,
|
|
@@ -15624,14 +15982,184 @@ var find_alert_rules_default = defineTool({
|
|
|
15624
15982
|
})),
|
|
15625
15983
|
pagination: {
|
|
15626
15984
|
issue: includeIssue ? { nextCursor: issuePage.nextCursor } : null,
|
|
15627
|
-
metric:
|
|
15628
|
-
}
|
|
15985
|
+
metric: metricPage ? { nextCursor: metricPage.nextCursor } : null
|
|
15986
|
+
},
|
|
15987
|
+
...warnings.length > 0 ? { warnings } : {}
|
|
15629
15988
|
});
|
|
15630
15989
|
}
|
|
15631
15990
|
});
|
|
15632
15991
|
|
|
15633
15992
|
//#endregion
|
|
15634
|
-
//#region ../mcp-core/dist/
|
|
15993
|
+
//#region ../mcp-core/dist/alert-rule-details-CJ-FfoC7.js
|
|
15994
|
+
const componentId = z.union([z.string(), z.number()]);
|
|
15995
|
+
const conditionSchema = z.object({
|
|
15996
|
+
id: componentId.optional(),
|
|
15997
|
+
type: z.string(),
|
|
15998
|
+
comparison: z.unknown(),
|
|
15999
|
+
conditionResult: z.unknown()
|
|
16000
|
+
});
|
|
16001
|
+
const conditionGroupSchema$1 = z.object({
|
|
16002
|
+
id: componentId.optional(),
|
|
16003
|
+
logicType: z.string(),
|
|
16004
|
+
conditions: z.array(conditionSchema)
|
|
16005
|
+
});
|
|
16006
|
+
const actionGroupSchema = conditionGroupSchema$1.extend({ actions: z.array(z.object({
|
|
16007
|
+
id: componentId.optional(),
|
|
16008
|
+
type: z.string(),
|
|
16009
|
+
integrationId: componentId.nullable().optional(),
|
|
16010
|
+
config: z.record(z.string(), z.unknown()),
|
|
16011
|
+
data: z.record(z.string(), z.unknown()),
|
|
16012
|
+
status: z.string().optional()
|
|
16013
|
+
})) });
|
|
16014
|
+
const metricQuerySchema = z.object({
|
|
16015
|
+
dataset: z.string(),
|
|
16016
|
+
query: z.string(),
|
|
16017
|
+
aggregate: z.string(),
|
|
16018
|
+
timeWindow: z.number(),
|
|
16019
|
+
environment: z.string().nullable(),
|
|
16020
|
+
eventTypes: z.array(z.string()),
|
|
16021
|
+
extrapolationMode: z.string().nullable().optional()
|
|
16022
|
+
});
|
|
16023
|
+
const uptimeQuerySchema = z.object({
|
|
16024
|
+
url: z.string(),
|
|
16025
|
+
method: z.string(),
|
|
16026
|
+
intervalSeconds: z.number(),
|
|
16027
|
+
timeoutMs: z.number(),
|
|
16028
|
+
assertion: z.unknown(),
|
|
16029
|
+
traceSampling: z.boolean().optional(),
|
|
16030
|
+
responseCaptureEnabled: z.boolean().optional()
|
|
16031
|
+
});
|
|
16032
|
+
const cronQuerySchema = z.object({
|
|
16033
|
+
id: z.string(),
|
|
16034
|
+
name: z.string(),
|
|
16035
|
+
slug: z.string(),
|
|
16036
|
+
status: z.string(),
|
|
16037
|
+
isMuted: z.boolean(),
|
|
16038
|
+
config: z.object({
|
|
16039
|
+
schedule_type: z.string(),
|
|
16040
|
+
schedule: z.union([z.string(), z.array(z.union([z.number(), z.string()]))]),
|
|
16041
|
+
checkin_margin: z.number().nullable().optional(),
|
|
16042
|
+
max_runtime: z.number().nullable().optional(),
|
|
16043
|
+
timezone: z.string().nullable().optional(),
|
|
16044
|
+
failure_issue_threshold: z.number().nullable().optional(),
|
|
16045
|
+
recovery_threshold: z.number().nullable().optional()
|
|
16046
|
+
}),
|
|
16047
|
+
environments: z.array(z.object({
|
|
16048
|
+
name: z.string(),
|
|
16049
|
+
status: z.string(),
|
|
16050
|
+
isMuted: z.boolean()
|
|
16051
|
+
}))
|
|
16052
|
+
});
|
|
16053
|
+
function sourceDetails(source) {
|
|
16054
|
+
const type = typeof source.type === "string" ? source.type : "unknown";
|
|
16055
|
+
const query = source.queryObj;
|
|
16056
|
+
const unavailable = {
|
|
16057
|
+
type,
|
|
16058
|
+
unavailableReason: "Source configuration is unavailable."
|
|
16059
|
+
};
|
|
16060
|
+
if (!isPlainObject$3(query)) return unavailable;
|
|
16061
|
+
if (type === "snuba_query_subscription") {
|
|
16062
|
+
const parsed = metricQuerySchema.safeParse(query.snubaQuery);
|
|
16063
|
+
if (!parsed.success) return unavailable;
|
|
16064
|
+
const { timeWindow,...config } = parsed.data;
|
|
16065
|
+
return {
|
|
16066
|
+
type,
|
|
16067
|
+
query: {
|
|
16068
|
+
...config,
|
|
16069
|
+
timeWindowSeconds: timeWindow
|
|
16070
|
+
}
|
|
16071
|
+
};
|
|
16072
|
+
}
|
|
16073
|
+
if (type === "uptime_subscription") {
|
|
16074
|
+
const parsed = uptimeQuerySchema.safeParse(query);
|
|
16075
|
+
return parsed.success ? {
|
|
16076
|
+
type,
|
|
16077
|
+
query: parsed.data,
|
|
16078
|
+
omittedFields: ["headers", "body"]
|
|
16079
|
+
} : unavailable;
|
|
16080
|
+
}
|
|
16081
|
+
if (type === "cron_monitor") {
|
|
16082
|
+
const parsed = cronQuerySchema.safeParse(query);
|
|
16083
|
+
return parsed.success ? {
|
|
16084
|
+
type,
|
|
16085
|
+
query: parsed.data
|
|
16086
|
+
} : unavailable;
|
|
16087
|
+
}
|
|
16088
|
+
return {
|
|
16089
|
+
type,
|
|
16090
|
+
unavailableReason: "This source type is not supported for inspection."
|
|
16091
|
+
};
|
|
16092
|
+
}
|
|
16093
|
+
/** Project native configuration explicitly so backend metadata stays private. */
|
|
16094
|
+
async function getAlertRuleDetails(api, organizationSlug, rule, scopedProjectSlug) {
|
|
16095
|
+
const scope = await api.getAlertRuleProjectScope({
|
|
16096
|
+
organizationSlug,
|
|
16097
|
+
ruleId: rule.id
|
|
16098
|
+
});
|
|
16099
|
+
const project = scopedProjectSlug ? await api.getProject({
|
|
16100
|
+
organizationSlug,
|
|
16101
|
+
projectSlugOrId: scopedProjectSlug
|
|
16102
|
+
}) : void 0;
|
|
16103
|
+
const sources = [];
|
|
16104
|
+
for (const id of rule.detectorIds ?? []) try {
|
|
16105
|
+
const detector = await api.getDetector({
|
|
16106
|
+
organizationSlug,
|
|
16107
|
+
detectorId: id
|
|
16108
|
+
});
|
|
16109
|
+
if (project && detector.projectId !== null && String(detector.projectId) !== String(project.id)) {
|
|
16110
|
+
sources.push({
|
|
16111
|
+
id: String(id),
|
|
16112
|
+
status: "outside_project_constraint"
|
|
16113
|
+
});
|
|
16114
|
+
continue;
|
|
16115
|
+
}
|
|
16116
|
+
sources.push({
|
|
16117
|
+
id: String(detector.id),
|
|
16118
|
+
status: "available",
|
|
16119
|
+
name: detector.name,
|
|
16120
|
+
type: detector.type,
|
|
16121
|
+
projectId: detector.projectId === null ? null : String(detector.projectId),
|
|
16122
|
+
enabled: detector.enabled,
|
|
16123
|
+
config: detector.type === "issue_stream" ? {} : detector.config,
|
|
16124
|
+
conditionGroup: detector.conditionGroup ? conditionGroupSchema$1.parse(detector.conditionGroup) : null,
|
|
16125
|
+
dataSources: (detector.dataSources ?? []).map(sourceDetails)
|
|
16126
|
+
});
|
|
16127
|
+
} catch (error) {
|
|
16128
|
+
if (!(error instanceof ApiNotFoundError || error instanceof ApiPermissionError)) throw error;
|
|
16129
|
+
sources.push({
|
|
16130
|
+
id: String(id),
|
|
16131
|
+
status: "unavailable",
|
|
16132
|
+
reason: "Not found or not accessible."
|
|
16133
|
+
});
|
|
16134
|
+
}
|
|
16135
|
+
const projectIds = project ? scope.projectIds.filter((id) => id === String(project.id)) : scope.projectIds;
|
|
16136
|
+
return {
|
|
16137
|
+
id: String(rule.id),
|
|
16138
|
+
name: rule.name,
|
|
16139
|
+
enabled: rule.enabled,
|
|
16140
|
+
config: z.object({ frequency: z.number().optional() }).parse(rule.config),
|
|
16141
|
+
environment: rule.environment,
|
|
16142
|
+
owner: rule.owner ? formatActor(rule.owner) : null,
|
|
16143
|
+
dateCreated: formatDate(rule.dateCreated),
|
|
16144
|
+
dateUpdated: formatDate(rule.dateUpdated),
|
|
16145
|
+
lastTriggered: formatDate(rule.lastTriggered),
|
|
16146
|
+
triggers: rule.triggers ? conditionGroupSchema$1.parse(rule.triggers) : null,
|
|
16147
|
+
actionFilters: (rule.actionFilters ?? []).map((group) => actionGroupSchema.parse(group)),
|
|
16148
|
+
scope: {
|
|
16149
|
+
includesAllProjects: scope.includesAllProjects,
|
|
16150
|
+
projectIds,
|
|
16151
|
+
...project ? {
|
|
16152
|
+
limitedToProject: scopedProjectSlug,
|
|
16153
|
+
...!scope.includesAllProjects ? { outsideProjectCount: scope.projectIds.length - projectIds.length } : {}
|
|
16154
|
+
} : {}
|
|
16155
|
+
},
|
|
16156
|
+
sources,
|
|
16157
|
+
webUrl: api.getIssueAlertRuleUrl(organizationSlug, rule.id)
|
|
16158
|
+
};
|
|
16159
|
+
}
|
|
16160
|
+
|
|
16161
|
+
//#endregion
|
|
16162
|
+
//#region ../mcp-core/dist/alerts-Cv9MFDEC.js
|
|
15635
16163
|
const NUMERIC_ID_PATTERN = /^\d+$/;
|
|
15636
16164
|
const COMPONENT_DETAIL_SKIP_KEYS = new Set([
|
|
15637
16165
|
"id",
|
|
@@ -15759,40 +16287,6 @@ function formatComponentSummary(label, components, headingLevel) {
|
|
|
15759
16287
|
if (components.length > 5) lines.push(`- ...and ${components.length - 5} more`);
|
|
15760
16288
|
return lines;
|
|
15761
16289
|
}
|
|
15762
|
-
function getIssueAlertRuleFrequency(rule) {
|
|
15763
|
-
if (rule.frequency !== void 0 && rule.frequency !== null) return rule.frequency;
|
|
15764
|
-
const frequency = rule.config.frequency;
|
|
15765
|
-
return typeof frequency === "number" ? frequency : null;
|
|
15766
|
-
}
|
|
15767
|
-
function formatIssueAlertRule(rule, projectSlug$1, options = {}) {
|
|
15768
|
-
const headingLevel = options.headingLevel ?? 2;
|
|
15769
|
-
const includeComponents = options.includeComponents ?? true;
|
|
15770
|
-
const heading = "#".repeat(Math.min(headingLevel, 6));
|
|
15771
|
-
const owner = rule.owner ? formatActor(rule.owner) : null;
|
|
15772
|
-
const frequency = getIssueAlertRuleFrequency(rule);
|
|
15773
|
-
const lines = compactLines([
|
|
15774
|
-
`${heading} ${rule.name}`,
|
|
15775
|
-
"",
|
|
15776
|
-
`**Kind**: Issue Alert`,
|
|
15777
|
-
`**ID**: ${formatId(rule.id)}`,
|
|
15778
|
-
`**Project**: ${projectSlug$1}`,
|
|
15779
|
-
rule.status ? `**Status**: ${rule.status}` : rule.enabled !== void 0 ? `**Status**: ${rule.enabled ? "enabled" : "disabled"}` : null,
|
|
15780
|
-
rule.actionMatch ? `**Action Match**: ${rule.actionMatch}` : null,
|
|
15781
|
-
rule.filterMatch ? `**Filter Match**: ${rule.filterMatch}` : null,
|
|
15782
|
-
frequency !== null ? `**Frequency**: ${frequency} minutes` : null,
|
|
15783
|
-
rule.environment ? `**Environment**: ${rule.environment}` : null,
|
|
15784
|
-
owner ? `**Owner**: ${owner}` : null,
|
|
15785
|
-
formatDate(rule.dateCreated) ? `**Created**: ${formatDate(rule.dateCreated)}` : null,
|
|
15786
|
-
formatDate(rule.dateUpdated) ? `**Updated**: ${formatDate(rule.dateUpdated)}` : null,
|
|
15787
|
-
formatDate(rule.lastTriggered) ? `**Last Triggered**: ${formatDate(rule.lastTriggered)}` : null,
|
|
15788
|
-
options.url ? `**URL**: ${options.url}` : null
|
|
15789
|
-
]);
|
|
15790
|
-
if (includeComponents) {
|
|
15791
|
-
const workflowTriggers = rule.triggers ? [rule.triggers] : [];
|
|
15792
|
-
lines.push(...formatComponentSummary("Conditions", rule.conditions, headingLevel + 1), ...formatComponentSummary("Filters", rule.filters, headingLevel + 1), ...formatComponentSummary("Actions", rule.actions, headingLevel + 1), ...formatComponentSummary("Triggers", workflowTriggers, headingLevel + 1), ...formatComponentSummary("Action Filters", rule.actionFilters ?? [], headingLevel + 1));
|
|
15793
|
-
}
|
|
15794
|
-
return lines.join("\n");
|
|
15795
|
-
}
|
|
15796
16290
|
function formatMetricAlertRule(rule, options = {}) {
|
|
15797
16291
|
const headingLevel = options.headingLevel ?? 2;
|
|
15798
16292
|
const includeComponents = options.includeComponents ?? true;
|
|
@@ -15818,14 +16312,16 @@ function formatMetricAlertRule(rule, options = {}) {
|
|
|
15818
16312
|
if (includeComponents) lines.push(...formatComponentSummary("Triggers", rule.triggers, headingLevel + 1));
|
|
15819
16313
|
return lines.join("\n");
|
|
15820
16314
|
}
|
|
16315
|
+
/** Resolve case-insensitive names only when the search results are complete. */
|
|
15821
16316
|
async function findExactIssueAlertRuleMatches(apiService, params) {
|
|
15822
|
-
const
|
|
16317
|
+
const page = await apiService.listIssueAlertRulesPage({
|
|
15823
16318
|
organizationSlug: params.organizationSlug,
|
|
15824
16319
|
projectSlug: params.projectSlug,
|
|
15825
16320
|
query: params.ruleName,
|
|
15826
16321
|
limit: 100
|
|
15827
16322
|
});
|
|
15828
|
-
|
|
16323
|
+
if (page.nextCursor) throw new UserInputError("Alert name search is incomplete. Find the Alert with find_alert_rules and retry with its numeric ID and explicit kind.");
|
|
16324
|
+
return page.rules.filter((rule) => rule.name.toLowerCase() === params.ruleName.toLowerCase());
|
|
15829
16325
|
}
|
|
15830
16326
|
async function findExactMetricAlertRuleMatches(apiService, params) {
|
|
15831
16327
|
const rules = await apiService.listMetricAlertRules({
|
|
@@ -15857,7 +16353,7 @@ async function resolveIssueAlertRule(apiService, params) {
|
|
|
15857
16353
|
ruleId: matches[0].id
|
|
15858
16354
|
});
|
|
15859
16355
|
if (matches.length > 1) throw new UserInputError(`Multiple issue alert rules named "${params.ruleIdOrName}" were found. Retry with the numeric rule ID.`);
|
|
15860
|
-
throw new UserInputError(`Issue alert rule "${params.ruleIdOrName}" was not found in project ${params.projectSlug}.`);
|
|
16356
|
+
throw new UserInputError(`Issue alert rule "${params.ruleIdOrName}" was not found${params.projectSlug ? ` in project ${params.projectSlug}` : ""}.`);
|
|
15861
16357
|
}
|
|
15862
16358
|
async function resolveMetricAlertRule(apiService, params) {
|
|
15863
16359
|
if (isNumericAlertRuleId(params.ruleIdOrName)) try {
|
|
@@ -15882,7 +16378,7 @@ async function resolveMetricAlertRule(apiService, params) {
|
|
|
15882
16378
|
}
|
|
15883
16379
|
|
|
15884
16380
|
//#endregion
|
|
15885
|
-
//#region ../mcp-core/dist/get-alert-rule-
|
|
16381
|
+
//#region ../mcp-core/dist/get-alert-rule-DOk7Olu5.js
|
|
15886
16382
|
const AlertRuleKind = z.enum([
|
|
15887
16383
|
"all",
|
|
15888
16384
|
"issue",
|
|
@@ -15914,7 +16410,8 @@ var get_alert_rule_default = defineTool({
|
|
|
15914
16410
|
"<hints>",
|
|
15915
16411
|
"- Use `kind='issue'` or `kind='metric'` for numeric IDs because issue and metric alerts use separate endpoints.",
|
|
15916
16412
|
"- With `kind='all'`, a digit-only `ruleIdOrName` is treated as an exact alert rule name.",
|
|
15917
|
-
"- Issue
|
|
16413
|
+
"- Issue Alerts are notification workflows and may cover multiple projects or have no connected sources. Omit projectSlug to inspect organization-wide.",
|
|
16414
|
+
"- Issue details include complete conditions, notification actions, connected monitors and project scope. Inaccessible or session-restricted sources are marked explicitly.",
|
|
15918
16415
|
"</hints>"
|
|
15919
16416
|
].join("\n"),
|
|
15920
16417
|
inputSchema: {
|
|
@@ -15937,22 +16434,22 @@ var get_alert_rule_default = defineTool({
|
|
|
15937
16434
|
project: { slug: requestedProjectSlug }
|
|
15938
16435
|
});
|
|
15939
16436
|
const projectSlug$1 = context$1.constraints.projectSlug ?? requestedProjectSlug;
|
|
15940
|
-
if (params.kind === "issue" && !projectSlug$1) throw new UserInputError("projectSlug is required when inspecting an issue alert rule.");
|
|
15941
16437
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
15942
16438
|
const organizationSlug = params.organizationSlug;
|
|
15943
|
-
|
|
16439
|
+
setOrganizationContext(organizationSlug);
|
|
15944
16440
|
if (projectSlug$1) setTag("project.slug", projectSlug$1);
|
|
16441
|
+
const warnings = [];
|
|
15945
16442
|
let match;
|
|
15946
16443
|
if (params.kind === "issue") {
|
|
15947
16444
|
const rule = await resolveIssueAlertRule(apiService, {
|
|
15948
16445
|
organizationSlug,
|
|
15949
|
-
projectSlug: projectSlug$1
|
|
16446
|
+
projectSlug: projectSlug$1,
|
|
15950
16447
|
ruleIdOrName: params.ruleIdOrName
|
|
15951
16448
|
});
|
|
15952
16449
|
match = {
|
|
15953
16450
|
kind: "issue",
|
|
15954
16451
|
rule,
|
|
15955
|
-
projectSlug: projectSlug$1
|
|
16452
|
+
projectSlug: projectSlug$1
|
|
15956
16453
|
};
|
|
15957
16454
|
} else if (params.kind === "metric") {
|
|
15958
16455
|
const rule = await resolveMetricAlertRule(apiService, {
|
|
@@ -15968,31 +16465,34 @@ var get_alert_rule_default = defineTool({
|
|
|
15968
16465
|
};
|
|
15969
16466
|
} else {
|
|
15970
16467
|
const matches = [];
|
|
15971
|
-
|
|
15972
|
-
|
|
16468
|
+
const issueRules = await findExactIssueAlertRuleMatches(apiService, {
|
|
16469
|
+
organizationSlug,
|
|
16470
|
+
projectSlug: projectSlug$1,
|
|
16471
|
+
ruleName: params.ruleIdOrName
|
|
16472
|
+
});
|
|
16473
|
+
matches.push(...issueRules.map((rule) => ({
|
|
16474
|
+
kind: "issue",
|
|
16475
|
+
rule,
|
|
16476
|
+
projectSlug: projectSlug$1
|
|
16477
|
+
})));
|
|
16478
|
+
try {
|
|
16479
|
+
const metricPage = await apiService.listMetricAlertRulesPage({
|
|
15973
16480
|
organizationSlug,
|
|
15974
16481
|
projectSlug: projectSlug$1,
|
|
15975
16482
|
query: params.ruleIdOrName,
|
|
15976
16483
|
limit: 100
|
|
15977
16484
|
});
|
|
15978
|
-
|
|
15979
|
-
|
|
16485
|
+
if (metricPage.nextCursor) throw new UserInputError("Alert name search is incomplete. Find the Alert with find_alert_rules and retry with its numeric ID and explicit kind.");
|
|
16486
|
+
matches.push(...metricPage.rules.filter((rule) => rule.name.toLowerCase() === params.ruleIdOrName.toLowerCase()).map((rule) => ({
|
|
16487
|
+
kind: "metric",
|
|
15980
16488
|
rule,
|
|
15981
16489
|
projectSlug: projectSlug$1
|
|
15982
16490
|
})));
|
|
16491
|
+
} catch (error) {
|
|
16492
|
+
if (!(error instanceof ApiClientError) || error.status !== 410) throw error;
|
|
16493
|
+
warnings.push("Metric alert lookup is unavailable because the legacy API has been retired. Only issue Alerts were searched.");
|
|
15983
16494
|
}
|
|
15984
|
-
|
|
15985
|
-
organizationSlug,
|
|
15986
|
-
projectSlug: projectSlug$1,
|
|
15987
|
-
query: params.ruleIdOrName,
|
|
15988
|
-
limit: 100
|
|
15989
|
-
});
|
|
15990
|
-
matches.push(...metricRules.filter((rule) => rule.name.toLowerCase() === params.ruleIdOrName.toLowerCase()).map((rule) => ({
|
|
15991
|
-
kind: "metric",
|
|
15992
|
-
rule,
|
|
15993
|
-
projectSlug: projectSlug$1
|
|
15994
|
-
})));
|
|
15995
|
-
if (matches.length === 0) throw new UserInputError(`Alert rule "${params.ruleIdOrName}" was not found.`);
|
|
16495
|
+
if (matches.length === 0) throw new UserInputError(`Alert rule "${params.ruleIdOrName}" was not found.${warnings.length ? ` ${warnings.join(" ")}` : ""}`);
|
|
15996
16496
|
if (matches.length > 1) throw new UserInputError(`Multiple alert rules named "${params.ruleIdOrName}" were found: ${matches.map(describeMatch).join(", ")}. Retry with the numeric rule ID and explicit kind.`);
|
|
15997
16497
|
const [found] = matches;
|
|
15998
16498
|
match = found.kind === "issue" ? {
|
|
@@ -16011,9 +16511,13 @@ var get_alert_rule_default = defineTool({
|
|
|
16011
16511
|
};
|
|
16012
16512
|
if (match.kind === "metric") assertMetricAlertRuleWithinProject(match.rule, match.projectSlug);
|
|
16013
16513
|
}
|
|
16514
|
+
if (match.kind === "issue") return structuredResult({
|
|
16515
|
+
alertRule: await getAlertRuleDetails(apiService, organizationSlug, match.rule, context$1.constraints.projectSlug),
|
|
16516
|
+
...warnings.length ? { warnings } : {}
|
|
16517
|
+
});
|
|
16014
16518
|
const scopeLabel = projectSlug$1 ? `${organizationSlug}/${projectSlug$1}` : organizationSlug;
|
|
16015
16519
|
let output = `# Alert Rule in **${scopeLabel}**\n\n`;
|
|
16016
|
-
output +=
|
|
16520
|
+
output += formatMetricAlertRule(match.rule, { url: apiService.getMetricAlertRuleUrl(organizationSlug, match.rule.id) });
|
|
16017
16521
|
output += "\n\n## Response Notes\n\n";
|
|
16018
16522
|
output += "- Use these details to inspect alert conditions, filters, routing, and notification actions before changing the rule in Sentry.\n";
|
|
16019
16523
|
return output;
|
|
@@ -16021,7 +16525,203 @@ var get_alert_rule_default = defineTool({
|
|
|
16021
16525
|
});
|
|
16022
16526
|
|
|
16023
16527
|
//#endregion
|
|
16024
|
-
//#region ../mcp-core/dist/
|
|
16528
|
+
//#region ../mcp-core/dist/get-alert-options-DaJVqiFn.js
|
|
16529
|
+
const sectionSchema = z.enum([
|
|
16530
|
+
"actions",
|
|
16531
|
+
"conditions",
|
|
16532
|
+
"sources"
|
|
16533
|
+
]);
|
|
16534
|
+
const conditionGroupSchema = z.enum(["workflow_trigger", "action_filter"]);
|
|
16535
|
+
const getAlertOptionsOutputSchema = z.object({
|
|
16536
|
+
section: sectionSchema,
|
|
16537
|
+
actions: z.array(AlertActionOptionSchema).optional(),
|
|
16538
|
+
conditions: z.array(AlertConditionOptionSchema).optional(),
|
|
16539
|
+
conditionGroup: conditionGroupSchema.optional(),
|
|
16540
|
+
sources: z.array(z.object({
|
|
16541
|
+
id: z.string(),
|
|
16542
|
+
name: z.string(),
|
|
16543
|
+
type: z.string(),
|
|
16544
|
+
projectId: z.string().nullable(),
|
|
16545
|
+
enabled: z.boolean(),
|
|
16546
|
+
workflowIds: z.array(z.string())
|
|
16547
|
+
})).optional(),
|
|
16548
|
+
nextCursor: z.string().nullable(),
|
|
16549
|
+
inputGuide: z.object({
|
|
16550
|
+
schemaFormat: z.string(),
|
|
16551
|
+
fieldNames: z.record(z.string(), z.string()),
|
|
16552
|
+
targetTypes: z.record(z.string(), z.string()),
|
|
16553
|
+
notes: z.array(z.string())
|
|
16554
|
+
}).optional()
|
|
16555
|
+
});
|
|
16556
|
+
var get_alert_options_default = defineTool({
|
|
16557
|
+
name: "get_alert_options",
|
|
16558
|
+
skills: ["inspect"],
|
|
16559
|
+
requiredScopes: ["org:read", "project:read"],
|
|
16560
|
+
description: [
|
|
16561
|
+
"Discover available actions, conditions, or sources for a Sentry Alert (notification workflow).",
|
|
16562
|
+
"",
|
|
16563
|
+
"Choose one section per call; reuse its cursor with the same section and filters.",
|
|
16564
|
+
"- actions: installed integrations, notification services, native config/data schemas and Sentry App settings. These schemas use Sentry's internal field names and target enums; inputGuide explains the update format.",
|
|
16565
|
+
"- conditions: condition types and comparison schemas for workflow triggers or action filters.",
|
|
16566
|
+
"- sources: accessible monitors and project issue streams. Use an issue_stream source to connect all issues from its project; a source with projectId=null covers all projects.",
|
|
16567
|
+
"Slack and Teams accept channel names; Discord needs a channel ID or URL. Dynamic Sentry App fields require explicit values; this tool does not enumerate their external choices.",
|
|
16568
|
+
"",
|
|
16569
|
+
"<examples>",
|
|
16570
|
+
"get_alert_options(organizationSlug='my-org', section='actions', actionTypes=['slack', 'msteams'])",
|
|
16571
|
+
"get_alert_options(organizationSlug='my-org', section='conditions', conditionGroup='action_filter')",
|
|
16572
|
+
"get_alert_options(organizationSlug='my-org', section='sources', projectSlug='backend', sourceTypes=['issue_stream'])",
|
|
16573
|
+
"</examples>"
|
|
16574
|
+
].join("\n"),
|
|
16575
|
+
inputSchema: {
|
|
16576
|
+
organizationSlug: ParamOrganizationSlug,
|
|
16577
|
+
regionUrl: ParamRegionUrl.nullable().default(null),
|
|
16578
|
+
section: sectionSchema.describe("The kind of Alert options to discover."),
|
|
16579
|
+
actionTypes: z.array(z.string().trim().min(1)).max(20).nullable().default(null).describe("Actions only: restrict to action types, such as slack, msteams, email, or pagerduty."),
|
|
16580
|
+
conditionGroup: conditionGroupSchema.nullable().default(null).describe("Required for conditions: workflow_trigger for Alert triggers, action_filter for action groups."),
|
|
16581
|
+
projectSlug: ParamProjectSlugOrAll.nullable().default(null),
|
|
16582
|
+
sourceTypes: z.array(z.string().trim().min(1)).max(20).nullable().default(null).describe("Sources only: restrict by monitor type, such as issue_stream or metric_issue."),
|
|
16583
|
+
query: z.string().trim().min(1).nullable().default(null).describe("Sources only: Sentry monitor search, such as name:latency or workflow:123."),
|
|
16584
|
+
cursor: z.string().nullable().default(null).describe("Next cursor from the same section and filters."),
|
|
16585
|
+
limit: z.number().int().min(1).max(100).default(25).describe("Maximum options to return in this page.")
|
|
16586
|
+
},
|
|
16587
|
+
outputSchema: getAlertOptionsOutputSchema,
|
|
16588
|
+
annotations: {
|
|
16589
|
+
readOnlyHint: true,
|
|
16590
|
+
destructiveHint: false,
|
|
16591
|
+
openWorldHint: true
|
|
16592
|
+
},
|
|
16593
|
+
async handler(params, context$1) {
|
|
16594
|
+
const { section, organizationSlug } = params;
|
|
16595
|
+
if (params.actionTypes !== null && section !== "actions") throw new UserInputError("actionTypes can only be used with section='actions'.");
|
|
16596
|
+
if (params.conditionGroup !== null && section !== "conditions") throw new UserInputError("conditionGroup can only be used with section='conditions'.");
|
|
16597
|
+
if ((params.sourceTypes !== null || params.query !== null) && section !== "sources") throw new UserInputError("sourceTypes and query can only be used with section='sources'.");
|
|
16598
|
+
const api = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
16599
|
+
setOrganizationContext(organizationSlug);
|
|
16600
|
+
const pageParams = {
|
|
16601
|
+
organizationSlug,
|
|
16602
|
+
cursor: params.cursor ?? void 0,
|
|
16603
|
+
limit: params.limit
|
|
16604
|
+
};
|
|
16605
|
+
if (section === "actions") {
|
|
16606
|
+
const page$1 = await api.listAvailableAlertActionsPage({
|
|
16607
|
+
...pageParams,
|
|
16608
|
+
types: params.actionTypes ?? void 0
|
|
16609
|
+
});
|
|
16610
|
+
return structuredResult({
|
|
16611
|
+
section,
|
|
16612
|
+
...page$1,
|
|
16613
|
+
inputGuide: {
|
|
16614
|
+
schemaFormat: "Sentry-native schemas; workflow action inputs use camelCase fields and string target types.",
|
|
16615
|
+
fieldNames: {
|
|
16616
|
+
target_identifier: "targetIdentifier",
|
|
16617
|
+
target_display: "targetDisplay",
|
|
16618
|
+
target_type: "targetType",
|
|
16619
|
+
fallthrough_type: "fallthroughType"
|
|
16620
|
+
},
|
|
16621
|
+
targetTypes: {
|
|
16622
|
+
"0": "specific",
|
|
16623
|
+
"1": "user",
|
|
16624
|
+
"2": "team",
|
|
16625
|
+
"3": "sentry_app",
|
|
16626
|
+
"4": "issue_owners"
|
|
16627
|
+
},
|
|
16628
|
+
notes: [
|
|
16629
|
+
"Integration actions also require integrationId; choose a returned integration and service ID when applicable.",
|
|
16630
|
+
"Email team IDs can be found with find_teams; member destinations require a user ID.",
|
|
16631
|
+
"Sentry App settings include static field choices. Dynamic fields require explicit values; preserve existing settings when editing unrelated fields."
|
|
16632
|
+
]
|
|
16633
|
+
}
|
|
16634
|
+
});
|
|
16635
|
+
}
|
|
16636
|
+
if (section === "conditions") {
|
|
16637
|
+
if (!params.conditionGroup) throw new UserInputError("conditionGroup is required with section='conditions'.");
|
|
16638
|
+
return structuredResult({
|
|
16639
|
+
section,
|
|
16640
|
+
conditionGroup: params.conditionGroup,
|
|
16641
|
+
...await api.listAlertConditionsPage({
|
|
16642
|
+
...pageParams,
|
|
16643
|
+
group: params.conditionGroup
|
|
16644
|
+
})
|
|
16645
|
+
});
|
|
16646
|
+
}
|
|
16647
|
+
const requestedProjectSlug = params.projectSlug && params.projectSlug !== "all" ? params.projectSlug : void 0;
|
|
16648
|
+
if (requestedProjectSlug) assertProjectRefWithinConstraint({
|
|
16649
|
+
resourceLabel: "Alert source",
|
|
16650
|
+
scopedProjectSlug: context$1.constraints.projectSlug,
|
|
16651
|
+
project: { slug: requestedProjectSlug }
|
|
16652
|
+
});
|
|
16653
|
+
const projectSlug$1 = context$1.constraints.projectSlug ?? requestedProjectSlug;
|
|
16654
|
+
const project = projectSlug$1 ? await api.getProject({
|
|
16655
|
+
organizationSlug,
|
|
16656
|
+
projectSlugOrId: projectSlug$1
|
|
16657
|
+
}) : void 0;
|
|
16658
|
+
const page = await api.listDetectorsPage({
|
|
16659
|
+
...pageParams,
|
|
16660
|
+
projectId: project ? String(project.id) : void 0,
|
|
16661
|
+
types: params.sourceTypes ?? void 0,
|
|
16662
|
+
query: params.query ?? void 0
|
|
16663
|
+
});
|
|
16664
|
+
return structuredResult({
|
|
16665
|
+
section,
|
|
16666
|
+
sources: page.detectors.filter((detector) => !project || detector.projectId === String(project.id)).map((detector) => ({
|
|
16667
|
+
id: detector.id,
|
|
16668
|
+
name: detector.name,
|
|
16669
|
+
type: detector.type,
|
|
16670
|
+
projectId: detector.projectId,
|
|
16671
|
+
enabled: detector.enabled,
|
|
16672
|
+
workflowIds: detector.workflowIds ?? []
|
|
16673
|
+
})),
|
|
16674
|
+
nextCursor: page.nextCursor
|
|
16675
|
+
});
|
|
16676
|
+
}
|
|
16677
|
+
});
|
|
16678
|
+
|
|
16679
|
+
//#endregion
|
|
16680
|
+
//#region ../mcp-core/dist/enhance-error-C-IasWwg.js
|
|
16681
|
+
/**
|
|
16682
|
+
* Enhances a 404 error with parameter context to help users understand what went wrong.
|
|
16683
|
+
* This is optional - tools can use this when they want to provide extra context.
|
|
16684
|
+
*
|
|
16685
|
+
* @example
|
|
16686
|
+
* ```typescript
|
|
16687
|
+
* try {
|
|
16688
|
+
* const issue = await apiService.getIssue({ organizationSlug, issueId });
|
|
16689
|
+
* } catch (error) {
|
|
16690
|
+
* if (error instanceof ApiNotFoundError) {
|
|
16691
|
+
* throw enhanceNotFoundError(error, { organizationSlug, issueId });
|
|
16692
|
+
* }
|
|
16693
|
+
* throw error;
|
|
16694
|
+
* }
|
|
16695
|
+
* ```
|
|
16696
|
+
*/
|
|
16697
|
+
function enhanceNotFoundError(error, params) {
|
|
16698
|
+
const paramsList = [];
|
|
16699
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null && value !== "") paramsList.push(`${key}: '${value}'`);
|
|
16700
|
+
if (paramsList.length > 0) {
|
|
16701
|
+
const enhancedMessage = `${error.message}\nPlease verify these parameters are correct:\n${paramsList.map((p) => ` - ${p}`).join("\n")}`;
|
|
16702
|
+
return new ApiNotFoundError(enhancedMessage, error.detail, error.responseBody);
|
|
16703
|
+
}
|
|
16704
|
+
return error;
|
|
16705
|
+
}
|
|
16706
|
+
|
|
16707
|
+
//#endregion
|
|
16708
|
+
//#region ../mcp-core/dist/code-location-B3p1xz3c.js
|
|
16709
|
+
/** Formats a verified source location for the issue-details response. */
|
|
16710
|
+
function formatCodeLocation(codeLocation) {
|
|
16711
|
+
const output = ["## Code Location", ""];
|
|
16712
|
+
if (codeLocation.repository) output.push(`**Repository**: ${codeLocation.repository}`);
|
|
16713
|
+
if (codeLocation.path) output.push(`**Path**: ${codeLocation.path}`);
|
|
16714
|
+
if (codeLocation.line !== void 0) output.push(`**Line**: ${codeLocation.line}`);
|
|
16715
|
+
output.push(`**Source**: ${codeLocation.url}`, "");
|
|
16716
|
+
return `${output.join("\n")}\n`;
|
|
16717
|
+
}
|
|
16718
|
+
/** Selects Sentry's most relevant application frame: the last in-app frame. */
|
|
16719
|
+
function findMostRelevantInAppFrame(frames) {
|
|
16720
|
+
return frames.findLast((frame) => frame.inApp === true);
|
|
16721
|
+
}
|
|
16722
|
+
|
|
16723
|
+
//#endregion
|
|
16724
|
+
//#region ../mcp-core/dist/tool-call-formatting-DQggqUN_.js
|
|
16025
16725
|
function formatArgumentValue(value) {
|
|
16026
16726
|
if (typeof value === "string") return `'${value.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
|
|
16027
16727
|
if (Array.isArray(value) || typeof value === "object") return JSON.stringify(value);
|
|
@@ -16074,7 +16774,7 @@ function formatAvailableToolCallInstruction({ toolName, experimentalMode, purpos
|
|
|
16074
16774
|
}
|
|
16075
16775
|
|
|
16076
16776
|
//#endregion
|
|
16077
|
-
//#region ../mcp-core/dist/ai-conversation-actions-
|
|
16777
|
+
//#region ../mcp-core/dist/ai-conversation-actions-CLccuTm5.js
|
|
16078
16778
|
const MAX_SUGGESTED_ACTIONS = 3;
|
|
16079
16779
|
function formatInlineCode$1(value) {
|
|
16080
16780
|
const backtickRuns = value.match(/`+/g) ?? [];
|
|
@@ -16085,8 +16785,8 @@ function formatInlineCode$1(value) {
|
|
|
16085
16785
|
}
|
|
16086
16786
|
/** Builds transcript actions that match the session's direct or catalog surface. */
|
|
16087
16787
|
function getAIConversationSuggestedActions({ organizationSlug, aiConversations, experimentalMode, availableToolNames, directToolNames }) {
|
|
16088
|
-
if (aiConversations.length === 0 || !isToolAvailableInSession("
|
|
16089
|
-
const targetIsDirect = directToolNames ? directToolNames.has("
|
|
16788
|
+
if (aiConversations.length === 0 || !isToolAvailableInSession("get_agent_conversation_details", availableToolNames)) return [];
|
|
16789
|
+
const targetIsDirect = directToolNames ? directToolNames.has("get_agent_conversation_details") : isTopLevelToolName("get_agent_conversation_details", experimentalMode);
|
|
16090
16790
|
const executeToolIsDirect = directToolNames ? directToolNames.has("execute_sentry_tool") : isTopLevelToolName("execute_sentry_tool", experimentalMode);
|
|
16091
16791
|
const useCatalogGateway = !targetIsDirect && executeToolIsDirect && isToolAvailableInSession("execute_sentry_tool", availableToolNames);
|
|
16092
16792
|
if (!targetIsDirect && !useCatalogGateway) return [];
|
|
@@ -16097,17 +16797,17 @@ function getAIConversationSuggestedActions({ organizationSlug, aiConversations,
|
|
|
16097
16797
|
};
|
|
16098
16798
|
return targetIsDirect ? {
|
|
16099
16799
|
type: "tool_call",
|
|
16100
|
-
toolName: "
|
|
16800
|
+
toolName: "get_agent_conversation_details",
|
|
16101
16801
|
arguments: targetArguments,
|
|
16102
|
-
reason: "Fetch the full transcript for this
|
|
16802
|
+
reason: "Fetch the full transcript for this agent conversation."
|
|
16103
16803
|
} : {
|
|
16104
16804
|
type: "tool_call",
|
|
16105
16805
|
toolName: "execute_sentry_tool",
|
|
16106
16806
|
arguments: {
|
|
16107
|
-
name: "
|
|
16807
|
+
name: "get_agent_conversation_details",
|
|
16108
16808
|
arguments: targetArguments
|
|
16109
16809
|
},
|
|
16110
|
-
reason: "Fetch the full transcript for this
|
|
16810
|
+
reason: "Fetch the full transcript for this agent conversation."
|
|
16111
16811
|
};
|
|
16112
16812
|
});
|
|
16113
16813
|
}
|
|
@@ -16120,185 +16820,15 @@ function formatAIConversationActionInstructions({ organizationSlug, aiConversati
|
|
|
16120
16820
|
availableToolNames,
|
|
16121
16821
|
directToolNames
|
|
16122
16822
|
});
|
|
16123
|
-
if (actions.length === 0) return ["
|
|
16823
|
+
if (actions.length === 0) return ["Agent conversation detail lookup is not available in this session."];
|
|
16124
16824
|
return actions.map((action) => `Use the Sentry tool ${formatInlineCode$1(formatToolCall({
|
|
16125
16825
|
toolName: action.toolName,
|
|
16126
16826
|
arguments: action.arguments
|
|
16127
16827
|
}))} to fetch the full transcript.`);
|
|
16128
16828
|
}
|
|
16129
|
-
/**
|
|
16130
|
-
* Adds concrete transcript follow-ups to otherwise markdown-first results.
|
|
16131
|
-
* The markdown remains the compatibility path for clients that do not read
|
|
16132
|
-
* structured content.
|
|
16133
|
-
*/
|
|
16134
|
-
function addAIConversationSuggestedActions({ markdown, organizationSlug, aiConversations, experimentalMode, availableToolNames, directToolNames }) {
|
|
16135
|
-
const suggestedActions = getAIConversationSuggestedActions({
|
|
16136
|
-
organizationSlug,
|
|
16137
|
-
aiConversations,
|
|
16138
|
-
experimentalMode,
|
|
16139
|
-
availableToolNames,
|
|
16140
|
-
directToolNames
|
|
16141
|
-
});
|
|
16142
|
-
if (suggestedActions.length === 0) return markdown;
|
|
16143
|
-
return {
|
|
16144
|
-
content: [{
|
|
16145
|
-
type: "text",
|
|
16146
|
-
text: markdown
|
|
16147
|
-
}],
|
|
16148
|
-
structuredContent: { suggestedActions }
|
|
16149
|
-
};
|
|
16150
|
-
}
|
|
16151
16829
|
|
|
16152
16830
|
//#endregion
|
|
16153
|
-
//#region ../mcp-core/dist/
|
|
16154
|
-
/**
|
|
16155
|
-
* Enhances a 404 error with parameter context to help users understand what went wrong.
|
|
16156
|
-
* This is optional - tools can use this when they want to provide extra context.
|
|
16157
|
-
*
|
|
16158
|
-
* @example
|
|
16159
|
-
* ```typescript
|
|
16160
|
-
* try {
|
|
16161
|
-
* const issue = await apiService.getIssue({ organizationSlug, issueId });
|
|
16162
|
-
* } catch (error) {
|
|
16163
|
-
* if (error instanceof ApiNotFoundError) {
|
|
16164
|
-
* throw enhanceNotFoundError(error, { organizationSlug, issueId });
|
|
16165
|
-
* }
|
|
16166
|
-
* throw error;
|
|
16167
|
-
* }
|
|
16168
|
-
* ```
|
|
16169
|
-
*/
|
|
16170
|
-
function enhanceNotFoundError(error, params) {
|
|
16171
|
-
const paramsList = [];
|
|
16172
|
-
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null && value !== "") paramsList.push(`${key}: '${value}'`);
|
|
16173
|
-
if (paramsList.length > 0) {
|
|
16174
|
-
const enhancedMessage = `${error.message}\nPlease verify these parameters are correct:\n${paramsList.map((p) => ` - ${p}`).join("\n")}`;
|
|
16175
|
-
return new ApiNotFoundError(enhancedMessage, error.detail, error.responseBody);
|
|
16176
|
-
}
|
|
16177
|
-
return error;
|
|
16178
|
-
}
|
|
16179
|
-
|
|
16180
|
-
//#endregion
|
|
16181
|
-
//#region ../mcp-core/dist/url-scope-CRM5sNo7.js
|
|
16182
|
-
function resolveScopedOrganizationSlug({ resourceLabel, scopedOrganizationSlug, urlOrganizationSlug }) {
|
|
16183
|
-
if (!scopedOrganizationSlug) return urlOrganizationSlug;
|
|
16184
|
-
if (scopedOrganizationSlug !== urlOrganizationSlug) throw new UserInputError(`${resourceLabel} URL is outside the active organization constraint. Expected organization "${scopedOrganizationSlug}" but got "${urlOrganizationSlug}".`);
|
|
16185
|
-
return scopedOrganizationSlug;
|
|
16186
|
-
}
|
|
16187
|
-
function resolveScopedProjectSlug({ resourceLabel, scopedProjectSlug, urlProjectSlug }) {
|
|
16188
|
-
if (!scopedProjectSlug) return urlProjectSlug;
|
|
16189
|
-
if (scopedProjectSlug !== urlProjectSlug) throw new UserInputError(`${resourceLabel} URL is outside the active project constraint. Expected project "${scopedProjectSlug}" but got "${urlProjectSlug}".`);
|
|
16190
|
-
return scopedProjectSlug;
|
|
16191
|
-
}
|
|
16192
|
-
function assertScopedProjectSlug({ resourceLabel, scopedProjectSlug, actualProjectSlug }) {
|
|
16193
|
-
if (!scopedProjectSlug) return actualProjectSlug;
|
|
16194
|
-
if (scopedProjectSlug !== actualProjectSlug) throw new UserInputError(`${resourceLabel} is outside the active project constraint. Expected project "${scopedProjectSlug}".`);
|
|
16195
|
-
return actualProjectSlug;
|
|
16196
|
-
}
|
|
16197
|
-
function resolveScopedProjectSlugOrId({ resourceLabel, scopedProjectSlugOrId, urlProjectSlug }) {
|
|
16198
|
-
if (scopedProjectSlugOrId == null || typeof scopedProjectSlugOrId === "string" && scopedProjectSlugOrId.trim() === "") return urlProjectSlug;
|
|
16199
|
-
if (typeof scopedProjectSlugOrId === "number" || isNumericId(String(scopedProjectSlugOrId))) return urlProjectSlug;
|
|
16200
|
-
if (scopedProjectSlugOrId !== urlProjectSlug) throw new UserInputError(`${resourceLabel} URL is outside the active project constraint. Expected project "${scopedProjectSlugOrId}" but got "${urlProjectSlug}".`);
|
|
16201
|
-
return scopedProjectSlugOrId;
|
|
16202
|
-
}
|
|
16203
|
-
|
|
16204
|
-
//#endregion
|
|
16205
|
-
//#region ../mcp-core/dist/issue-helpers-0Dnme3Ym.js
|
|
16206
|
-
/**
|
|
16207
|
-
* Extracts the Sentry issue ID and organization slug from a full URL
|
|
16208
|
-
*
|
|
16209
|
-
* @param url - A full Sentry issue URL
|
|
16210
|
-
* @returns Object containing the numeric issue ID and organization slug (if found)
|
|
16211
|
-
* @throws Error if the input is invalid
|
|
16212
|
-
*/
|
|
16213
|
-
function extractIssueId(url) {
|
|
16214
|
-
if (!url || typeof url !== "string") throw new UserInputError("Invalid Sentry issue URL. URL must be a non-empty string.");
|
|
16215
|
-
if (!url.startsWith("http://") && !url.startsWith("https://")) throw new UserInputError("Invalid Sentry issue URL. Must start with http:// or https://");
|
|
16216
|
-
let parsedUrl;
|
|
16217
|
-
try {
|
|
16218
|
-
parsedUrl = new URL(url);
|
|
16219
|
-
} catch (error) {
|
|
16220
|
-
throw new UserInputError(`Invalid Sentry issue URL. Unable to parse URL: ${url}`);
|
|
16221
|
-
}
|
|
16222
|
-
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
16223
|
-
if (pathParts.length < 2 || !pathParts.includes("issues")) throw new UserInputError("Invalid Sentry issue URL. Path must contain '/issues/{issue_id}'");
|
|
16224
|
-
const issueId = pathParts[pathParts.indexOf("issues") + 1];
|
|
16225
|
-
if (!issueId) throw new UserInputError("Unable to determine issue ID from URL.");
|
|
16226
|
-
let organizationSlug;
|
|
16227
|
-
if (pathParts.includes("organizations")) organizationSlug = pathParts[pathParts.indexOf("organizations") + 1];
|
|
16228
|
-
else if (pathParts.length > 1 && pathParts[0] !== "issues") organizationSlug = pathParts[0];
|
|
16229
|
-
else {
|
|
16230
|
-
const hostParts = parsedUrl.hostname.split(".");
|
|
16231
|
-
if (hostParts.length > 2 && hostParts[0] !== "www") organizationSlug = hostParts[0];
|
|
16232
|
-
}
|
|
16233
|
-
if (!organizationSlug) throw new UserInputError("Invalid Sentry issue URL. Could not determine organization.");
|
|
16234
|
-
return {
|
|
16235
|
-
issueId,
|
|
16236
|
-
organizationSlug
|
|
16237
|
-
};
|
|
16238
|
-
}
|
|
16239
|
-
/**
|
|
16240
|
-
* Sometimes the LLM will pass in a funky issue shortId. For example it might pass
|
|
16241
|
-
* in "CLOUDFLARE-MCP-41." instead of "CLOUDFLARE-MCP-41". This function attempts to
|
|
16242
|
-
* fix common issues.
|
|
16243
|
-
*
|
|
16244
|
-
* @param issueId - The issue ID to parse
|
|
16245
|
-
* @returns The parsed issue ID
|
|
16246
|
-
*/
|
|
16247
|
-
function parseIssueId(issueId) {
|
|
16248
|
-
if (!issueId.trim()) throw new UserInputError("Issue ID cannot be empty");
|
|
16249
|
-
let finalIssueId = issueId;
|
|
16250
|
-
finalIssueId = finalIssueId.replace(/[^\w-]/g, "");
|
|
16251
|
-
if (!finalIssueId) throw new UserInputError("Issue ID cannot be empty after removing special characters");
|
|
16252
|
-
const validFormatRegex = /^(\d+|[A-Za-z0-9][\w-]*-[A-Za-z0-9]+)$/;
|
|
16253
|
-
if (!validFormatRegex.test(finalIssueId)) throw new UserInputError(`Invalid issue ID format: "${finalIssueId}". Expected either a numeric ID or a project code followed by an alphanumeric identifier (e.g., "PROJECT-ABC123").`);
|
|
16254
|
-
return finalIssueId;
|
|
16255
|
-
}
|
|
16256
|
-
/**
|
|
16257
|
-
* Parses issue parameters from a variety of formats.
|
|
16258
|
-
*
|
|
16259
|
-
* @param params - Object containing issue URL, issue ID, and organization slug
|
|
16260
|
-
* @returns Object containing the parsed organization slug and issue ID
|
|
16261
|
-
* @throws Error if the input is invalid
|
|
16262
|
-
*/
|
|
16263
|
-
function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
|
|
16264
|
-
if (issueUrl) {
|
|
16265
|
-
const resolved = extractIssueId(issueUrl);
|
|
16266
|
-
if (!resolved) throw new Error("Invalid Sentry issue URL. Path should contain '/issues/{issue_id}'");
|
|
16267
|
-
return {
|
|
16268
|
-
organizationSlug: resolveScopedOrganizationSlug({
|
|
16269
|
-
resourceLabel: "Issue",
|
|
16270
|
-
scopedOrganizationSlug: organizationSlug,
|
|
16271
|
-
urlOrganizationSlug: resolved.organizationSlug
|
|
16272
|
-
}),
|
|
16273
|
-
issueId: parseIssueId(resolved.issueId)
|
|
16274
|
-
};
|
|
16275
|
-
}
|
|
16276
|
-
if (!organizationSlug) throw new UserInputError("Organization slug is required");
|
|
16277
|
-
if (issueId) return {
|
|
16278
|
-
organizationSlug,
|
|
16279
|
-
issueId: parseIssueId(issueId)
|
|
16280
|
-
};
|
|
16281
|
-
throw new UserInputError("Either issueId or issueUrl must be provided");
|
|
16282
|
-
}
|
|
16283
|
-
|
|
16284
|
-
//#endregion
|
|
16285
|
-
//#region ../mcp-core/dist/code-location-DW_YNpMG.js
|
|
16286
|
-
/** Formats a verified source location for the issue-details response. */
|
|
16287
|
-
function formatCodeLocation(codeLocation) {
|
|
16288
|
-
const output = ["## Code Location", ""];
|
|
16289
|
-
if (codeLocation.repository) output.push(`**Repository**: ${codeLocation.repository}`);
|
|
16290
|
-
if (codeLocation.path) output.push(`**Path**: ${codeLocation.path}`);
|
|
16291
|
-
if (codeLocation.line !== void 0) output.push(`**Line**: ${codeLocation.line}`);
|
|
16292
|
-
output.push(`**Source**: ${codeLocation.url}`, "");
|
|
16293
|
-
return `${output.join("\n")}\n`;
|
|
16294
|
-
}
|
|
16295
|
-
/** Selects Sentry's most relevant application frame: the last in-app frame. */
|
|
16296
|
-
function findMostRelevantInAppFrame(frames) {
|
|
16297
|
-
return frames.findLast((frame) => frame.inApp === true);
|
|
16298
|
-
}
|
|
16299
|
-
|
|
16300
|
-
//#endregion
|
|
16301
|
-
//#region ../mcp-core/dist/seer-BoTKAK7k.js
|
|
16831
|
+
//#region ../mcp-core/dist/seer-DqLgmvV9.js
|
|
16302
16832
|
const SEER_POLLING_INTERVAL = 5e3;
|
|
16303
16833
|
const SEER_TIMEOUT = 5 * 60 * 1e3;
|
|
16304
16834
|
const SEER_MAX_RETRIES = 3;
|
|
@@ -16363,6 +16893,19 @@ function wrapSeerAnalysisOutput({ output, runId, step, includeProvenanceTags })
|
|
|
16363
16893
|
const attrs = [runId === void 0 ? null : `run_id="${escapeXmlAttribute(runId)}"`, `step="${escapeXmlAttribute(step)}"`].filter(Boolean);
|
|
16364
16894
|
return `<seer_analysis ${attrs.join(" ")}>\n${output.trimEnd()}\n</seer_analysis>\n`;
|
|
16365
16895
|
}
|
|
16896
|
+
/**
|
|
16897
|
+
* Wraps shared-formatter Seer analysis content in the provenance boundary,
|
|
16898
|
+
* mirroring the tags getOutputForAutofixRun applies to MCP-rendered output.
|
|
16899
|
+
* Seer content is LLM-generated, so it must be marked as untrusted data.
|
|
16900
|
+
*/
|
|
16901
|
+
function wrapSeerContent(content, runId) {
|
|
16902
|
+
return wrapSeerAnalysisOutput({
|
|
16903
|
+
output: content,
|
|
16904
|
+
runId,
|
|
16905
|
+
step: "analysis",
|
|
16906
|
+
includeProvenanceTags: true
|
|
16907
|
+
});
|
|
16908
|
+
}
|
|
16366
16909
|
const RootCauseArtifactDataSchema = z.object({
|
|
16367
16910
|
one_line_description: z.string().optional(),
|
|
16368
16911
|
five_whys: z.array(z.string()).default([]),
|
|
@@ -16463,7 +17006,7 @@ function getActiveAutofixTodo(autofix) {
|
|
|
16463
17006
|
}
|
|
16464
17007
|
|
|
16465
17008
|
//#endregion
|
|
16466
|
-
//#region ../mcp-core/dist/user-formatting-
|
|
17009
|
+
//#region ../mcp-core/dist/user-formatting-CTX3nhjo.js
|
|
16467
17010
|
function formatUserGeoSummary(value) {
|
|
16468
17011
|
if (!isPlainObject$3(value)) return null;
|
|
16469
17012
|
const parts = [
|
|
@@ -16477,7 +17020,7 @@ function formatUserGeoSummary(value) {
|
|
|
16477
17020
|
}
|
|
16478
17021
|
|
|
16479
17022
|
//#endregion
|
|
16480
|
-
//#region ../mcp-core/dist/formatting-
|
|
17023
|
+
//#region ../mcp-core/dist/formatting-31tlKXsb.js
|
|
16481
17024
|
/**
|
|
16482
17025
|
* Convert Seer fixability score to actionability label.
|
|
16483
17026
|
* Thresholds match Sentry core: src/sentry/seer/autofix/constants.py
|
|
@@ -16571,6 +17114,29 @@ function formatFrameHeader(frame, frameIndex, platform) {
|
|
|
16571
17114
|
}
|
|
16572
17115
|
}
|
|
16573
17116
|
/**
|
|
17117
|
+
* Whether the shared formatter covers this event type, and so whether its body should be used
|
|
17118
|
+
* instead of the local rendering.
|
|
17119
|
+
*
|
|
17120
|
+
* "default" is an error event without exception data, "generic" a performance regression or
|
|
17121
|
+
* metric issue, "csp" a Content Security Policy violation. Anything else (a transaction, most
|
|
17122
|
+
* notably) keeps the local path, which renders things the shared body does not carry such as
|
|
17123
|
+
* the fetched performance trace.
|
|
17124
|
+
*/
|
|
17125
|
+
/**
|
|
17126
|
+
* Whether to read the issue's metadata instead of its top level fields. Performance issues can
|
|
17127
|
+
* have various categories such as 'db_query', but the issueType starts with 'performance_'.
|
|
17128
|
+
*
|
|
17129
|
+
* It matters which side of this an issue falls on: metadata.value is a query pattern for a
|
|
17130
|
+
* performance issue and the exception message for an error, so reading it unconditionally
|
|
17131
|
+
* misnames the error text.
|
|
17132
|
+
*/
|
|
17133
|
+
function isPerformanceIssueType(issue) {
|
|
17134
|
+
return issue.issueType?.startsWith("performance_") === true || issue.issueCategory === "performance";
|
|
17135
|
+
}
|
|
17136
|
+
function usesSharedFormatterBody(event) {
|
|
17137
|
+
return event.type === "error" || event.type === "default" || event.type === "generic" || event.type === "csp";
|
|
17138
|
+
}
|
|
17139
|
+
/**
|
|
16574
17140
|
* Formats a Sentry event into a structured markdown output.
|
|
16575
17141
|
* Includes error messages, stack traces, request info, and contextual data.
|
|
16576
17142
|
*
|
|
@@ -17512,14 +18078,17 @@ function formatSeerSummary(autofixState) {
|
|
|
17512
18078
|
parts.push(`**Status:** ${getStatusDisplayName(autofix.status)}`);
|
|
17513
18079
|
parts.push("");
|
|
17514
18080
|
}
|
|
17515
|
-
|
|
17516
|
-
|
|
17517
|
-
|
|
17518
|
-
|
|
17519
|
-
|
|
17520
|
-
|
|
17521
|
-
|
|
17522
|
-
|
|
18081
|
+
if (autofixState.formatted?.content) parts.push(wrapSeerContent(autofixState.formatted.content, autofix.run_id));
|
|
18082
|
+
else {
|
|
18083
|
+
const { rootCause, solution } = getAutofixArtifactSummaries(autofix);
|
|
18084
|
+
if (solution) {
|
|
18085
|
+
parts.push("**Summary:**");
|
|
18086
|
+
parts.push(solution);
|
|
18087
|
+
} else if (rootCause) {
|
|
18088
|
+
parts.push("**Root Cause Identified:**");
|
|
18089
|
+
parts.push(rootCause);
|
|
18090
|
+
} else if (!isTerminalStatus(autofix.status)) parts.push("Analysis has started but no results yet.");
|
|
18091
|
+
}
|
|
17523
18092
|
if (autofix.status === "error") {
|
|
17524
18093
|
parts.push("");
|
|
17525
18094
|
parts.push("**Status:** Analysis failed.");
|
|
@@ -17538,7 +18107,7 @@ function formatSeerSummary(autofixState) {
|
|
|
17538
18107
|
*/
|
|
17539
18108
|
function formatIssueOutput({ organizationSlug, issue, event, apiService, autofixState, performanceTrace, externalIssues, relatedReplayIds, aiConversations, codeLocation, experimentalMode, availableToolNames, directToolNames }) {
|
|
17540
18109
|
let output = `# Issue ${issue.shortId} in **${organizationSlug}**\n\n`;
|
|
17541
|
-
const isPerformanceIssue = issue
|
|
18110
|
+
const isPerformanceIssue = isPerformanceIssueType(issue);
|
|
17542
18111
|
if (isPerformanceIssue && issue.metadata) {
|
|
17543
18112
|
const issueTitle = issue.metadata.title || issue.title;
|
|
17544
18113
|
output += `**Description**: ${issueTitle}\n`;
|
|
@@ -17601,13 +18170,26 @@ function formatIssueOutput({ organizationSlug, issue, event, apiService, autofix
|
|
|
17601
18170
|
}
|
|
17602
18171
|
output += `**Event ID**: ${event.id}\n`;
|
|
17603
18172
|
output += `**Type**: ${event.type}\n`;
|
|
17604
|
-
|
|
18173
|
+
const isSharedFormatterType = usesSharedFormatterBody(event);
|
|
18174
|
+
if (isSharedFormatterType) {
|
|
17605
18175
|
const typedEvent = event;
|
|
17606
18176
|
if (typedEvent.dateCreated) output += `**Occurred At**: ${new Date(typedEvent.dateCreated).toISOString()}\n`;
|
|
17607
18177
|
}
|
|
17608
18178
|
if (event.message) output += `**Message**:\n${event.message}\n`;
|
|
17609
18179
|
output += "\n";
|
|
17610
|
-
|
|
18180
|
+
if (isSharedFormatterType && event.formatted?.format === "markdown" && event.formatted.content) {
|
|
18181
|
+
output += formatIssueReplayOutput({
|
|
18182
|
+
apiService,
|
|
18183
|
+
organizationSlug,
|
|
18184
|
+
event,
|
|
18185
|
+
relatedReplayIds,
|
|
18186
|
+
experimentalMode: experimentalMode ?? false,
|
|
18187
|
+
availableToolNames,
|
|
18188
|
+
directToolNames
|
|
18189
|
+
});
|
|
18190
|
+
const formattedContent = event.formatted.content;
|
|
18191
|
+
output += formattedContent.endsWith("\n") ? formattedContent : `${formattedContent}\n`;
|
|
18192
|
+
} else output += formatEventOutput(event, {
|
|
17611
18193
|
performanceTrace,
|
|
17612
18194
|
replaySummary: {
|
|
17613
18195
|
apiService,
|
|
@@ -17736,10 +18318,10 @@ function formatAIConversationResponseNote({ aiConversations, organizationSlug, e
|
|
|
17736
18318
|
if (aiConversations.length === 1) {
|
|
17737
18319
|
const [conversation] = aiConversations;
|
|
17738
18320
|
const spanSuffix = conversation.spanId ? ` Matching span: \`${conversation.spanId}\`.` : "";
|
|
17739
|
-
return `-
|
|
18321
|
+
return `- Agent conversation found in this trace: \`${conversation.conversationId}\`.${spanSuffix}\n${instructions.map((instruction) => `- ${instruction}`).join("\n")}\n`;
|
|
17740
18322
|
}
|
|
17741
18323
|
const conversationIds = aiConversations.map((conversation) => `\`${conversation.conversationId}\``).join(", ");
|
|
17742
|
-
return `- Multiple
|
|
18324
|
+
return `- Multiple agent conversations were found in this trace: ${conversationIds}.\n${instructions.map((instruction) => `- ${instruction}`).join("\n")}\n`;
|
|
17743
18325
|
}
|
|
17744
18326
|
const MAX_DISPLAY_REPLAYS = 5;
|
|
17745
18327
|
function formatIssueReplayOutput({ apiService, organizationSlug, event, relatedReplayIds, experimentalMode, availableToolNames, directToolNames }) {
|
|
@@ -17825,7 +18407,111 @@ function stripReplayMetadata(event) {
|
|
|
17825
18407
|
}
|
|
17826
18408
|
|
|
17827
18409
|
//#endregion
|
|
17828
|
-
//#region ../mcp-core/dist/
|
|
18410
|
+
//#region ../mcp-core/dist/url-scope-V6MOdP9h.js
|
|
18411
|
+
function resolveScopedOrganizationSlug({ resourceLabel, scopedOrganizationSlug, urlOrganizationSlug }) {
|
|
18412
|
+
if (!scopedOrganizationSlug) return urlOrganizationSlug;
|
|
18413
|
+
if (scopedOrganizationSlug !== urlOrganizationSlug) throw new UserInputError(`${resourceLabel} URL is outside the active organization constraint. Expected organization "${scopedOrganizationSlug}" but got "${urlOrganizationSlug}".`);
|
|
18414
|
+
return scopedOrganizationSlug;
|
|
18415
|
+
}
|
|
18416
|
+
function resolveScopedProjectSlug({ resourceLabel, scopedProjectSlug, urlProjectSlug }) {
|
|
18417
|
+
if (!scopedProjectSlug) return urlProjectSlug;
|
|
18418
|
+
if (scopedProjectSlug !== urlProjectSlug) throw new UserInputError(`${resourceLabel} URL is outside the active project constraint. Expected project "${scopedProjectSlug}" but got "${urlProjectSlug}".`);
|
|
18419
|
+
return scopedProjectSlug;
|
|
18420
|
+
}
|
|
18421
|
+
function assertScopedProjectSlug({ resourceLabel, scopedProjectSlug, actualProjectSlug }) {
|
|
18422
|
+
if (!scopedProjectSlug) return actualProjectSlug;
|
|
18423
|
+
if (scopedProjectSlug !== actualProjectSlug) throw new UserInputError(`${resourceLabel} is outside the active project constraint. Expected project "${scopedProjectSlug}".`);
|
|
18424
|
+
return actualProjectSlug;
|
|
18425
|
+
}
|
|
18426
|
+
function resolveScopedProjectSlugOrId({ resourceLabel, scopedProjectSlugOrId, urlProjectSlug }) {
|
|
18427
|
+
if (scopedProjectSlugOrId == null || typeof scopedProjectSlugOrId === "string" && scopedProjectSlugOrId.trim() === "") return urlProjectSlug;
|
|
18428
|
+
if (typeof scopedProjectSlugOrId === "number" || isNumericId(String(scopedProjectSlugOrId))) return urlProjectSlug;
|
|
18429
|
+
if (scopedProjectSlugOrId !== urlProjectSlug) throw new UserInputError(`${resourceLabel} URL is outside the active project constraint. Expected project "${scopedProjectSlugOrId}" but got "${urlProjectSlug}".`);
|
|
18430
|
+
return scopedProjectSlugOrId;
|
|
18431
|
+
}
|
|
18432
|
+
|
|
18433
|
+
//#endregion
|
|
18434
|
+
//#region ../mcp-core/dist/issue-helpers-qGxiGeE5.js
|
|
18435
|
+
/**
|
|
18436
|
+
* Extracts the Sentry issue ID and organization slug from a full URL
|
|
18437
|
+
*
|
|
18438
|
+
* @param url - A full Sentry issue URL
|
|
18439
|
+
* @returns Object containing the numeric issue ID and organization slug (if found)
|
|
18440
|
+
* @throws Error if the input is invalid
|
|
18441
|
+
*/
|
|
18442
|
+
function extractIssueId(url) {
|
|
18443
|
+
if (!url || typeof url !== "string") throw new UserInputError("Invalid Sentry issue URL. URL must be a non-empty string.");
|
|
18444
|
+
if (!url.startsWith("http://") && !url.startsWith("https://")) throw new UserInputError("Invalid Sentry issue URL. Must start with http:// or https://");
|
|
18445
|
+
let parsedUrl;
|
|
18446
|
+
try {
|
|
18447
|
+
parsedUrl = new URL(url);
|
|
18448
|
+
} catch (error) {
|
|
18449
|
+
throw new UserInputError(`Invalid Sentry issue URL. Unable to parse URL: ${url}`);
|
|
18450
|
+
}
|
|
18451
|
+
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
18452
|
+
if (pathParts.length < 2 || !pathParts.includes("issues")) throw new UserInputError("Invalid Sentry issue URL. Path must contain '/issues/{issue_id}'");
|
|
18453
|
+
const issueId = pathParts[pathParts.indexOf("issues") + 1];
|
|
18454
|
+
if (!issueId) throw new UserInputError("Unable to determine issue ID from URL.");
|
|
18455
|
+
let organizationSlug;
|
|
18456
|
+
if (pathParts.includes("organizations")) organizationSlug = pathParts[pathParts.indexOf("organizations") + 1];
|
|
18457
|
+
else if (pathParts.length > 1 && pathParts[0] !== "issues") organizationSlug = pathParts[0];
|
|
18458
|
+
else {
|
|
18459
|
+
const hostParts = parsedUrl.hostname.split(".");
|
|
18460
|
+
if (hostParts.length > 2 && hostParts[0] !== "www") organizationSlug = hostParts[0];
|
|
18461
|
+
}
|
|
18462
|
+
if (!organizationSlug) throw new UserInputError("Invalid Sentry issue URL. Could not determine organization.");
|
|
18463
|
+
return {
|
|
18464
|
+
issueId,
|
|
18465
|
+
organizationSlug
|
|
18466
|
+
};
|
|
18467
|
+
}
|
|
18468
|
+
/**
|
|
18469
|
+
* Sometimes the LLM will pass in a funky issue shortId. For example it might pass
|
|
18470
|
+
* in "CLOUDFLARE-MCP-41." instead of "CLOUDFLARE-MCP-41". This function attempts to
|
|
18471
|
+
* fix common issues.
|
|
18472
|
+
*
|
|
18473
|
+
* @param issueId - The issue ID to parse
|
|
18474
|
+
* @returns The parsed issue ID
|
|
18475
|
+
*/
|
|
18476
|
+
function parseIssueId(issueId) {
|
|
18477
|
+
if (!issueId.trim()) throw new UserInputError("Issue ID cannot be empty");
|
|
18478
|
+
let finalIssueId = issueId;
|
|
18479
|
+
finalIssueId = finalIssueId.replace(/[^\w-]/g, "");
|
|
18480
|
+
if (!finalIssueId) throw new UserInputError("Issue ID cannot be empty after removing special characters");
|
|
18481
|
+
const validFormatRegex = /^(\d+|[A-Za-z0-9][\w-]*-[A-Za-z0-9]+)$/;
|
|
18482
|
+
if (!validFormatRegex.test(finalIssueId)) throw new UserInputError(`Invalid issue ID format: "${finalIssueId}". Expected either a numeric ID or a project code followed by an alphanumeric identifier (e.g., "PROJECT-ABC123").`);
|
|
18483
|
+
return finalIssueId;
|
|
18484
|
+
}
|
|
18485
|
+
/**
|
|
18486
|
+
* Parses issue parameters from a variety of formats.
|
|
18487
|
+
*
|
|
18488
|
+
* @param params - Object containing issue URL, issue ID, and organization slug
|
|
18489
|
+
* @returns Object containing the parsed organization slug and issue ID
|
|
18490
|
+
* @throws Error if the input is invalid
|
|
18491
|
+
*/
|
|
18492
|
+
function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
|
|
18493
|
+
if (issueUrl) {
|
|
18494
|
+
const resolved = extractIssueId(issueUrl);
|
|
18495
|
+
if (!resolved) throw new Error("Invalid Sentry issue URL. Path should contain '/issues/{issue_id}'");
|
|
18496
|
+
return {
|
|
18497
|
+
organizationSlug: resolveScopedOrganizationSlug({
|
|
18498
|
+
resourceLabel: "Issue",
|
|
18499
|
+
scopedOrganizationSlug: organizationSlug,
|
|
18500
|
+
urlOrganizationSlug: resolved.organizationSlug
|
|
18501
|
+
}),
|
|
18502
|
+
issueId: parseIssueId(resolved.issueId)
|
|
18503
|
+
};
|
|
18504
|
+
}
|
|
18505
|
+
if (!organizationSlug) throw new UserInputError("Organization slug is required");
|
|
18506
|
+
if (issueId) return {
|
|
18507
|
+
organizationSlug,
|
|
18508
|
+
issueId: parseIssueId(issueId)
|
|
18509
|
+
};
|
|
18510
|
+
throw new UserInputError("Either issueId or issueUrl must be provided");
|
|
18511
|
+
}
|
|
18512
|
+
|
|
18513
|
+
//#endregion
|
|
18514
|
+
//#region ../mcp-core/dist/issue-y4HGWyCn.js
|
|
17829
18515
|
function assertIssueWithinProjectConstraint({ issue, projectSlug: projectSlug$1, resourceLabel = "Issue" }) {
|
|
17830
18516
|
assertScopedProjectSlug({
|
|
17831
18517
|
resourceLabel,
|
|
@@ -17847,7 +18533,7 @@ async function ensureIssueWithinProjectConstraint({ apiService, organizationSlug
|
|
|
17847
18533
|
}
|
|
17848
18534
|
|
|
17849
18535
|
//#endregion
|
|
17850
|
-
//#region ../mcp-core/dist/code-location-
|
|
18536
|
+
//#region ../mcp-core/dist/code-location-Dh_XFzfu.js
|
|
17851
18537
|
const CODE_LOCATION_TIMEOUT_MS = 3e3;
|
|
17852
18538
|
/** Resolves a verified source location, omitting optional enrichment failures. */
|
|
17853
18539
|
async function resolveCodeLocation({ apiService, organizationSlug, projectSlug: projectSlug$1, event }) {
|
|
@@ -17950,10 +18636,174 @@ function getString$1(value) {
|
|
|
17950
18636
|
}
|
|
17951
18637
|
|
|
17952
18638
|
//#endregion
|
|
17953
|
-
//#region ../mcp-core/dist/get-issue-details-
|
|
18639
|
+
//#region ../mcp-core/dist/get-issue-details-t289hNuc.js
|
|
18640
|
+
const MAX_RELATED_REPLAYS = 5;
|
|
17954
18641
|
const MAX_AI_CONVERSATION_MATCHES = 3;
|
|
17955
18642
|
const AI_CONVERSATION_LOOKUP_WINDOW_MS = 24 * 60 * 60 * 1e3;
|
|
17956
18643
|
const TRACE_ID_PATTERN = /^[0-9a-fA-F]{32}$/;
|
|
18644
|
+
/**
|
|
18645
|
+
* The issue payload as `structuredContent`.
|
|
18646
|
+
*
|
|
18647
|
+
* Every field is mapped explicitly rather than spread from an api response, so a passthrough
|
|
18648
|
+
* upstream schema cannot leak backend-only fields into the public interface.
|
|
18649
|
+
*
|
|
18650
|
+
* `event.body` is the one open record: it is whatever Sentry's shared formatter emits
|
|
18651
|
+
* for `?llmFormat=json`, and its sections are decided there. Enumerating them here would make
|
|
18652
|
+
* this schema a second declaration of that contract, needing a bump every time a section is
|
|
18653
|
+
* added on the Sentry side.
|
|
18654
|
+
*/
|
|
18655
|
+
const getIssueDetailsOutputSchema = z.object({
|
|
18656
|
+
issue: z.object({
|
|
18657
|
+
shortId: z.string(),
|
|
18658
|
+
title: z.string(),
|
|
18659
|
+
culprit: z.string().nullish(),
|
|
18660
|
+
firstSeen: z.string().nullish(),
|
|
18661
|
+
lastSeen: z.string().nullish(),
|
|
18662
|
+
occurrences: z.number().nullish(),
|
|
18663
|
+
usersImpacted: z.number().nullish(),
|
|
18664
|
+
status: z.string().nullish(),
|
|
18665
|
+
substatus: z.string().nullish(),
|
|
18666
|
+
assignedTo: z.string().nullish(),
|
|
18667
|
+
issueType: z.string().nullish(),
|
|
18668
|
+
issueCategory: z.string().nullish(),
|
|
18669
|
+
seerActionability: z.string().nullish(),
|
|
18670
|
+
platform: z.string().nullish(),
|
|
18671
|
+
project: z.string().nullish(),
|
|
18672
|
+
url: z.string(),
|
|
18673
|
+
location: z.string().nullish(),
|
|
18674
|
+
queryPattern: z.string().nullish()
|
|
18675
|
+
}),
|
|
18676
|
+
event: z.object({
|
|
18677
|
+
id: z.string(),
|
|
18678
|
+
type: z.string().nullish(),
|
|
18679
|
+
occurredAt: z.string().nullish(),
|
|
18680
|
+
body: z.record(z.string(), z.unknown())
|
|
18681
|
+
}),
|
|
18682
|
+
seer: z.object({
|
|
18683
|
+
status: z.string().nullish(),
|
|
18684
|
+
rootCause: z.string().nullish(),
|
|
18685
|
+
solution: z.string().nullish()
|
|
18686
|
+
}).nullish(),
|
|
18687
|
+
codeLocation: z.object({
|
|
18688
|
+
repository: z.string().nullish(),
|
|
18689
|
+
path: z.string().nullish(),
|
|
18690
|
+
line: z.number().nullish(),
|
|
18691
|
+
url: z.string()
|
|
18692
|
+
}).nullish(),
|
|
18693
|
+
replays: z.object({
|
|
18694
|
+
attached: z.string().nullish(),
|
|
18695
|
+
related: z.array(z.string()),
|
|
18696
|
+
relatedCount: z.number()
|
|
18697
|
+
}).nullish(),
|
|
18698
|
+
externalIssues: z.array(z.object({
|
|
18699
|
+
id: z.string(),
|
|
18700
|
+
issueId: z.string(),
|
|
18701
|
+
serviceType: z.string(),
|
|
18702
|
+
displayName: z.string(),
|
|
18703
|
+
webUrl: z.string()
|
|
18704
|
+
})).nullish(),
|
|
18705
|
+
aiConversations: z.array(z.object({
|
|
18706
|
+
conversationId: z.string(),
|
|
18707
|
+
spanId: z.string().nullish()
|
|
18708
|
+
})).nullish()
|
|
18709
|
+
});
|
|
18710
|
+
/**
|
|
18711
|
+
* Parses the shared formatter's json body. Returns undefined when the caller's org is not on
|
|
18712
|
+
* the rollout yet, which is the signal to keep returning markdown: a structured result has to
|
|
18713
|
+
* carry the whole answer, and without the body it would not.
|
|
18714
|
+
*/
|
|
18715
|
+
function parseFormattedBody(event) {
|
|
18716
|
+
if (!usesSharedFormatterBody(event)) return void 0;
|
|
18717
|
+
const content = event.formatted?.content;
|
|
18718
|
+
if (!content) return void 0;
|
|
18719
|
+
try {
|
|
18720
|
+
const parsed = JSON.parse(content);
|
|
18721
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : void 0;
|
|
18722
|
+
} catch {
|
|
18723
|
+
return void 0;
|
|
18724
|
+
}
|
|
18725
|
+
}
|
|
18726
|
+
/**
|
|
18727
|
+
* The attached replay plus the related ones, derived the way the markdown output derives them.
|
|
18728
|
+
* The attached id lives on the event rather than in the related list, so passing that list
|
|
18729
|
+
* through alone loses the replay for an issue whose only one is attached.
|
|
18730
|
+
*/
|
|
18731
|
+
/**
|
|
18732
|
+
* ``dateCreated`` sits on the shared-formatter event types rather than the base union, and
|
|
18733
|
+
* the markdown path normalizes it to ISO. Read it the same way and tolerate a bad value.
|
|
18734
|
+
*/
|
|
18735
|
+
function eventOccurredAt(event) {
|
|
18736
|
+
const raw = "dateCreated" in event ? event.dateCreated : null;
|
|
18737
|
+
if (typeof raw !== "string") return null;
|
|
18738
|
+
const parsed = new Date(raw);
|
|
18739
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString();
|
|
18740
|
+
}
|
|
18741
|
+
function buildReplays(event, relatedReplayIds) {
|
|
18742
|
+
const attached = getReplayIdFromEvent(event);
|
|
18743
|
+
const related = dedupeReplayIds(relatedReplayIds ?? []).filter((replayId) => replayId !== attached);
|
|
18744
|
+
if (!attached && related.length === 0) return null;
|
|
18745
|
+
return {
|
|
18746
|
+
attached,
|
|
18747
|
+
related: related.slice(0, MAX_RELATED_REPLAYS),
|
|
18748
|
+
relatedCount: related.length
|
|
18749
|
+
};
|
|
18750
|
+
}
|
|
18751
|
+
function buildIssueDetailsPayload({ organizationSlug, issue, event, body, apiService, autofixState, externalIssues, relatedReplayIds, aiConversations, codeLocation }) {
|
|
18752
|
+
const autofix = autofixState?.autofix;
|
|
18753
|
+
const summaries = autofix ? getAutofixArtifactSummaries(autofix) : void 0;
|
|
18754
|
+
const isPerf = isPerformanceIssueType(issue) && !!issue.metadata;
|
|
18755
|
+
return {
|
|
18756
|
+
issue: {
|
|
18757
|
+
shortId: issue.shortId,
|
|
18758
|
+
title: (isPerf ? issue.metadata?.title : null) || issue.title,
|
|
18759
|
+
culprit: issue.culprit,
|
|
18760
|
+
firstSeen: issue.firstSeen,
|
|
18761
|
+
lastSeen: issue.lastSeen,
|
|
18762
|
+
occurrences: issue.count == null ? null : Number(issue.count),
|
|
18763
|
+
usersImpacted: issue.userCount == null ? null : Number(issue.userCount),
|
|
18764
|
+
status: issue.status,
|
|
18765
|
+
substatus: issue.substatus,
|
|
18766
|
+
assignedTo: typeof issue.assignedTo === "string" ? issue.assignedTo : issue.assignedTo?.name,
|
|
18767
|
+
issueType: issue.issueType,
|
|
18768
|
+
issueCategory: issue.issueCategory,
|
|
18769
|
+
seerActionability: issue.seerFixabilityScore == null ? null : getSeerActionabilityLabel(issue.seerFixabilityScore),
|
|
18770
|
+
platform: issue.platform,
|
|
18771
|
+
project: issue.project?.name,
|
|
18772
|
+
url: apiService.getIssueUrl(organizationSlug, issue.shortId),
|
|
18773
|
+
location: isPerf ? issue.metadata?.location : null,
|
|
18774
|
+
queryPattern: isPerf ? issue.metadata?.value : null
|
|
18775
|
+
},
|
|
18776
|
+
event: {
|
|
18777
|
+
id: event.id,
|
|
18778
|
+
type: typeof event.type === "string" ? event.type : null,
|
|
18779
|
+
occurredAt: eventOccurredAt(event),
|
|
18780
|
+
body
|
|
18781
|
+
},
|
|
18782
|
+
seer: autofix ? {
|
|
18783
|
+
status: getStatusDisplayName(autofix.status),
|
|
18784
|
+
rootCause: summaries?.rootCause,
|
|
18785
|
+
solution: summaries?.solution
|
|
18786
|
+
} : null,
|
|
18787
|
+
codeLocation: codeLocation ? {
|
|
18788
|
+
repository: codeLocation.repository,
|
|
18789
|
+
path: codeLocation.path,
|
|
18790
|
+
line: codeLocation.line,
|
|
18791
|
+
url: codeLocation.url
|
|
18792
|
+
} : null,
|
|
18793
|
+
replays: buildReplays(event, relatedReplayIds),
|
|
18794
|
+
externalIssues: externalIssues?.length ? externalIssues.map((issue$1) => ({
|
|
18795
|
+
id: String(issue$1.id),
|
|
18796
|
+
issueId: String(issue$1.issueId),
|
|
18797
|
+
serviceType: issue$1.serviceType,
|
|
18798
|
+
displayName: issue$1.displayName,
|
|
18799
|
+
webUrl: issue$1.webUrl
|
|
18800
|
+
})) : null,
|
|
18801
|
+
aiConversations: aiConversations?.length ? aiConversations.map((conversation) => ({
|
|
18802
|
+
conversationId: conversation.conversationId,
|
|
18803
|
+
spanId: conversation.spanId
|
|
18804
|
+
})) : null
|
|
18805
|
+
};
|
|
18806
|
+
}
|
|
17957
18807
|
var get_issue_details_default = defineTool({
|
|
17958
18808
|
name: "get_issue_details",
|
|
17959
18809
|
skills: [
|
|
@@ -18020,7 +18870,7 @@ var get_issue_details_default = defineTool({
|
|
|
18020
18870
|
const orgSlug$1 = params.organizationSlug;
|
|
18021
18871
|
const eventId = params.eventId;
|
|
18022
18872
|
if (!orgSlug$1) throw new UserInputError("`organizationSlug` is required when providing `eventId`");
|
|
18023
|
-
|
|
18873
|
+
setOrganizationContext(orgSlug$1);
|
|
18024
18874
|
let issue$1;
|
|
18025
18875
|
if (params.issueId) issue$1 = await apiService.getIssue({
|
|
18026
18876
|
organizationSlug: orgSlug$1,
|
|
@@ -18031,7 +18881,7 @@ var get_issue_details_default = defineTool({
|
|
|
18031
18881
|
organizationSlug: orgSlug$1,
|
|
18032
18882
|
query: eventId
|
|
18033
18883
|
});
|
|
18034
|
-
if (!found)
|
|
18884
|
+
if (!found) throw new UserInputError(`No issue found for Event ID: ${eventId}`);
|
|
18035
18885
|
issue$1 = found;
|
|
18036
18886
|
}
|
|
18037
18887
|
assertIssueWithinProjectConstraint({
|
|
@@ -18040,12 +18890,12 @@ var get_issue_details_default = defineTool({
|
|
|
18040
18890
|
});
|
|
18041
18891
|
const [{ event: event$1, performanceTrace: performanceTrace$1, aiConversations: aiConversations$1, codeLocation: codeLocation$1 }, { autofixState: autofixState$1, externalIssues: externalIssues$1, relatedReplayIds: relatedReplayIds$1 }] = await Promise.all([apiService.getEventForIssue({
|
|
18042
18892
|
organizationSlug: orgSlug$1,
|
|
18043
|
-
issueId: issue$1.
|
|
18893
|
+
issueId: String(issue$1.id),
|
|
18044
18894
|
eventId
|
|
18045
18895
|
}).catch((error) => {
|
|
18046
18896
|
if (error instanceof ApiNotFoundError) throw enhanceNotFoundError(error, {
|
|
18047
18897
|
organizationSlug: orgSlug$1,
|
|
18048
|
-
issueId: issue$1.
|
|
18898
|
+
issueId: String(issue$1.id),
|
|
18049
18899
|
eventId
|
|
18050
18900
|
});
|
|
18051
18901
|
throw error;
|
|
@@ -18063,25 +18913,31 @@ var get_issue_details_default = defineTool({
|
|
|
18063
18913
|
issue: issue$1,
|
|
18064
18914
|
seerEnabled: isSeerGranted(context$1)
|
|
18065
18915
|
})]);
|
|
18066
|
-
|
|
18067
|
-
|
|
18068
|
-
organizationSlug: orgSlug$1,
|
|
18069
|
-
issue: issue$1,
|
|
18070
|
-
event: event$1,
|
|
18071
|
-
apiService,
|
|
18072
|
-
autofixState: autofixState$1,
|
|
18073
|
-
performanceTrace: performanceTrace$1,
|
|
18074
|
-
externalIssues: externalIssues$1,
|
|
18075
|
-
relatedReplayIds: relatedReplayIds$1,
|
|
18076
|
-
aiConversations: aiConversations$1,
|
|
18077
|
-
codeLocation: codeLocation$1,
|
|
18078
|
-
experimentalMode: context$1.experimentalMode,
|
|
18079
|
-
availableToolNames: context$1.availableToolNames,
|
|
18080
|
-
directToolNames: context$1.directToolNames
|
|
18081
|
-
}),
|
|
18916
|
+
const body$1 = parseFormattedBody(event$1);
|
|
18917
|
+
if (body$1) return structuredResult(buildIssueDetailsPayload({
|
|
18082
18918
|
organizationSlug: orgSlug$1,
|
|
18919
|
+
issue: issue$1,
|
|
18920
|
+
event: event$1,
|
|
18921
|
+
body: body$1,
|
|
18922
|
+
apiService,
|
|
18923
|
+
autofixState: autofixState$1,
|
|
18924
|
+
externalIssues: externalIssues$1,
|
|
18925
|
+
relatedReplayIds: relatedReplayIds$1,
|
|
18083
18926
|
aiConversations: aiConversations$1,
|
|
18084
|
-
|
|
18927
|
+
codeLocation: codeLocation$1
|
|
18928
|
+
}));
|
|
18929
|
+
return formatIssueOutput({
|
|
18930
|
+
organizationSlug: orgSlug$1,
|
|
18931
|
+
issue: issue$1,
|
|
18932
|
+
event: event$1,
|
|
18933
|
+
apiService,
|
|
18934
|
+
autofixState: autofixState$1,
|
|
18935
|
+
performanceTrace: performanceTrace$1,
|
|
18936
|
+
externalIssues: externalIssues$1,
|
|
18937
|
+
relatedReplayIds: relatedReplayIds$1,
|
|
18938
|
+
aiConversations: aiConversations$1,
|
|
18939
|
+
codeLocation: codeLocation$1,
|
|
18940
|
+
experimentalMode: context$1.experimentalMode,
|
|
18085
18941
|
availableToolNames: context$1.availableToolNames,
|
|
18086
18942
|
directToolNames: context$1.directToolNames
|
|
18087
18943
|
});
|
|
@@ -18093,7 +18949,7 @@ var get_issue_details_default = defineTool({
|
|
|
18093
18949
|
issueId: params.issueId,
|
|
18094
18950
|
issueUrl: params.issueUrl
|
|
18095
18951
|
});
|
|
18096
|
-
|
|
18952
|
+
setOrganizationContext(orgSlug);
|
|
18097
18953
|
let issue;
|
|
18098
18954
|
try {
|
|
18099
18955
|
issue = await apiService.getIssue({
|
|
@@ -18113,7 +18969,7 @@ var get_issue_details_default = defineTool({
|
|
|
18113
18969
|
});
|
|
18114
18970
|
const [{ event, performanceTrace, aiConversations, codeLocation }, { autofixState, externalIssues, relatedReplayIds }] = await Promise.all([apiService.getLatestEventForIssue({
|
|
18115
18971
|
organizationSlug: orgSlug,
|
|
18116
|
-
issueId: issue.
|
|
18972
|
+
issueId: String(issue.id)
|
|
18117
18973
|
}).then(async (event$1) => ({
|
|
18118
18974
|
event: event$1,
|
|
18119
18975
|
...await fetchEventEnrichment({
|
|
@@ -18128,25 +18984,31 @@ var get_issue_details_default = defineTool({
|
|
|
18128
18984
|
issue,
|
|
18129
18985
|
seerEnabled: isSeerGranted(context$1)
|
|
18130
18986
|
})]);
|
|
18131
|
-
|
|
18132
|
-
|
|
18133
|
-
organizationSlug: orgSlug,
|
|
18134
|
-
issue,
|
|
18135
|
-
event,
|
|
18136
|
-
apiService,
|
|
18137
|
-
autofixState,
|
|
18138
|
-
performanceTrace,
|
|
18139
|
-
externalIssues,
|
|
18140
|
-
relatedReplayIds,
|
|
18141
|
-
aiConversations,
|
|
18142
|
-
codeLocation,
|
|
18143
|
-
experimentalMode: context$1.experimentalMode,
|
|
18144
|
-
availableToolNames: context$1.availableToolNames,
|
|
18145
|
-
directToolNames: context$1.directToolNames
|
|
18146
|
-
}),
|
|
18987
|
+
const body = parseFormattedBody(event);
|
|
18988
|
+
if (body) return structuredResult(buildIssueDetailsPayload({
|
|
18147
18989
|
organizationSlug: orgSlug,
|
|
18990
|
+
issue,
|
|
18991
|
+
event,
|
|
18992
|
+
body,
|
|
18993
|
+
apiService,
|
|
18994
|
+
autofixState,
|
|
18995
|
+
externalIssues,
|
|
18996
|
+
relatedReplayIds,
|
|
18148
18997
|
aiConversations,
|
|
18149
|
-
|
|
18998
|
+
codeLocation
|
|
18999
|
+
}));
|
|
19000
|
+
return formatIssueOutput({
|
|
19001
|
+
organizationSlug: orgSlug,
|
|
19002
|
+
issue,
|
|
19003
|
+
event,
|
|
19004
|
+
apiService,
|
|
19005
|
+
autofixState,
|
|
19006
|
+
performanceTrace,
|
|
19007
|
+
externalIssues,
|
|
19008
|
+
relatedReplayIds,
|
|
19009
|
+
aiConversations,
|
|
19010
|
+
codeLocation,
|
|
19011
|
+
experimentalMode: context$1.experimentalMode,
|
|
18150
19012
|
availableToolNames: context$1.availableToolNames,
|
|
18151
19013
|
directToolNames: context$1.directToolNames
|
|
18152
19014
|
});
|
|
@@ -18194,7 +19056,7 @@ async function fetchIssueEnrichmentData({ apiService, organizationSlug, issue, s
|
|
|
18194
19056
|
}),
|
|
18195
19057
|
apiService.getIssueExternalLinks({
|
|
18196
19058
|
organizationSlug,
|
|
18197
|
-
issueId
|
|
19059
|
+
issueId
|
|
18198
19060
|
}).catch(() => void 0),
|
|
18199
19061
|
apiService.listReplayIdsForIssue({
|
|
18200
19062
|
organizationSlug,
|
|
@@ -18224,7 +19086,7 @@ async function maybeFetchAutofixState({ apiService, organizationSlug, issue, see
|
|
|
18224
19086
|
if (!seerEnabled) return void 0;
|
|
18225
19087
|
return apiService.getAutofixState({
|
|
18226
19088
|
organizationSlug,
|
|
18227
|
-
issueId: issue.
|
|
19089
|
+
issueId: String(issue.id)
|
|
18228
19090
|
}).catch(() => void 0);
|
|
18229
19091
|
}
|
|
18230
19092
|
async function maybeFetchPerformanceTrace({ apiService, organizationSlug, event }) {
|
|
@@ -18324,7 +19186,7 @@ function getReplayDataSource(issue) {
|
|
|
18324
19186
|
}
|
|
18325
19187
|
|
|
18326
19188
|
//#endregion
|
|
18327
|
-
//#region ../mcp-core/dist/event-stacktrace-
|
|
19189
|
+
//#region ../mcp-core/dist/event-stacktrace-WES63IMe.js
|
|
18328
19190
|
/**
|
|
18329
19191
|
* Fetches an issue event and formats the selected thread stacktrace.
|
|
18330
19192
|
*/
|
|
@@ -18403,7 +19265,7 @@ function selectUnique(threads, predicate, notFoundMessage, ambiguousMessage) {
|
|
|
18403
19265
|
}
|
|
18404
19266
|
|
|
18405
19267
|
//#endregion
|
|
18406
|
-
//#region ../mcp-core/dist/get-event-stacktrace-
|
|
19268
|
+
//#region ../mcp-core/dist/get-event-stacktrace-CDGRtbOg.js
|
|
18407
19269
|
var get_event_stacktrace_default = defineTool({
|
|
18408
19270
|
name: "get_event_stacktrace",
|
|
18409
19271
|
skills: [
|
|
@@ -18446,7 +19308,7 @@ var get_event_stacktrace_default = defineTool({
|
|
|
18446
19308
|
},
|
|
18447
19309
|
async handler(params, context$1) {
|
|
18448
19310
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
18449
|
-
|
|
19311
|
+
setOrganizationContext(params.organizationSlug);
|
|
18450
19312
|
setTag("issue.id", params.issueId);
|
|
18451
19313
|
try {
|
|
18452
19314
|
await ensureIssueWithinProjectConstraint({
|
|
@@ -18474,7 +19336,7 @@ var get_event_stacktrace_default = defineTool({
|
|
|
18474
19336
|
});
|
|
18475
19337
|
|
|
18476
19338
|
//#endregion
|
|
18477
|
-
//#region ../mcp-core/dist/get-issue-activity-
|
|
19339
|
+
//#region ../mcp-core/dist/get-issue-activity-DA97QQfR.js
|
|
18478
19340
|
function getActivityText(activity) {
|
|
18479
19341
|
const data = activity.data;
|
|
18480
19342
|
if (!data) return null;
|
|
@@ -18524,7 +19386,7 @@ var get_issue_activity_default = defineTool({
|
|
|
18524
19386
|
organizationSlug: params.organizationSlug ?? context$1.constraints.organizationSlug
|
|
18525
19387
|
});
|
|
18526
19388
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
18527
|
-
|
|
19389
|
+
setOrganizationContext(parsed.organizationSlug);
|
|
18528
19390
|
setTag("issue.id", parsed.issueId);
|
|
18529
19391
|
await ensureIssueWithinProjectConstraint({
|
|
18530
19392
|
apiService,
|
|
@@ -18567,7 +19429,7 @@ var get_issue_activity_default = defineTool({
|
|
|
18567
19429
|
});
|
|
18568
19430
|
|
|
18569
19431
|
//#endregion
|
|
18570
|
-
//#region ../mcp-core/dist/breadcrumbs-
|
|
19432
|
+
//#region ../mcp-core/dist/breadcrumbs-uFW9kNaP.js
|
|
18571
19433
|
/**
|
|
18572
19434
|
* Fetches breadcrumbs from an issue event and formats them.
|
|
18573
19435
|
* Defaults to the latest event when eventId is omitted.
|
|
@@ -18631,7 +19493,7 @@ function cleanAndTruncate(str, maxLen) {
|
|
|
18631
19493
|
}
|
|
18632
19494
|
|
|
18633
19495
|
//#endregion
|
|
18634
|
-
//#region ../mcp-core/dist/get-issue-breadcrumbs-
|
|
19496
|
+
//#region ../mcp-core/dist/get-issue-breadcrumbs-D-UCFqx1.js
|
|
18635
19497
|
var get_issue_breadcrumbs_default = defineTool({
|
|
18636
19498
|
name: "get_issue_breadcrumbs",
|
|
18637
19499
|
skills: ["inspect", "triage"],
|
|
@@ -18671,7 +19533,7 @@ var get_issue_breadcrumbs_default = defineTool({
|
|
|
18671
19533
|
organizationSlug: params.organizationSlug ?? context$1.constraints.organizationSlug
|
|
18672
19534
|
});
|
|
18673
19535
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
18674
|
-
|
|
19536
|
+
setOrganizationContext(parsed.organizationSlug);
|
|
18675
19537
|
setTag("issue.id", parsed.issueId);
|
|
18676
19538
|
try {
|
|
18677
19539
|
await ensureIssueWithinProjectConstraint({
|
|
@@ -18693,7 +19555,7 @@ var get_issue_breadcrumbs_default = defineTool({
|
|
|
18693
19555
|
});
|
|
18694
19556
|
|
|
18695
19557
|
//#endregion
|
|
18696
|
-
//#region ../mcp-core/dist/get-issue-tag-values-
|
|
19558
|
+
//#region ../mcp-core/dist/get-issue-tag-values-CyHuVJ-4.js
|
|
18697
19559
|
const getIssueTagValuesOutputSchema = z.object({ tag: z.object({
|
|
18698
19560
|
key: z.string(),
|
|
18699
19561
|
name: z.string(),
|
|
@@ -18774,7 +19636,7 @@ var get_issue_tag_values_default = defineTool({
|
|
|
18774
19636
|
issueId: params.issueId,
|
|
18775
19637
|
issueUrl: params.issueUrl
|
|
18776
19638
|
});
|
|
18777
|
-
|
|
19639
|
+
setOrganizationContext(orgSlug);
|
|
18778
19640
|
await ensureIssueWithinProjectConstraint({
|
|
18779
19641
|
apiService,
|
|
18780
19642
|
organizationSlug: orgSlug,
|
|
@@ -18811,7 +19673,7 @@ var get_issue_tag_values_default = defineTool({
|
|
|
18811
19673
|
});
|
|
18812
19674
|
|
|
18813
19675
|
//#endregion
|
|
18814
|
-
//#region ../mcp-core/dist/get-issue-user-reports-
|
|
19676
|
+
//#region ../mcp-core/dist/get-issue-user-reports-DhU4yW1i.js
|
|
18815
19677
|
function getReporter(report) {
|
|
18816
19678
|
const userId = report.user?.id?.trim();
|
|
18817
19679
|
const userIdReporter = userId && !["none", "null"].includes(userId.toLowerCase()) ? `user:${userId}` : null;
|
|
@@ -18864,7 +19726,7 @@ var get_issue_user_reports_default = defineTool({
|
|
|
18864
19726
|
organizationSlug: params.organizationSlug ?? context$1.constraints.organizationSlug
|
|
18865
19727
|
});
|
|
18866
19728
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
18867
|
-
|
|
19729
|
+
setOrganizationContext(parsed.organizationSlug);
|
|
18868
19730
|
setTag("issue.id", parsed.issueId);
|
|
18869
19731
|
await ensureIssueWithinProjectConstraint({
|
|
18870
19732
|
apiService,
|
|
@@ -22399,7 +23261,7 @@ function createAnthropic(options = {}) {
|
|
|
22399
23261
|
var anthropic = createAnthropic();
|
|
22400
23262
|
|
|
22401
23263
|
//#endregion
|
|
22402
|
-
//#region ../mcp-core/dist/anthropic-provider-
|
|
23264
|
+
//#region ../mcp-core/dist/anthropic-provider-NqnQSpoe.js
|
|
22403
23265
|
const DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-5";
|
|
22404
23266
|
let configuredBaseUrl$2;
|
|
22405
23267
|
/**
|
|
@@ -27052,7 +27914,7 @@ function createOpenAI(options = {}) {
|
|
|
27052
27914
|
var openai = createOpenAI();
|
|
27053
27915
|
|
|
27054
27916
|
//#endregion
|
|
27055
|
-
//#region ../mcp-core/dist/azure-openai-provider-
|
|
27917
|
+
//#region ../mcp-core/dist/azure-openai-provider-BcsSfFBw.js
|
|
27056
27918
|
const DEFAULT_OPENAI_MODEL$1 = "gpt-5";
|
|
27057
27919
|
let configuredBaseUrl$1;
|
|
27058
27920
|
function setAzureOpenAIBaseUrl(baseUrl) {
|
|
@@ -27110,7 +27972,7 @@ function getAzureOpenAIModel(model) {
|
|
|
27110
27972
|
}
|
|
27111
27973
|
|
|
27112
27974
|
//#endregion
|
|
27113
|
-
//#region ../mcp-core/dist/openai-provider-
|
|
27975
|
+
//#region ../mcp-core/dist/openai-provider-DNtIUzcM.js
|
|
27114
27976
|
const DEFAULT_OPENAI_MODEL = "gpt-5";
|
|
27115
27977
|
let configuredBaseUrl;
|
|
27116
27978
|
/**
|
|
@@ -27150,7 +28012,7 @@ function getOpenAIModel(model) {
|
|
|
27150
28012
|
}
|
|
27151
28013
|
|
|
27152
28014
|
//#endregion
|
|
27153
|
-
//#region ../mcp-core/dist/openrouter-provider-
|
|
28015
|
+
//#region ../mcp-core/dist/openrouter-provider-Bq38hmFY.js
|
|
27154
28016
|
const DEFAULT_OPENROUTER_MODEL = "openai/gpt-5.6-luna";
|
|
27155
28017
|
const DEFAULT_OPENROUTER_REASONING_EFFORT = "high";
|
|
27156
28018
|
const OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1";
|
|
@@ -27202,7 +28064,7 @@ function getOpenRouterProviderOptions() {
|
|
|
27202
28064
|
}
|
|
27203
28065
|
|
|
27204
28066
|
//#endregion
|
|
27205
|
-
//#region ../mcp-core/dist/provider-factory-
|
|
28067
|
+
//#region ../mcp-core/dist/provider-factory-BNDtCneN.js
|
|
27206
28068
|
let configuredProvider;
|
|
27207
28069
|
/**
|
|
27208
28070
|
* Configure the embedded agent provider explicitly.
|
|
@@ -27347,7 +28209,7 @@ function getResolvedProviderType() {
|
|
|
27347
28209
|
}
|
|
27348
28210
|
|
|
27349
28211
|
//#endregion
|
|
27350
|
-
//#region ../mcp-core/dist/resolve-region-url-
|
|
28212
|
+
//#region ../mcp-core/dist/resolve-region-url-DgkcX4pA.js
|
|
27351
28213
|
const regionUrlCache = /* @__PURE__ */ new WeakMap();
|
|
27352
28214
|
function getRegionUrlCache(context$1) {
|
|
27353
28215
|
let cache = regionUrlCache.get(context$1);
|
|
@@ -27386,7 +28248,7 @@ async function resolveRegionUrlForOrganization({ context: context$1, organizatio
|
|
|
27386
28248
|
}
|
|
27387
28249
|
|
|
27388
28250
|
//#endregion
|
|
27389
|
-
//#region ../mcp-core/dist/semantic-display-
|
|
28251
|
+
//#region ../mcp-core/dist/semantic-display-C9x4ir1O.js
|
|
27390
28252
|
const SPAN_LABEL_MAX_LENGTH = 160;
|
|
27391
28253
|
const SPAN_METADATA_MAX_LENGTH = 64;
|
|
27392
28254
|
const SPAN_ATTRIBUTE_MAX_LENGTH = 2048;
|
|
@@ -27774,7 +28636,7 @@ function formatDisplayPart(value, maxLength) {
|
|
|
27774
28636
|
}
|
|
27775
28637
|
|
|
27776
28638
|
//#endregion
|
|
27777
|
-
//#region ../mcp-core/dist/get-trace-details-
|
|
28639
|
+
//#region ../mcp-core/dist/get-trace-details-DIFsJzLU.js
|
|
27778
28640
|
const MAX_TRACE_FETCH_LIMIT = 1e3;
|
|
27779
28641
|
const MAX_FOCUSED_TRACE_FETCH_LIMIT = 1e4;
|
|
27780
28642
|
const MIN_TRACE_FETCH_LIMIT = 50;
|
|
@@ -27848,7 +28710,7 @@ var get_trace_details_default = defineTool({
|
|
|
27848
28710
|
regionUrl: params.regionUrl
|
|
27849
28711
|
});
|
|
27850
28712
|
const apiService = apiServiceFromContext(context$1, { regionUrl: regionUrl ?? void 0 });
|
|
27851
|
-
|
|
28713
|
+
setOrganizationContext(params.organizationSlug);
|
|
27852
28714
|
setTag("trace.id", params.traceId);
|
|
27853
28715
|
if (params.spanId) setTag("trace.span_id", params.spanId);
|
|
27854
28716
|
if (context$1.constraints.projectSlug) setTag("project.slug", context$1.constraints.projectSlug);
|
|
@@ -27888,14 +28750,7 @@ var get_trace_details_default = defineTool({
|
|
|
27888
28750
|
directToolNames: context$1.directToolNames,
|
|
27889
28751
|
aiConversations
|
|
27890
28752
|
});
|
|
27891
|
-
return
|
|
27892
|
-
markdown,
|
|
27893
|
-
organizationSlug: params.organizationSlug,
|
|
27894
|
-
aiConversations,
|
|
27895
|
-
experimentalMode: context$1.experimentalMode ?? false,
|
|
27896
|
-
availableToolNames: context$1.availableToolNames,
|
|
27897
|
-
directToolNames: context$1.directToolNames
|
|
27898
|
-
});
|
|
28753
|
+
return markdown;
|
|
27899
28754
|
}
|
|
27900
28755
|
});
|
|
27901
28756
|
function isTraceSpanNode(node) {
|
|
@@ -28454,7 +29309,7 @@ function formatAIConversationSection({ aiConversations, organizationSlug, experi
|
|
|
28454
29309
|
availableToolNames,
|
|
28455
29310
|
directToolNames
|
|
28456
29311
|
});
|
|
28457
|
-
const lines = ["##
|
|
29312
|
+
const lines = ["## Agent Conversations", ""];
|
|
28458
29313
|
if (aiConversations.length === 1) {
|
|
28459
29314
|
const [conversation] = aiConversations;
|
|
28460
29315
|
lines.push(`**Conversation ID**: \`${conversation.conversationId}\``);
|
|
@@ -28534,7 +29389,7 @@ function buildTraceNextSteps({ organizationSlug, traceId, spanFocused = false, e
|
|
|
28534
29389
|
}
|
|
28535
29390
|
|
|
28536
29391
|
//#endregion
|
|
28537
|
-
//#region ../mcp-core/dist/get-span-details-
|
|
29392
|
+
//#region ../mcp-core/dist/get-span-details-CC9cxfpa.js
|
|
28538
29393
|
var get_span_details_default = defineTool({
|
|
28539
29394
|
name: "get_span_details",
|
|
28540
29395
|
skills: ["inspect"],
|
|
@@ -28575,7 +29430,7 @@ var get_span_details_default = defineTool({
|
|
|
28575
29430
|
});
|
|
28576
29431
|
|
|
28577
29432
|
//#endregion
|
|
28578
|
-
//#region ../mcp-core/dist/url-helpers-
|
|
29433
|
+
//#region ../mcp-core/dist/url-helpers-DtpSKjOI.js
|
|
28579
29434
|
/**
|
|
28580
29435
|
* Parses a Sentry URL and extracts resource type and identifiers.
|
|
28581
29436
|
*
|
|
@@ -28838,7 +29693,7 @@ function isProfileUrl(url) {
|
|
|
28838
29693
|
}
|
|
28839
29694
|
|
|
28840
29695
|
//#endregion
|
|
28841
|
-
//#region ../mcp-core/dist/get-replay-details-
|
|
29696
|
+
//#region ../mcp-core/dist/get-replay-details-BM6gDmGp.js
|
|
28842
29697
|
const MAX_ACTIVITY_EVENTS = 6;
|
|
28843
29698
|
const MAX_RELATED_ERRORS = 3;
|
|
28844
29699
|
const MAX_RELATED_TRACES = 2;
|
|
@@ -28890,7 +29745,7 @@ var get_replay_details_default = defineTool({
|
|
|
28890
29745
|
regionUrl: params.regionUrl
|
|
28891
29746
|
});
|
|
28892
29747
|
const apiService = apiServiceFromContext(context$1, { regionUrl: regionUrl ?? void 0 });
|
|
28893
|
-
|
|
29748
|
+
setOrganizationContext(resolved.organizationSlug);
|
|
28894
29749
|
setTag("replay.id", resolved.replayId);
|
|
28895
29750
|
const replay = await apiService.getReplayDetails({
|
|
28896
29751
|
organizationSlug: resolved.organizationSlug,
|
|
@@ -29175,7 +30030,44 @@ function quoteDetail(value) {
|
|
|
29175
30030
|
}
|
|
29176
30031
|
|
|
29177
30032
|
//#endregion
|
|
29178
|
-
//#region ../mcp-core/dist/get-event-attachment-
|
|
30033
|
+
//#region ../mcp-core/dist/get-event-attachment-LSEqrcub.js
|
|
30034
|
+
function formatMegabytes(bytes) {
|
|
30035
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
30036
|
+
}
|
|
30037
|
+
/**
|
|
30038
|
+
* Render the response for an attachment too large to inline: a presigned direct
|
|
30039
|
+
* link when available, otherwise authenticated-download instructions.
|
|
30040
|
+
*/
|
|
30041
|
+
function formatOversizedAttachment(params, attachment) {
|
|
30042
|
+
const sizeBytes = attachment.attachment.size;
|
|
30043
|
+
const downloadApiPath = `projects/${params.organizationSlug}/${params.projectSlug}/events/${params.eventId}/attachments/${params.attachmentId}/?download=1`;
|
|
30044
|
+
const outputName = `attachment-${params.attachmentId}`;
|
|
30045
|
+
let output = "# Event Attachment — Too Large to Return Inline\n\n";
|
|
30046
|
+
output += `**Event ID:** ${params.eventId}\n`;
|
|
30047
|
+
output += `**Attachment ID:** ${params.attachmentId}\n`;
|
|
30048
|
+
output += `**Filename:** ${attachment.filename}\n`;
|
|
30049
|
+
output += `**Type:** ${attachment.attachment.type}\n`;
|
|
30050
|
+
output += `**Size:** ${sizeBytes} bytes (${formatMegabytes(sizeBytes)})\n`;
|
|
30051
|
+
output += `**MIME Type:** ${attachment.contentType}\n`;
|
|
30052
|
+
output += `**Created:** ${attachment.attachment.dateCreated}\n\n`;
|
|
30053
|
+
output += `This attachment (${formatMegabytes(sizeBytes)}) exceeds the ${formatMegabytes(DEFAULT_MAX_INLINE_ATTACHMENT_BYTES)} inline limit for MCP responses, so its contents were not downloaded.\n\n`;
|
|
30054
|
+
output += "## How to download it\n\n";
|
|
30055
|
+
if (attachment.directDownloadUrl) {
|
|
30056
|
+
output += "**Direct download** (a presigned link — no authentication needed; it expires shortly, so fetch it promptly):\n\n";
|
|
30057
|
+
output += `${attachment.directDownloadUrl}\n\n`;
|
|
30058
|
+
output += "If the link has expired, re-run this tool to get a fresh one, or use the authenticated API endpoint below.\n\n";
|
|
30059
|
+
output += "**Authenticated Sentry API endpoint** (requires Sentry credentials):\n";
|
|
30060
|
+
output += `- Sentry CLI: \`sentry api ${downloadApiPath} > ${outputName}\`\n`;
|
|
30061
|
+
output += `- Or an \`Authorization: Bearer <token>\` request to: ${attachment.downloadUrl}\n`;
|
|
30062
|
+
} else {
|
|
30063
|
+
output += "The download URL is an authenticated Sentry API endpoint — it is not a public link and requires your Sentry credentials (a bare fetch returns HTTP 401).\n\n";
|
|
30064
|
+
output += "- **Sentry CLI** (handles auth automatically):\n";
|
|
30065
|
+
output += ` \`sentry api ${downloadApiPath} > ${outputName}\`\n`;
|
|
30066
|
+
output += `- **Any HTTP client** with an \`Authorization: Bearer <token>\` header against: ${attachment.downloadUrl}\n`;
|
|
30067
|
+
output += "- **Sentry UI:** open the event and use the Attachments tab.\n";
|
|
30068
|
+
}
|
|
30069
|
+
return output;
|
|
30070
|
+
}
|
|
29179
30071
|
var get_event_attachment_default = defineTool({
|
|
29180
30072
|
name: "get_event_attachment",
|
|
29181
30073
|
skills: ["inspect"],
|
|
@@ -29223,7 +30115,7 @@ var get_event_attachment_default = defineTool({
|
|
|
29223
30115
|
},
|
|
29224
30116
|
async handler(params, context$1) {
|
|
29225
30117
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
29226
|
-
|
|
30118
|
+
setOrganizationContext(params.organizationSlug);
|
|
29227
30119
|
if (params.attachmentId) {
|
|
29228
30120
|
const attachment = await apiService.getEventAttachment({
|
|
29229
30121
|
organizationSlug: params.organizationSlug,
|
|
@@ -29231,12 +30123,19 @@ var get_event_attachment_default = defineTool({
|
|
|
29231
30123
|
eventId: params.eventId,
|
|
29232
30124
|
attachmentId: params.attachmentId
|
|
29233
30125
|
});
|
|
30126
|
+
if (attachment.bytes === null) return formatOversizedAttachment({
|
|
30127
|
+
organizationSlug: params.organizationSlug,
|
|
30128
|
+
projectSlug: params.projectSlug,
|
|
30129
|
+
eventId: params.eventId,
|
|
30130
|
+
attachmentId: params.attachmentId
|
|
30131
|
+
}, attachment);
|
|
29234
30132
|
const contentParts = [];
|
|
29235
30133
|
const effectiveMimeType = attachment.contentType;
|
|
29236
30134
|
const isBinary = !effectiveMimeType.startsWith("text/");
|
|
29237
|
-
|
|
30135
|
+
const isEmpty = attachment.bytes.length === 0;
|
|
30136
|
+
if (isBinary && !isEmpty) {
|
|
29238
30137
|
const isImage = effectiveMimeType.startsWith("image/");
|
|
29239
|
-
const base64 =
|
|
30138
|
+
const base64 = bytesToBase64(attachment.bytes);
|
|
29240
30139
|
if (isImage) {
|
|
29241
30140
|
const image = {
|
|
29242
30141
|
type: "image",
|
|
@@ -29265,11 +30164,15 @@ var get_event_attachment_default = defineTool({
|
|
|
29265
30164
|
output$1 += `**MIME Type:** ${effectiveMimeType}\n`;
|
|
29266
30165
|
output$1 += `**Created:** ${attachment.attachment.dateCreated}\n\n`;
|
|
29267
30166
|
output$1 += `**Download URL:** ${attachment.downloadUrl}\n\n`;
|
|
29268
|
-
if (
|
|
30167
|
+
if (isEmpty) {
|
|
30168
|
+
output$1 += `## Empty Content\n\n`;
|
|
30169
|
+
if (attachment.attachment.size > 0) output$1 += `The download returned no data even though the attachment metadata reports ${attachment.attachment.size} bytes. This usually indicates a failed or truncated download; try again, or download it directly from the URL above (requires Sentry authentication).\n`;
|
|
30170
|
+
else output$1 += `This attachment is empty (0 bytes).\n`;
|
|
30171
|
+
} else if (isBinary) {
|
|
29269
30172
|
output$1 += `## Binary Content\n\n`;
|
|
29270
30173
|
output$1 += `The attachment is included as a resource and accessible through your client.\n`;
|
|
29271
30174
|
} else {
|
|
29272
|
-
const textContent =
|
|
30175
|
+
const textContent = new TextDecoder().decode(attachment.bytes);
|
|
29273
30176
|
output$1 += `## File Content\n\n`;
|
|
29274
30177
|
output$1 += `\`\`\`\n${textContent}\n\`\`\`\n\n`;
|
|
29275
30178
|
}
|
|
@@ -29320,7 +30223,7 @@ var get_event_attachment_default = defineTool({
|
|
|
29320
30223
|
});
|
|
29321
30224
|
|
|
29322
30225
|
//#endregion
|
|
29323
|
-
//#region ../mcp-core/dist/formatting-
|
|
30226
|
+
//#region ../mcp-core/dist/formatting-BG8yQUmg.js
|
|
29324
30227
|
/**
|
|
29325
30228
|
* Helper function to format assignedTo field for display
|
|
29326
30229
|
*/
|
|
@@ -29332,7 +30235,7 @@ function formatAssignedTo(assignedTo) {
|
|
|
29332
30235
|
}
|
|
29333
30236
|
|
|
29334
30237
|
//#endregion
|
|
29335
|
-
//#region ../mcp-core/dist/update-issue-
|
|
30238
|
+
//#region ../mcp-core/dist/update-issue-BH3fTM71.js
|
|
29336
30239
|
function pluralize(value, noun) {
|
|
29337
30240
|
return `${value} ${noun}${value === 1 ? "" : "s"}`;
|
|
29338
30241
|
}
|
|
@@ -29471,7 +30374,9 @@ function buildNoChangesOutput(params) {
|
|
|
29471
30374
|
return output;
|
|
29472
30375
|
}
|
|
29473
30376
|
function isAssigneeAlreadySet(issue, requestedAssignee, currentUserId) {
|
|
29474
|
-
if (
|
|
30377
|
+
if (requestedAssignee === void 0) return false;
|
|
30378
|
+
if (requestedAssignee === null) return !issue.assignedTo;
|
|
30379
|
+
if (!issue.assignedTo) return false;
|
|
29475
30380
|
if (typeof issue.assignedTo === "string") return issue.assignedTo === requestedAssignee;
|
|
29476
30381
|
if (requestedAssignee === "me") return issue.assignedTo.type === "user" && currentUserId !== void 0 && String(issue.assignedTo.id) === currentUserId;
|
|
29477
30382
|
if (requestedAssignee.startsWith("user:")) return issue.assignedTo.type === "user" && String(issue.assignedTo.id) === requestedAssignee.slice(5);
|
|
@@ -29596,12 +30501,13 @@ var update_issue_default = defineTool({
|
|
|
29596
30501
|
description: [
|
|
29597
30502
|
"Update a Sentry issue's status or assignment.",
|
|
29598
30503
|
"",
|
|
29599
|
-
"Use this to resolve, reopen, assign, or ignore an issue.",
|
|
30504
|
+
"Use this to resolve, reopen, assign, unassign, or ignore an issue.",
|
|
29600
30505
|
"",
|
|
29601
30506
|
"<examples>",
|
|
29602
30507
|
"```",
|
|
29603
30508
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', status='resolved')",
|
|
29604
30509
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', assignedTo='user:123456')",
|
|
30510
|
+
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', assignedTo=null)",
|
|
29605
30511
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', status='ignored')",
|
|
29606
30512
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', status='ignored', ignoreMode='forever')",
|
|
29607
30513
|
"update_issue(organizationSlug='my-org', issueId='PROJECT-123', status='ignored', ignoreMode='untilOccurrenceCount', ignoreCount=100, ignoreWindowMinutes=60)",
|
|
@@ -29612,7 +30518,7 @@ var update_issue_default = defineTool({
|
|
|
29612
30518
|
"<hints>",
|
|
29613
30519
|
"- Provide `issueUrl` or `organizationSlug` + `issueId`.",
|
|
29614
30520
|
"- At least one of `status` or `assignedTo` is required.",
|
|
29615
|
-
"- `assignedTo`
|
|
30521
|
+
"- Omit `assignedTo` to leave assignment unchanged. Pass `null` to unassign; otherwise use `user:ID` or `team:ID_OR_SLUG`.",
|
|
29616
30522
|
"- Use `execute_sentry_tool(name='whoami', arguments={})` to find your user ID for self-assignment.",
|
|
29617
30523
|
"- Status values: `resolved`, `resolvedInNextRelease`, `unresolved`, `ignored`.",
|
|
29618
30524
|
"- `status='ignored'` defaults to `ignoreMode='untilEscalating'`.",
|
|
@@ -29647,13 +30553,13 @@ var update_issue_default = defineTool({
|
|
|
29647
30553
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
29648
30554
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
29649
30555
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
29650
|
-
if (
|
|
30556
|
+
if (params.status === void 0 && params.assignedTo === void 0) throw new UserInputError("At least one of `status` or `assignedTo` must be provided to update the issue");
|
|
29651
30557
|
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
29652
30558
|
organizationSlug: params.organizationSlug,
|
|
29653
30559
|
issueId: params.issueId,
|
|
29654
30560
|
issueUrl: params.issueUrl
|
|
29655
30561
|
});
|
|
29656
|
-
|
|
30562
|
+
setOrganizationContext(orgSlug);
|
|
29657
30563
|
const currentIssue = await apiService.getIssue({
|
|
29658
30564
|
organizationSlug: orgSlug,
|
|
29659
30565
|
issueId: parsedIssueId
|
|
@@ -29681,7 +30587,7 @@ var update_issue_default = defineTool({
|
|
|
29681
30587
|
} else if (currentIgnoreState && requestedIgnoreFamily && currentIgnoreState.family !== requestedIgnoreFamily) throw new UserInputError("Changing ignore behavior on an already ignored issue between `untilEscalating`, `forever`, and condition-based modes is not supported. First set `status` to `unresolved`, then ignore it again with the new rule.");
|
|
29682
30588
|
}
|
|
29683
30589
|
const requestedIssueUrl = apiService.getIssueUrl(orgSlug, currentIssue.shortId);
|
|
29684
|
-
if (
|
|
30590
|
+
if (updateStatus === void 0 && updateAssignedTo === void 0 && updateIgnore === void 0) {
|
|
29685
30591
|
const commentResult$1 = await tryPostReasonComment(apiService, orgSlug, parsedIssueId, params.reason);
|
|
29686
30592
|
return buildNoChangesOutput({
|
|
29687
30593
|
issue: currentIssue,
|
|
@@ -29716,7 +30622,7 @@ var update_issue_default = defineTool({
|
|
|
29716
30622
|
if (statusChanged) output += `**Status**: ${currentStatusDisplay} → **${updatedStatusDisplay}**\n`;
|
|
29717
30623
|
if (updatedIgnoreState && (statusChanged || ignoreBehaviorChanged) && (ignoreBehaviorChanged || params.status === "ignored")) if (currentIgnoreState && ignoreBehaviorChanged) output += `**Ignore Behavior**: ${currentIgnoreState.behavior} → **${updatedIgnoreState.behavior}**\n`;
|
|
29718
30624
|
else output += `**Ignore Behavior**: **${updatedIgnoreState.behavior}**\n`;
|
|
29719
|
-
if (updateAssignedTo && assignmentChanged) {
|
|
30625
|
+
if (updateAssignedTo !== void 0 && assignmentChanged) {
|
|
29720
30626
|
const oldAssignee = formatAssignedTo(currentIssue.assignedTo ?? null);
|
|
29721
30627
|
const newAssignee = params.assignedTo === "me" ? "You" : formatAssignedTo(updatedIssue.assignedTo ?? null);
|
|
29722
30628
|
output += `**Assigned To**: ${oldAssignee} → **${newAssignee}**\n`;
|
|
@@ -29738,7 +30644,7 @@ var update_issue_default = defineTool({
|
|
|
29738
30644
|
});
|
|
29739
30645
|
|
|
29740
30646
|
//#endregion
|
|
29741
|
-
//#region ../mcp-core/dist/provider-fallback-
|
|
30647
|
+
//#region ../mcp-core/dist/provider-fallback-B4jxYMQu.js
|
|
29742
30648
|
/**
|
|
29743
30649
|
* Run an optional embedded-agent rewrite and fall back to the caller's direct
|
|
29744
30650
|
* behavior when the agent cannot complete the rewrite.
|
|
@@ -29778,7 +30684,126 @@ async function withProviderFallback({ operation, fallback, onFallback, run }) {
|
|
|
29778
30684
|
}
|
|
29779
30685
|
|
|
29780
30686
|
//#endregion
|
|
29781
|
-
//#region ../mcp-core/dist/
|
|
30687
|
+
//#region ../mcp-core/dist/sentry-CcB-AERp.js
|
|
30688
|
+
const SCRUB_PATTERNS = [
|
|
30689
|
+
{
|
|
30690
|
+
pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
|
|
30691
|
+
replacement: "[REDACTED_OPENAI_KEY]",
|
|
30692
|
+
description: "OpenAI API key"
|
|
30693
|
+
},
|
|
30694
|
+
{
|
|
30695
|
+
pattern: /\bBearer\s+[a-zA-Z0-9\-._~+/]+={0,}/g,
|
|
30696
|
+
replacement: "Bearer [REDACTED_TOKEN]",
|
|
30697
|
+
description: "Bearer token"
|
|
30698
|
+
},
|
|
30699
|
+
{
|
|
30700
|
+
pattern: /\bsntrys_[a-zA-Z0-9_]+\b/g,
|
|
30701
|
+
replacement: "[REDACTED_SENTRY_TOKEN]",
|
|
30702
|
+
description: "Sentry access token"
|
|
30703
|
+
}
|
|
30704
|
+
];
|
|
30705
|
+
const MAX_SCRUB_DEPTH = 20;
|
|
30706
|
+
/**
|
|
30707
|
+
* Recursively scrub sensitive data from any value.
|
|
30708
|
+
* Returns tuple of [scrubbedValue, didScrub, descriptionsOfMatchedPatterns]
|
|
30709
|
+
*/
|
|
30710
|
+
function scrubValue(value, depth = 0) {
|
|
30711
|
+
if (depth >= MAX_SCRUB_DEPTH) return [
|
|
30712
|
+
"[MAX_DEPTH_EXCEEDED]",
|
|
30713
|
+
false,
|
|
30714
|
+
[]
|
|
30715
|
+
];
|
|
30716
|
+
if (typeof value === "string") {
|
|
30717
|
+
let scrubbed = value;
|
|
30718
|
+
let didScrub = false;
|
|
30719
|
+
const matchedDescriptions = [];
|
|
30720
|
+
for (const { pattern, replacement, description: description$73 } of SCRUB_PATTERNS) {
|
|
30721
|
+
pattern.lastIndex = 0;
|
|
30722
|
+
if (pattern.test(scrubbed)) {
|
|
30723
|
+
didScrub = true;
|
|
30724
|
+
matchedDescriptions.push(description$73);
|
|
30725
|
+
pattern.lastIndex = 0;
|
|
30726
|
+
scrubbed = scrubbed.replace(pattern, replacement);
|
|
30727
|
+
}
|
|
30728
|
+
}
|
|
30729
|
+
return [
|
|
30730
|
+
scrubbed,
|
|
30731
|
+
didScrub,
|
|
30732
|
+
matchedDescriptions
|
|
30733
|
+
];
|
|
30734
|
+
}
|
|
30735
|
+
if (Array.isArray(value)) {
|
|
30736
|
+
let arrayDidScrub = false;
|
|
30737
|
+
const arrayDescriptions = [];
|
|
30738
|
+
const scrubbedArray = value.map((item) => {
|
|
30739
|
+
const [scrubbed, didScrub, descriptions] = scrubValue(item, depth + 1);
|
|
30740
|
+
if (didScrub) {
|
|
30741
|
+
arrayDidScrub = true;
|
|
30742
|
+
arrayDescriptions.push(...descriptions);
|
|
30743
|
+
}
|
|
30744
|
+
return scrubbed;
|
|
30745
|
+
});
|
|
30746
|
+
return [
|
|
30747
|
+
scrubbedArray,
|
|
30748
|
+
arrayDidScrub,
|
|
30749
|
+
arrayDescriptions
|
|
30750
|
+
];
|
|
30751
|
+
}
|
|
30752
|
+
if (value && typeof value === "object") {
|
|
30753
|
+
let objectDidScrub = false;
|
|
30754
|
+
const objectDescriptions = [];
|
|
30755
|
+
const scrubbed = {};
|
|
30756
|
+
for (const [key, val] of Object.entries(value)) {
|
|
30757
|
+
const [scrubbedVal, didScrub, descriptions] = scrubValue(val, depth + 1);
|
|
30758
|
+
if (didScrub) {
|
|
30759
|
+
objectDidScrub = true;
|
|
30760
|
+
objectDescriptions.push(...descriptions);
|
|
30761
|
+
}
|
|
30762
|
+
scrubbed[key] = scrubbedVal;
|
|
30763
|
+
}
|
|
30764
|
+
return [
|
|
30765
|
+
scrubbed,
|
|
30766
|
+
objectDidScrub,
|
|
30767
|
+
objectDescriptions
|
|
30768
|
+
];
|
|
30769
|
+
}
|
|
30770
|
+
return [
|
|
30771
|
+
value,
|
|
30772
|
+
false,
|
|
30773
|
+
[]
|
|
30774
|
+
];
|
|
30775
|
+
}
|
|
30776
|
+
/**
|
|
30777
|
+
* Sentry beforeSend hook that scrubs sensitive data from events
|
|
30778
|
+
* and applies custom fingerprinting for specific error types.
|
|
30779
|
+
*/
|
|
30780
|
+
function sentryBeforeSend(event, hint) {
|
|
30781
|
+
const firstException = event?.exception?.values?.[0];
|
|
30782
|
+
if (firstException?.type === "AI_APICallError" && firstException.value) event.fingerprint = ["AI_APICallError", firstException.value];
|
|
30783
|
+
const [scrubbedEvent, didScrub, descriptions] = scrubValue(event);
|
|
30784
|
+
if (didScrub) {
|
|
30785
|
+
const uniqueDescriptions = [...new Set(descriptions)];
|
|
30786
|
+
console.warn(`[Sentry] Event contained sensitive data: ${uniqueDescriptions.join(", ")}`);
|
|
30787
|
+
}
|
|
30788
|
+
return scrubbedEvent;
|
|
30789
|
+
}
|
|
30790
|
+
const EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
30791
|
+
/**
|
|
30792
|
+
* Scrub tokens (OpenAI/Bearer/Sentry) and emails from a free-form string before
|
|
30793
|
+
* logging it. Applied at the log call site so it covers every sink (stderr and
|
|
30794
|
+
* Sentry Logs).
|
|
30795
|
+
*/
|
|
30796
|
+
function scrubSensitiveText(text$1) {
|
|
30797
|
+
let scrubbed = text$1;
|
|
30798
|
+
for (const { pattern, replacement } of SCRUB_PATTERNS) {
|
|
30799
|
+
pattern.lastIndex = 0;
|
|
30800
|
+
scrubbed = scrubbed.replace(pattern, replacement);
|
|
30801
|
+
}
|
|
30802
|
+
return scrubbed.replace(EMAIL_PATTERN, "[REDACTED_EMAIL]");
|
|
30803
|
+
}
|
|
30804
|
+
|
|
30805
|
+
//#endregion
|
|
30806
|
+
//#region ../mcp-core/dist/callEmbeddedAgent-DvwjAsbW.js
|
|
29782
30807
|
/**
|
|
29783
30808
|
* Resolve the underlying provider failure from an AI SDK error.
|
|
29784
30809
|
*
|
|
@@ -29870,6 +30895,13 @@ async function callEmbeddedAgent({ system, prompt, tools, schema }) {
|
|
|
29870
30895
|
});
|
|
29871
30896
|
throw new UserInputError("The AI was unable to process your query. Please try rephrasing.");
|
|
29872
30897
|
}
|
|
30898
|
+
if (NoOutputGeneratedError.isInstance(error)) {
|
|
30899
|
+
logWarn("Embedded agent produced no output", {
|
|
30900
|
+
loggerScope: ["agents", "embedded"],
|
|
30901
|
+
extra: { errorMessage: error.message }
|
|
30902
|
+
});
|
|
30903
|
+
throw new UserInputError("The AI could not construct a valid query for this request. Please rephrase or narrow it — for example, specify the fields, a real environment name, or a time range.");
|
|
30904
|
+
}
|
|
29873
30905
|
const providerError = resolveProviderApiCallError(error);
|
|
29874
30906
|
if (providerError) throw toLLMProviderError(providerError, error);
|
|
29875
30907
|
if (RetryError.isInstance(error)) throw new LLMProviderError(`The AI provider is currently unavailable: ${error.message}. Please try again later.`, { cause: error });
|
|
@@ -29966,7 +30998,7 @@ function rescueFromText(text$1, schema) {
|
|
|
29966
30998
|
}
|
|
29967
30999
|
|
|
29968
31000
|
//#endregion
|
|
29969
|
-
//#region ../mcp-core/dist/utils-
|
|
31001
|
+
//#region ../mcp-core/dist/utils-_7jC6e0y.js
|
|
29970
31002
|
/**
|
|
29971
31003
|
* Standard response schema for all embedded agent tools.
|
|
29972
31004
|
* Tools return either an error message or the result data, never both.
|
|
@@ -30085,7 +31117,7 @@ function agentTool(config) {
|
|
|
30085
31117
|
}
|
|
30086
31118
|
|
|
30087
31119
|
//#endregion
|
|
30088
|
-
//#region ../mcp-core/dist/dataset-fields-
|
|
31120
|
+
//#region ../mcp-core/dist/dataset-fields-nUaj8nt3.js
|
|
30089
31121
|
const REPLAY_EXCLUDED_TAGS = new Set([
|
|
30090
31122
|
"browser",
|
|
30091
31123
|
"device",
|
|
@@ -30584,7 +31616,7 @@ function getReplayCommonPatterns(availableFields) {
|
|
|
30584
31616
|
}
|
|
30585
31617
|
|
|
30586
31618
|
//#endregion
|
|
30587
|
-
//#region ../mcp-core/dist/otel-semantics-
|
|
31619
|
+
//#region ../mcp-core/dist/otel-semantics-D9c5D-bO.js
|
|
30588
31620
|
var namespace$72 = "android";
|
|
30589
31621
|
var description$72 = "The Android platform on which the Android application is running.\n";
|
|
30590
31622
|
var attributes$72 = {
|
|
@@ -35606,7 +36638,7 @@ function createOtelLookupTool(options) {
|
|
|
35606
36638
|
}
|
|
35607
36639
|
|
|
35608
36640
|
//#endregion
|
|
35609
|
-
//#region ../mcp-core/dist/whoami-
|
|
36641
|
+
//#region ../mcp-core/dist/whoami-B81Oqo48.js
|
|
35610
36642
|
/**
|
|
35611
36643
|
* Get the current authenticated user's information from Sentry API
|
|
35612
36644
|
*/
|
|
@@ -35635,7 +36667,7 @@ function createWhoamiTool(options) {
|
|
|
35635
36667
|
}
|
|
35636
36668
|
|
|
35637
36669
|
//#endregion
|
|
35638
|
-
//#region ../mcp-core/dist/utils-
|
|
36670
|
+
//#region ../mcp-core/dist/utils-DNoGJro2.js
|
|
35639
36671
|
const DEFAULT_MAX_VALUE_LENGTH = 200;
|
|
35640
36672
|
const DEFAULT_MAX_ARRAY_ITEMS = 20;
|
|
35641
36673
|
const SENTRY_SEARCH_TOKEN_PATTERN = /(^|\s)!?([A-Za-z_][A-Za-z0-9_.[\],-]*):(?=\S)(?!\/\/)/g;
|
|
@@ -36096,7 +37128,7 @@ function createDatasetAttributesTool(options) {
|
|
|
36096
37128
|
attributeTypes: z.array(traceItemAttributeTypeSchema).min(1).optional().describe("Optional attribute types to list. Use ['string','number','boolean'] when unsure.")
|
|
36097
37129
|
}),
|
|
36098
37130
|
execute: async ({ dataset, substringMatch, query, attributeTypes }) => {
|
|
36099
|
-
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await import("./config-
|
|
37131
|
+
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await import("./config-_di9BWJ0.js");
|
|
36100
37132
|
const normalizedDataset = normalizeEventsDataset(dataset);
|
|
36101
37133
|
const attributeTimeParams = { statsPeriod: "14d" };
|
|
36102
37134
|
const { attributes: customAttributes, fieldTypes } = await fetchCustomAttributes(apiService, organizationSlug, dataset, projectId, attributeTimeParams, {
|
|
@@ -36186,14 +37218,18 @@ function createValidateEventsSearchTool(options) {
|
|
|
36186
37218
|
}
|
|
36187
37219
|
|
|
36188
37220
|
//#endregion
|
|
36189
|
-
//#region ../mcp-core/dist/agent-
|
|
37221
|
+
//#region ../mcp-core/dist/agent-D-RH-_8n.js
|
|
36190
37222
|
const SEARCH_EVENTS_DATASETS$1 = [...PUBLIC_EVENTS_DATASETS, "replays"];
|
|
36191
37223
|
const searchEventsAgentOutputSchema = z.object({
|
|
36192
37224
|
dataset: z.enum(SEARCH_EVENTS_DATASETS$1).describe("Which dataset to use for the query"),
|
|
36193
37225
|
query: z.string().describe("The Sentry query string for filtering results"),
|
|
36194
37226
|
fields: z.array(z.string()).describe("Array of field names to return in results."),
|
|
36195
37227
|
sort: z.string().describe("Sort parameter for results."),
|
|
36196
|
-
environment: z.union([z.string(), z.array(z.string()).min(1)]).nullable().default(null).describe("Separate environment filter for datasets like replays that do not support environment in the query string.
|
|
37228
|
+
environment: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).nullable().default(null).describe("Separate environment filter for datasets like replays that do not support environment in the query string. Set only to a real environment the user named (see the 'Available environments' list); omit otherwise. Never use wildcards, placeholders, or example values."),
|
|
37229
|
+
timeSeries: z.object({
|
|
37230
|
+
yAxis: z.string().describe("The aggregate to plot over time, e.g. 'count()', 'count_unique(user)', 'sum(span.duration)'."),
|
|
37231
|
+
interval: z.string().nullable().default(null).describe("Bucket size like '1h' or '1d'. Set ONLY when the user names a granularity (e.g. 'per hour' -> '1h'); otherwise null so Sentry picks a sensible bucket for the time range.")
|
|
37232
|
+
}).nullable().default(null).describe("Set ONLY when the user wants a metric OVER TIME (e.g. 'per hour', 'per day', 'trend', 'over time'). Otherwise leave null and return a normal query. The interval is decided here, never required from the caller."),
|
|
36197
37233
|
timeRange: z.union([
|
|
36198
37234
|
z.object({ statsPeriod: z.string().describe("Relative time period like '1h', '24h', '7d'") }),
|
|
36199
37235
|
z.object({
|
|
@@ -36205,10 +37241,44 @@ const searchEventsAgentOutputSchema = z.object({
|
|
|
36205
37241
|
explanation: z.string().default("").describe("Brief explanation of how you translated this query.")
|
|
36206
37242
|
}).refine((data) => {
|
|
36207
37243
|
if (data.dataset === "replays") return true;
|
|
37244
|
+
if (data.timeSeries) return true;
|
|
36208
37245
|
if (!data.sort || !data.fields || data.fields.length === 0) return true;
|
|
36209
37246
|
const sortField = data.sort.startsWith("-") ? data.sort.substring(1) : data.sort;
|
|
36210
37247
|
return data.fields.includes(sortField);
|
|
36211
37248
|
}, { message: "Sort field must be included in the fields array. Sentry requires that any field used for sorting must also be explicitly selected. Add the sort field to the fields array or choose a different sort field that's already included." });
|
|
37249
|
+
const MAX_INLINE_ENVIRONMENTS = 100;
|
|
37250
|
+
/**
|
|
37251
|
+
* Append the organization's real environment names to the system prompt.
|
|
37252
|
+
*
|
|
37253
|
+
* Without this the model invents `environment` values (e.g. `":null"`, `".*"`)
|
|
37254
|
+
* that Sentry rejects, burning the step budget and producing no output — the top
|
|
37255
|
+
* source of search_events failures. Grounding it lets the model pick a real one
|
|
37256
|
+
* or omit the field.
|
|
37257
|
+
*/
|
|
37258
|
+
function buildSystemPromptWithEnvironments(base, environmentNames) {
|
|
37259
|
+
if (environmentNames.length === 0) return base;
|
|
37260
|
+
const rule = "When the user names an environment, set the `environment` field to a matching value from this list EXACTLY; otherwise OMIT the field. Never use wildcards, placeholders, \"null\", \"*\", empty strings, or example values.";
|
|
37261
|
+
if (environmentNames.length <= MAX_INLINE_ENVIRONMENTS) {
|
|
37262
|
+
const list = environmentNames.map((name$4) => `"${name$4}"`).join(", ");
|
|
37263
|
+
return `${base}\n\n## Available environments\nThe only valid \`environment\` values for this organization are: ${list}.\n${rule}`;
|
|
37264
|
+
}
|
|
37265
|
+
return `${base}\n\n## Environments\nThis organization has ${environmentNames.length} environments. ${rule}`;
|
|
37266
|
+
}
|
|
37267
|
+
/**
|
|
37268
|
+
* Best-effort fetch of the org's environment names (scoped to the project when
|
|
37269
|
+
* known). Failures are non-fatal — callers still run, just without grounding.
|
|
37270
|
+
*/
|
|
37271
|
+
async function fetchEnvironmentNames(options) {
|
|
37272
|
+
try {
|
|
37273
|
+
const environments = await options.apiService.listEnvironments({
|
|
37274
|
+
organizationSlug: options.organizationSlug,
|
|
37275
|
+
projectId: options.projectId
|
|
37276
|
+
});
|
|
37277
|
+
return environments.map((environment) => environment.name).filter((name$4) => name$4.length > 0);
|
|
37278
|
+
} catch {
|
|
37279
|
+
return [];
|
|
37280
|
+
}
|
|
37281
|
+
}
|
|
36212
37282
|
/**
|
|
36213
37283
|
* Search events agent - single entry point for translating natural language queries to Sentry search syntax
|
|
36214
37284
|
* This returns both the translated query result AND the tool calls made by the agent
|
|
@@ -36236,8 +37306,9 @@ async function searchEventsAgent(options) {
|
|
|
36236
37306
|
projectId: options.projectId
|
|
36237
37307
|
});
|
|
36238
37308
|
const whoamiTool = createWhoamiTool({ apiService: options.apiService });
|
|
37309
|
+
const environmentNames = options.environmentNames ?? await fetchEnvironmentNames(options);
|
|
36239
37310
|
return await callEmbeddedAgent({
|
|
36240
|
-
system: systemPrompt,
|
|
37311
|
+
system: buildSystemPromptWithEnvironments(systemPrompt, environmentNames),
|
|
36241
37312
|
prompt: options.query,
|
|
36242
37313
|
tools: {
|
|
36243
37314
|
datasetAttributes: datasetAttributesTool,
|
|
@@ -36251,7 +37322,7 @@ async function searchEventsAgent(options) {
|
|
|
36251
37322
|
}
|
|
36252
37323
|
|
|
36253
37324
|
//#endregion
|
|
36254
|
-
//#region ../mcp-core/dist/analyzer-
|
|
37325
|
+
//#region ../mcp-core/dist/analyzer-BuS9K0e5.js
|
|
36255
37326
|
/**
|
|
36256
37327
|
* Analyzes flamegraph data to extract hot paths (most CPU-intensive call stacks).
|
|
36257
37328
|
*
|
|
@@ -36510,7 +37581,7 @@ function hasProfileData(flamegraph) {
|
|
|
36510
37581
|
}
|
|
36511
37582
|
|
|
36512
37583
|
//#endregion
|
|
36513
|
-
//#region ../mcp-core/dist/formatters-
|
|
37584
|
+
//#region ../mcp-core/dist/formatters-DsABISrU.js
|
|
36514
37585
|
/**
|
|
36515
37586
|
* Format an explanation for how the input query was translated
|
|
36516
37587
|
*/
|
|
@@ -36975,9 +38046,47 @@ function formatTraceMetricsResults(params) {
|
|
|
36975
38046
|
output += "- Switch between samples and aggregates in Sentry for deeper analysis\n";
|
|
36976
38047
|
return output;
|
|
36977
38048
|
}
|
|
38049
|
+
/**
|
|
38050
|
+
* Whether summing per-bucket values yields a meaningful series total.
|
|
38051
|
+
* Only `count()` and `sum(...)` are additive across time buckets;
|
|
38052
|
+
* `count_unique`, `avg`, percentiles, min/max, rates, etc. are not.
|
|
38053
|
+
*/
|
|
38054
|
+
function isAdditiveAggregate(yAxis) {
|
|
38055
|
+
const fn = yAxis.trim().toLowerCase();
|
|
38056
|
+
return fn === "count()" || fn.startsWith("sum(");
|
|
38057
|
+
}
|
|
38058
|
+
/**
|
|
38059
|
+
* Format an events-stats (timeseries) result: a metric bucketed over time.
|
|
38060
|
+
* `interval` is null when Sentry chose the bucket size for the range.
|
|
38061
|
+
*/
|
|
38062
|
+
function formatTimeSeriesResults(params) {
|
|
38063
|
+
const { series, yAxis, interval, inputQuery, includeExplanation, explanation, timeRange, url } = params;
|
|
38064
|
+
const points = series.data.map(([ts, values]) => ({
|
|
38065
|
+
time: (/* @__PURE__ */ new Date(ts * 1e3)).toISOString().slice(0, 16).replace("T", " "),
|
|
38066
|
+
value: values[0]?.count ?? 0
|
|
38067
|
+
}));
|
|
38068
|
+
const total = isAdditiveAggregate(yAxis) ? points.reduce((sum, p) => sum + p.value, 0) : null;
|
|
38069
|
+
const peak = points.reduce((max, p) => max === void 0 || p.value > max.value ? p : max, void 0);
|
|
38070
|
+
const MAX_ROWS = 48;
|
|
38071
|
+
const shown = points.length > MAX_ROWS ? points.slice(-MAX_ROWS) : points;
|
|
38072
|
+
const truncatedNote = points.length > MAX_ROWS ? ` (most recent ${MAX_ROWS} of ${points.length})` : "";
|
|
38073
|
+
const lines = [`# Search Results for "${inputQuery}"`];
|
|
38074
|
+
if (includeExplanation && explanation) lines.push("", formatExplanation$1(explanation));
|
|
38075
|
+
lines.push("", `## ${yAxis} over time`);
|
|
38076
|
+
lines.push(`- **Interval**: ${interval ? `\`${interval}\`` : "auto (chosen by Sentry for the range)"}`);
|
|
38077
|
+
lines.push(`- **Time range**: ${formatExecutedTimeRange(timeRange)}`);
|
|
38078
|
+
if (total !== null) lines.push(`- **Total**: ${total.toLocaleString()}`);
|
|
38079
|
+
if (peak) lines.push(`- **Peak**: ${peak.value.toLocaleString()} at ${peak.time}`);
|
|
38080
|
+
if (shown.length > 0) {
|
|
38081
|
+
lines.push("", `## Buckets${truncatedNote}`, "", "| Time (UTC) | Value |", "| --- | --- |");
|
|
38082
|
+
for (const p of shown) lines.push(`| ${p.time} | ${p.value.toLocaleString()} |`);
|
|
38083
|
+
} else lines.push("", "No data points in this range.");
|
|
38084
|
+
if (url) lines.push("", formatSentryDashboardLink(url).trimEnd());
|
|
38085
|
+
return lines.join("\n");
|
|
38086
|
+
}
|
|
36978
38087
|
|
|
36979
38088
|
//#endregion
|
|
36980
|
-
//#region ../mcp-core/dist/replays-
|
|
38089
|
+
//#region ../mcp-core/dist/replays-DQeYjWub.js
|
|
36981
38090
|
const DEFAULT_REPLAY_SORT = "-started_at";
|
|
36982
38091
|
const DEFAULT_REPLAY_STATS_PERIOD = "14d";
|
|
36983
38092
|
const REPLAY_SORT_FIELDS = [
|
|
@@ -37102,7 +38211,7 @@ function formatReplayEnvironment(environment) {
|
|
|
37102
38211
|
}
|
|
37103
38212
|
|
|
37104
38213
|
//#endregion
|
|
37105
|
-
//#region ../mcp-core/dist/search-events-
|
|
38214
|
+
//#region ../mcp-core/dist/search-events-BFGK2Xtv.js
|
|
37106
38215
|
const SEARCH_EVENTS_DATASETS = [...PUBLIC_EVENTS_DATASETS, "replays"];
|
|
37107
38216
|
const DEFAULT_EVENTS_SORT = "-timestamp";
|
|
37108
38217
|
function defaultSortForDataset(dataset) {
|
|
@@ -37159,6 +38268,42 @@ function appendSearchFilter(query, filter$1) {
|
|
|
37159
38268
|
if (tokenizeSearchQuery(trimmedQuery).includes(filter$1)) return trimmedQuery;
|
|
37160
38269
|
return [trimmedQuery, filter$1].filter(Boolean).join(" ");
|
|
37161
38270
|
}
|
|
38271
|
+
/**
|
|
38272
|
+
* Collect the environment names a search actually filters on — from both the
|
|
38273
|
+
* separate `environment` field and any `environment:` token in the query string.
|
|
38274
|
+
* Sentry only validates the former against real environments, so a bad value in
|
|
38275
|
+
* the query (e.g. a typo) otherwise slips through and silently returns nothing.
|
|
38276
|
+
*/
|
|
38277
|
+
function collectRequestedEnvironments(environment, query) {
|
|
38278
|
+
const values = [];
|
|
38279
|
+
if (typeof environment === "string") values.push(environment);
|
|
38280
|
+
else if (Array.isArray(environment)) values.push(...environment);
|
|
38281
|
+
const tokens = tokenizeSearchQuery(query);
|
|
38282
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
38283
|
+
const match = /^environment:(.*)$/is.exec(tokens[i]);
|
|
38284
|
+
if (!match) continue;
|
|
38285
|
+
let value = match[1];
|
|
38286
|
+
while (value.startsWith("[") && !value.includes("]") && i + 1 < tokens.length) value += ` ${tokens[++i]}`;
|
|
38287
|
+
const inner = value.startsWith("[") && value.endsWith("]") ? value.slice(1, -1) : value;
|
|
38288
|
+
for (const part of inner.split(",")) {
|
|
38289
|
+
const cleaned = part.trim().replace(/^["']|["']$/g, "");
|
|
38290
|
+
if (cleaned) values.push(cleaned);
|
|
38291
|
+
}
|
|
38292
|
+
}
|
|
38293
|
+
return values;
|
|
38294
|
+
}
|
|
38295
|
+
/**
|
|
38296
|
+
* Note listing the org's real environments when a search references one that
|
|
38297
|
+
* doesn't exist, so the caller can retry with a valid name. We don't guess a
|
|
38298
|
+
* match — the calling agent maps from the list.
|
|
38299
|
+
*/
|
|
38300
|
+
function formatUnknownEnvironmentNote(unknown, available) {
|
|
38301
|
+
const uniqueUnknown = [...new Set(unknown)].map((name$4) => `\`${name$4}\``);
|
|
38302
|
+
const shown = available.slice(0, 50).map((name$4) => `\`${name$4}\``);
|
|
38303
|
+
const more = available.length > shown.length ? ` (${available.length} total)` : "";
|
|
38304
|
+
const label = uniqueUnknown.length === 1 ? "environment" : "environments";
|
|
38305
|
+
return `> ⚠️ Requested ${label} not found in this organization: ${uniqueUnknown.join(", ")}. Available environments: ${shown.join(", ")}${more}. Re-run filtering by one of these, or omit the environment to search all.`;
|
|
38306
|
+
}
|
|
37162
38307
|
function applyEnvironmentToEventsQuery(dataset, query, environment) {
|
|
37163
38308
|
if (dataset === "replays") return query;
|
|
37164
38309
|
return appendSearchFilter(query, formatEnvironmentFilter(environment));
|
|
@@ -37250,11 +38395,12 @@ var search_events_default = defineTool({
|
|
|
37250
38395
|
description: [
|
|
37251
38396
|
"Search Sentry events and replays. Use for event counts/statistics.",
|
|
37252
38397
|
"",
|
|
37253
|
-
"`query`
|
|
38398
|
+
"`query` is natural language or Sentry search syntax; a configured agent fixes dataset, query, fields, and sort.",
|
|
37254
38399
|
"",
|
|
37255
|
-
"Supports
|
|
38400
|
+
"Supports THREE query types:",
|
|
37256
38401
|
"1. AGGREGATIONS (counts, sums, averages): 'how many errors', 'total tokens'",
|
|
37257
38402
|
"2. Individual events with timestamps: 'error logs from last hour'",
|
|
38403
|
+
"3. TIME SERIES (metric over time): 'errors per hour', 'error trend over time'",
|
|
37258
38404
|
"",
|
|
37259
38405
|
"Datasets:",
|
|
37260
38406
|
"- errors: Exception/crash events with stack traces, usually grouped into issues",
|
|
@@ -37271,15 +38417,14 @@ var search_events_default = defineTool({
|
|
|
37271
38417
|
"",
|
|
37272
38418
|
"<examples>",
|
|
37273
38419
|
"search_events(organizationSlug='my-org', query='how many errors today')",
|
|
37274
|
-
"search_events(organizationSlug='my-org', dataset='errors', query='level:error')",
|
|
37275
38420
|
"search_events(organizationSlug='my-org', dataset='errors', fields=['issue', 'count()'], sort='-count()')",
|
|
38421
|
+
"search_events(organizationSlug='my-org', query='errors per hour last 24h')",
|
|
37276
38422
|
"search_events(organizationSlug='my-org', dataset='spans', query='span.op:db', sort='-span.duration')",
|
|
37277
38423
|
"search_events(organizationSlug='my-org', dataset='replays', query='count_errors:>0', sort='-count_errors')",
|
|
37278
38424
|
"</examples>",
|
|
37279
38425
|
"",
|
|
37280
38426
|
"<hints>",
|
|
37281
|
-
"-
|
|
37282
|
-
"- Parse org/project notation directly without calling find_organizations or find_projects.",
|
|
38427
|
+
"- name/otherName notation means <organizationSlug>/<projectSlug>; parse it directly, don't call find_organizations/find_projects.",
|
|
37283
38428
|
"- Use fields with aggregate functions like count(), avg(), sum() for statistics",
|
|
37284
38429
|
"- Sort by -count() for most common, -timestamp for newest",
|
|
37285
38430
|
"</hints>"
|
|
@@ -37302,10 +38447,22 @@ var search_events_default = defineTool({
|
|
|
37302
38447
|
destructiveHint: false,
|
|
37303
38448
|
openWorldHint: true
|
|
37304
38449
|
},
|
|
38450
|
+
onError(error, params, context$1) {
|
|
38451
|
+
const query = params.query;
|
|
38452
|
+
logWarn("search_events query failed", {
|
|
38453
|
+
loggerScope: ["tools", "search_events"],
|
|
38454
|
+
extra: {
|
|
38455
|
+
errorName: error instanceof Error ? error.name : typeof error,
|
|
38456
|
+
errorMessage: scrubSensitiveText(error instanceof Error ? error.message : String(error)),
|
|
38457
|
+
organizationSlug: (typeof params.organizationSlug === "string" ? params.organizationSlug : null) ?? context$1.constraints.organizationSlug,
|
|
38458
|
+
query: typeof query === "string" ? scrubSensitiveText(query) : null
|
|
38459
|
+
}
|
|
38460
|
+
});
|
|
38461
|
+
},
|
|
37305
38462
|
async handler(params, context$1) {
|
|
37306
38463
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37307
38464
|
const organizationSlug = params.organizationSlug;
|
|
37308
|
-
|
|
38465
|
+
setOrganizationContext(organizationSlug);
|
|
37309
38466
|
if (params.projectSlug) setTag("project.slug", params.projectSlug);
|
|
37310
38467
|
const inputDataset = params.dataset ?? "errors";
|
|
37311
38468
|
const hasStructuredQuery = looksLikeSentrySearchSyntax(params.query);
|
|
@@ -37326,6 +38483,7 @@ var search_events_default = defineTool({
|
|
|
37326
38483
|
let timeParams;
|
|
37327
38484
|
let explanation;
|
|
37328
38485
|
let environment = params.environment;
|
|
38486
|
+
let timeSeries = null;
|
|
37329
38487
|
const explicitSort = params.sort?.trim() || void 0;
|
|
37330
38488
|
const hasExplicitDataset = params.dataset !== void 0;
|
|
37331
38489
|
const hasExplicitFields = hasFields(params.fields);
|
|
@@ -37336,7 +38494,15 @@ var search_events_default = defineTool({
|
|
|
37336
38494
|
const environmentFilter = formatEnvironmentFilter(params.environment);
|
|
37337
38495
|
const explicitStructuredTraceQuery = shouldTrustStructuredTraceSearch ? appendSearchFilter(params.query ?? "", environmentFilter) : params.query ?? "";
|
|
37338
38496
|
const canRunWithoutAgent = shouldTrustStructuredTraceSearch && hasExplicitFields && hasExplicitSort;
|
|
37339
|
-
|
|
38497
|
+
const willRunAgent = hasAgentProvider() && !canRunWithoutAgent;
|
|
38498
|
+
const inputReferencesEnvironment = params.environment != null || collectRequestedEnvironments(null, params.query ?? "").length > 0;
|
|
38499
|
+
const environmentNames = willRunAgent || inputReferencesEnvironment ? await fetchEnvironmentNames({
|
|
38500
|
+
apiService,
|
|
38501
|
+
organizationSlug,
|
|
38502
|
+
projectId
|
|
38503
|
+
}) : [];
|
|
38504
|
+
const knownEnvironments = new Set(environmentNames.map((name$4) => name$4.toLowerCase()));
|
|
38505
|
+
if (willRunAgent) {
|
|
37340
38506
|
const parsed = await withProviderFallback({
|
|
37341
38507
|
operation: "search_events.rewrite",
|
|
37342
38508
|
fallback: () => ({
|
|
@@ -37345,6 +38511,7 @@ var search_events_default = defineTool({
|
|
|
37345
38511
|
fields: inputDataset === "replays" ? [] : params.fields ?? defaultFieldsForDataset(inputDataset),
|
|
37346
38512
|
sort: explicitSort || defaultSortForDataset(inputDataset),
|
|
37347
38513
|
environment: params.environment ?? null,
|
|
38514
|
+
timeSeries: null,
|
|
37348
38515
|
timeRange: { statsPeriod: params.period ?? "14d" },
|
|
37349
38516
|
explanation: ""
|
|
37350
38517
|
}),
|
|
@@ -37359,11 +38526,13 @@ var search_events_default = defineTool({
|
|
|
37359
38526
|
}),
|
|
37360
38527
|
organizationSlug,
|
|
37361
38528
|
apiService,
|
|
37362
|
-
projectId
|
|
38529
|
+
projectId,
|
|
38530
|
+
environmentNames
|
|
37363
38531
|
})).result
|
|
37364
38532
|
});
|
|
37365
38533
|
const shouldTrustExplicitSearchParams = shouldTrustStructuredTraceSearch || hasStructuredQuery && parsed.dataset === inputDataset;
|
|
37366
|
-
|
|
38534
|
+
timeSeries = parsed.timeSeries ?? null;
|
|
38535
|
+
if (!timeSeries && !parsed.sort?.trim() && !(shouldTrustExplicitSearchParams && hasExplicitSort)) throw new UserInputError(`Search Events Agent response missing required 'sort' parameter. Received: ${JSON.stringify(parsed, null, 2)}. The agent must specify how to sort results (e.g., '-timestamp' for newest first).`);
|
|
37367
38536
|
dataset = shouldTrustStructuredTraceSearch ? inputDataset : parsed.dataset;
|
|
37368
38537
|
sentryQuery = shouldTrustStructuredTraceSearch ? choosePreservingRepairedQuery({
|
|
37369
38538
|
originalQuery: params.query ?? "",
|
|
@@ -37388,6 +38557,9 @@ var search_events_default = defineTool({
|
|
|
37388
38557
|
timeParams = { statsPeriod: params.period ?? "14d" };
|
|
37389
38558
|
fields = dataset === "replays" ? [] : params.fields ?? defaultFieldsForDataset(dataset);
|
|
37390
38559
|
}
|
|
38560
|
+
const unknownEnvironments = knownEnvironments.size > 0 ? collectRequestedEnvironments(environment, sentryQuery).filter((name$4) => !knownEnvironments.has(name$4.toLowerCase())) : [];
|
|
38561
|
+
const environmentNote = unknownEnvironments.length > 0 ? formatUnknownEnvironmentNote(unknownEnvironments, environmentNames) : "";
|
|
38562
|
+
const withEnvironmentNote = (text$1) => environmentNote ? `${environmentNote}\n\n${text$1}` : text$1;
|
|
37391
38563
|
if (dataset === "replays") {
|
|
37392
38564
|
const replaySort = sortParam || DEFAULT_REPLAY_SORT;
|
|
37393
38565
|
if (!isValidReplaySort(replaySort)) throw new UserInputError(`Invalid replay sort "${replaySort}". Use a supported replay sort like ${DEFAULT_REPLAY_SORT}, -count_errors, -count_rage_clicks, or -duration.`);
|
|
@@ -37410,7 +38582,7 @@ var search_events_default = defineTool({
|
|
|
37410
38582
|
...replayTimeParams
|
|
37411
38583
|
});
|
|
37412
38584
|
getActiveSpan()?.setAttribute("gen_ai.tool.call.result.count", replays.length);
|
|
37413
|
-
|
|
38585
|
+
const replayOutput = formatReplayResults({
|
|
37414
38586
|
replays,
|
|
37415
38587
|
inputQuery: params.query || sentryQuery || "recent replays",
|
|
37416
38588
|
includeExplanation: params.includeExplanation,
|
|
@@ -37433,6 +38605,30 @@ var search_events_default = defineTool({
|
|
|
37433
38605
|
availableToolNames: context$1.availableToolNames,
|
|
37434
38606
|
directToolNames: context$1.directToolNames
|
|
37435
38607
|
});
|
|
38608
|
+
return withEnvironmentNote(replayOutput);
|
|
38609
|
+
}
|
|
38610
|
+
if (timeSeries) {
|
|
38611
|
+
const timeSeriesQuery = applyEnvironmentToEventsQuery(dataset, sentryQuery, environment);
|
|
38612
|
+
const series = await apiService.getEventsTimeSeries({
|
|
38613
|
+
organizationSlug,
|
|
38614
|
+
query: timeSeriesQuery,
|
|
38615
|
+
yAxis: timeSeries.yAxis,
|
|
38616
|
+
interval: timeSeries.interval ?? void 0,
|
|
38617
|
+
projectId,
|
|
38618
|
+
dataset,
|
|
38619
|
+
...timeParams
|
|
38620
|
+
});
|
|
38621
|
+
const statsUrl = apiService.getEventsExplorerUrl(organizationSlug, timeSeriesQuery, projectId, dataset, [timeSeries.yAxis], `-${timeSeries.yAxis}`, [timeSeries.yAxis], [], timeParams.statsPeriod, timeParams.start, timeParams.end);
|
|
38622
|
+
return withEnvironmentNote(formatTimeSeriesResults({
|
|
38623
|
+
series,
|
|
38624
|
+
yAxis: timeSeries.yAxis,
|
|
38625
|
+
interval: timeSeries.interval,
|
|
38626
|
+
inputQuery: params.query || timeSeriesQuery,
|
|
38627
|
+
includeExplanation: params.includeExplanation,
|
|
38628
|
+
explanation,
|
|
38629
|
+
timeRange: timeParams,
|
|
38630
|
+
url: statsUrl
|
|
38631
|
+
}));
|
|
37436
38632
|
}
|
|
37437
38633
|
fields = augmentFieldsWithSort(fields, sortParam);
|
|
37438
38634
|
const requestFields = buildRequestFields(dataset, fields);
|
|
@@ -37503,17 +38699,17 @@ var search_events_default = defineTool({
|
|
|
37503
38699
|
directToolNames: context$1.directToolNames
|
|
37504
38700
|
};
|
|
37505
38701
|
switch (dataset) {
|
|
37506
|
-
case "errors": return formatErrorResults(formatParams);
|
|
37507
|
-
case "logs": return formatLogResults(formatParams);
|
|
37508
|
-
case "spans": return formatSpanResults(formatParams);
|
|
37509
|
-
case "profiles": return formatProfileResults(formatParams);
|
|
37510
|
-
default: return formatTraceMetricsResults(formatParams);
|
|
38702
|
+
case "errors": return withEnvironmentNote(formatErrorResults(formatParams));
|
|
38703
|
+
case "logs": return withEnvironmentNote(formatLogResults(formatParams));
|
|
38704
|
+
case "spans": return withEnvironmentNote(formatSpanResults(formatParams));
|
|
38705
|
+
case "profiles": return withEnvironmentNote(formatProfileResults(formatParams));
|
|
38706
|
+
default: return withEnvironmentNote(formatTraceMetricsResults(formatParams));
|
|
37511
38707
|
}
|
|
37512
38708
|
}
|
|
37513
38709
|
});
|
|
37514
38710
|
|
|
37515
38711
|
//#endregion
|
|
37516
|
-
//#region ../mcp-core/dist/create-team-
|
|
38712
|
+
//#region ../mcp-core/dist/create-team-CgnBfkV1.js
|
|
37517
38713
|
const createTeamOutputSchema = z.object({ team: z.object({
|
|
37518
38714
|
id: z.string(),
|
|
37519
38715
|
slug: z.string(),
|
|
@@ -37558,7 +38754,7 @@ var create_team_default = defineTool({
|
|
|
37558
38754
|
async handler(params, context$1) {
|
|
37559
38755
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37560
38756
|
const organizationSlug = params.organizationSlug;
|
|
37561
|
-
|
|
38757
|
+
setOrganizationContext(organizationSlug);
|
|
37562
38758
|
const team = await apiService.createTeam({
|
|
37563
38759
|
organizationSlug,
|
|
37564
38760
|
name: params.name
|
|
@@ -37572,7 +38768,7 @@ var create_team_default = defineTool({
|
|
|
37572
38768
|
});
|
|
37573
38769
|
|
|
37574
38770
|
//#endregion
|
|
37575
|
-
//#region ../mcp-core/dist/create-project-
|
|
38771
|
+
//#region ../mcp-core/dist/create-project-BHO4uN-y.js
|
|
37576
38772
|
function getUsableClientKey(clientKeys) {
|
|
37577
38773
|
return clientKeys.find((key) => key.name === "Default" && key.isActive && key.dsn.public) ?? clientKeys.find((key) => key.isActive && key.dsn.public);
|
|
37578
38774
|
}
|
|
@@ -37668,7 +38864,7 @@ var create_project_default = defineTool({
|
|
|
37668
38864
|
async handler(params, context$1) {
|
|
37669
38865
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37670
38866
|
const organizationSlug = params.organizationSlug;
|
|
37671
|
-
|
|
38867
|
+
setOrganizationContext(organizationSlug);
|
|
37672
38868
|
setTag("team.slug", params.teamSlug);
|
|
37673
38869
|
const repositoryMatch = params.repository ? findRepositoryMatch(await apiService.listRepos({ organizationSlug }), params.repository) : null;
|
|
37674
38870
|
const project = await apiService.createProject({
|
|
@@ -37728,7 +38924,7 @@ var create_project_default = defineTool({
|
|
|
37728
38924
|
});
|
|
37729
38925
|
|
|
37730
38926
|
//#endregion
|
|
37731
|
-
//#region ../mcp-core/dist/update-project-
|
|
38927
|
+
//#region ../mcp-core/dist/update-project-CQdb0Elv.js
|
|
37732
38928
|
const updateProjectOutputSchema = z.object({ project: z.object({
|
|
37733
38929
|
id: z.string(),
|
|
37734
38930
|
slug: z.string(),
|
|
@@ -37789,7 +38985,7 @@ var update_project_default = defineTool({
|
|
|
37789
38985
|
async handler(params, context$1) {
|
|
37790
38986
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37791
38987
|
const organizationSlug = params.organizationSlug;
|
|
37792
|
-
|
|
38988
|
+
setOrganizationContext(organizationSlug);
|
|
37793
38989
|
setTag("project.slug", params.projectSlug);
|
|
37794
38990
|
const hasProjectUpdates = params.name || params.slug || params.platform;
|
|
37795
38991
|
if (!hasProjectUpdates) throw new UserInputError("At least one project metadata field is required: `name`, `slug`, or `platform`.");
|
|
@@ -37817,7 +39013,7 @@ var update_project_default = defineTool({
|
|
|
37817
39013
|
});
|
|
37818
39014
|
|
|
37819
39015
|
//#endregion
|
|
37820
|
-
//#region ../mcp-core/dist/add-team-to-project-
|
|
39016
|
+
//#region ../mcp-core/dist/add-team-to-project-CNjkc5mL.js
|
|
37821
39017
|
const assignedTeamSchema$1 = z.object({
|
|
37822
39018
|
id: z.string(),
|
|
37823
39019
|
slug: z.string(),
|
|
@@ -37875,7 +39071,7 @@ var add_team_to_project_default = defineTool({
|
|
|
37875
39071
|
async handler(params, context$1) {
|
|
37876
39072
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37877
39073
|
const organizationSlug = params.organizationSlug;
|
|
37878
|
-
|
|
39074
|
+
setOrganizationContext(organizationSlug);
|
|
37879
39075
|
setTag("project.slug", params.projectSlug);
|
|
37880
39076
|
setTag("team.slug", params.teamSlug);
|
|
37881
39077
|
const currentTeams = await apiService.listProjectTeams({
|
|
@@ -37904,7 +39100,7 @@ var add_team_to_project_default = defineTool({
|
|
|
37904
39100
|
});
|
|
37905
39101
|
|
|
37906
39102
|
//#endregion
|
|
37907
|
-
//#region ../mcp-core/dist/remove-team-from-project-
|
|
39103
|
+
//#region ../mcp-core/dist/remove-team-from-project-CM2_RkK5.js
|
|
37908
39104
|
const assignedTeamSchema = z.object({
|
|
37909
39105
|
id: z.string(),
|
|
37910
39106
|
slug: z.string(),
|
|
@@ -37963,7 +39159,7 @@ var remove_team_from_project_default = defineTool({
|
|
|
37963
39159
|
async handler(params, context$1) {
|
|
37964
39160
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
37965
39161
|
const organizationSlug = params.organizationSlug;
|
|
37966
|
-
|
|
39162
|
+
setOrganizationContext(organizationSlug);
|
|
37967
39163
|
setTag("project.slug", params.projectSlug);
|
|
37968
39164
|
setTag("team.slug", params.teamSlug);
|
|
37969
39165
|
const currentTeams = await apiService.listProjectTeams({
|
|
@@ -37990,7 +39186,7 @@ var remove_team_from_project_default = defineTool({
|
|
|
37990
39186
|
});
|
|
37991
39187
|
|
|
37992
39188
|
//#endregion
|
|
37993
|
-
//#region ../mcp-core/dist/create-dsn-
|
|
39189
|
+
//#region ../mcp-core/dist/create-dsn-BtFKEMq7.js
|
|
37994
39190
|
const createDsnOutputSchema = z.object({ dsn: z.object({
|
|
37995
39191
|
id: z.string(),
|
|
37996
39192
|
name: z.string(),
|
|
@@ -38039,7 +39235,7 @@ var create_dsn_default = defineTool({
|
|
|
38039
39235
|
async handler(params, context$1) {
|
|
38040
39236
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
38041
39237
|
const organizationSlug = params.organizationSlug;
|
|
38042
|
-
|
|
39238
|
+
setOrganizationContext(organizationSlug);
|
|
38043
39239
|
setTag("project.slug", params.projectSlug);
|
|
38044
39240
|
const clientKey = await apiService.createClientKey({
|
|
38045
39241
|
organizationSlug,
|
|
@@ -38055,7 +39251,7 @@ var create_dsn_default = defineTool({
|
|
|
38055
39251
|
});
|
|
38056
39252
|
|
|
38057
39253
|
//#endregion
|
|
38058
|
-
//#region ../mcp-core/dist/find-dsns-
|
|
39254
|
+
//#region ../mcp-core/dist/find-dsns-CqiIxv7u.js
|
|
38059
39255
|
const findDsnsOutputSchema = z.object({ dsns: z.array(z.object({
|
|
38060
39256
|
id: z.string(),
|
|
38061
39257
|
name: z.string(),
|
|
@@ -38090,7 +39286,7 @@ var find_dsns_default = defineTool({
|
|
|
38090
39286
|
async handler(params, context$1) {
|
|
38091
39287
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
38092
39288
|
const organizationSlug = params.organizationSlug;
|
|
38093
|
-
|
|
39289
|
+
setOrganizationContext(organizationSlug);
|
|
38094
39290
|
setTag("project.slug", params.projectSlug);
|
|
38095
39291
|
const clientKeys = await apiService.listClientKeys({
|
|
38096
39292
|
organizationSlug,
|
|
@@ -38105,7 +39301,7 @@ var find_dsns_default = defineTool({
|
|
|
38105
39301
|
});
|
|
38106
39302
|
|
|
38107
39303
|
//#endregion
|
|
38108
|
-
//#region ../mcp-core/dist/update-dsn-
|
|
39304
|
+
//#region ../mcp-core/dist/update-dsn-DP7ljBh8.js
|
|
38109
39305
|
var update_dsn_default = defineTool({
|
|
38110
39306
|
name: "update_dsn",
|
|
38111
39307
|
skills: ["project-management"],
|
|
@@ -38169,7 +39365,7 @@ var update_dsn_default = defineTool({
|
|
|
38169
39365
|
async handler(params, context$1) {
|
|
38170
39366
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
38171
39367
|
const organizationSlug = params.organizationSlug;
|
|
38172
|
-
|
|
39368
|
+
setOrganizationContext(organizationSlug);
|
|
38173
39369
|
setTag("project.slug", params.projectSlug);
|
|
38174
39370
|
const hasUpdates = params.name !== void 0 || params.isActive !== void 0 || params.disableRateLimit !== void 0 || params.rateLimitWindow !== void 0 || params.rateLimitCount !== void 0 || params.browserSdkVersion !== void 0 || params.loaderHasReplay !== void 0 || params.loaderHasPerformance !== void 0 || params.loaderHasDebug !== void 0 || params.loaderHasFeedback !== void 0 || params.loaderHasLogsAndMetrics !== void 0;
|
|
38175
39371
|
if (!hasUpdates) throw new UserInputError("At least one setting must be provided to update. Provide one or more of: name, isActive, rateLimitWindow + rateLimitCount, disableRateLimit, browserSdkVersion, or loader options.");
|
|
@@ -38239,57 +39435,7 @@ var update_dsn_default = defineTool({
|
|
|
38239
39435
|
});
|
|
38240
39436
|
|
|
38241
39437
|
//#endregion
|
|
38242
|
-
//#region ../mcp-core/dist/
|
|
38243
|
-
/**
|
|
38244
|
-
* Fetch with timeout using AbortController
|
|
38245
|
-
* @param url - The URL to fetch
|
|
38246
|
-
* @param options - Standard fetch options
|
|
38247
|
-
* @param timeoutMs - Timeout in milliseconds (default: 30000)
|
|
38248
|
-
* @returns Promise<Response>
|
|
38249
|
-
* @throws Error if request times out
|
|
38250
|
-
*/
|
|
38251
|
-
async function fetchWithTimeout(url, options = {}, timeoutMs = 3e4) {
|
|
38252
|
-
const controller = new AbortController();
|
|
38253
|
-
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
38254
|
-
try {
|
|
38255
|
-
const response = await fetch(url, {
|
|
38256
|
-
...options,
|
|
38257
|
-
signal: controller.signal
|
|
38258
|
-
});
|
|
38259
|
-
return response;
|
|
38260
|
-
} catch (error) {
|
|
38261
|
-
if (error instanceof Error && error.name === "AbortError") throw new Error(`Request timeout after ${timeoutMs}ms`);
|
|
38262
|
-
throw error;
|
|
38263
|
-
} finally {
|
|
38264
|
-
clearTimeout(timeoutId);
|
|
38265
|
-
}
|
|
38266
|
-
}
|
|
38267
|
-
/**
|
|
38268
|
-
* Retry a function with exponential backoff
|
|
38269
|
-
* @param fn - The async function to retry
|
|
38270
|
-
* @param options - Retry options
|
|
38271
|
-
* @param options.maxRetries - Maximum number of retries (default: 3)
|
|
38272
|
-
* @param options.initialDelay - Initial delay in milliseconds (default: 1000)
|
|
38273
|
-
* @param options.shouldRetry - Predicate to determine if error should be retried (default: always retry)
|
|
38274
|
-
* @returns Promise with the function result
|
|
38275
|
-
* @throws The last error if all retries are exhausted
|
|
38276
|
-
*/
|
|
38277
|
-
async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, shouldRetry = (error) => true } = {}) {
|
|
38278
|
-
let lastError;
|
|
38279
|
-
let delay$1 = initialDelay;
|
|
38280
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) try {
|
|
38281
|
-
return await fn();
|
|
38282
|
-
} catch (error) {
|
|
38283
|
-
lastError = error;
|
|
38284
|
-
if (attempt === maxRetries || !shouldRetry(error)) throw error;
|
|
38285
|
-
await new Promise((resolve$1) => setTimeout(resolve$1, delay$1));
|
|
38286
|
-
delay$1 = Math.min(delay$1 * 2, 3e4);
|
|
38287
|
-
}
|
|
38288
|
-
throw lastError;
|
|
38289
|
-
}
|
|
38290
|
-
|
|
38291
|
-
//#endregion
|
|
38292
|
-
//#region ../mcp-core/dist/analyze-issue-with-seer-D9pdpxPy.js
|
|
39438
|
+
//#region ../mcp-core/dist/analyze-issue-with-seer-Bh4zPWGl.js
|
|
38293
39439
|
var analyze_issue_with_seer_default = defineTool({
|
|
38294
39440
|
name: "analyze_issue_with_seer",
|
|
38295
39441
|
skills: ["seer"],
|
|
@@ -38355,7 +39501,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38355
39501
|
issueId: params.issueId,
|
|
38356
39502
|
issueUrl: params.issueUrl
|
|
38357
39503
|
});
|
|
38358
|
-
|
|
39504
|
+
setOrganizationContext(orgSlug);
|
|
38359
39505
|
const issue = await apiService.getIssue({
|
|
38360
39506
|
organizationSlug: orgSlug,
|
|
38361
39507
|
issueId: parsedIssueId
|
|
@@ -38400,7 +39546,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38400
39546
|
const existingStatus = autofixState.autofix.status;
|
|
38401
39547
|
if (isTerminalStatus(existingStatus)) {
|
|
38402
39548
|
output += `## Analysis ${getStatusDisplayName(existingStatus)}\n\n`;
|
|
38403
|
-
output += getOutputForAutofixRun(autofixState.autofix);
|
|
39549
|
+
output += autofixState.formatted?.content ? wrapSeerContent(autofixState.formatted.content, autofixState.autofix.run_id) : getOutputForAutofixRun(autofixState.autofix);
|
|
38404
39550
|
if (existingStatus !== "completed") {
|
|
38405
39551
|
output += `\n**Status**: ${existingStatus}\n`;
|
|
38406
39552
|
output += getHumanInterventionGuidance(existingStatus);
|
|
@@ -38423,7 +39569,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38423
39569
|
const status = autofixState.autofix.status;
|
|
38424
39570
|
if (isTerminalStatus(status)) {
|
|
38425
39571
|
output += `## Analysis ${getStatusDisplayName(status)}\n\n`;
|
|
38426
|
-
output += getOutputForAutofixRun(autofixState.autofix);
|
|
39572
|
+
output += autofixState.formatted?.content ? wrapSeerContent(autofixState.formatted.content, autofixState.autofix.run_id) : getOutputForAutofixRun(autofixState.autofix);
|
|
38427
39573
|
if (status !== "completed") {
|
|
38428
39574
|
output += `\n**Status**: ${status}\n`;
|
|
38429
39575
|
output += getHumanInterventionGuidance(status);
|
|
@@ -38465,7 +39611,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38465
39611
|
}
|
|
38466
39612
|
if (autofixState.autofix) {
|
|
38467
39613
|
output += `**Current Status**: ${getStatusDisplayName(autofixState.autofix.status)}\n\n`;
|
|
38468
|
-
output += getOutputForAutofixRun(autofixState.autofix);
|
|
39614
|
+
output += autofixState.formatted?.content ? wrapSeerContent(autofixState.formatted.content, autofixState.autofix.run_id) : getOutputForAutofixRun(autofixState.autofix);
|
|
38469
39615
|
}
|
|
38470
39616
|
output += `\n## Analysis Timed Out\n\n`;
|
|
38471
39617
|
output += `The analysis is taking longer than expected (>${SEER_TIMEOUT / 1e3}s).\n\n`;
|
|
@@ -38478,7 +39624,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
38478
39624
|
});
|
|
38479
39625
|
|
|
38480
39626
|
//#endregion
|
|
38481
|
-
//#region ../mcp-core/dist/search-docs-
|
|
39627
|
+
//#region ../mcp-core/dist/search-docs-Tj5IpQIk.js
|
|
38482
39628
|
var search_docs_default = defineTool({
|
|
38483
39629
|
name: "search_docs",
|
|
38484
39630
|
skills: ["inspect", "docs"],
|
|
@@ -38575,7 +39721,7 @@ var search_docs_default = defineTool({
|
|
|
38575
39721
|
});
|
|
38576
39722
|
|
|
38577
39723
|
//#endregion
|
|
38578
|
-
//#region ../mcp-core/dist/get-doc-
|
|
39724
|
+
//#region ../mcp-core/dist/get-doc-D-DZcOOW.js
|
|
38579
39725
|
var get_doc_default = defineTool({
|
|
38580
39726
|
name: "get_doc",
|
|
38581
39727
|
skills: ["inspect", "docs"],
|
|
@@ -38653,7 +39799,7 @@ var get_doc_default = defineTool({
|
|
|
38653
39799
|
});
|
|
38654
39800
|
|
|
38655
39801
|
//#endregion
|
|
38656
|
-
//#region ../mcp-core/dist/config-
|
|
39802
|
+
//#region ../mcp-core/dist/config-CCjTO4AY.js
|
|
38657
39803
|
/**
|
|
38658
39804
|
* Configuration for the search-issues agent
|
|
38659
39805
|
*/
|
|
@@ -38750,7 +39896,7 @@ Use issueFields only when a requested field is not in the built-in fields list.
|
|
|
38750
39896
|
Use whoami only for natural-language me references.`;
|
|
38751
39897
|
|
|
38752
39898
|
//#endregion
|
|
38753
|
-
//#region ../mcp-core/dist/agent-
|
|
39899
|
+
//#region ../mcp-core/dist/agent-DyOsplyJ.js
|
|
38754
39900
|
const searchIssuesAgentOutputSchema = z.object({
|
|
38755
39901
|
query: z.string().describe("The Sentry issue search query"),
|
|
38756
39902
|
sort: z.enum([
|
|
@@ -38784,7 +39930,7 @@ async function searchIssuesAgent(options) {
|
|
|
38784
39930
|
}
|
|
38785
39931
|
|
|
38786
39932
|
//#endregion
|
|
38787
|
-
//#region ../mcp-core/dist/formatters-
|
|
39933
|
+
//#region ../mcp-core/dist/formatters-CZbnEl5Q.js
|
|
38788
39934
|
/**
|
|
38789
39935
|
* Format an explanation for how the input query was translated
|
|
38790
39936
|
*/
|
|
@@ -38878,7 +40024,7 @@ function formatDate$1(dateString) {
|
|
|
38878
40024
|
}
|
|
38879
40025
|
|
|
38880
40026
|
//#endregion
|
|
38881
|
-
//#region ../mcp-core/dist/search-issues-
|
|
40027
|
+
//#region ../mcp-core/dist/search-issues-lbSTiP3S.js
|
|
38882
40028
|
const ProjectSlugOrIdSchema = z.string().trim().superRefine(validateSlugOrId);
|
|
38883
40029
|
function buildIssueSearchRepairPrompt(params) {
|
|
38884
40030
|
return [
|
|
@@ -38960,7 +40106,7 @@ var search_issues_default = defineTool({
|
|
|
38960
40106
|
},
|
|
38961
40107
|
async handler(params, context$1) {
|
|
38962
40108
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
38963
|
-
|
|
40109
|
+
setOrganizationContext(params.organizationSlug);
|
|
38964
40110
|
if (params.projectSlugOrId) if (isNumericId(params.projectSlugOrId)) setTag("project.id", params.projectSlugOrId);
|
|
38965
40111
|
else setTag("project.slug", params.projectSlugOrId);
|
|
38966
40112
|
let query;
|
|
@@ -39058,7 +40204,7 @@ var search_issues_default = defineTool({
|
|
|
39058
40204
|
});
|
|
39059
40205
|
|
|
39060
40206
|
//#endregion
|
|
39061
|
-
//#region ../mcp-core/dist/config-
|
|
40207
|
+
//#region ../mcp-core/dist/config-Nif76Shh.js
|
|
39062
40208
|
const systemPrompt$1 = `You are a Sentry issue event filter translator. Your job is to:
|
|
39063
40209
|
1. Translate natural language queries into Sentry tag filters for events within a SPECIFIC issue
|
|
39064
40210
|
2. Select appropriate fields to return in the results
|
|
@@ -39391,7 +40537,7 @@ const EXAMPLE_QUERIES = [
|
|
|
39391
40537
|
];
|
|
39392
40538
|
|
|
39393
40539
|
//#endregion
|
|
39394
|
-
//#region ../mcp-core/dist/utils-
|
|
40540
|
+
//#region ../mcp-core/dist/utils-DeCBYEnS.js
|
|
39395
40541
|
/**
|
|
39396
40542
|
* Create a tool for the agent to query available tags and fields for issue events
|
|
39397
40543
|
* The tool is pre-bound with the API service and organization configured for the appropriate region
|
|
@@ -39474,7 +40620,7 @@ Received: ${params.issueUrl}`);
|
|
|
39474
40620
|
}
|
|
39475
40621
|
|
|
39476
40622
|
//#endregion
|
|
39477
|
-
//#region ../mcp-core/dist/agent-
|
|
40623
|
+
//#region ../mcp-core/dist/agent-DTdycAuW.js
|
|
39478
40624
|
const searchIssueEventsAgentOutputSchema = z.object({
|
|
39479
40625
|
query: z.string().describe("Sentry query filters for tags/fields (NOT including issue: prefix - handler adds that)"),
|
|
39480
40626
|
fields: z.array(z.string()).describe("Array of field names to return in results"),
|
|
@@ -39516,7 +40662,7 @@ async function searchIssueEventsAgent(options) {
|
|
|
39516
40662
|
}
|
|
39517
40663
|
|
|
39518
40664
|
//#endregion
|
|
39519
|
-
//#region ../mcp-core/dist/search-issue-events-
|
|
40665
|
+
//#region ../mcp-core/dist/search-issue-events-Ck9S6CNC.js
|
|
39520
40666
|
function buildIssueEventSearchRepairPrompt(params) {
|
|
39521
40667
|
return [
|
|
39522
40668
|
"Fix this Sentry issue event search request.",
|
|
@@ -39580,7 +40726,7 @@ var search_issue_events_default = defineTool({
|
|
|
39580
40726
|
issueUrl: params.issueUrl
|
|
39581
40727
|
});
|
|
39582
40728
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
39583
|
-
|
|
40729
|
+
setOrganizationContext(organizationSlug);
|
|
39584
40730
|
setTag("issue.id", issueId);
|
|
39585
40731
|
if (params.projectSlug) setTag("project.slug", params.projectSlug);
|
|
39586
40732
|
await ensureIssueWithinProjectConstraint({
|
|
@@ -39669,7 +40815,7 @@ var search_issue_events_default = defineTool({
|
|
|
39669
40815
|
});
|
|
39670
40816
|
|
|
39671
40817
|
//#endregion
|
|
39672
|
-
//#region ../mcp-core/dist/formatter-
|
|
40818
|
+
//#region ../mcp-core/dist/formatter-ffKOVbDF.js
|
|
39673
40819
|
/**
|
|
39674
40820
|
* Maps a change type to its corresponding status icon.
|
|
39675
40821
|
*/
|
|
@@ -40045,7 +41191,7 @@ function formatSdkSummary(profile) {
|
|
|
40045
41191
|
}
|
|
40046
41192
|
|
|
40047
41193
|
//#endregion
|
|
40048
|
-
//#region ../mcp-core/dist/get-profile-
|
|
41194
|
+
//#region ../mcp-core/dist/get-profile-4EwZiRri.js
|
|
40049
41195
|
/**
|
|
40050
41196
|
* Resolves profile parameters from URL or explicit params.
|
|
40051
41197
|
* URL takes precedence if provided and valid.
|
|
@@ -40175,7 +41321,7 @@ var get_profile_default = defineTool({
|
|
|
40175
41321
|
setTag("project.slug", String(projectSlugOrId));
|
|
40176
41322
|
setTag("project.id", String(project.id));
|
|
40177
41323
|
}
|
|
40178
|
-
|
|
41324
|
+
setOrganizationContext(organizationSlug);
|
|
40179
41325
|
setTag("transaction.name", transactionName);
|
|
40180
41326
|
if (params.compareAgainstPeriod) {
|
|
40181
41327
|
setTag("baseline.period", params.compareAgainstPeriod);
|
|
@@ -40263,7 +41409,7 @@ var get_profile_default = defineTool({
|
|
|
40263
41409
|
});
|
|
40264
41410
|
|
|
40265
41411
|
//#endregion
|
|
40266
|
-
//#region ../mcp-core/dist/get-profile-details-
|
|
41412
|
+
//#region ../mcp-core/dist/get-profile-details-KNM3CXky.js
|
|
40267
41413
|
function resolveProfileDetailsParams(params) {
|
|
40268
41414
|
if (params.profileUrl) {
|
|
40269
41415
|
if (!isProfileUrl(params.profileUrl)) throw new UserInputError("Invalid profile URL. URL must point to a Sentry profile resource.");
|
|
@@ -40421,7 +41567,7 @@ var get_profile_details_default = defineTool({
|
|
|
40421
41567
|
regionUrl: params.regionUrl
|
|
40422
41568
|
});
|
|
40423
41569
|
const apiService = apiServiceFromContext(context$1, { regionUrl: regionUrl ?? void 0 });
|
|
40424
|
-
|
|
41570
|
+
setOrganizationContext(resolved.organizationSlug);
|
|
40425
41571
|
if (resolved.mode === "transaction") {
|
|
40426
41572
|
setTag("profile.id", resolved.profileId);
|
|
40427
41573
|
const isNumericProjectInput = typeof resolved.projectSlugOrId === "number" || isNumericId(String(resolved.projectSlugOrId));
|
|
@@ -40491,7 +41637,7 @@ var get_profile_details_default = defineTool({
|
|
|
40491
41637
|
});
|
|
40492
41638
|
|
|
40493
41639
|
//#endregion
|
|
40494
|
-
//#region ../mcp-core/dist/get-
|
|
41640
|
+
//#region ../mcp-core/dist/get-agent-conversation-details-bM0VVNAG.js
|
|
40495
41641
|
function withoutUndefined(value) {
|
|
40496
41642
|
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0));
|
|
40497
41643
|
}
|
|
@@ -40851,8 +41997,8 @@ function buildConversationArtifact(apiService, organizationSlug, conversationId,
|
|
|
40851
41997
|
timeline
|
|
40852
41998
|
});
|
|
40853
41999
|
}
|
|
40854
|
-
var
|
|
40855
|
-
name: "
|
|
42000
|
+
var get_agent_conversation_details_default = defineTool({
|
|
42001
|
+
name: "get_agent_conversation_details",
|
|
40856
42002
|
skills: [
|
|
40857
42003
|
"inspect",
|
|
40858
42004
|
"triage",
|
|
@@ -40860,13 +42006,13 @@ var get_ai_conversation_details_default = defineTool({
|
|
|
40860
42006
|
],
|
|
40861
42007
|
requiredScopes: ["event:read", "project:read"],
|
|
40862
42008
|
description: [
|
|
40863
|
-
"Fetch the chronological transcript and debugging details for one AI conversation.",
|
|
42009
|
+
"Fetch the chronological transcript and debugging details for one agent conversation, formerly called an AI conversation.",
|
|
40864
42010
|
"",
|
|
40865
|
-
"Returns a timeline of user messages, assistant messages, and tool calls, with trace/span IDs for deeper debugging. To discover or list conversations, use
|
|
42011
|
+
"Returns a timeline of user messages, assistant messages, and tool calls, with trace/span IDs for deeper debugging. To discover or list conversations, use search_agent_conversations."
|
|
40866
42012
|
].join("\n"),
|
|
40867
42013
|
inputSchema: {
|
|
40868
42014
|
organizationSlug: ParamOrganizationSlug,
|
|
40869
|
-
conversationId: z.string().trim().describe("The
|
|
42015
|
+
conversationId: z.string().trim().describe("The agent conversation ID from gen_ai.conversation.id."),
|
|
40870
42016
|
project: z.string().trim().optional().describe("Numeric project ID to scope the query. Falls back to context constraint or all projects."),
|
|
40871
42017
|
start: z.string().trim().optional().describe("Explicit start time for the conversation lookup window."),
|
|
40872
42018
|
end: z.string().trim().optional().describe("Explicit end time for the conversation lookup window."),
|
|
@@ -40879,7 +42025,7 @@ var get_ai_conversation_details_default = defineTool({
|
|
|
40879
42025
|
},
|
|
40880
42026
|
outputSchema: aiConversationDetailsOutputSchema,
|
|
40881
42027
|
async handler(params, context$1) {
|
|
40882
|
-
|
|
42028
|
+
setOrganizationContext(params.organizationSlug);
|
|
40883
42029
|
setTag("ai_conversation.id", params.conversationId);
|
|
40884
42030
|
if (params.start && !params.end || !params.start && params.end) throw new UserInputError("`start` and `end` must be provided together.");
|
|
40885
42031
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
@@ -40907,7 +42053,7 @@ var get_ai_conversation_details_default = defineTool({
|
|
|
40907
42053
|
});
|
|
40908
42054
|
|
|
40909
42055
|
//#endregion
|
|
40910
|
-
//#region ../mcp-core/dist/formatting-
|
|
42056
|
+
//#region ../mcp-core/dist/formatting-B1ckR5H7.js
|
|
40911
42057
|
function getSnapshotImageDisplayName(img) {
|
|
40912
42058
|
return img.display_name || img.image_file_name || "unknown";
|
|
40913
42059
|
}
|
|
@@ -41001,7 +42147,7 @@ function isPlainObject$2(value) {
|
|
|
41001
42147
|
}
|
|
41002
42148
|
|
|
41003
42149
|
//#endregion
|
|
41004
|
-
//#region ../mcp-core/dist/handlers-
|
|
42150
|
+
//#region ../mcp-core/dist/handlers-DhPeWak0.js
|
|
41005
42151
|
function fullResolutionHint({ organizationSlug, snapshotId, imageIdentifier, experimentalMode, availableToolNames, directToolNames }) {
|
|
41006
42152
|
return `- **Full Resolution**: ${formatToolCallInstruction({
|
|
41007
42153
|
toolName: "get_snapshot_image",
|
|
@@ -41267,7 +42413,7 @@ async function fetchSnapshotSummary(apiService, organizationSlug, snapshotId, so
|
|
|
41267
42413
|
}
|
|
41268
42414
|
|
|
41269
42415
|
//#endregion
|
|
41270
|
-
//#region ../mcp-core/dist/get-snapshot-
|
|
42416
|
+
//#region ../mcp-core/dist/get-snapshot-P1FuvUwa.js
|
|
41271
42417
|
var get_snapshot_default = defineTool({
|
|
41272
42418
|
name: "get_snapshot",
|
|
41273
42419
|
skills: ["inspect"],
|
|
@@ -41332,7 +42478,7 @@ var get_snapshot_default = defineTool({
|
|
|
41332
42478
|
},
|
|
41333
42479
|
async handler(params, context$1) {
|
|
41334
42480
|
if (!params.organizationSlug || !params.snapshotId) throw new UserInputError("Provide both organizationSlug and snapshotId. Use get_sentry_resource for snapshot URLs.");
|
|
41335
|
-
|
|
42481
|
+
setOrganizationContext(params.organizationSlug);
|
|
41336
42482
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
41337
42483
|
return fetchSnapshotSummary(apiService, params.organizationSlug, params.snapshotId, null, {
|
|
41338
42484
|
showUnmodified: params.showUnmodified,
|
|
@@ -41345,7 +42491,7 @@ var get_snapshot_default = defineTool({
|
|
|
41345
42491
|
});
|
|
41346
42492
|
|
|
41347
42493
|
//#endregion
|
|
41348
|
-
//#region ../mcp-core/dist/get-snapshot-image-
|
|
42494
|
+
//#region ../mcp-core/dist/get-snapshot-image-DjtwEpMj.js
|
|
41349
42495
|
var get_snapshot_image_default = defineTool({
|
|
41350
42496
|
name: "get_snapshot_image",
|
|
41351
42497
|
skills: ["inspect"],
|
|
@@ -41395,7 +42541,7 @@ var get_snapshot_image_default = defineTool({
|
|
|
41395
42541
|
},
|
|
41396
42542
|
async handler(params, context$1) {
|
|
41397
42543
|
if (!params.organizationSlug || !params.snapshotId) throw new UserInputError("Provide both organizationSlug and snapshotId. Use get_sentry_resource for snapshot URLs.");
|
|
41398
|
-
|
|
42544
|
+
setOrganizationContext(params.organizationSlug);
|
|
41399
42545
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
41400
42546
|
return fetchSnapshotImage(apiService, params.organizationSlug, params.snapshotId, params.imageIdentifier, params.imageResolution, {
|
|
41401
42547
|
experimentalMode: context$1.experimentalMode ?? false,
|
|
@@ -41406,7 +42552,7 @@ var get_snapshot_image_default = defineTool({
|
|
|
41406
42552
|
});
|
|
41407
42553
|
|
|
41408
42554
|
//#endregion
|
|
41409
|
-
//#region ../mcp-core/dist/get-sentry-resource-
|
|
42555
|
+
//#region ../mcp-core/dist/get-sentry-resource-BXVp2SKN.js
|
|
41410
42556
|
/** Types with full API integration. */
|
|
41411
42557
|
const FULLY_SUPPORTED_TYPES = [
|
|
41412
42558
|
"issue",
|
|
@@ -41481,7 +42627,7 @@ function resolveFromParsedUrl(parsed, params) {
|
|
|
41481
42627
|
});
|
|
41482
42628
|
if (detectedType === "unknown") {
|
|
41483
42629
|
if (parsed.transaction) throw new UserInputError(`Detected a performance summary URL for transaction "${parsed.transaction}". Use \`search_events\` to find traces and performance data for this transaction.`);
|
|
41484
|
-
throw new UserInputError("Could not determine resource type from URL. Supported URL patterns: issues, events, traces,
|
|
42630
|
+
throw new UserInputError("Could not determine resource type from URL. Supported URL patterns: issues, events, traces, agent conversations, profiles, replays, monitors, and releases.");
|
|
41485
42631
|
}
|
|
41486
42632
|
if (params.resourceType && params.resourceType !== detectedType) {
|
|
41487
42633
|
if (params.resourceType === "trace" && detectedType === "span") {
|
|
@@ -41526,7 +42672,7 @@ function resolveFromParsedUrl(parsed, params) {
|
|
|
41526
42672
|
spanId: parsed.spanId
|
|
41527
42673
|
};
|
|
41528
42674
|
case "ai_conversation":
|
|
41529
|
-
if (!parsed.conversationId) throw new UserInputError("Could not extract
|
|
42675
|
+
if (!parsed.conversationId) throw new UserInputError("Could not extract agent conversation ID from URL.");
|
|
41530
42676
|
return {
|
|
41531
42677
|
type: "ai_conversation",
|
|
41532
42678
|
organizationSlug,
|
|
@@ -41646,7 +42792,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41646
42792
|
fallbackInstruction: "Full-resolution snapshot image bytes are not available in this session",
|
|
41647
42793
|
purpose: "for full-resolution image bytes"
|
|
41648
42794
|
});
|
|
41649
|
-
const supportedResources = monitorResourcesAvailable ? "issues, events, traces, spans,
|
|
42795
|
+
const supportedResources = monitorResourcesAvailable ? "issues, events, traces, spans, agent conversations, replays, monitors, preprod snapshots, and snapshot images." : "issues, events, traces, spans, agent conversations, replays, preprod snapshots, and snapshot images.";
|
|
41650
42796
|
const resourceIds = [...monitorResourcesAvailable ? ["- monitor: <monitorSlug>"] : [], "- snapshot: <snapshotId>"];
|
|
41651
42797
|
return [
|
|
41652
42798
|
"Fetch a Sentry resource by URL, or by resourceType plus resourceId.",
|
|
@@ -41655,7 +42801,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41655
42801
|
`Supports ${supportedResources}`,
|
|
41656
42802
|
"Trace lookups return a condensed overview by default.",
|
|
41657
42803
|
"",
|
|
41658
|
-
"
|
|
42804
|
+
"Agent Conversations: A conversation is a set of spans sharing the same gen_ai.conversation.id. Use resourceType='ai_conversation' with a conversation ID, or pass a Sentry conversation URL, to fetch the transcript/details. To discover or list conversations, use search_agent_conversations. Conversations are NOT issues — do not use search_issues for conversation queries.",
|
|
41659
42805
|
"",
|
|
41660
42806
|
"For preprod snapshot URLs (matching 'sentry.io/preprod/snapshots/'):",
|
|
41661
42807
|
"- Without ?selectedSnapshot=: returns the snapshot diff summary (changed, added, removed images)",
|
|
@@ -41684,7 +42830,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41684
42830
|
"monitor",
|
|
41685
42831
|
"snapshot"
|
|
41686
42832
|
]).optional().describe("Resource type. With a URL, can override a span-focused trace URL with `trace`. Use `monitor` with a monitor slug only when inspect monitor tools are available or `snapshot` with a snapshot artifact ID."),
|
|
41687
|
-
resourceId: z.string().trim().optional().describe("Resource identifier: issue shortId (e.g., 'PROJECT-123'), event ID, trace ID,
|
|
42833
|
+
resourceId: z.string().trim().optional().describe("Resource identifier: issue shortId (e.g., 'PROJECT-123'), event ID, trace ID, agent conversation ID, replay ID, monitor slug when inspect monitor tools are available, or snapshot artifact ID. Required when not using a URL."),
|
|
41688
42834
|
organizationSlug: ParamOrganizationSlug.optional()
|
|
41689
42835
|
},
|
|
41690
42836
|
annotations: {
|
|
@@ -41701,7 +42847,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41701
42847
|
projectSlug: context$1.constraints.projectSlug
|
|
41702
42848
|
});
|
|
41703
42849
|
setTag("resource.type", resolved.type);
|
|
41704
|
-
|
|
42850
|
+
setOrganizationContext(resolved.organizationSlug);
|
|
41705
42851
|
if (resolved.spanId) setTag("trace.span_id", resolved.spanId);
|
|
41706
42852
|
getActiveSpan()?.setAttribute("app.resource.type", resolved.type);
|
|
41707
42853
|
if (resolved.type === "release") {
|
|
@@ -41731,7 +42877,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41731
42877
|
spanId: resolved.spanId,
|
|
41732
42878
|
regionUrl: context$1.constraints.regionUrl ?? null
|
|
41733
42879
|
}, context$1);
|
|
41734
|
-
case "ai_conversation": return
|
|
42880
|
+
case "ai_conversation": return get_agent_conversation_details_default.handler({
|
|
41735
42881
|
organizationSlug: resolved.organizationSlug,
|
|
41736
42882
|
conversationId: resolved.conversationId,
|
|
41737
42883
|
project: resolved.projectSlugOrId,
|
|
@@ -41794,7 +42940,7 @@ var get_sentry_resource_default = defineTool({
|
|
|
41794
42940
|
});
|
|
41795
42941
|
|
|
41796
42942
|
//#endregion
|
|
41797
|
-
//#region ../mcp-core/dist/get-latest-base-snapshot-
|
|
42943
|
+
//#region ../mcp-core/dist/get-latest-base-snapshot-CEkWKEZJ.js
|
|
41798
42944
|
var get_latest_base_snapshot_default = defineTool({
|
|
41799
42945
|
name: "get_latest_base_snapshot",
|
|
41800
42946
|
skills: ["inspect"],
|
|
@@ -41847,7 +42993,7 @@ var get_latest_base_snapshot_default = defineTool({
|
|
|
41847
42993
|
openWorldHint: true
|
|
41848
42994
|
},
|
|
41849
42995
|
async handler(params, context$1) {
|
|
41850
|
-
|
|
42996
|
+
setOrganizationContext(params.organizationSlug);
|
|
41851
42997
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
41852
42998
|
const project = params.project ?? void 0;
|
|
41853
42999
|
const projectId = project && isNumericId(project) ? project : void 0;
|
|
@@ -41890,9 +43036,15 @@ var get_latest_base_snapshot_default = defineTool({
|
|
|
41890
43036
|
});
|
|
41891
43037
|
|
|
41892
43038
|
//#endregion
|
|
41893
|
-
//#region ../mcp-core/dist/search-
|
|
43039
|
+
//#region ../mcp-core/dist/search-agent-conversations-BGO_38e-.js
|
|
41894
43040
|
const PREVIEW_LENGTH = 240;
|
|
41895
43041
|
const TRACE_ID_SAMPLE_SIZE = 3;
|
|
43042
|
+
const usdFormatter = new Intl.NumberFormat("en-US", {
|
|
43043
|
+
style: "currency",
|
|
43044
|
+
currency: "USD",
|
|
43045
|
+
notation: "compact",
|
|
43046
|
+
maximumSignificantDigits: 3
|
|
43047
|
+
});
|
|
41896
43048
|
const aiConversationSearchResultSchema = z.object({
|
|
41897
43049
|
conversationId: z.string(),
|
|
41898
43050
|
title: z.string().nullable(),
|
|
@@ -41905,7 +43057,7 @@ const aiConversationSearchResultSchema = z.object({
|
|
|
41905
43057
|
toolCallCount: z.number(),
|
|
41906
43058
|
toolErrorCount: z.number(),
|
|
41907
43059
|
totalTokens: z.number(),
|
|
41908
|
-
totalCost: z.
|
|
43060
|
+
totalCost: z.string(),
|
|
41909
43061
|
traceCount: z.number(),
|
|
41910
43062
|
sampleTraceIds: z.array(z.string()),
|
|
41911
43063
|
firstInputPreview: z.string().nullable(),
|
|
@@ -41951,6 +43103,11 @@ function previewText(value) {
|
|
|
41951
43103
|
if (value == null || value.length <= PREVIEW_LENGTH) return value;
|
|
41952
43104
|
return `${value.slice(0, PREVIEW_LENGTH - 3)}...`;
|
|
41953
43105
|
}
|
|
43106
|
+
function formatLLMCost(cost) {
|
|
43107
|
+
if (cost === 0) return "—";
|
|
43108
|
+
if (cost > 0 && cost < .01) return "<$0.01";
|
|
43109
|
+
return usdFormatter.format(cost);
|
|
43110
|
+
}
|
|
41954
43111
|
function projectUser(user) {
|
|
41955
43112
|
if (!user) return null;
|
|
41956
43113
|
return {
|
|
@@ -41977,7 +43134,7 @@ function buildArtifact(apiService, organizationSlug, conversations, nextCursor,
|
|
|
41977
43134
|
aiCallCount: llmCalls,
|
|
41978
43135
|
toolCallCount: toolCalls,
|
|
41979
43136
|
totalTokens,
|
|
41980
|
-
totalCost,
|
|
43137
|
+
totalCost: formatLLMCost(totalCost),
|
|
41981
43138
|
startTimestamp,
|
|
41982
43139
|
endTimestamp,
|
|
41983
43140
|
traceCount,
|
|
@@ -41993,8 +43150,8 @@ function buildArtifact(apiService, organizationSlug, conversations, nextCursor,
|
|
|
41993
43150
|
})
|
|
41994
43151
|
};
|
|
41995
43152
|
}
|
|
41996
|
-
var
|
|
41997
|
-
name: "
|
|
43153
|
+
var search_agent_conversations_default = defineTool({
|
|
43154
|
+
name: "search_agent_conversations",
|
|
41998
43155
|
skills: [
|
|
41999
43156
|
"inspect",
|
|
42000
43157
|
"triage",
|
|
@@ -42002,15 +43159,15 @@ var search_ai_conversations_default = defineTool({
|
|
|
42002
43159
|
],
|
|
42003
43160
|
requiredScopes: ["event:read", "project:read"],
|
|
42004
43161
|
description: [
|
|
42005
|
-
"Search Sentry AI Conversations and return one summary row per conversation.",
|
|
43162
|
+
"Search Sentry Agent Conversations, formerly called AI Conversations, and return one summary row per conversation.",
|
|
42006
43163
|
"",
|
|
42007
|
-
"Use this tool to find or list
|
|
42008
|
-
"Each row includes title (when available), cost, tokens, call counts, previews, and other list metadata.",
|
|
42009
|
-
"Use
|
|
43164
|
+
"Use this tool to find or list Agent Conversations. Results are conversation summaries, not raw span rows.",
|
|
43165
|
+
"Each row includes title (when available), USD cost, tokens, call counts, previews, and other list metadata.",
|
|
43166
|
+
"Use get_agent_conversation_details with a conversationId to fetch the transcript. Use get_sentry_resource for Sentry conversation URLs.",
|
|
42010
43167
|
"",
|
|
42011
43168
|
"<examples>",
|
|
42012
|
-
"
|
|
42013
|
-
"
|
|
43169
|
+
"search_agent_conversations(organizationSlug='my-org', query='failed conversations', period='7d')",
|
|
43170
|
+
"search_agent_conversations(organizationSlug='my-org', query='checkout', project='backend')",
|
|
42014
43171
|
"</examples>"
|
|
42015
43172
|
].join("\n"),
|
|
42016
43173
|
inputSchema: {
|
|
@@ -42036,7 +43193,7 @@ var search_ai_conversations_default = defineTool({
|
|
|
42036
43193
|
const requestedPeriod = params.period ?? "30d";
|
|
42037
43194
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
42038
43195
|
const organizationSlug = params.organizationSlug;
|
|
42039
|
-
|
|
43196
|
+
setOrganizationContext(organizationSlug);
|
|
42040
43197
|
const projectIds = await resolveProjectIds({
|
|
42041
43198
|
apiService,
|
|
42042
43199
|
organizationSlug,
|
|
@@ -42069,7 +43226,7 @@ var search_ai_conversations_default = defineTool({
|
|
|
42069
43226
|
});
|
|
42070
43227
|
|
|
42071
43228
|
//#endregion
|
|
42072
|
-
//#region ../mcp-core/dist/add-issue-note-
|
|
43229
|
+
//#region ../mcp-core/dist/add-issue-note-YI_XzMvf.js
|
|
42073
43230
|
function formatComment(comment) {
|
|
42074
43231
|
const actor = comment.user ? formatActor(comment.user) : "current user";
|
|
42075
43232
|
const text$1 = comment.data ? readString(comment.data, "text") : null;
|
|
@@ -42119,7 +43276,7 @@ var add_issue_note_default = defineTool({
|
|
|
42119
43276
|
organizationSlug: params.organizationSlug ?? context$1.constraints.organizationSlug
|
|
42120
43277
|
});
|
|
42121
43278
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
42122
|
-
|
|
43279
|
+
setOrganizationContext(parsed.organizationSlug);
|
|
42123
43280
|
setTag("issue.id", parsed.issueId);
|
|
42124
43281
|
await ensureIssueWithinProjectConstraint({
|
|
42125
43282
|
apiService,
|
|
@@ -42145,7 +43302,26 @@ var add_issue_note_default = defineTool({
|
|
|
42145
43302
|
});
|
|
42146
43303
|
|
|
42147
43304
|
//#endregion
|
|
42148
|
-
//#region ../mcp-core/dist/onboarding-status-update-
|
|
43305
|
+
//#region ../mcp-core/dist/onboarding-status-update-BJR7w05r.js
|
|
43306
|
+
const updateBaseSchema = z.object({
|
|
43307
|
+
status: AgenticOnboardingStageStatusUpdateSchema.describe("The stage's current status."),
|
|
43308
|
+
runStatus: AgenticOnboardingRunStatusUpdateSchema.optional().describe("Set only when the entire onboarding run has completed or failed."),
|
|
43309
|
+
eventNote: z.string().trim().min(1).max(256).optional().describe("Short context to display with this progress event. Required when status is failed.")
|
|
43310
|
+
}).strict();
|
|
43311
|
+
const createProjectUpdateSchema = updateBaseSchema.extend({
|
|
43312
|
+
stage: z.literal("create_project").describe("Report progress while creating or selecting Sentry projects."),
|
|
43313
|
+
extra: z.object({ projectSlugs: z.array(z.string().trim().min(1)).min(1).max(100).describe("Sentry project slugs created or selected during onboarding. Values accumulate across updates; include each project as it becomes usable while active, then all known projects when completed.") }).strict().optional().describe("Project metadata accepted only by the create_project stage.")
|
|
43314
|
+
});
|
|
43315
|
+
const receiveVerificationErrorUpdateSchema = updateBaseSchema.extend({
|
|
43316
|
+
stage: z.literal("receive_verification_error").describe("Report progress while receiving the verification error in Sentry."),
|
|
43317
|
+
extra: z.object({ issueIds: z.array(z.string().trim().min(1)).min(1).max(100).describe("Sentry issue IDs observed after sending the verification error. Values accumulate across updates; include each matching issue as it is confirmed, then all known issues when completed.") }).strict().optional().describe("Issue metadata accepted only by the receive_verification_error stage.")
|
|
43318
|
+
});
|
|
43319
|
+
const updateWithoutExtraSchema = updateBaseSchema.extend({ stage: AgenticOnboardingStageSchema.exclude(["create_project", "receive_verification_error"]).describe("Report progress for a stage that does not accept extra metadata.") });
|
|
43320
|
+
const onboardingUpdateSchema = z.discriminatedUnion("stage", [
|
|
43321
|
+
createProjectUpdateSchema,
|
|
43322
|
+
receiveVerificationErrorUpdateSchema,
|
|
43323
|
+
updateWithoutExtraSchema
|
|
43324
|
+
]).describe("The stage-specific onboarding progress update.");
|
|
42149
43325
|
var onboarding_status_update_default = defineTool({
|
|
42150
43326
|
name: "onboarding_status_update",
|
|
42151
43327
|
skills: ALL_SKILLS,
|
|
@@ -42168,13 +43344,8 @@ var onboarding_status_update_default = defineTool({
|
|
|
42168
43344
|
inputSchema: {
|
|
42169
43345
|
organizationSlug: ParamOrganizationSlug,
|
|
42170
43346
|
regionUrl: ParamRegionUrl.nullable().default(null),
|
|
42171
|
-
runToken:
|
|
42172
|
-
|
|
42173
|
-
status: AgenticOnboardingStageStatusUpdateSchema.describe("The stage's current status."),
|
|
42174
|
-
runStatus: AgenticOnboardingRunStatusUpdateSchema.optional().describe("Set only when the entire onboarding run has completed or failed."),
|
|
42175
|
-
eventNote: z.string().trim().min(1).max(256).optional().describe("Short context to display with this progress event. Required when status is failed."),
|
|
42176
|
-
projectSlugs: AgenticOnboardingStatusUpdateSchema.shape.projectSlugs.describe("Validated Sentry project slugs. Send only for create_project. Values accumulate across updates; include each project as it becomes usable while active, then all known projects when completed."),
|
|
42177
|
-
issueIds: AgenticOnboardingStatusUpdateSchema.shape.issueIds.describe("Validated Sentry issue IDs returned by MCP. Send only for receive_verification_error. Values accumulate across updates; include each matching issue as it is confirmed, then all known issues when completed.")
|
|
43347
|
+
runToken: AgenticOnboardingRunTokenSchema.describe("The 10-character onboarding run token supplied by Sentry."),
|
|
43348
|
+
update: onboardingUpdateSchema
|
|
42178
43349
|
},
|
|
42179
43350
|
annotations: {
|
|
42180
43351
|
readOnlyHint: false,
|
|
@@ -42184,26 +43355,42 @@ var onboarding_status_update_default = defineTool({
|
|
|
42184
43355
|
},
|
|
42185
43356
|
async handler(params, context$1) {
|
|
42186
43357
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? context$1.constraints.regionUrl ?? void 0 });
|
|
42187
|
-
|
|
43358
|
+
setOrganizationContext(params.organizationSlug);
|
|
43359
|
+
const update = AgenticOnboardingStatusUpdateSchema.parse({
|
|
43360
|
+
schemaVersion: 1,
|
|
43361
|
+
runToken: params.runToken,
|
|
43362
|
+
...params.update
|
|
43363
|
+
});
|
|
42188
43364
|
const run = await apiService.updateAgenticOnboardingStatus({
|
|
42189
43365
|
organizationSlug: params.organizationSlug,
|
|
42190
|
-
update
|
|
42191
|
-
schemaVersion: 1,
|
|
42192
|
-
runToken: params.runToken,
|
|
42193
|
-
stage: params.stage,
|
|
42194
|
-
status: params.status,
|
|
42195
|
-
...params.runStatus ? { runStatus: params.runStatus } : {},
|
|
42196
|
-
...params.eventNote ? { eventNote: params.eventNote } : {},
|
|
42197
|
-
...params.projectSlugs ? { projectSlugs: params.projectSlugs } : {},
|
|
42198
|
-
...params.issueIds ? { issueIds: params.issueIds } : {}
|
|
42199
|
-
}
|
|
43366
|
+
update
|
|
42200
43367
|
});
|
|
42201
43368
|
return `Onboarding status updated. Continue updates: ${run.continueUpdates ? "yes" : "no"}.`;
|
|
42202
43369
|
}
|
|
42203
43370
|
});
|
|
42204
43371
|
|
|
42205
43372
|
//#endregion
|
|
42206
|
-
//#region ../mcp-core/dist/catalog-
|
|
43373
|
+
//#region ../mcp-core/dist/catalog-CZAR_B3F.js
|
|
43374
|
+
const legacyGetAIConversationDetails = {
|
|
43375
|
+
...get_agent_conversation_details_default,
|
|
43376
|
+
name: "get_ai_conversation_details",
|
|
43377
|
+
includeInSkillDefinitions: false,
|
|
43378
|
+
description: [
|
|
43379
|
+
"Deprecated alias for get_agent_conversation_details.",
|
|
43380
|
+
"",
|
|
43381
|
+
"Use get_agent_conversation_details for new integrations. This alias is kept for backward compatibility."
|
|
43382
|
+
].join("\n")
|
|
43383
|
+
};
|
|
43384
|
+
const legacySearchAIConversations = {
|
|
43385
|
+
...search_agent_conversations_default,
|
|
43386
|
+
name: "search_ai_conversations",
|
|
43387
|
+
includeInSkillDefinitions: false,
|
|
43388
|
+
description: [
|
|
43389
|
+
"Deprecated alias for search_agent_conversations.",
|
|
43390
|
+
"",
|
|
43391
|
+
"Use search_agent_conversations for new integrations. This alias is kept for backward compatibility."
|
|
43392
|
+
].join("\n")
|
|
43393
|
+
};
|
|
42207
43394
|
/**
|
|
42208
43395
|
* Catalog of ordinary Sentry MCP operations.
|
|
42209
43396
|
*
|
|
@@ -42231,6 +43418,7 @@ const catalogTools = {
|
|
|
42231
43418
|
delete_uptime_monitor: delete_uptime_monitor_default,
|
|
42232
43419
|
find_alert_rules: find_alert_rules_default,
|
|
42233
43420
|
get_alert_rule: get_alert_rule_default,
|
|
43421
|
+
get_alert_options: get_alert_options_default,
|
|
42234
43422
|
get_issue_details: get_issue_details_default,
|
|
42235
43423
|
get_event_stacktrace: get_event_stacktrace_default,
|
|
42236
43424
|
get_issue_activity: get_issue_activity_default,
|
|
@@ -42258,19 +43446,22 @@ const catalogTools = {
|
|
|
42258
43446
|
search_issue_events: search_issue_events_default,
|
|
42259
43447
|
get_profile: get_profile_default,
|
|
42260
43448
|
get_profile_details: get_profile_details_default,
|
|
43449
|
+
get_sentry_mcp_info: get_sentry_mcp_info_default,
|
|
42261
43450
|
get_sentry_resource: get_sentry_resource_default,
|
|
42262
43451
|
get_snapshot: get_snapshot_default,
|
|
42263
43452
|
get_snapshot_image: get_snapshot_image_default,
|
|
42264
43453
|
get_latest_base_snapshot: get_latest_base_snapshot_default,
|
|
42265
|
-
|
|
42266
|
-
|
|
43454
|
+
get_agent_conversation_details: get_agent_conversation_details_default,
|
|
43455
|
+
get_ai_conversation_details: legacyGetAIConversationDetails,
|
|
43456
|
+
search_agent_conversations: search_agent_conversations_default,
|
|
43457
|
+
search_ai_conversations: legacySearchAIConversations,
|
|
42267
43458
|
add_issue_note: add_issue_note_default,
|
|
42268
43459
|
onboarding_status_update: onboarding_status_update_default
|
|
42269
43460
|
};
|
|
42270
43461
|
var catalog_default = catalogTools;
|
|
42271
43462
|
|
|
42272
43463
|
//#endregion
|
|
42273
|
-
//#region ../mcp-core/dist/schema-
|
|
43464
|
+
//#region ../mcp-core/dist/schema-Bf6vaXky.js
|
|
42274
43465
|
function zodFieldMapToJsonSchema(fieldMap) {
|
|
42275
43466
|
const zodObject = Object.keys(fieldMap).length > 0 ? z.object(fieldMap) : z.object({});
|
|
42276
43467
|
const { $schema: _,...jsonSchema$1 } = z.toJSONSchema(zodObject, {
|
|
@@ -42282,7 +43473,7 @@ function zodFieldMapToJsonSchema(fieldMap) {
|
|
|
42282
43473
|
}
|
|
42283
43474
|
|
|
42284
43475
|
//#endregion
|
|
42285
|
-
//#region ../mcp-core/dist/search
|
|
43476
|
+
//#region ../mcp-core/dist/search--TO414uy.js
|
|
42286
43477
|
function tokenize(value) {
|
|
42287
43478
|
return value.toLowerCase().split(/[^a-z0-9_]+/).map((token) => token.trim()).filter(Boolean);
|
|
42288
43479
|
}
|
|
@@ -42333,7 +43524,7 @@ function searchToolCatalog({ tools, context: context$1, query, limit }) {
|
|
|
42333
43524
|
}
|
|
42334
43525
|
|
|
42335
43526
|
//#endregion
|
|
42336
|
-
//#region ../mcp-core/dist/search-tools-
|
|
43527
|
+
//#region ../mcp-core/dist/search-tools-DD_Fpn20.js
|
|
42337
43528
|
const DEFAULT_LIMIT = 8;
|
|
42338
43529
|
const MAX_LIMIT = 20;
|
|
42339
43530
|
const toolAnnotationsOutputSchema = z.object({
|
|
@@ -42415,7 +43606,7 @@ function createSearchToolsTool(getTools) {
|
|
|
42415
43606
|
}
|
|
42416
43607
|
|
|
42417
43608
|
//#endregion
|
|
42418
|
-
//#region ../mcp-core/dist/execute-tool-
|
|
43609
|
+
//#region ../mcp-core/dist/execute-tool-Z6g9XYm0.js
|
|
42419
43610
|
function setToolArgumentAttributes(span, params) {
|
|
42420
43611
|
for (const [key, value] of Object.entries(params)) {
|
|
42421
43612
|
const attributeValue = value == null || typeof value === "object" ? JSON.stringify(value) : value;
|
|
@@ -42444,6 +43635,7 @@ async function executeCatalogToolWithSpan({ tool: tool$1, params, context: conte
|
|
|
42444
43635
|
} catch (error) {
|
|
42445
43636
|
span.setStatus({ code: 2 });
|
|
42446
43637
|
if (!isExpectedToolError(error)) span.recordException(error);
|
|
43638
|
+
recordToolFailure(tool$1, error, params, context$1);
|
|
42447
43639
|
throw error;
|
|
42448
43640
|
}
|
|
42449
43641
|
});
|
|
@@ -42499,7 +43691,7 @@ function createExecuteTool(getTools) {
|
|
|
42499
43691
|
}
|
|
42500
43692
|
|
|
42501
43693
|
//#endregion
|
|
42502
|
-
//#region ../mcp-core/dist/tools-
|
|
43694
|
+
//#region ../mcp-core/dist/tools-EVTUbO4b.js
|
|
42503
43695
|
function getAllTools() {
|
|
42504
43696
|
return allTools;
|
|
42505
43697
|
}
|
|
@@ -59206,8 +60398,8 @@ function configureServer({ server, context: context$1, experimentalMode = false,
|
|
|
59206
60398
|
if (context$1.clientFamily) setTag("app.client.family", context$1.clientFamily);
|
|
59207
60399
|
if (context$1.transport) setTag("app.transport", context$1.transport);
|
|
59208
60400
|
setTag("app.server.mode.experimental", experimentalMode);
|
|
60401
|
+
const rawParams = params && typeof params === "object" && !Array.isArray(params) ? params : {};
|
|
59209
60402
|
try {
|
|
59210
|
-
const rawParams = params && typeof params === "object" && !Array.isArray(params) ? params : {};
|
|
59211
60403
|
const paramsWithConstraints = injectConstraintParams(rawParams, tool$1, contextWithToolAvailability);
|
|
59212
60404
|
if (activeSpan) for (const [key, value] of Object.entries(paramsWithConstraints)) {
|
|
59213
60405
|
const attributeValue = value == null || typeof value === "object" ? JSON.stringify(value) : value;
|
|
@@ -59235,6 +60427,7 @@ function configureServer({ server, context: context$1, experimentalMode = false,
|
|
|
59235
60427
|
if (isApiAuthenticationErrorDeep(error) && context$1.onUpstreamUnauthorized) try {
|
|
59236
60428
|
await context$1.onUpstreamUnauthorized();
|
|
59237
60429
|
} catch {}
|
|
60430
|
+
recordToolFailure(tool$1, error, rawParams, contextWithToolAvailability);
|
|
59238
60431
|
return {
|
|
59239
60432
|
content: [{
|
|
59240
60433
|
type: "text",
|
|
@@ -59253,111 +60446,6 @@ function configureServer({ server, context: context$1, experimentalMode = false,
|
|
|
59253
60446
|
return registrations;
|
|
59254
60447
|
}
|
|
59255
60448
|
|
|
59256
|
-
//#endregion
|
|
59257
|
-
//#region ../mcp-core/dist/sentry-D99fvngC.js
|
|
59258
|
-
const SCRUB_PATTERNS = [
|
|
59259
|
-
{
|
|
59260
|
-
pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
|
|
59261
|
-
replacement: "[REDACTED_OPENAI_KEY]",
|
|
59262
|
-
description: "OpenAI API key"
|
|
59263
|
-
},
|
|
59264
|
-
{
|
|
59265
|
-
pattern: /\bBearer\s+[a-zA-Z0-9\-._~+/]+={0,}/g,
|
|
59266
|
-
replacement: "Bearer [REDACTED_TOKEN]",
|
|
59267
|
-
description: "Bearer token"
|
|
59268
|
-
},
|
|
59269
|
-
{
|
|
59270
|
-
pattern: /\bsntrys_[a-zA-Z0-9_]+\b/g,
|
|
59271
|
-
replacement: "[REDACTED_SENTRY_TOKEN]",
|
|
59272
|
-
description: "Sentry access token"
|
|
59273
|
-
}
|
|
59274
|
-
];
|
|
59275
|
-
const MAX_SCRUB_DEPTH = 20;
|
|
59276
|
-
/**
|
|
59277
|
-
* Recursively scrub sensitive data from any value.
|
|
59278
|
-
* Returns tuple of [scrubbedValue, didScrub, descriptionsOfMatchedPatterns]
|
|
59279
|
-
*/
|
|
59280
|
-
function scrubValue(value, depth = 0) {
|
|
59281
|
-
if (depth >= MAX_SCRUB_DEPTH) return [
|
|
59282
|
-
"[MAX_DEPTH_EXCEEDED]",
|
|
59283
|
-
false,
|
|
59284
|
-
[]
|
|
59285
|
-
];
|
|
59286
|
-
if (typeof value === "string") {
|
|
59287
|
-
let scrubbed = value;
|
|
59288
|
-
let didScrub = false;
|
|
59289
|
-
const matchedDescriptions = [];
|
|
59290
|
-
for (const { pattern, replacement, description: description$73 } of SCRUB_PATTERNS) {
|
|
59291
|
-
pattern.lastIndex = 0;
|
|
59292
|
-
if (pattern.test(scrubbed)) {
|
|
59293
|
-
didScrub = true;
|
|
59294
|
-
matchedDescriptions.push(description$73);
|
|
59295
|
-
pattern.lastIndex = 0;
|
|
59296
|
-
scrubbed = scrubbed.replace(pattern, replacement);
|
|
59297
|
-
}
|
|
59298
|
-
}
|
|
59299
|
-
return [
|
|
59300
|
-
scrubbed,
|
|
59301
|
-
didScrub,
|
|
59302
|
-
matchedDescriptions
|
|
59303
|
-
];
|
|
59304
|
-
}
|
|
59305
|
-
if (Array.isArray(value)) {
|
|
59306
|
-
let arrayDidScrub = false;
|
|
59307
|
-
const arrayDescriptions = [];
|
|
59308
|
-
const scrubbedArray = value.map((item) => {
|
|
59309
|
-
const [scrubbed, didScrub, descriptions] = scrubValue(item, depth + 1);
|
|
59310
|
-
if (didScrub) {
|
|
59311
|
-
arrayDidScrub = true;
|
|
59312
|
-
arrayDescriptions.push(...descriptions);
|
|
59313
|
-
}
|
|
59314
|
-
return scrubbed;
|
|
59315
|
-
});
|
|
59316
|
-
return [
|
|
59317
|
-
scrubbedArray,
|
|
59318
|
-
arrayDidScrub,
|
|
59319
|
-
arrayDescriptions
|
|
59320
|
-
];
|
|
59321
|
-
}
|
|
59322
|
-
if (value && typeof value === "object") {
|
|
59323
|
-
let objectDidScrub = false;
|
|
59324
|
-
const objectDescriptions = [];
|
|
59325
|
-
const scrubbed = {};
|
|
59326
|
-
for (const [key, val] of Object.entries(value)) {
|
|
59327
|
-
const [scrubbedVal, didScrub, descriptions] = scrubValue(val, depth + 1);
|
|
59328
|
-
if (didScrub) {
|
|
59329
|
-
objectDidScrub = true;
|
|
59330
|
-
objectDescriptions.push(...descriptions);
|
|
59331
|
-
}
|
|
59332
|
-
scrubbed[key] = scrubbedVal;
|
|
59333
|
-
}
|
|
59334
|
-
return [
|
|
59335
|
-
scrubbed,
|
|
59336
|
-
objectDidScrub,
|
|
59337
|
-
objectDescriptions
|
|
59338
|
-
];
|
|
59339
|
-
}
|
|
59340
|
-
return [
|
|
59341
|
-
value,
|
|
59342
|
-
false,
|
|
59343
|
-
[]
|
|
59344
|
-
];
|
|
59345
|
-
}
|
|
59346
|
-
/**
|
|
59347
|
-
* Sentry beforeSend hook that scrubs sensitive data from events
|
|
59348
|
-
* and applies custom fingerprinting for specific error types.
|
|
59349
|
-
*/
|
|
59350
|
-
function sentryBeforeSend(event, hint) {
|
|
59351
|
-
const firstException = event?.exception?.values?.[0];
|
|
59352
|
-
if (firstException?.type === "AI_APICallError" && firstException.value) event.fingerprint = ["AI_APICallError", firstException.value];
|
|
59353
|
-
const [scrubbedEvent, didScrub, descriptions] = scrubValue(event);
|
|
59354
|
-
if (didScrub) {
|
|
59355
|
-
const uniqueDescriptions = [...new Set(descriptions)];
|
|
59356
|
-
console.warn(`[Sentry] Event contained sensitive data: ${uniqueDescriptions.join(", ")}`);
|
|
59357
|
-
}
|
|
59358
|
-
return scrubbedEvent;
|
|
59359
|
-
}
|
|
59360
|
-
|
|
59361
60449
|
//#endregion
|
|
59362
60450
|
//#region src/index.ts
|
|
59363
60451
|
const packageName = "@sentry/mcp-server";
|
|
@@ -59491,7 +60579,6 @@ async function main() {
|
|
|
59491
60579
|
}
|
|
59492
60580
|
Sentry.init({
|
|
59493
60581
|
dsn: cfg.sentryDsn,
|
|
59494
|
-
sendDefaultPii: true,
|
|
59495
60582
|
tracesSampleRate: 1,
|
|
59496
60583
|
beforeSend: sentryBeforeSend,
|
|
59497
60584
|
initialScope: { tags: {
|
|
@@ -59524,17 +60611,28 @@ async function main() {
|
|
|
59524
60611
|
}
|
|
59525
60612
|
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
59526
60613
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
59527
|
-
|
|
59528
|
-
|
|
59529
|
-
|
|
59530
|
-
|
|
59531
|
-
|
|
60614
|
+
let exiting = false;
|
|
60615
|
+
function exitAfterError(error, label) {
|
|
60616
|
+
if (exiting) {
|
|
60617
|
+
process.exit(1);
|
|
60618
|
+
return;
|
|
60619
|
+
}
|
|
60620
|
+
exiting = true;
|
|
60621
|
+
try {
|
|
60622
|
+
console.error(label, error);
|
|
60623
|
+
} catch {}
|
|
60624
|
+
try {
|
|
60625
|
+
Sentry.captureException(error);
|
|
60626
|
+
} catch {}
|
|
60627
|
+
const timer = setTimeout(() => process.exit(1), SENTRY_TIMEOUT);
|
|
60628
|
+
timer.unref();
|
|
60629
|
+
Sentry.flush(SENTRY_TIMEOUT).finally(() => process.exit(1));
|
|
60630
|
+
}
|
|
60631
|
+
process.on("uncaughtException", (error) => {
|
|
60632
|
+
exitAfterError(error, "Uncaught exception:");
|
|
59532
60633
|
});
|
|
59533
|
-
process.on("unhandledRejection",
|
|
59534
|
-
|
|
59535
|
-
Sentry.captureException(reason);
|
|
59536
|
-
await Sentry.flush(SENTRY_TIMEOUT);
|
|
59537
|
-
process.exit(1);
|
|
60634
|
+
process.on("unhandledRejection", (reason) => {
|
|
60635
|
+
exitAfterError(reason, "Unhandled rejection:");
|
|
59538
60636
|
});
|
|
59539
60637
|
const context$1 = {
|
|
59540
60638
|
accessToken: cfg.accessToken,
|
|
@@ -59555,11 +60653,8 @@ async function main() {
|
|
|
59555
60653
|
context: context$1,
|
|
59556
60654
|
experimentalMode: cli.experimental
|
|
59557
60655
|
});
|
|
59558
|
-
startStdio(server, context$1).catch(
|
|
59559
|
-
|
|
59560
|
-
Sentry.captureException(err);
|
|
59561
|
-
await Sentry.flush(SENTRY_TIMEOUT);
|
|
59562
|
-
process.exit(1);
|
|
60656
|
+
startStdio(server, context$1).catch((err) => {
|
|
60657
|
+
exitAfterError(err, "Server error:");
|
|
59563
60658
|
});
|
|
59564
60659
|
}
|
|
59565
60660
|
main().catch((err) => {
|