@sentry/mcp-server 0.25.0 → 0.27.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/cli/parse.cjs +1 -1
- package/dist/cli/parse.d.cts +1 -1
- package/dist/cli/parse.d.cts.map +1 -1
- package/dist/cli/parse.d.ts +1 -1
- package/dist/cli/parse.d.ts.map +1 -1
- package/dist/cli/parse.js +1 -1
- package/dist/cli/resolve.cjs +1 -1
- package/dist/cli/resolve.d.cts +1 -1
- package/dist/cli/resolve.d.ts +1 -1
- package/dist/cli/resolve.js +1 -1
- package/dist/cli/types.d.cts +1 -1
- package/dist/cli/types.d.ts +1 -1
- package/dist/cli/usage.cjs +1 -1
- package/dist/cli/usage.js +1 -1
- package/dist/{config-BoFBjXRq-CGHqlnJ9.cjs → config-CEjP2CYO-CZKUamRu.cjs} +2 -2
- package/dist/{config-BoFBjXRq-CGHqlnJ9.cjs.map → config-CEjP2CYO-CZKUamRu.cjs.map} +1 -1
- package/dist/{config-BoFBjXRq-CMdBQOkQ.js → config-CEjP2CYO-DNCUeo0R.js} +2 -2
- package/dist/{config-BoFBjXRq-CMdBQOkQ.js.map → config-CEjP2CYO-DNCUeo0R.js.map} +1 -1
- package/dist/config-CwE3_vz4.cjs +7 -0
- package/dist/{config-BEgU9ylR.js → config-HqPAzoGg.js} +1 -1
- package/dist/index.cjs +2573 -243
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2571 -241
- package/dist/index.js.map +1 -1
- package/dist/{parse-46t_fITC.js → parse-B9o4fVyT.js} +12 -1
- package/dist/parse-B9o4fVyT.js.map +1 -0
- package/dist/{parse-BjIH83SX.cjs → parse-c_3eNB2Z.cjs} +12 -1
- package/dist/parse-c_3eNB2Z.cjs.map +1 -0
- package/dist/{resolve-CdTP9riu.cjs → resolve-DFUPLqHE.cjs} +11 -1
- package/dist/resolve-DFUPLqHE.cjs.map +1 -0
- package/dist/{resolve-Cg3SH2zt.js → resolve-DpUhCbfh.js} +11 -1
- package/dist/resolve-DpUhCbfh.js.map +1 -0
- package/dist/{stdio-CwqdTAhY.js → stdio-D7VKnapT.js} +3 -3
- package/dist/{stdio-CwqdTAhY.js.map → stdio-D7VKnapT.js.map} +1 -1
- package/dist/{stdio-Cl-Ib8bu.cjs → stdio-Dv01oTty.cjs} +3 -3
- package/dist/{stdio-Cl-Ib8bu.cjs.map → stdio-Dv01oTty.cjs.map} +1 -1
- package/dist/transports/stdio.cjs +1 -1
- package/dist/transports/stdio.js +1 -1
- package/dist/{types-D5f00mg9.d.ts → types--Ysz5ZMd.d.cts} +12 -1
- package/dist/types--Ysz5ZMd.d.cts.map +1 -0
- package/dist/{types-DpmAC3S8.d.cts → types-BlGRNCea.d.ts} +12 -1
- package/dist/types-BlGRNCea.d.ts.map +1 -0
- package/dist/{usage-DD58xBe3.cjs → usage-D9Tpyb5N.cjs} +15 -5
- package/dist/usage-D9Tpyb5N.cjs.map +1 -0
- package/dist/{usage-BzYvqaru.js → usage-DR57Krum.js} +15 -5
- package/dist/usage-DR57Krum.js.map +1 -0
- package/package.json +6 -6
- package/dist/config-rZ982IEm.cjs +0 -7
- package/dist/parse-46t_fITC.js.map +0 -1
- package/dist/parse-BjIH83SX.cjs.map +0 -1
- package/dist/resolve-CdTP9riu.cjs.map +0 -1
- package/dist/resolve-Cg3SH2zt.js.map +0 -1
- package/dist/types-D5f00mg9.d.ts.map +0 -1
- package/dist/types-DpmAC3S8.d.cts.map +0 -1
- package/dist/usage-BzYvqaru.js.map +0 -1
- package/dist/usage-DD58xBe3.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_chunk = require('./chunk-DoeelZqw.cjs');
|
|
3
|
-
const require_resolve = require('./resolve-
|
|
4
|
-
const require_stdio = require('./stdio-
|
|
5
|
-
const
|
|
6
|
-
const require_usage = require('./usage-
|
|
7
|
-
const require_parse = require('./parse-
|
|
3
|
+
const require_resolve = require('./resolve-DFUPLqHE.cjs');
|
|
4
|
+
const require_stdio = require('./stdio-Dv01oTty.cjs');
|
|
5
|
+
const require_config_CEjP2CYO = require('./config-CEjP2CYO-CZKUamRu.cjs');
|
|
6
|
+
const require_usage = require('./usage-D9Tpyb5N.cjs');
|
|
7
|
+
const require_parse = require('./parse-c_3eNB2Z.cjs');
|
|
8
8
|
const zod = require_chunk.__toESM(require("zod"));
|
|
9
9
|
const node_util = require_chunk.__toESM(require("node:util"));
|
|
10
10
|
const __sentry_core = require_chunk.__toESM(require("@sentry/core"));
|
|
@@ -1752,7 +1752,7 @@ function logIssue(error, contextsOrOptions, attachmentsArg) {
|
|
|
1752
1752
|
}
|
|
1753
1753
|
|
|
1754
1754
|
//#endregion
|
|
1755
|
-
//#region ../mcp-core/dist/schema-
|
|
1755
|
+
//#region ../mcp-core/dist/schema-VoUcElu5.js
|
|
1756
1756
|
/**
|
|
1757
1757
|
* Schema for Sentry API error responses.
|
|
1758
1758
|
*
|
|
@@ -2175,6 +2175,31 @@ const EventAttachmentSchema = zod.z.object({
|
|
|
2175
2175
|
});
|
|
2176
2176
|
const EventAttachmentListSchema = zod.z.array(EventAttachmentSchema);
|
|
2177
2177
|
/**
|
|
2178
|
+
* Schema for individual tag values within an issue's tag distribution.
|
|
2179
|
+
*
|
|
2180
|
+
* Represents a single value's occurrence count and percentage within a tag.
|
|
2181
|
+
*/
|
|
2182
|
+
const IssueTagValueSchema = zod.z.object({
|
|
2183
|
+
key: zod.z.string().nullable().optional(),
|
|
2184
|
+
name: zod.z.string().nullable().optional(),
|
|
2185
|
+
value: zod.z.string().nullable(),
|
|
2186
|
+
count: zod.z.number(),
|
|
2187
|
+
lastSeen: zod.z.string().datetime().nullable().optional(),
|
|
2188
|
+
firstSeen: zod.z.string().datetime().nullable().optional()
|
|
2189
|
+
});
|
|
2190
|
+
/**
|
|
2191
|
+
* Schema for Sentry issue tag values response.
|
|
2192
|
+
*
|
|
2193
|
+
* Contains aggregate counts of unique tag values for an issue,
|
|
2194
|
+
* useful for understanding the distribution of tags like URL, browser, etc.
|
|
2195
|
+
*/
|
|
2196
|
+
const IssueTagValuesSchema = zod.z.object({
|
|
2197
|
+
key: zod.z.string(),
|
|
2198
|
+
name: zod.z.string(),
|
|
2199
|
+
totalValues: zod.z.number(),
|
|
2200
|
+
topValues: zod.z.array(IssueTagValueSchema)
|
|
2201
|
+
});
|
|
2202
|
+
/**
|
|
2178
2203
|
* Schema for Sentry trace metadata response.
|
|
2179
2204
|
*
|
|
2180
2205
|
* Contains high-level statistics about a trace including span counts,
|
|
@@ -2464,7 +2489,7 @@ function createApiError(message, status, detail, responseBody) {
|
|
|
2464
2489
|
}
|
|
2465
2490
|
|
|
2466
2491
|
//#endregion
|
|
2467
|
-
//#region ../mcp-core/dist/client-
|
|
2492
|
+
//#region ../mcp-core/dist/client-DXmt8umX.js
|
|
2468
2493
|
/**
|
|
2469
2494
|
* Mapping of common network error codes to user-friendly messages.
|
|
2470
2495
|
* These help users understand and resolve connection issues.
|
|
@@ -2562,6 +2587,27 @@ var SentryApiService = class {
|
|
|
2562
2587
|
return require_resolve.isSentryHost(this.host);
|
|
2563
2588
|
}
|
|
2564
2589
|
/**
|
|
2590
|
+
* Validates and applies time parameters to a URLSearchParams object.
|
|
2591
|
+
*
|
|
2592
|
+
* Enforces mutual exclusivity between relative (statsPeriod) and
|
|
2593
|
+
* absolute (start/end) time ranges, and ensures start/end are paired.
|
|
2594
|
+
*
|
|
2595
|
+
* @param queryParams The URLSearchParams to modify
|
|
2596
|
+
* @param statsPeriod Relative time period (e.g., "24h", "7d")
|
|
2597
|
+
* @param start Absolute start time (ISO 8601)
|
|
2598
|
+
* @param end Absolute end time (ISO 8601)
|
|
2599
|
+
* @throws {ApiValidationError} If time parameters are invalid
|
|
2600
|
+
*/
|
|
2601
|
+
applyTimeParams(queryParams, statsPeriod, start, end) {
|
|
2602
|
+
if (statsPeriod && (start || end)) throw new ApiValidationError("Cannot use both statsPeriod and start/end parameters. Use either statsPeriod for relative time or start/end for absolute time.");
|
|
2603
|
+
if (start && !end || !start && end) throw new ApiValidationError("Both start and end parameters must be provided together for absolute time ranges.");
|
|
2604
|
+
if (statsPeriod) queryParams.set("statsPeriod", statsPeriod);
|
|
2605
|
+
else if (start && end) {
|
|
2606
|
+
queryParams.set("start", start);
|
|
2607
|
+
queryParams.set("end", end);
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
/**
|
|
2565
2611
|
* Internal method for making authenticated requests to Sentry API.
|
|
2566
2612
|
*
|
|
2567
2613
|
* Handles:
|
|
@@ -3156,13 +3202,7 @@ var SentryApiService = class {
|
|
|
3156
3202
|
const searchQuery = new URLSearchParams();
|
|
3157
3203
|
if (dataset) searchQuery.set("dataset", dataset);
|
|
3158
3204
|
if (project) searchQuery.set("project", project);
|
|
3159
|
-
|
|
3160
|
-
if (start && !end || !start && end) throw new ApiValidationError("Both start and end parameters must be provided together for absolute time ranges.");
|
|
3161
|
-
if (statsPeriod) searchQuery.set("statsPeriod", statsPeriod);
|
|
3162
|
-
else if (start && end) {
|
|
3163
|
-
searchQuery.set("start", start);
|
|
3164
|
-
searchQuery.set("end", end);
|
|
3165
|
-
}
|
|
3205
|
+
this.applyTimeParams(searchQuery, statsPeriod, start, end);
|
|
3166
3206
|
if (useCache !== void 0) searchQuery.set("useCache", useCache ? "1" : "0");
|
|
3167
3207
|
if (useFlagsBackend !== void 0) searchQuery.set("useFlagsBackend", useFlagsBackend ? "1" : "0");
|
|
3168
3208
|
const body = await this.requestJSON(searchQuery.toString() ? `/organizations/${organizationSlug}/tags/?${searchQuery.toString()}` : `/organizations/${organizationSlug}/tags/`, void 0, opts);
|
|
@@ -3202,13 +3242,7 @@ var SentryApiService = class {
|
|
|
3202
3242
|
queryParams.set("itemType", itemType);
|
|
3203
3243
|
queryParams.set("attributeType", attributeType);
|
|
3204
3244
|
if (project) queryParams.set("project", project);
|
|
3205
|
-
|
|
3206
|
-
if (start && !end || !start && end) throw new ApiValidationError("Both start and end parameters must be provided together for absolute time ranges.");
|
|
3207
|
-
if (statsPeriod) queryParams.set("statsPeriod", statsPeriod);
|
|
3208
|
-
else if (start && end) {
|
|
3209
|
-
queryParams.set("start", start);
|
|
3210
|
-
queryParams.set("end", end);
|
|
3211
|
-
}
|
|
3245
|
+
this.applyTimeParams(queryParams, statsPeriod, start, end);
|
|
3212
3246
|
const url = `/organizations/${organizationSlug}/trace-items/attributes/?${queryParams.toString()}`;
|
|
3213
3247
|
const body = await this.requestJSON(url, void 0, opts);
|
|
3214
3248
|
return Array.isArray(body) ? body : [];
|
|
@@ -3262,6 +3296,35 @@ var SentryApiService = class {
|
|
|
3262
3296
|
const body = await this.requestJSON(`/organizations/${organizationSlug}/issues/${issueId}/`, void 0, opts);
|
|
3263
3297
|
return IssueSchema.parse(body);
|
|
3264
3298
|
}
|
|
3299
|
+
/**
|
|
3300
|
+
* Retrieves tag value distribution for a specific issue.
|
|
3301
|
+
*
|
|
3302
|
+
* Returns aggregate counts of unique tag values, useful for understanding
|
|
3303
|
+
* how an issue is distributed across different tag values (e.g., URLs,
|
|
3304
|
+
* browsers, environments).
|
|
3305
|
+
*
|
|
3306
|
+
* @param params Query parameters
|
|
3307
|
+
* @param params.organizationSlug Organization identifier
|
|
3308
|
+
* @param params.issueId Issue identifier (short ID or numeric ID)
|
|
3309
|
+
* @param params.tagKey Tag key to get values for (e.g., "url", "browser", "environment")
|
|
3310
|
+
* @param opts Request options
|
|
3311
|
+
* @returns Tag value distribution with counts and percentages
|
|
3312
|
+
*
|
|
3313
|
+
* @example
|
|
3314
|
+
* ```typescript
|
|
3315
|
+
* const tagValues = await apiService.getIssueTagValues({
|
|
3316
|
+
* organizationSlug: "my-org",
|
|
3317
|
+
* issueId: "PROJECT-123",
|
|
3318
|
+
* tagKey: "url"
|
|
3319
|
+
* });
|
|
3320
|
+
* console.log(`Total unique values: ${tagValues.totalValues}`);
|
|
3321
|
+
* tagValues.topValues.forEach(v => console.log(`${v.value}: ${v.count}`));
|
|
3322
|
+
* ```
|
|
3323
|
+
*/
|
|
3324
|
+
async getIssueTagValues({ organizationSlug, issueId, tagKey }, opts) {
|
|
3325
|
+
const body = await this.requestJSON(`/organizations/${organizationSlug}/issues/${issueId}/tags/${tagKey}/`, void 0, opts);
|
|
3326
|
+
return IssueTagValuesSchema.parse(body);
|
|
3327
|
+
}
|
|
3265
3328
|
async getEventForIssue({ organizationSlug, issueId, eventId }, opts) {
|
|
3266
3329
|
const body = await this.requestJSON(`/organizations/${organizationSlug}/issues/${issueId}/events/${eventId}/`, void 0, opts);
|
|
3267
3330
|
const parseResult = EventSchema.safeParse(body);
|
|
@@ -3295,6 +3358,26 @@ var SentryApiService = class {
|
|
|
3295
3358
|
eventId: "latest"
|
|
3296
3359
|
}, opts);
|
|
3297
3360
|
}
|
|
3361
|
+
/**
|
|
3362
|
+
* Lists events for a specific issue.
|
|
3363
|
+
* Uses the issue-specific endpoint which already filters by issue ID.
|
|
3364
|
+
*
|
|
3365
|
+
* @see https://docs.sentry.io/api/events/list-an-issues-events/
|
|
3366
|
+
*/
|
|
3367
|
+
async listEventsForIssue({ organizationSlug, issueId, query, limit = 50, sort, statsPeriod, start, end, full = false }, opts) {
|
|
3368
|
+
const params = new URLSearchParams();
|
|
3369
|
+
if (query) params.append("query", query);
|
|
3370
|
+
params.append("per_page", String(limit));
|
|
3371
|
+
if (sort) params.append("sort", sort);
|
|
3372
|
+
if (statsPeriod) params.append("statsPeriod", statsPeriod);
|
|
3373
|
+
else if (start && end) {
|
|
3374
|
+
params.append("start", start);
|
|
3375
|
+
params.append("end", end);
|
|
3376
|
+
}
|
|
3377
|
+
if (full) params.append("full", "true");
|
|
3378
|
+
const apiUrl = `/organizations/${organizationSlug}/issues/${issueId}/events/?${params.toString()}`;
|
|
3379
|
+
return await this.requestJSON(apiUrl, void 0, opts);
|
|
3380
|
+
}
|
|
3298
3381
|
async listEventAttachments({ organizationSlug, projectSlug, eventId }, opts) {
|
|
3299
3382
|
const body = await this.requestJSON(`/projects/${organizationSlug}/${projectSlug}/events/${eventId}/attachments/`, void 0, opts);
|
|
3300
3383
|
return EventAttachmentListSchema.parse(body);
|
|
@@ -3382,13 +3465,7 @@ var SentryApiService = class {
|
|
|
3382
3465
|
queryParams.set("per_page", params.limit.toString());
|
|
3383
3466
|
queryParams.set("query", params.query);
|
|
3384
3467
|
queryParams.set("dataset", "errors");
|
|
3385
|
-
|
|
3386
|
-
if (params.start && !params.end || !params.start && params.end) throw new ApiValidationError("Both start and end parameters must be provided together for absolute time ranges.");
|
|
3387
|
-
if (params.statsPeriod) queryParams.set("statsPeriod", params.statsPeriod);
|
|
3388
|
-
else if (params.start && params.end) {
|
|
3389
|
-
queryParams.set("start", params.start);
|
|
3390
|
-
queryParams.set("end", params.end);
|
|
3391
|
-
}
|
|
3468
|
+
this.applyTimeParams(queryParams, params.statsPeriod, params.start, params.end);
|
|
3392
3469
|
if (params.projectId) queryParams.set("project", params.projectId);
|
|
3393
3470
|
let apiSort = params.sort;
|
|
3394
3471
|
if (params.sort?.includes("(") && !params.sort?.includes("equation|")) {
|
|
@@ -3416,13 +3493,7 @@ var SentryApiService = class {
|
|
|
3416
3493
|
queryParams.set("per_page", params.limit.toString());
|
|
3417
3494
|
queryParams.set("query", params.query);
|
|
3418
3495
|
queryParams.set("dataset", params.dataset);
|
|
3419
|
-
|
|
3420
|
-
if (params.start && !params.end || !params.start && params.end) throw new ApiValidationError("Both start and end parameters must be provided together for absolute time ranges.");
|
|
3421
|
-
if (params.statsPeriod) queryParams.set("statsPeriod", params.statsPeriod);
|
|
3422
|
-
else if (params.start && params.end) {
|
|
3423
|
-
queryParams.set("start", params.start);
|
|
3424
|
-
queryParams.set("end", params.end);
|
|
3425
|
-
}
|
|
3496
|
+
this.applyTimeParams(queryParams, params.statsPeriod, params.start, params.end);
|
|
3426
3497
|
if (params.projectId) queryParams.set("project", params.projectId);
|
|
3427
3498
|
if (params.dataset === "spans") queryParams.set("sampling", "NORMAL");
|
|
3428
3499
|
let apiSort = params.sort;
|
|
@@ -3585,7 +3656,7 @@ function validateRegionUrl(regionUrl, baseHost) {
|
|
|
3585
3656
|
}
|
|
3586
3657
|
|
|
3587
3658
|
//#endregion
|
|
3588
|
-
//#region ../mcp-core/dist/api-
|
|
3659
|
+
//#region ../mcp-core/dist/api-DgBjJzAN.js
|
|
3589
3660
|
/**
|
|
3590
3661
|
* Create a Sentry API service from server context with optional region override
|
|
3591
3662
|
* @param context - Server context containing host and access token
|
|
@@ -3606,7 +3677,7 @@ function apiServiceFromContext(context$1, opts = {}) {
|
|
|
3606
3677
|
}
|
|
3607
3678
|
|
|
3608
3679
|
//#endregion
|
|
3609
|
-
//#region ../mcp-core/dist/whoami-
|
|
3680
|
+
//#region ../mcp-core/dist/whoami-B_pOoN0T.js
|
|
3610
3681
|
var whoami_default = defineTool({
|
|
3611
3682
|
name: "whoami",
|
|
3612
3683
|
description: [
|
|
@@ -3639,7 +3710,7 @@ var whoami_default = defineTool({
|
|
|
3639
3710
|
});
|
|
3640
3711
|
|
|
3641
3712
|
//#endregion
|
|
3642
|
-
//#region ../mcp-core/dist/find-organizations-
|
|
3713
|
+
//#region ../mcp-core/dist/find-organizations-DudCkGim.js
|
|
3643
3714
|
const RESULT_LIMIT$2 = 25;
|
|
3644
3715
|
var find_organizations_default = defineTool({
|
|
3645
3716
|
name: "find_organizations",
|
|
@@ -3691,7 +3762,7 @@ var find_organizations_default = defineTool({
|
|
|
3691
3762
|
});
|
|
3692
3763
|
|
|
3693
3764
|
//#endregion
|
|
3694
|
-
//#region ../mcp-core/dist/find-teams-
|
|
3765
|
+
//#region ../mcp-core/dist/find-teams-BP0pLsvf.js
|
|
3695
3766
|
const RESULT_LIMIT$1 = 25;
|
|
3696
3767
|
var find_teams_default = defineTool({
|
|
3697
3768
|
name: "find_teams",
|
|
@@ -3739,7 +3810,7 @@ var find_teams_default = defineTool({
|
|
|
3739
3810
|
});
|
|
3740
3811
|
|
|
3741
3812
|
//#endregion
|
|
3742
|
-
//#region ../mcp-core/dist/find-projects-
|
|
3813
|
+
//#region ../mcp-core/dist/find-projects-YtaNsBaH.js
|
|
3743
3814
|
const RESULT_LIMIT = 25;
|
|
3744
3815
|
var find_projects_default = defineTool({
|
|
3745
3816
|
name: "find_projects",
|
|
@@ -3783,7 +3854,7 @@ var find_projects_default = defineTool({
|
|
|
3783
3854
|
});
|
|
3784
3855
|
|
|
3785
3856
|
//#endregion
|
|
3786
|
-
//#region ../mcp-core/dist/find-releases-
|
|
3857
|
+
//#region ../mcp-core/dist/find-releases-BVBIICgY.js
|
|
3787
3858
|
var find_releases_default = defineTool({
|
|
3788
3859
|
name: "find_releases",
|
|
3789
3860
|
skills: ["inspect"],
|
|
@@ -3932,7 +4003,7 @@ function parseIssueId(issueId) {
|
|
|
3932
4003
|
* @returns Object containing the parsed organization slug and issue ID
|
|
3933
4004
|
* @throws Error if the input is invalid
|
|
3934
4005
|
*/
|
|
3935
|
-
function parseIssueParams({ issueUrl, issueId, organizationSlug }) {
|
|
4006
|
+
function parseIssueParams$1({ issueUrl, issueId, organizationSlug }) {
|
|
3936
4007
|
if (issueUrl) {
|
|
3937
4008
|
const resolved = extractIssueId(issueUrl);
|
|
3938
4009
|
if (!resolved) throw new Error("Invalid Sentry issue URL. Path should contain '/issues/{issue_id}'");
|
|
@@ -4031,7 +4102,7 @@ function getOutputForAutofixStep(step) {
|
|
|
4031
4102
|
}
|
|
4032
4103
|
|
|
4033
4104
|
//#endregion
|
|
4034
|
-
//#region ../mcp-core/dist/formatting-
|
|
4105
|
+
//#region ../mcp-core/dist/formatting-BhgNMv3a.js
|
|
4035
4106
|
const LANGUAGE_EXTENSIONS = {
|
|
4036
4107
|
".java": "java",
|
|
4037
4108
|
".py": "python",
|
|
@@ -4995,6 +5066,7 @@ function formatIssueOutput({ organizationSlug, issue, event, apiService, autofix
|
|
|
4995
5066
|
output += "# Using this information\n\n";
|
|
4996
5067
|
output += `- You can reference the IssueID in commit messages (e.g. \`Fixes ${issue.shortId}\`) to automatically close the issue when the commit is merged.\n`;
|
|
4997
5068
|
output += "- The stacktrace includes both first-party application code as well as third-party code, its important to triage to first-party code.\n";
|
|
5069
|
+
output += `- To search for specific occurrences or filter events within this issue, use \`search_issue_events(organizationSlug='${organizationSlug}', issueId='${issue.shortId}', naturalLanguageQuery='your query')\`\n`;
|
|
4998
5070
|
return output;
|
|
4999
5071
|
}
|
|
5000
5072
|
|
|
@@ -5027,7 +5099,7 @@ function enhanceNotFoundError(error, params) {
|
|
|
5027
5099
|
}
|
|
5028
5100
|
|
|
5029
5101
|
//#endregion
|
|
5030
|
-
//#region ../mcp-core/dist/get-issue-details-
|
|
5102
|
+
//#region ../mcp-core/dist/get-issue-details-U818j2tY.js
|
|
5031
5103
|
var get_issue_details_default = defineTool({
|
|
5032
5104
|
name: "get_issue_details",
|
|
5033
5105
|
skills: [
|
|
@@ -5138,7 +5210,7 @@ var get_issue_details_default = defineTool({
|
|
|
5138
5210
|
}
|
|
5139
5211
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
5140
5212
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
5141
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
5213
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
5142
5214
|
organizationSlug: params.organizationSlug,
|
|
5143
5215
|
issueId: params.issueId,
|
|
5144
5216
|
issueUrl: params.issueUrl
|
|
@@ -5208,7 +5280,122 @@ function shouldFetchTraceForEvent(event) {
|
|
|
5208
5280
|
}
|
|
5209
5281
|
|
|
5210
5282
|
//#endregion
|
|
5211
|
-
//#region ../mcp-core/dist/get-
|
|
5283
|
+
//#region ../mcp-core/dist/get-issue-tag-values-tupBr2Mu.js
|
|
5284
|
+
var get_issue_tag_values_default = defineTool({
|
|
5285
|
+
name: "get_issue_tag_values",
|
|
5286
|
+
skills: ["inspect"],
|
|
5287
|
+
requiredScopes: ["event:read"],
|
|
5288
|
+
description: [
|
|
5289
|
+
"Get tag value distribution for a specific Sentry issue.",
|
|
5290
|
+
"",
|
|
5291
|
+
"Use this tool when you need to:",
|
|
5292
|
+
"- Understand how an issue is distributed across different tag values",
|
|
5293
|
+
"- Get aggregate counts of unique tag values (e.g., 'how many unique URLs are affected')",
|
|
5294
|
+
"- Analyze which browsers, environments, or URLs are most impacted by an issue",
|
|
5295
|
+
"- View the tag distributions page data programmatically",
|
|
5296
|
+
"",
|
|
5297
|
+
"Common tag keys:",
|
|
5298
|
+
"- `url`: Request URLs affected by the issue",
|
|
5299
|
+
"- `browser`: Browser types and versions",
|
|
5300
|
+
"- `browser.name`: Browser names only",
|
|
5301
|
+
"- `os`: Operating systems",
|
|
5302
|
+
"- `environment`: Deployment environments (production, staging, etc.)",
|
|
5303
|
+
"- `release`: Software releases",
|
|
5304
|
+
"- `device`: Device types",
|
|
5305
|
+
"- `user`: Affected users",
|
|
5306
|
+
"",
|
|
5307
|
+
"<examples>",
|
|
5308
|
+
"### Get URL distribution for an issue",
|
|
5309
|
+
"```",
|
|
5310
|
+
"get_issue_tag_values(organizationSlug='my-organization', issueId='PROJECT-123', tagKey='url')",
|
|
5311
|
+
"```",
|
|
5312
|
+
"",
|
|
5313
|
+
"### Get browser distribution using issue URL",
|
|
5314
|
+
"```",
|
|
5315
|
+
"get_issue_tag_values(issueUrl='https://sentry.io/issues/PROJECT-123/', tagKey='browser')",
|
|
5316
|
+
"```",
|
|
5317
|
+
"",
|
|
5318
|
+
"### Get environment distribution",
|
|
5319
|
+
"```",
|
|
5320
|
+
"get_issue_tag_values(organizationSlug='my-organization', issueId='PROJECT-123', tagKey='environment')",
|
|
5321
|
+
"```",
|
|
5322
|
+
"</examples>",
|
|
5323
|
+
"",
|
|
5324
|
+
"<hints>",
|
|
5325
|
+
"- If user provides a Sentry URL, pass the ENTIRE URL to issueUrl parameter unchanged",
|
|
5326
|
+
"- Common tag keys: url, browser, browser.name, os, environment, release, device, user",
|
|
5327
|
+
"- Tag keys are case-sensitive",
|
|
5328
|
+
"</hints>"
|
|
5329
|
+
].join("\n"),
|
|
5330
|
+
inputSchema: {
|
|
5331
|
+
organizationSlug: ParamOrganizationSlug.optional(),
|
|
5332
|
+
regionUrl: ParamRegionUrl.nullable().default(null),
|
|
5333
|
+
issueId: ParamIssueShortId.optional(),
|
|
5334
|
+
issueUrl: ParamIssueUrl.optional(),
|
|
5335
|
+
tagKey: zod.z.string().trim().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/, "Tag key must contain only alphanumeric characters, dots, hyphens, and underscores, and must start with an alphanumeric character").describe("The tag key to get values for (e.g., 'url', 'browser', 'environment', 'release').")
|
|
5336
|
+
},
|
|
5337
|
+
annotations: {
|
|
5338
|
+
readOnlyHint: true,
|
|
5339
|
+
openWorldHint: true
|
|
5340
|
+
},
|
|
5341
|
+
async handler(params, context$1) {
|
|
5342
|
+
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
5343
|
+
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
5344
|
+
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
5345
|
+
if (!params.tagKey) throw new UserInputError("`tagKey` is required. Common values: url, browser, environment, release, os, device, user");
|
|
5346
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
5347
|
+
organizationSlug: params.organizationSlug,
|
|
5348
|
+
issueId: params.issueId,
|
|
5349
|
+
issueUrl: params.issueUrl
|
|
5350
|
+
});
|
|
5351
|
+
(0, __sentry_core.setTag)("organization.slug", orgSlug);
|
|
5352
|
+
let tagValues;
|
|
5353
|
+
try {
|
|
5354
|
+
tagValues = await apiService.getIssueTagValues({
|
|
5355
|
+
organizationSlug: orgSlug,
|
|
5356
|
+
issueId: parsedIssueId,
|
|
5357
|
+
tagKey: params.tagKey
|
|
5358
|
+
});
|
|
5359
|
+
} catch (error) {
|
|
5360
|
+
if (error instanceof ApiNotFoundError) throw enhanceNotFoundError(error, {
|
|
5361
|
+
organizationSlug: orgSlug,
|
|
5362
|
+
issueId: parsedIssueId,
|
|
5363
|
+
tagKey: params.tagKey
|
|
5364
|
+
});
|
|
5365
|
+
throw error;
|
|
5366
|
+
}
|
|
5367
|
+
let output = `# Tag Distribution: ${tagValues.name}\n\n`;
|
|
5368
|
+
output += `**Issue**: ${parsedIssueId}\n`;
|
|
5369
|
+
output += `**Tag Key**: \`${tagValues.key}\`\n`;
|
|
5370
|
+
output += `**Total Unique Values**: ${tagValues.totalValues}\n\n`;
|
|
5371
|
+
if (tagValues.topValues.length === 0) {
|
|
5372
|
+
output += "No values found for this tag.\n";
|
|
5373
|
+
return output;
|
|
5374
|
+
}
|
|
5375
|
+
output += "## Top Values\n\n";
|
|
5376
|
+
output += "| Value | Count | First Seen | Last Seen |\n";
|
|
5377
|
+
output += "|-------|-------|------------|----------|\n";
|
|
5378
|
+
for (const value of tagValues.topValues) {
|
|
5379
|
+
const firstSeen = value.firstSeen ? new Date(value.firstSeen).toISOString().split("T")[0] : "-";
|
|
5380
|
+
const lastSeen = value.lastSeen ? new Date(value.lastSeen).toISOString().split("T")[0] : "-";
|
|
5381
|
+
const rawValue = value.value ?? "(null)";
|
|
5382
|
+
let displayValue = rawValue.length > 60 ? `${rawValue.substring(0, 57)}...` : rawValue;
|
|
5383
|
+
displayValue = displayValue.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/`/g, "\\`").replace(/\n/g, " ");
|
|
5384
|
+
output += `| \`${displayValue}\` | ${value.count} | ${firstSeen} | ${lastSeen} |\n`;
|
|
5385
|
+
}
|
|
5386
|
+
if (tagValues.topValues.length > 0 && tagValues.totalValues > 0) {
|
|
5387
|
+
const shownCount = tagValues.topValues.length;
|
|
5388
|
+
output += `\n*Showing top ${shownCount} of ${tagValues.totalValues} unique values*\n`;
|
|
5389
|
+
}
|
|
5390
|
+
output += "\n## Using this information\n\n";
|
|
5391
|
+
output += `- Use \`get_issue_details(organizationSlug='${orgSlug}', issueId='${parsedIssueId}')\` to see the full issue details\n`;
|
|
5392
|
+
output += `- Try other tag keys like: url, browser, environment, release, os, device, user\n`;
|
|
5393
|
+
return output;
|
|
5394
|
+
}
|
|
5395
|
+
});
|
|
5396
|
+
|
|
5397
|
+
//#endregion
|
|
5398
|
+
//#region ../mcp-core/dist/get-trace-details-DDDetJqp.js
|
|
5212
5399
|
const MAX_DEPTH = 2;
|
|
5213
5400
|
const MINIMUM_DURATION_THRESHOLD_MS = 10;
|
|
5214
5401
|
const MIN_MEANINGFUL_CHILD_DURATION = 5;
|
|
@@ -5507,7 +5694,7 @@ function formatTraceOutput({ organizationSlug, traceId, traceMeta, trace: trace$
|
|
|
5507
5694
|
}
|
|
5508
5695
|
|
|
5509
5696
|
//#endregion
|
|
5510
|
-
//#region ../mcp-core/dist/get-event-attachment-
|
|
5697
|
+
//#region ../mcp-core/dist/get-event-attachment-itWm1HrK.js
|
|
5511
5698
|
var get_event_attachment_default = defineTool({
|
|
5512
5699
|
name: "get_event_attachment",
|
|
5513
5700
|
skills: ["inspect"],
|
|
@@ -5643,7 +5830,7 @@ var get_event_attachment_default = defineTool({
|
|
|
5643
5830
|
});
|
|
5644
5831
|
|
|
5645
5832
|
//#endregion
|
|
5646
|
-
//#region ../mcp-core/dist/formatting-
|
|
5833
|
+
//#region ../mcp-core/dist/formatting-CIwRyNGU.js
|
|
5647
5834
|
/**
|
|
5648
5835
|
* Helper function to format assignedTo field for display
|
|
5649
5836
|
*/
|
|
@@ -5655,7 +5842,7 @@ function formatAssignedTo(assignedTo) {
|
|
|
5655
5842
|
}
|
|
5656
5843
|
|
|
5657
5844
|
//#endregion
|
|
5658
|
-
//#region ../mcp-core/dist/update-issue-
|
|
5845
|
+
//#region ../mcp-core/dist/update-issue-DA_N-toV.js
|
|
5659
5846
|
var update_issue_default = defineTool({
|
|
5660
5847
|
name: "update_issue",
|
|
5661
5848
|
skills: ["triage"],
|
|
@@ -5723,7 +5910,7 @@ var update_issue_default = defineTool({
|
|
|
5723
5910
|
if (!params.issueUrl && !params.issueId) throw new UserInputError("Either `issueId` or `issueUrl` must be provided");
|
|
5724
5911
|
if (!params.issueUrl && !params.organizationSlug) throw new UserInputError("`organizationSlug` is required when providing `issueId`");
|
|
5725
5912
|
if (!params.status && !params.assignedTo) throw new UserInputError("At least one of `status` or `assignedTo` must be provided to update the issue");
|
|
5726
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
5913
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
5727
5914
|
organizationSlug: params.organizationSlug,
|
|
5728
5915
|
issueId: params.issueId,
|
|
5729
5916
|
issueUrl: params.issueUrl
|
|
@@ -5952,6 +6139,20 @@ var name10$1 = "AI_NoSuchModelError";
|
|
|
5952
6139
|
var marker11$1 = `vercel.ai.error.${name10$1}`;
|
|
5953
6140
|
var symbol11$1 = Symbol.for(marker11$1);
|
|
5954
6141
|
var _a11$1;
|
|
6142
|
+
var NoSuchModelError = class extends AISDKError {
|
|
6143
|
+
constructor({ errorName = name10$1, modelId, modelType, message = `No such ${modelType}: ${modelId}` }) {
|
|
6144
|
+
super({
|
|
6145
|
+
name: errorName,
|
|
6146
|
+
message
|
|
6147
|
+
});
|
|
6148
|
+
this[_a11$1] = true;
|
|
6149
|
+
this.modelId = modelId;
|
|
6150
|
+
this.modelType = modelType;
|
|
6151
|
+
}
|
|
6152
|
+
static isInstance(error) {
|
|
6153
|
+
return AISDKError.hasMarker(error, marker11$1);
|
|
6154
|
+
}
|
|
6155
|
+
};
|
|
5955
6156
|
_a11$1 = symbol11$1;
|
|
5956
6157
|
var name11$1 = "AI_TooManyEmbeddingValuesForCallError";
|
|
5957
6158
|
var marker12$1 = `vercel.ai.error.${name11$1}`;
|
|
@@ -6487,6 +6688,10 @@ var postToApi = async ({ url, headers = {}, body, successfulResponseHandler, fai
|
|
|
6487
6688
|
throw error;
|
|
6488
6689
|
}
|
|
6489
6690
|
};
|
|
6691
|
+
async function resolve(value) {
|
|
6692
|
+
if (typeof value === "function") value = value();
|
|
6693
|
+
return Promise.resolve(value);
|
|
6694
|
+
}
|
|
6490
6695
|
var createJsonErrorResponseHandler = ({ errorSchema, errorToMessage, isRetryable }) => async ({ response, url, requestBodyValues }) => {
|
|
6491
6696
|
const responseBody = await response.text();
|
|
6492
6697
|
const responseHeaders = extractResponseHeaders(response);
|
|
@@ -6802,7 +7007,7 @@ function getResponseMetadata({ id, model, created }) {
|
|
|
6802
7007
|
timestamp: created != null ? /* @__PURE__ */ new Date(created * 1e3) : void 0
|
|
6803
7008
|
};
|
|
6804
7009
|
}
|
|
6805
|
-
function prepareTools({ mode, useLegacyFunctionCalling = false, structuredOutputs }) {
|
|
7010
|
+
function prepareTools$1({ mode, useLegacyFunctionCalling = false, structuredOutputs }) {
|
|
6806
7011
|
var _a$2;
|
|
6807
7012
|
const tools = ((_a$2 = mode.tools) == null ? void 0 : _a$2.length) ? mode.tools : void 0;
|
|
6808
7013
|
const toolWarnings = [];
|
|
@@ -7030,7 +7235,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
7030
7235
|
}
|
|
7031
7236
|
switch (type) {
|
|
7032
7237
|
case "regular": {
|
|
7033
|
-
const { tools, tool_choice, functions, function_call, toolWarnings } = prepareTools({
|
|
7238
|
+
const { tools, tool_choice, functions, function_call, toolWarnings } = prepareTools$1({
|
|
7034
7239
|
mode,
|
|
7035
7240
|
useLegacyFunctionCalling,
|
|
7036
7241
|
structuredOutputs: this.supportsStructuredOutputs
|
|
@@ -8928,7 +9133,7 @@ function createOpenAI(options = {}) {
|
|
|
8928
9133
|
var openai = createOpenAI({ compatibility: "strict" });
|
|
8929
9134
|
|
|
8930
9135
|
//#endregion
|
|
8931
|
-
//#region ../mcp-core/dist/openai-provider-
|
|
9136
|
+
//#region ../mcp-core/dist/openai-provider-BhiGfaFk.js
|
|
8932
9137
|
const DEFAULT_OPENAI_MODEL = "gpt-5";
|
|
8933
9138
|
const VALID_REASONING_EFFORTS = [
|
|
8934
9139
|
"low",
|
|
@@ -8936,13 +9141,13 @@ const VALID_REASONING_EFFORTS = [
|
|
|
8936
9141
|
"high"
|
|
8937
9142
|
];
|
|
8938
9143
|
const DEFAULT_REASONING_EFFORT = "low";
|
|
8939
|
-
let configuredBaseUrl;
|
|
9144
|
+
let configuredBaseUrl$1;
|
|
8940
9145
|
/**
|
|
8941
9146
|
* Configure the OpenAI base URL (CLI flag only, not environment variable).
|
|
8942
9147
|
* This must be called explicitly - it cannot be set via environment variables for security.
|
|
8943
9148
|
*/
|
|
8944
9149
|
function setOpenAIBaseUrl(baseUrl) {
|
|
8945
|
-
configuredBaseUrl = baseUrl;
|
|
9150
|
+
configuredBaseUrl$1 = baseUrl;
|
|
8946
9151
|
}
|
|
8947
9152
|
/**
|
|
8948
9153
|
* Retrieve an OpenAI language model configured from environment variables and explicit config.
|
|
@@ -8964,89 +9169,1323 @@ function getOpenAIModel(model) {
|
|
|
8964
9169
|
throw new Error(`Invalid OPENAI_REASONING_EFFORT value: "${envReasoningEffort}". Must be one of: ${validValues}, or "" (empty string to disable). Default is "${DEFAULT_REASONING_EFFORT}".`);
|
|
8965
9170
|
}
|
|
8966
9171
|
const factory = createOpenAI({
|
|
8967
|
-
...configuredBaseUrl && { baseURL: configuredBaseUrl },
|
|
9172
|
+
...configuredBaseUrl$1 && { baseURL: configuredBaseUrl$1 },
|
|
8968
9173
|
headers: { "User-Agent": require_stdio.USER_AGENT }
|
|
8969
9174
|
});
|
|
8970
9175
|
return factory(model ?? defaultModel, { ...reasoningEffort && { reasoningEffort } });
|
|
8971
9176
|
}
|
|
8972
9177
|
|
|
8973
9178
|
//#endregion
|
|
8974
|
-
//#region ../../node_modules/.pnpm
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
base64Strategy: "contentEncoding:base64",
|
|
8997
|
-
nameStrategy: "ref",
|
|
8998
|
-
openAiAnyTypeName: "OpenAiAnyType"
|
|
8999
|
-
};
|
|
9000
|
-
const getDefaultOptions = (options) => typeof options === "string" ? {
|
|
9001
|
-
...defaultOptions,
|
|
9002
|
-
name: options
|
|
9003
|
-
} : {
|
|
9004
|
-
...defaultOptions,
|
|
9005
|
-
...options
|
|
9006
|
-
};
|
|
9007
|
-
|
|
9008
|
-
//#endregion
|
|
9009
|
-
//#region ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
9010
|
-
const getRefs = (options) => {
|
|
9011
|
-
const _options = getDefaultOptions(options);
|
|
9012
|
-
const currentPath = _options.name !== void 0 ? [
|
|
9013
|
-
..._options.basePath,
|
|
9014
|
-
_options.definitionPath,
|
|
9015
|
-
_options.name
|
|
9016
|
-
] : _options.basePath;
|
|
9017
|
-
return {
|
|
9018
|
-
..._options,
|
|
9019
|
-
flags: { hasReferencedOpenAiAnyType: false },
|
|
9020
|
-
currentPath,
|
|
9021
|
-
propertyPath: void 0,
|
|
9022
|
-
seen: new Map(Object.entries(_options.definitions).map(([name$2, def]) => [def._def, {
|
|
9023
|
-
def: def._def,
|
|
9024
|
-
path: [
|
|
9025
|
-
..._options.basePath,
|
|
9026
|
-
_options.definitionPath,
|
|
9027
|
-
name$2
|
|
9028
|
-
],
|
|
9029
|
-
jsonSchema: void 0
|
|
9030
|
-
}]))
|
|
9179
|
+
//#region ../../node_modules/.pnpm/@ai-sdk+anthropic@1.2.12_zod@3.25.76/node_modules/@ai-sdk/anthropic/dist/index.mjs
|
|
9180
|
+
var anthropicErrorDataSchema = zod.z.object({
|
|
9181
|
+
type: zod.z.literal("error"),
|
|
9182
|
+
error: zod.z.object({
|
|
9183
|
+
type: zod.z.string(),
|
|
9184
|
+
message: zod.z.string()
|
|
9185
|
+
})
|
|
9186
|
+
});
|
|
9187
|
+
var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
|
|
9188
|
+
errorSchema: anthropicErrorDataSchema,
|
|
9189
|
+
errorToMessage: (data) => data.error.message
|
|
9190
|
+
});
|
|
9191
|
+
function prepareTools(mode) {
|
|
9192
|
+
var _a$2;
|
|
9193
|
+
const tools = ((_a$2 = mode.tools) == null ? void 0 : _a$2.length) ? mode.tools : void 0;
|
|
9194
|
+
const toolWarnings = [];
|
|
9195
|
+
const betas = /* @__PURE__ */ new Set();
|
|
9196
|
+
if (tools == null) return {
|
|
9197
|
+
tools: void 0,
|
|
9198
|
+
tool_choice: void 0,
|
|
9199
|
+
toolWarnings,
|
|
9200
|
+
betas
|
|
9031
9201
|
};
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
|
|
9040
|
-
|
|
9202
|
+
const anthropicTools2 = [];
|
|
9203
|
+
for (const tool$1 of tools) switch (tool$1.type) {
|
|
9204
|
+
case "function":
|
|
9205
|
+
anthropicTools2.push({
|
|
9206
|
+
name: tool$1.name,
|
|
9207
|
+
description: tool$1.description,
|
|
9208
|
+
input_schema: tool$1.parameters
|
|
9209
|
+
});
|
|
9210
|
+
break;
|
|
9211
|
+
case "provider-defined":
|
|
9212
|
+
switch (tool$1.id) {
|
|
9213
|
+
case "anthropic.computer_20250124":
|
|
9214
|
+
betas.add("computer-use-2025-01-24");
|
|
9215
|
+
anthropicTools2.push({
|
|
9216
|
+
name: tool$1.name,
|
|
9217
|
+
type: "computer_20250124",
|
|
9218
|
+
display_width_px: tool$1.args.displayWidthPx,
|
|
9219
|
+
display_height_px: tool$1.args.displayHeightPx,
|
|
9220
|
+
display_number: tool$1.args.displayNumber
|
|
9221
|
+
});
|
|
9222
|
+
break;
|
|
9223
|
+
case "anthropic.computer_20241022":
|
|
9224
|
+
betas.add("computer-use-2024-10-22");
|
|
9225
|
+
anthropicTools2.push({
|
|
9226
|
+
name: tool$1.name,
|
|
9227
|
+
type: "computer_20241022",
|
|
9228
|
+
display_width_px: tool$1.args.displayWidthPx,
|
|
9229
|
+
display_height_px: tool$1.args.displayHeightPx,
|
|
9230
|
+
display_number: tool$1.args.displayNumber
|
|
9231
|
+
});
|
|
9232
|
+
break;
|
|
9233
|
+
case "anthropic.text_editor_20250124":
|
|
9234
|
+
betas.add("computer-use-2025-01-24");
|
|
9235
|
+
anthropicTools2.push({
|
|
9236
|
+
name: tool$1.name,
|
|
9237
|
+
type: "text_editor_20250124"
|
|
9238
|
+
});
|
|
9239
|
+
break;
|
|
9240
|
+
case "anthropic.text_editor_20241022":
|
|
9241
|
+
betas.add("computer-use-2024-10-22");
|
|
9242
|
+
anthropicTools2.push({
|
|
9243
|
+
name: tool$1.name,
|
|
9244
|
+
type: "text_editor_20241022"
|
|
9245
|
+
});
|
|
9246
|
+
break;
|
|
9247
|
+
case "anthropic.bash_20250124":
|
|
9248
|
+
betas.add("computer-use-2025-01-24");
|
|
9249
|
+
anthropicTools2.push({
|
|
9250
|
+
name: tool$1.name,
|
|
9251
|
+
type: "bash_20250124"
|
|
9252
|
+
});
|
|
9253
|
+
break;
|
|
9254
|
+
case "anthropic.bash_20241022":
|
|
9255
|
+
betas.add("computer-use-2024-10-22");
|
|
9256
|
+
anthropicTools2.push({
|
|
9257
|
+
name: tool$1.name,
|
|
9258
|
+
type: "bash_20241022"
|
|
9259
|
+
});
|
|
9260
|
+
break;
|
|
9261
|
+
default:
|
|
9262
|
+
toolWarnings.push({
|
|
9263
|
+
type: "unsupported-tool",
|
|
9264
|
+
tool: tool$1
|
|
9265
|
+
});
|
|
9266
|
+
break;
|
|
9267
|
+
}
|
|
9268
|
+
break;
|
|
9269
|
+
default:
|
|
9270
|
+
toolWarnings.push({
|
|
9271
|
+
type: "unsupported-tool",
|
|
9272
|
+
tool: tool$1
|
|
9273
|
+
});
|
|
9274
|
+
break;
|
|
9275
|
+
}
|
|
9276
|
+
const toolChoice = mode.toolChoice;
|
|
9277
|
+
if (toolChoice == null) return {
|
|
9278
|
+
tools: anthropicTools2,
|
|
9279
|
+
tool_choice: void 0,
|
|
9280
|
+
toolWarnings,
|
|
9281
|
+
betas
|
|
9041
9282
|
};
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
}
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9283
|
+
const type = toolChoice.type;
|
|
9284
|
+
switch (type) {
|
|
9285
|
+
case "auto": return {
|
|
9286
|
+
tools: anthropicTools2,
|
|
9287
|
+
tool_choice: { type: "auto" },
|
|
9288
|
+
toolWarnings,
|
|
9289
|
+
betas
|
|
9290
|
+
};
|
|
9291
|
+
case "required": return {
|
|
9292
|
+
tools: anthropicTools2,
|
|
9293
|
+
tool_choice: { type: "any" },
|
|
9294
|
+
toolWarnings,
|
|
9295
|
+
betas
|
|
9296
|
+
};
|
|
9297
|
+
case "none": return {
|
|
9298
|
+
tools: void 0,
|
|
9299
|
+
tool_choice: void 0,
|
|
9300
|
+
toolWarnings,
|
|
9301
|
+
betas
|
|
9302
|
+
};
|
|
9303
|
+
case "tool": return {
|
|
9304
|
+
tools: anthropicTools2,
|
|
9305
|
+
tool_choice: {
|
|
9306
|
+
type: "tool",
|
|
9307
|
+
name: toolChoice.toolName
|
|
9308
|
+
},
|
|
9309
|
+
toolWarnings,
|
|
9310
|
+
betas
|
|
9311
|
+
};
|
|
9312
|
+
default: {
|
|
9313
|
+
const _exhaustiveCheck = type;
|
|
9314
|
+
throw new UnsupportedFunctionalityError({ functionality: `Unsupported tool choice type: ${_exhaustiveCheck}` });
|
|
9315
|
+
}
|
|
9316
|
+
}
|
|
9317
|
+
}
|
|
9318
|
+
function convertToAnthropicMessagesPrompt({ prompt, sendReasoning, warnings }) {
|
|
9319
|
+
var _a$2, _b, _c, _d;
|
|
9320
|
+
const betas = /* @__PURE__ */ new Set();
|
|
9321
|
+
const blocks = groupIntoBlocks(prompt);
|
|
9322
|
+
let system = void 0;
|
|
9323
|
+
const messages = [];
|
|
9324
|
+
function getCacheControl(providerMetadata) {
|
|
9325
|
+
var _a2$2;
|
|
9326
|
+
const anthropic2 = providerMetadata == null ? void 0 : providerMetadata.anthropic;
|
|
9327
|
+
const cacheControlValue = (_a2$2 = anthropic2 == null ? void 0 : anthropic2.cacheControl) != null ? _a2$2 : anthropic2 == null ? void 0 : anthropic2.cache_control;
|
|
9328
|
+
return cacheControlValue;
|
|
9329
|
+
}
|
|
9330
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
9331
|
+
const block = blocks[i];
|
|
9332
|
+
const isLastBlock = i === blocks.length - 1;
|
|
9333
|
+
const type = block.type;
|
|
9334
|
+
switch (type) {
|
|
9335
|
+
case "system": {
|
|
9336
|
+
if (system != null) throw new UnsupportedFunctionalityError({ functionality: "Multiple system messages that are separated by user/assistant messages" });
|
|
9337
|
+
system = block.messages.map(({ content, providerMetadata }) => ({
|
|
9338
|
+
type: "text",
|
|
9339
|
+
text: content,
|
|
9340
|
+
cache_control: getCacheControl(providerMetadata)
|
|
9341
|
+
}));
|
|
9342
|
+
break;
|
|
9343
|
+
}
|
|
9344
|
+
case "user": {
|
|
9345
|
+
const anthropicContent = [];
|
|
9346
|
+
for (const message of block.messages) {
|
|
9347
|
+
const { role, content } = message;
|
|
9348
|
+
switch (role) {
|
|
9349
|
+
case "user": {
|
|
9350
|
+
for (let j = 0; j < content.length; j++) {
|
|
9351
|
+
const part = content[j];
|
|
9352
|
+
const isLastPart = j === content.length - 1;
|
|
9353
|
+
const cacheControl = (_a$2 = getCacheControl(part.providerMetadata)) != null ? _a$2 : isLastPart ? getCacheControl(message.providerMetadata) : void 0;
|
|
9354
|
+
switch (part.type) {
|
|
9355
|
+
case "text": {
|
|
9356
|
+
anthropicContent.push({
|
|
9357
|
+
type: "text",
|
|
9358
|
+
text: part.text,
|
|
9359
|
+
cache_control: cacheControl
|
|
9360
|
+
});
|
|
9361
|
+
break;
|
|
9362
|
+
}
|
|
9363
|
+
case "image": {
|
|
9364
|
+
anthropicContent.push({
|
|
9365
|
+
type: "image",
|
|
9366
|
+
source: part.image instanceof URL ? {
|
|
9367
|
+
type: "url",
|
|
9368
|
+
url: part.image.toString()
|
|
9369
|
+
} : {
|
|
9370
|
+
type: "base64",
|
|
9371
|
+
media_type: (_b = part.mimeType) != null ? _b : "image/jpeg",
|
|
9372
|
+
data: convertUint8ArrayToBase64(part.image)
|
|
9373
|
+
},
|
|
9374
|
+
cache_control: cacheControl
|
|
9375
|
+
});
|
|
9376
|
+
break;
|
|
9377
|
+
}
|
|
9378
|
+
case "file": {
|
|
9379
|
+
if (part.mimeType !== "application/pdf") throw new UnsupportedFunctionalityError({ functionality: "Non-PDF files in user messages" });
|
|
9380
|
+
betas.add("pdfs-2024-09-25");
|
|
9381
|
+
anthropicContent.push({
|
|
9382
|
+
type: "document",
|
|
9383
|
+
source: part.data instanceof URL ? {
|
|
9384
|
+
type: "url",
|
|
9385
|
+
url: part.data.toString()
|
|
9386
|
+
} : {
|
|
9387
|
+
type: "base64",
|
|
9388
|
+
media_type: "application/pdf",
|
|
9389
|
+
data: part.data
|
|
9390
|
+
},
|
|
9391
|
+
cache_control: cacheControl
|
|
9392
|
+
});
|
|
9393
|
+
break;
|
|
9394
|
+
}
|
|
9395
|
+
}
|
|
9396
|
+
}
|
|
9397
|
+
break;
|
|
9398
|
+
}
|
|
9399
|
+
case "tool": {
|
|
9400
|
+
for (let i2 = 0; i2 < content.length; i2++) {
|
|
9401
|
+
const part = content[i2];
|
|
9402
|
+
const isLastPart = i2 === content.length - 1;
|
|
9403
|
+
const cacheControl = (_c = getCacheControl(part.providerMetadata)) != null ? _c : isLastPart ? getCacheControl(message.providerMetadata) : void 0;
|
|
9404
|
+
const toolResultContent = part.content != null ? part.content.map((part2) => {
|
|
9405
|
+
var _a2$2;
|
|
9406
|
+
switch (part2.type) {
|
|
9407
|
+
case "text": return {
|
|
9408
|
+
type: "text",
|
|
9409
|
+
text: part2.text,
|
|
9410
|
+
cache_control: void 0
|
|
9411
|
+
};
|
|
9412
|
+
case "image": return {
|
|
9413
|
+
type: "image",
|
|
9414
|
+
source: {
|
|
9415
|
+
type: "base64",
|
|
9416
|
+
media_type: (_a2$2 = part2.mimeType) != null ? _a2$2 : "image/jpeg",
|
|
9417
|
+
data: part2.data
|
|
9418
|
+
},
|
|
9419
|
+
cache_control: void 0
|
|
9420
|
+
};
|
|
9421
|
+
}
|
|
9422
|
+
}) : JSON.stringify(part.result);
|
|
9423
|
+
anthropicContent.push({
|
|
9424
|
+
type: "tool_result",
|
|
9425
|
+
tool_use_id: part.toolCallId,
|
|
9426
|
+
content: toolResultContent,
|
|
9427
|
+
is_error: part.isError,
|
|
9428
|
+
cache_control: cacheControl
|
|
9429
|
+
});
|
|
9430
|
+
}
|
|
9431
|
+
break;
|
|
9432
|
+
}
|
|
9433
|
+
default: {
|
|
9434
|
+
const _exhaustiveCheck = role;
|
|
9435
|
+
throw new Error(`Unsupported role: ${_exhaustiveCheck}`);
|
|
9436
|
+
}
|
|
9437
|
+
}
|
|
9438
|
+
}
|
|
9439
|
+
messages.push({
|
|
9440
|
+
role: "user",
|
|
9441
|
+
content: anthropicContent
|
|
9442
|
+
});
|
|
9443
|
+
break;
|
|
9444
|
+
}
|
|
9445
|
+
case "assistant": {
|
|
9446
|
+
const anthropicContent = [];
|
|
9447
|
+
for (let j = 0; j < block.messages.length; j++) {
|
|
9448
|
+
const message = block.messages[j];
|
|
9449
|
+
const isLastMessage = j === block.messages.length - 1;
|
|
9450
|
+
const { content } = message;
|
|
9451
|
+
for (let k = 0; k < content.length; k++) {
|
|
9452
|
+
const part = content[k];
|
|
9453
|
+
const isLastContentPart = k === content.length - 1;
|
|
9454
|
+
const cacheControl = (_d = getCacheControl(part.providerMetadata)) != null ? _d : isLastContentPart ? getCacheControl(message.providerMetadata) : void 0;
|
|
9455
|
+
switch (part.type) {
|
|
9456
|
+
case "text": {
|
|
9457
|
+
anthropicContent.push({
|
|
9458
|
+
type: "text",
|
|
9459
|
+
text: isLastBlock && isLastMessage && isLastContentPart ? part.text.trim() : part.text,
|
|
9460
|
+
cache_control: cacheControl
|
|
9461
|
+
});
|
|
9462
|
+
break;
|
|
9463
|
+
}
|
|
9464
|
+
case "reasoning": {
|
|
9465
|
+
if (sendReasoning) anthropicContent.push({
|
|
9466
|
+
type: "thinking",
|
|
9467
|
+
thinking: part.text,
|
|
9468
|
+
signature: part.signature,
|
|
9469
|
+
cache_control: cacheControl
|
|
9470
|
+
});
|
|
9471
|
+
else warnings.push({
|
|
9472
|
+
type: "other",
|
|
9473
|
+
message: "sending reasoning content is disabled for this model"
|
|
9474
|
+
});
|
|
9475
|
+
break;
|
|
9476
|
+
}
|
|
9477
|
+
case "redacted-reasoning": {
|
|
9478
|
+
anthropicContent.push({
|
|
9479
|
+
type: "redacted_thinking",
|
|
9480
|
+
data: part.data,
|
|
9481
|
+
cache_control: cacheControl
|
|
9482
|
+
});
|
|
9483
|
+
break;
|
|
9484
|
+
}
|
|
9485
|
+
case "tool-call": {
|
|
9486
|
+
anthropicContent.push({
|
|
9487
|
+
type: "tool_use",
|
|
9488
|
+
id: part.toolCallId,
|
|
9489
|
+
name: part.toolName,
|
|
9490
|
+
input: part.args,
|
|
9491
|
+
cache_control: cacheControl
|
|
9492
|
+
});
|
|
9493
|
+
break;
|
|
9494
|
+
}
|
|
9495
|
+
}
|
|
9496
|
+
}
|
|
9497
|
+
}
|
|
9498
|
+
messages.push({
|
|
9499
|
+
role: "assistant",
|
|
9500
|
+
content: anthropicContent
|
|
9501
|
+
});
|
|
9502
|
+
break;
|
|
9503
|
+
}
|
|
9504
|
+
default: {
|
|
9505
|
+
const _exhaustiveCheck = type;
|
|
9506
|
+
throw new Error(`Unsupported type: ${_exhaustiveCheck}`);
|
|
9507
|
+
}
|
|
9508
|
+
}
|
|
9509
|
+
}
|
|
9510
|
+
return {
|
|
9511
|
+
prompt: {
|
|
9512
|
+
system,
|
|
9513
|
+
messages
|
|
9514
|
+
},
|
|
9515
|
+
betas
|
|
9516
|
+
};
|
|
9517
|
+
}
|
|
9518
|
+
function groupIntoBlocks(prompt) {
|
|
9519
|
+
const blocks = [];
|
|
9520
|
+
let currentBlock = void 0;
|
|
9521
|
+
for (const message of prompt) {
|
|
9522
|
+
const { role } = message;
|
|
9523
|
+
switch (role) {
|
|
9524
|
+
case "system": {
|
|
9525
|
+
if ((currentBlock == null ? void 0 : currentBlock.type) !== "system") {
|
|
9526
|
+
currentBlock = {
|
|
9527
|
+
type: "system",
|
|
9528
|
+
messages: []
|
|
9529
|
+
};
|
|
9530
|
+
blocks.push(currentBlock);
|
|
9531
|
+
}
|
|
9532
|
+
currentBlock.messages.push(message);
|
|
9533
|
+
break;
|
|
9534
|
+
}
|
|
9535
|
+
case "assistant": {
|
|
9536
|
+
if ((currentBlock == null ? void 0 : currentBlock.type) !== "assistant") {
|
|
9537
|
+
currentBlock = {
|
|
9538
|
+
type: "assistant",
|
|
9539
|
+
messages: []
|
|
9540
|
+
};
|
|
9541
|
+
blocks.push(currentBlock);
|
|
9542
|
+
}
|
|
9543
|
+
currentBlock.messages.push(message);
|
|
9544
|
+
break;
|
|
9545
|
+
}
|
|
9546
|
+
case "user": {
|
|
9547
|
+
if ((currentBlock == null ? void 0 : currentBlock.type) !== "user") {
|
|
9548
|
+
currentBlock = {
|
|
9549
|
+
type: "user",
|
|
9550
|
+
messages: []
|
|
9551
|
+
};
|
|
9552
|
+
blocks.push(currentBlock);
|
|
9553
|
+
}
|
|
9554
|
+
currentBlock.messages.push(message);
|
|
9555
|
+
break;
|
|
9556
|
+
}
|
|
9557
|
+
case "tool": {
|
|
9558
|
+
if ((currentBlock == null ? void 0 : currentBlock.type) !== "user") {
|
|
9559
|
+
currentBlock = {
|
|
9560
|
+
type: "user",
|
|
9561
|
+
messages: []
|
|
9562
|
+
};
|
|
9563
|
+
blocks.push(currentBlock);
|
|
9564
|
+
}
|
|
9565
|
+
currentBlock.messages.push(message);
|
|
9566
|
+
break;
|
|
9567
|
+
}
|
|
9568
|
+
default: {
|
|
9569
|
+
const _exhaustiveCheck = role;
|
|
9570
|
+
throw new Error(`Unsupported role: ${_exhaustiveCheck}`);
|
|
9571
|
+
}
|
|
9572
|
+
}
|
|
9573
|
+
}
|
|
9574
|
+
return blocks;
|
|
9575
|
+
}
|
|
9576
|
+
function mapAnthropicStopReason(finishReason) {
|
|
9577
|
+
switch (finishReason) {
|
|
9578
|
+
case "end_turn":
|
|
9579
|
+
case "stop_sequence": return "stop";
|
|
9580
|
+
case "tool_use": return "tool-calls";
|
|
9581
|
+
case "max_tokens": return "length";
|
|
9582
|
+
default: return "unknown";
|
|
9583
|
+
}
|
|
9584
|
+
}
|
|
9585
|
+
var AnthropicMessagesLanguageModel = class {
|
|
9586
|
+
constructor(modelId, settings, config) {
|
|
9587
|
+
this.specificationVersion = "v1";
|
|
9588
|
+
this.defaultObjectGenerationMode = "tool";
|
|
9589
|
+
this.modelId = modelId;
|
|
9590
|
+
this.settings = settings;
|
|
9591
|
+
this.config = config;
|
|
9592
|
+
}
|
|
9593
|
+
supportsUrl(url) {
|
|
9594
|
+
return url.protocol === "https:";
|
|
9595
|
+
}
|
|
9596
|
+
get provider() {
|
|
9597
|
+
return this.config.provider;
|
|
9598
|
+
}
|
|
9599
|
+
get supportsImageUrls() {
|
|
9600
|
+
return this.config.supportsImageUrls;
|
|
9601
|
+
}
|
|
9602
|
+
async getArgs({ mode, prompt, maxTokens = 4096, temperature, topP, topK, frequencyPenalty, presencePenalty, stopSequences, responseFormat, seed, providerMetadata: providerOptions }) {
|
|
9603
|
+
var _a$2, _b, _c;
|
|
9604
|
+
const type = mode.type;
|
|
9605
|
+
const warnings = [];
|
|
9606
|
+
if (frequencyPenalty != null) warnings.push({
|
|
9607
|
+
type: "unsupported-setting",
|
|
9608
|
+
setting: "frequencyPenalty"
|
|
9609
|
+
});
|
|
9610
|
+
if (presencePenalty != null) warnings.push({
|
|
9611
|
+
type: "unsupported-setting",
|
|
9612
|
+
setting: "presencePenalty"
|
|
9613
|
+
});
|
|
9614
|
+
if (seed != null) warnings.push({
|
|
9615
|
+
type: "unsupported-setting",
|
|
9616
|
+
setting: "seed"
|
|
9617
|
+
});
|
|
9618
|
+
if (responseFormat != null && responseFormat.type !== "text") warnings.push({
|
|
9619
|
+
type: "unsupported-setting",
|
|
9620
|
+
setting: "responseFormat",
|
|
9621
|
+
details: "JSON response format is not supported."
|
|
9622
|
+
});
|
|
9623
|
+
const { prompt: messagesPrompt, betas: messagesBetas } = convertToAnthropicMessagesPrompt({
|
|
9624
|
+
prompt,
|
|
9625
|
+
sendReasoning: (_a$2 = this.settings.sendReasoning) != null ? _a$2 : true,
|
|
9626
|
+
warnings
|
|
9627
|
+
});
|
|
9628
|
+
const anthropicOptions = parseProviderOptions({
|
|
9629
|
+
provider: "anthropic",
|
|
9630
|
+
providerOptions,
|
|
9631
|
+
schema: anthropicProviderOptionsSchema
|
|
9632
|
+
});
|
|
9633
|
+
const isThinking = ((_b = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _b.type) === "enabled";
|
|
9634
|
+
const thinkingBudget = (_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.budgetTokens;
|
|
9635
|
+
const baseArgs = {
|
|
9636
|
+
model: this.modelId,
|
|
9637
|
+
max_tokens: maxTokens,
|
|
9638
|
+
temperature,
|
|
9639
|
+
top_k: topK,
|
|
9640
|
+
top_p: topP,
|
|
9641
|
+
stop_sequences: stopSequences,
|
|
9642
|
+
...isThinking && { thinking: {
|
|
9643
|
+
type: "enabled",
|
|
9644
|
+
budget_tokens: thinkingBudget
|
|
9645
|
+
} },
|
|
9646
|
+
system: messagesPrompt.system,
|
|
9647
|
+
messages: messagesPrompt.messages
|
|
9648
|
+
};
|
|
9649
|
+
if (isThinking) {
|
|
9650
|
+
if (thinkingBudget == null) throw new UnsupportedFunctionalityError({ functionality: "thinking requires a budget" });
|
|
9651
|
+
if (baseArgs.temperature != null) {
|
|
9652
|
+
baseArgs.temperature = void 0;
|
|
9653
|
+
warnings.push({
|
|
9654
|
+
type: "unsupported-setting",
|
|
9655
|
+
setting: "temperature",
|
|
9656
|
+
details: "temperature is not supported when thinking is enabled"
|
|
9657
|
+
});
|
|
9658
|
+
}
|
|
9659
|
+
if (topK != null) {
|
|
9660
|
+
baseArgs.top_k = void 0;
|
|
9661
|
+
warnings.push({
|
|
9662
|
+
type: "unsupported-setting",
|
|
9663
|
+
setting: "topK",
|
|
9664
|
+
details: "topK is not supported when thinking is enabled"
|
|
9665
|
+
});
|
|
9666
|
+
}
|
|
9667
|
+
if (topP != null) {
|
|
9668
|
+
baseArgs.top_p = void 0;
|
|
9669
|
+
warnings.push({
|
|
9670
|
+
type: "unsupported-setting",
|
|
9671
|
+
setting: "topP",
|
|
9672
|
+
details: "topP is not supported when thinking is enabled"
|
|
9673
|
+
});
|
|
9674
|
+
}
|
|
9675
|
+
baseArgs.max_tokens = maxTokens + thinkingBudget;
|
|
9676
|
+
}
|
|
9677
|
+
switch (type) {
|
|
9678
|
+
case "regular": {
|
|
9679
|
+
const { tools, tool_choice, toolWarnings, betas: toolsBetas } = prepareTools(mode);
|
|
9680
|
+
return {
|
|
9681
|
+
args: {
|
|
9682
|
+
...baseArgs,
|
|
9683
|
+
tools,
|
|
9684
|
+
tool_choice
|
|
9685
|
+
},
|
|
9686
|
+
warnings: [...warnings, ...toolWarnings],
|
|
9687
|
+
betas: /* @__PURE__ */ new Set([...messagesBetas, ...toolsBetas])
|
|
9688
|
+
};
|
|
9689
|
+
}
|
|
9690
|
+
case "object-json": throw new UnsupportedFunctionalityError({ functionality: "json-mode object generation" });
|
|
9691
|
+
case "object-tool": {
|
|
9692
|
+
const { name: name$2, description: description$73, parameters } = mode.tool;
|
|
9693
|
+
return {
|
|
9694
|
+
args: {
|
|
9695
|
+
...baseArgs,
|
|
9696
|
+
tools: [{
|
|
9697
|
+
name: name$2,
|
|
9698
|
+
description: description$73,
|
|
9699
|
+
input_schema: parameters
|
|
9700
|
+
}],
|
|
9701
|
+
tool_choice: {
|
|
9702
|
+
type: "tool",
|
|
9703
|
+
name: name$2
|
|
9704
|
+
}
|
|
9705
|
+
},
|
|
9706
|
+
warnings,
|
|
9707
|
+
betas: messagesBetas
|
|
9708
|
+
};
|
|
9709
|
+
}
|
|
9710
|
+
default: {
|
|
9711
|
+
const _exhaustiveCheck = type;
|
|
9712
|
+
throw new Error(`Unsupported type: ${_exhaustiveCheck}`);
|
|
9713
|
+
}
|
|
9714
|
+
}
|
|
9715
|
+
}
|
|
9716
|
+
async getHeaders({ betas, headers }) {
|
|
9717
|
+
return combineHeaders(await resolve(this.config.headers), betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}, headers);
|
|
9718
|
+
}
|
|
9719
|
+
buildRequestUrl(isStreaming) {
|
|
9720
|
+
var _a$2, _b, _c;
|
|
9721
|
+
return (_c = (_b = (_a$2 = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a$2, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;
|
|
9722
|
+
}
|
|
9723
|
+
transformRequestBody(args) {
|
|
9724
|
+
var _a$2, _b, _c;
|
|
9725
|
+
return (_c = (_b = (_a$2 = this.config).transformRequestBody) == null ? void 0 : _b.call(_a$2, args)) != null ? _c : args;
|
|
9726
|
+
}
|
|
9727
|
+
async doGenerate(options) {
|
|
9728
|
+
var _a$2, _b, _c, _d;
|
|
9729
|
+
const { args, warnings, betas } = await this.getArgs(options);
|
|
9730
|
+
const { responseHeaders, value: response, rawValue: rawResponse } = await postJsonToApi({
|
|
9731
|
+
url: this.buildRequestUrl(false),
|
|
9732
|
+
headers: await this.getHeaders({
|
|
9733
|
+
betas,
|
|
9734
|
+
headers: options.headers
|
|
9735
|
+
}),
|
|
9736
|
+
body: this.transformRequestBody(args),
|
|
9737
|
+
failedResponseHandler: anthropicFailedResponseHandler,
|
|
9738
|
+
successfulResponseHandler: createJsonResponseHandler(anthropicMessagesResponseSchema),
|
|
9739
|
+
abortSignal: options.abortSignal,
|
|
9740
|
+
fetch: this.config.fetch
|
|
9741
|
+
});
|
|
9742
|
+
const { messages: rawPrompt,...rawSettings } = args;
|
|
9743
|
+
let text$1 = "";
|
|
9744
|
+
for (const content of response.content) if (content.type === "text") text$1 += content.text;
|
|
9745
|
+
let toolCalls = void 0;
|
|
9746
|
+
if (response.content.some((content) => content.type === "tool_use")) {
|
|
9747
|
+
toolCalls = [];
|
|
9748
|
+
for (const content of response.content) if (content.type === "tool_use") toolCalls.push({
|
|
9749
|
+
toolCallType: "function",
|
|
9750
|
+
toolCallId: content.id,
|
|
9751
|
+
toolName: content.name,
|
|
9752
|
+
args: JSON.stringify(content.input)
|
|
9753
|
+
});
|
|
9754
|
+
}
|
|
9755
|
+
const reasoning = response.content.filter((content) => content.type === "redacted_thinking" || content.type === "thinking").map((content) => content.type === "thinking" ? {
|
|
9756
|
+
type: "text",
|
|
9757
|
+
text: content.thinking,
|
|
9758
|
+
signature: content.signature
|
|
9759
|
+
} : {
|
|
9760
|
+
type: "redacted",
|
|
9761
|
+
data: content.data
|
|
9762
|
+
});
|
|
9763
|
+
return {
|
|
9764
|
+
text: text$1,
|
|
9765
|
+
reasoning: reasoning.length > 0 ? reasoning : void 0,
|
|
9766
|
+
toolCalls,
|
|
9767
|
+
finishReason: mapAnthropicStopReason(response.stop_reason),
|
|
9768
|
+
usage: {
|
|
9769
|
+
promptTokens: response.usage.input_tokens,
|
|
9770
|
+
completionTokens: response.usage.output_tokens
|
|
9771
|
+
},
|
|
9772
|
+
rawCall: {
|
|
9773
|
+
rawPrompt,
|
|
9774
|
+
rawSettings
|
|
9775
|
+
},
|
|
9776
|
+
rawResponse: {
|
|
9777
|
+
headers: responseHeaders,
|
|
9778
|
+
body: rawResponse
|
|
9779
|
+
},
|
|
9780
|
+
response: {
|
|
9781
|
+
id: (_a$2 = response.id) != null ? _a$2 : void 0,
|
|
9782
|
+
modelId: (_b = response.model) != null ? _b : void 0
|
|
9783
|
+
},
|
|
9784
|
+
warnings,
|
|
9785
|
+
providerMetadata: { anthropic: {
|
|
9786
|
+
cacheCreationInputTokens: (_c = response.usage.cache_creation_input_tokens) != null ? _c : null,
|
|
9787
|
+
cacheReadInputTokens: (_d = response.usage.cache_read_input_tokens) != null ? _d : null
|
|
9788
|
+
} },
|
|
9789
|
+
request: { body: JSON.stringify(args) }
|
|
9790
|
+
};
|
|
9791
|
+
}
|
|
9792
|
+
async doStream(options) {
|
|
9793
|
+
const { args, warnings, betas } = await this.getArgs(options);
|
|
9794
|
+
const body = {
|
|
9795
|
+
...args,
|
|
9796
|
+
stream: true
|
|
9797
|
+
};
|
|
9798
|
+
const { responseHeaders, value: response } = await postJsonToApi({
|
|
9799
|
+
url: this.buildRequestUrl(true),
|
|
9800
|
+
headers: await this.getHeaders({
|
|
9801
|
+
betas,
|
|
9802
|
+
headers: options.headers
|
|
9803
|
+
}),
|
|
9804
|
+
body: this.transformRequestBody(body),
|
|
9805
|
+
failedResponseHandler: anthropicFailedResponseHandler,
|
|
9806
|
+
successfulResponseHandler: createEventSourceResponseHandler(anthropicMessagesChunkSchema),
|
|
9807
|
+
abortSignal: options.abortSignal,
|
|
9808
|
+
fetch: this.config.fetch
|
|
9809
|
+
});
|
|
9810
|
+
const { messages: rawPrompt,...rawSettings } = args;
|
|
9811
|
+
let finishReason = "unknown";
|
|
9812
|
+
const usage = {
|
|
9813
|
+
promptTokens: NaN,
|
|
9814
|
+
completionTokens: NaN
|
|
9815
|
+
};
|
|
9816
|
+
const toolCallContentBlocks = {};
|
|
9817
|
+
let providerMetadata = void 0;
|
|
9818
|
+
let blockType = void 0;
|
|
9819
|
+
return {
|
|
9820
|
+
stream: response.pipeThrough(new TransformStream({ transform(chunk, controller) {
|
|
9821
|
+
var _a$2, _b, _c, _d;
|
|
9822
|
+
if (!chunk.success) {
|
|
9823
|
+
controller.enqueue({
|
|
9824
|
+
type: "error",
|
|
9825
|
+
error: chunk.error
|
|
9826
|
+
});
|
|
9827
|
+
return;
|
|
9828
|
+
}
|
|
9829
|
+
const value = chunk.value;
|
|
9830
|
+
switch (value.type) {
|
|
9831
|
+
case "ping": return;
|
|
9832
|
+
case "content_block_start": {
|
|
9833
|
+
const contentBlockType = value.content_block.type;
|
|
9834
|
+
blockType = contentBlockType;
|
|
9835
|
+
switch (contentBlockType) {
|
|
9836
|
+
case "text":
|
|
9837
|
+
case "thinking": return;
|
|
9838
|
+
case "redacted_thinking": {
|
|
9839
|
+
controller.enqueue({
|
|
9840
|
+
type: "redacted-reasoning",
|
|
9841
|
+
data: value.content_block.data
|
|
9842
|
+
});
|
|
9843
|
+
return;
|
|
9844
|
+
}
|
|
9845
|
+
case "tool_use": {
|
|
9846
|
+
toolCallContentBlocks[value.index] = {
|
|
9847
|
+
toolCallId: value.content_block.id,
|
|
9848
|
+
toolName: value.content_block.name,
|
|
9849
|
+
jsonText: ""
|
|
9850
|
+
};
|
|
9851
|
+
return;
|
|
9852
|
+
}
|
|
9853
|
+
default: {
|
|
9854
|
+
const _exhaustiveCheck = contentBlockType;
|
|
9855
|
+
throw new Error(`Unsupported content block type: ${_exhaustiveCheck}`);
|
|
9856
|
+
}
|
|
9857
|
+
}
|
|
9858
|
+
}
|
|
9859
|
+
case "content_block_stop": {
|
|
9860
|
+
if (toolCallContentBlocks[value.index] != null) {
|
|
9861
|
+
const contentBlock = toolCallContentBlocks[value.index];
|
|
9862
|
+
controller.enqueue({
|
|
9863
|
+
type: "tool-call",
|
|
9864
|
+
toolCallType: "function",
|
|
9865
|
+
toolCallId: contentBlock.toolCallId,
|
|
9866
|
+
toolName: contentBlock.toolName,
|
|
9867
|
+
args: contentBlock.jsonText
|
|
9868
|
+
});
|
|
9869
|
+
delete toolCallContentBlocks[value.index];
|
|
9870
|
+
}
|
|
9871
|
+
blockType = void 0;
|
|
9872
|
+
return;
|
|
9873
|
+
}
|
|
9874
|
+
case "content_block_delta": {
|
|
9875
|
+
const deltaType = value.delta.type;
|
|
9876
|
+
switch (deltaType) {
|
|
9877
|
+
case "text_delta": {
|
|
9878
|
+
controller.enqueue({
|
|
9879
|
+
type: "text-delta",
|
|
9880
|
+
textDelta: value.delta.text
|
|
9881
|
+
});
|
|
9882
|
+
return;
|
|
9883
|
+
}
|
|
9884
|
+
case "thinking_delta": {
|
|
9885
|
+
controller.enqueue({
|
|
9886
|
+
type: "reasoning",
|
|
9887
|
+
textDelta: value.delta.thinking
|
|
9888
|
+
});
|
|
9889
|
+
return;
|
|
9890
|
+
}
|
|
9891
|
+
case "signature_delta": {
|
|
9892
|
+
if (blockType === "thinking") controller.enqueue({
|
|
9893
|
+
type: "reasoning-signature",
|
|
9894
|
+
signature: value.delta.signature
|
|
9895
|
+
});
|
|
9896
|
+
return;
|
|
9897
|
+
}
|
|
9898
|
+
case "input_json_delta": {
|
|
9899
|
+
const contentBlock = toolCallContentBlocks[value.index];
|
|
9900
|
+
controller.enqueue({
|
|
9901
|
+
type: "tool-call-delta",
|
|
9902
|
+
toolCallType: "function",
|
|
9903
|
+
toolCallId: contentBlock.toolCallId,
|
|
9904
|
+
toolName: contentBlock.toolName,
|
|
9905
|
+
argsTextDelta: value.delta.partial_json
|
|
9906
|
+
});
|
|
9907
|
+
contentBlock.jsonText += value.delta.partial_json;
|
|
9908
|
+
return;
|
|
9909
|
+
}
|
|
9910
|
+
default: {
|
|
9911
|
+
const _exhaustiveCheck = deltaType;
|
|
9912
|
+
throw new Error(`Unsupported delta type: ${_exhaustiveCheck}`);
|
|
9913
|
+
}
|
|
9914
|
+
}
|
|
9915
|
+
}
|
|
9916
|
+
case "message_start": {
|
|
9917
|
+
usage.promptTokens = value.message.usage.input_tokens;
|
|
9918
|
+
usage.completionTokens = value.message.usage.output_tokens;
|
|
9919
|
+
providerMetadata = { anthropic: {
|
|
9920
|
+
cacheCreationInputTokens: (_a$2 = value.message.usage.cache_creation_input_tokens) != null ? _a$2 : null,
|
|
9921
|
+
cacheReadInputTokens: (_b = value.message.usage.cache_read_input_tokens) != null ? _b : null
|
|
9922
|
+
} };
|
|
9923
|
+
controller.enqueue({
|
|
9924
|
+
type: "response-metadata",
|
|
9925
|
+
id: (_c = value.message.id) != null ? _c : void 0,
|
|
9926
|
+
modelId: (_d = value.message.model) != null ? _d : void 0
|
|
9927
|
+
});
|
|
9928
|
+
return;
|
|
9929
|
+
}
|
|
9930
|
+
case "message_delta": {
|
|
9931
|
+
usage.completionTokens = value.usage.output_tokens;
|
|
9932
|
+
finishReason = mapAnthropicStopReason(value.delta.stop_reason);
|
|
9933
|
+
return;
|
|
9934
|
+
}
|
|
9935
|
+
case "message_stop": {
|
|
9936
|
+
controller.enqueue({
|
|
9937
|
+
type: "finish",
|
|
9938
|
+
finishReason,
|
|
9939
|
+
usage,
|
|
9940
|
+
providerMetadata
|
|
9941
|
+
});
|
|
9942
|
+
return;
|
|
9943
|
+
}
|
|
9944
|
+
case "error": {
|
|
9945
|
+
controller.enqueue({
|
|
9946
|
+
type: "error",
|
|
9947
|
+
error: value.error
|
|
9948
|
+
});
|
|
9949
|
+
return;
|
|
9950
|
+
}
|
|
9951
|
+
default: {
|
|
9952
|
+
const _exhaustiveCheck = value;
|
|
9953
|
+
throw new Error(`Unsupported chunk type: ${_exhaustiveCheck}`);
|
|
9954
|
+
}
|
|
9955
|
+
}
|
|
9956
|
+
} })),
|
|
9957
|
+
rawCall: {
|
|
9958
|
+
rawPrompt,
|
|
9959
|
+
rawSettings
|
|
9960
|
+
},
|
|
9961
|
+
rawResponse: { headers: responseHeaders },
|
|
9962
|
+
warnings,
|
|
9963
|
+
request: { body: JSON.stringify(body) }
|
|
9964
|
+
};
|
|
9965
|
+
}
|
|
9966
|
+
};
|
|
9967
|
+
var anthropicMessagesResponseSchema = zod.z.object({
|
|
9968
|
+
type: zod.z.literal("message"),
|
|
9969
|
+
id: zod.z.string().nullish(),
|
|
9970
|
+
model: zod.z.string().nullish(),
|
|
9971
|
+
content: zod.z.array(zod.z.discriminatedUnion("type", [
|
|
9972
|
+
zod.z.object({
|
|
9973
|
+
type: zod.z.literal("text"),
|
|
9974
|
+
text: zod.z.string()
|
|
9975
|
+
}),
|
|
9976
|
+
zod.z.object({
|
|
9977
|
+
type: zod.z.literal("thinking"),
|
|
9978
|
+
thinking: zod.z.string(),
|
|
9979
|
+
signature: zod.z.string()
|
|
9980
|
+
}),
|
|
9981
|
+
zod.z.object({
|
|
9982
|
+
type: zod.z.literal("redacted_thinking"),
|
|
9983
|
+
data: zod.z.string()
|
|
9984
|
+
}),
|
|
9985
|
+
zod.z.object({
|
|
9986
|
+
type: zod.z.literal("tool_use"),
|
|
9987
|
+
id: zod.z.string(),
|
|
9988
|
+
name: zod.z.string(),
|
|
9989
|
+
input: zod.z.unknown()
|
|
9990
|
+
})
|
|
9991
|
+
])),
|
|
9992
|
+
stop_reason: zod.z.string().nullish(),
|
|
9993
|
+
usage: zod.z.object({
|
|
9994
|
+
input_tokens: zod.z.number(),
|
|
9995
|
+
output_tokens: zod.z.number(),
|
|
9996
|
+
cache_creation_input_tokens: zod.z.number().nullish(),
|
|
9997
|
+
cache_read_input_tokens: zod.z.number().nullish()
|
|
9998
|
+
})
|
|
9999
|
+
});
|
|
10000
|
+
var anthropicMessagesChunkSchema = zod.z.discriminatedUnion("type", [
|
|
10001
|
+
zod.z.object({
|
|
10002
|
+
type: zod.z.literal("message_start"),
|
|
10003
|
+
message: zod.z.object({
|
|
10004
|
+
id: zod.z.string().nullish(),
|
|
10005
|
+
model: zod.z.string().nullish(),
|
|
10006
|
+
usage: zod.z.object({
|
|
10007
|
+
input_tokens: zod.z.number(),
|
|
10008
|
+
output_tokens: zod.z.number(),
|
|
10009
|
+
cache_creation_input_tokens: zod.z.number().nullish(),
|
|
10010
|
+
cache_read_input_tokens: zod.z.number().nullish()
|
|
10011
|
+
})
|
|
10012
|
+
})
|
|
10013
|
+
}),
|
|
10014
|
+
zod.z.object({
|
|
10015
|
+
type: zod.z.literal("content_block_start"),
|
|
10016
|
+
index: zod.z.number(),
|
|
10017
|
+
content_block: zod.z.discriminatedUnion("type", [
|
|
10018
|
+
zod.z.object({
|
|
10019
|
+
type: zod.z.literal("text"),
|
|
10020
|
+
text: zod.z.string()
|
|
10021
|
+
}),
|
|
10022
|
+
zod.z.object({
|
|
10023
|
+
type: zod.z.literal("thinking"),
|
|
10024
|
+
thinking: zod.z.string()
|
|
10025
|
+
}),
|
|
10026
|
+
zod.z.object({
|
|
10027
|
+
type: zod.z.literal("tool_use"),
|
|
10028
|
+
id: zod.z.string(),
|
|
10029
|
+
name: zod.z.string()
|
|
10030
|
+
}),
|
|
10031
|
+
zod.z.object({
|
|
10032
|
+
type: zod.z.literal("redacted_thinking"),
|
|
10033
|
+
data: zod.z.string()
|
|
10034
|
+
})
|
|
10035
|
+
])
|
|
10036
|
+
}),
|
|
10037
|
+
zod.z.object({
|
|
10038
|
+
type: zod.z.literal("content_block_delta"),
|
|
10039
|
+
index: zod.z.number(),
|
|
10040
|
+
delta: zod.z.discriminatedUnion("type", [
|
|
10041
|
+
zod.z.object({
|
|
10042
|
+
type: zod.z.literal("input_json_delta"),
|
|
10043
|
+
partial_json: zod.z.string()
|
|
10044
|
+
}),
|
|
10045
|
+
zod.z.object({
|
|
10046
|
+
type: zod.z.literal("text_delta"),
|
|
10047
|
+
text: zod.z.string()
|
|
10048
|
+
}),
|
|
10049
|
+
zod.z.object({
|
|
10050
|
+
type: zod.z.literal("thinking_delta"),
|
|
10051
|
+
thinking: zod.z.string()
|
|
10052
|
+
}),
|
|
10053
|
+
zod.z.object({
|
|
10054
|
+
type: zod.z.literal("signature_delta"),
|
|
10055
|
+
signature: zod.z.string()
|
|
10056
|
+
})
|
|
10057
|
+
])
|
|
10058
|
+
}),
|
|
10059
|
+
zod.z.object({
|
|
10060
|
+
type: zod.z.literal("content_block_stop"),
|
|
10061
|
+
index: zod.z.number()
|
|
10062
|
+
}),
|
|
10063
|
+
zod.z.object({
|
|
10064
|
+
type: zod.z.literal("error"),
|
|
10065
|
+
error: zod.z.object({
|
|
10066
|
+
type: zod.z.string(),
|
|
10067
|
+
message: zod.z.string()
|
|
10068
|
+
})
|
|
10069
|
+
}),
|
|
10070
|
+
zod.z.object({
|
|
10071
|
+
type: zod.z.literal("message_delta"),
|
|
10072
|
+
delta: zod.z.object({ stop_reason: zod.z.string().nullish() }),
|
|
10073
|
+
usage: zod.z.object({ output_tokens: zod.z.number() })
|
|
10074
|
+
}),
|
|
10075
|
+
zod.z.object({ type: zod.z.literal("message_stop") }),
|
|
10076
|
+
zod.z.object({ type: zod.z.literal("ping") })
|
|
10077
|
+
]);
|
|
10078
|
+
var anthropicProviderOptionsSchema = zod.z.object({ thinking: zod.z.object({
|
|
10079
|
+
type: zod.z.union([zod.z.literal("enabled"), zod.z.literal("disabled")]),
|
|
10080
|
+
budgetTokens: zod.z.number().optional()
|
|
10081
|
+
}).optional() });
|
|
10082
|
+
var Bash20241022Parameters = zod.z.object({
|
|
10083
|
+
command: zod.z.string(),
|
|
10084
|
+
restart: zod.z.boolean().optional()
|
|
10085
|
+
});
|
|
10086
|
+
function bashTool_20241022(options = {}) {
|
|
10087
|
+
return {
|
|
10088
|
+
type: "provider-defined",
|
|
10089
|
+
id: "anthropic.bash_20241022",
|
|
10090
|
+
args: {},
|
|
10091
|
+
parameters: Bash20241022Parameters,
|
|
10092
|
+
execute: options.execute,
|
|
10093
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
10094
|
+
};
|
|
10095
|
+
}
|
|
10096
|
+
var Bash20250124Parameters = zod.z.object({
|
|
10097
|
+
command: zod.z.string(),
|
|
10098
|
+
restart: zod.z.boolean().optional()
|
|
10099
|
+
});
|
|
10100
|
+
function bashTool_20250124(options = {}) {
|
|
10101
|
+
return {
|
|
10102
|
+
type: "provider-defined",
|
|
10103
|
+
id: "anthropic.bash_20250124",
|
|
10104
|
+
args: {},
|
|
10105
|
+
parameters: Bash20250124Parameters,
|
|
10106
|
+
execute: options.execute,
|
|
10107
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
10108
|
+
};
|
|
10109
|
+
}
|
|
10110
|
+
var TextEditor20241022Parameters = zod.z.object({
|
|
10111
|
+
command: zod.z.enum([
|
|
10112
|
+
"view",
|
|
10113
|
+
"create",
|
|
10114
|
+
"str_replace",
|
|
10115
|
+
"insert",
|
|
10116
|
+
"undo_edit"
|
|
10117
|
+
]),
|
|
10118
|
+
path: zod.z.string(),
|
|
10119
|
+
file_text: zod.z.string().optional(),
|
|
10120
|
+
insert_line: zod.z.number().int().optional(),
|
|
10121
|
+
new_str: zod.z.string().optional(),
|
|
10122
|
+
old_str: zod.z.string().optional(),
|
|
10123
|
+
view_range: zod.z.array(zod.z.number().int()).optional()
|
|
10124
|
+
});
|
|
10125
|
+
function textEditorTool_20241022(options = {}) {
|
|
10126
|
+
return {
|
|
10127
|
+
type: "provider-defined",
|
|
10128
|
+
id: "anthropic.text_editor_20241022",
|
|
10129
|
+
args: {},
|
|
10130
|
+
parameters: TextEditor20241022Parameters,
|
|
10131
|
+
execute: options.execute,
|
|
10132
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
10133
|
+
};
|
|
10134
|
+
}
|
|
10135
|
+
var TextEditor20250124Parameters = zod.z.object({
|
|
10136
|
+
command: zod.z.enum([
|
|
10137
|
+
"view",
|
|
10138
|
+
"create",
|
|
10139
|
+
"str_replace",
|
|
10140
|
+
"insert",
|
|
10141
|
+
"undo_edit"
|
|
10142
|
+
]),
|
|
10143
|
+
path: zod.z.string(),
|
|
10144
|
+
file_text: zod.z.string().optional(),
|
|
10145
|
+
insert_line: zod.z.number().int().optional(),
|
|
10146
|
+
new_str: zod.z.string().optional(),
|
|
10147
|
+
old_str: zod.z.string().optional(),
|
|
10148
|
+
view_range: zod.z.array(zod.z.number().int()).optional()
|
|
10149
|
+
});
|
|
10150
|
+
function textEditorTool_20250124(options = {}) {
|
|
10151
|
+
return {
|
|
10152
|
+
type: "provider-defined",
|
|
10153
|
+
id: "anthropic.text_editor_20250124",
|
|
10154
|
+
args: {},
|
|
10155
|
+
parameters: TextEditor20250124Parameters,
|
|
10156
|
+
execute: options.execute,
|
|
10157
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
10158
|
+
};
|
|
10159
|
+
}
|
|
10160
|
+
var Computer20241022Parameters = zod.z.object({
|
|
10161
|
+
action: zod.z.enum([
|
|
10162
|
+
"key",
|
|
10163
|
+
"type",
|
|
10164
|
+
"mouse_move",
|
|
10165
|
+
"left_click",
|
|
10166
|
+
"left_click_drag",
|
|
10167
|
+
"right_click",
|
|
10168
|
+
"middle_click",
|
|
10169
|
+
"double_click",
|
|
10170
|
+
"screenshot",
|
|
10171
|
+
"cursor_position"
|
|
10172
|
+
]),
|
|
10173
|
+
coordinate: zod.z.array(zod.z.number().int()).optional(),
|
|
10174
|
+
text: zod.z.string().optional()
|
|
10175
|
+
});
|
|
10176
|
+
function computerTool_20241022(options) {
|
|
10177
|
+
return {
|
|
10178
|
+
type: "provider-defined",
|
|
10179
|
+
id: "anthropic.computer_20241022",
|
|
10180
|
+
args: {
|
|
10181
|
+
displayWidthPx: options.displayWidthPx,
|
|
10182
|
+
displayHeightPx: options.displayHeightPx,
|
|
10183
|
+
displayNumber: options.displayNumber
|
|
10184
|
+
},
|
|
10185
|
+
parameters: Computer20241022Parameters,
|
|
10186
|
+
execute: options.execute,
|
|
10187
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
10188
|
+
};
|
|
10189
|
+
}
|
|
10190
|
+
var Computer20250124Parameters = zod.z.object({
|
|
10191
|
+
action: zod.z.enum([
|
|
10192
|
+
"key",
|
|
10193
|
+
"hold_key",
|
|
10194
|
+
"type",
|
|
10195
|
+
"cursor_position",
|
|
10196
|
+
"mouse_move",
|
|
10197
|
+
"left_mouse_down",
|
|
10198
|
+
"left_mouse_up",
|
|
10199
|
+
"left_click",
|
|
10200
|
+
"left_click_drag",
|
|
10201
|
+
"right_click",
|
|
10202
|
+
"middle_click",
|
|
10203
|
+
"double_click",
|
|
10204
|
+
"triple_click",
|
|
10205
|
+
"scroll",
|
|
10206
|
+
"wait",
|
|
10207
|
+
"screenshot"
|
|
10208
|
+
]),
|
|
10209
|
+
coordinate: zod.z.tuple([zod.z.number().int(), zod.z.number().int()]).optional(),
|
|
10210
|
+
duration: zod.z.number().optional(),
|
|
10211
|
+
scroll_amount: zod.z.number().optional(),
|
|
10212
|
+
scroll_direction: zod.z.enum([
|
|
10213
|
+
"up",
|
|
10214
|
+
"down",
|
|
10215
|
+
"left",
|
|
10216
|
+
"right"
|
|
10217
|
+
]).optional(),
|
|
10218
|
+
start_coordinate: zod.z.tuple([zod.z.number().int(), zod.z.number().int()]).optional(),
|
|
10219
|
+
text: zod.z.string().optional()
|
|
10220
|
+
});
|
|
10221
|
+
function computerTool_20250124(options) {
|
|
10222
|
+
return {
|
|
10223
|
+
type: "provider-defined",
|
|
10224
|
+
id: "anthropic.computer_20250124",
|
|
10225
|
+
args: {
|
|
10226
|
+
displayWidthPx: options.displayWidthPx,
|
|
10227
|
+
displayHeightPx: options.displayHeightPx,
|
|
10228
|
+
displayNumber: options.displayNumber
|
|
10229
|
+
},
|
|
10230
|
+
parameters: Computer20250124Parameters,
|
|
10231
|
+
execute: options.execute,
|
|
10232
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
10233
|
+
};
|
|
10234
|
+
}
|
|
10235
|
+
var anthropicTools = {
|
|
10236
|
+
bash_20241022: bashTool_20241022,
|
|
10237
|
+
bash_20250124: bashTool_20250124,
|
|
10238
|
+
textEditor_20241022: textEditorTool_20241022,
|
|
10239
|
+
textEditor_20250124: textEditorTool_20250124,
|
|
10240
|
+
computer_20241022: computerTool_20241022,
|
|
10241
|
+
computer_20250124: computerTool_20250124
|
|
10242
|
+
};
|
|
10243
|
+
function createAnthropic(options = {}) {
|
|
10244
|
+
var _a$2;
|
|
10245
|
+
const baseURL = (_a$2 = withoutTrailingSlash(options.baseURL)) != null ? _a$2 : "https://api.anthropic.com/v1";
|
|
10246
|
+
const getHeaders = () => ({
|
|
10247
|
+
"anthropic-version": "2023-06-01",
|
|
10248
|
+
"x-api-key": loadApiKey({
|
|
10249
|
+
apiKey: options.apiKey,
|
|
10250
|
+
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
10251
|
+
description: "Anthropic"
|
|
10252
|
+
}),
|
|
10253
|
+
...options.headers
|
|
10254
|
+
});
|
|
10255
|
+
const createChatModel = (modelId, settings = {}) => new AnthropicMessagesLanguageModel(modelId, settings, {
|
|
10256
|
+
provider: "anthropic.messages",
|
|
10257
|
+
baseURL,
|
|
10258
|
+
headers: getHeaders,
|
|
10259
|
+
fetch: options.fetch,
|
|
10260
|
+
supportsImageUrls: true
|
|
10261
|
+
});
|
|
10262
|
+
const provider = function(modelId, settings) {
|
|
10263
|
+
if (new.target) throw new Error("The Anthropic model function cannot be called with the new keyword.");
|
|
10264
|
+
return createChatModel(modelId, settings);
|
|
10265
|
+
};
|
|
10266
|
+
provider.languageModel = createChatModel;
|
|
10267
|
+
provider.chat = createChatModel;
|
|
10268
|
+
provider.messages = createChatModel;
|
|
10269
|
+
provider.textEmbeddingModel = (modelId) => {
|
|
10270
|
+
throw new NoSuchModelError({
|
|
10271
|
+
modelId,
|
|
10272
|
+
modelType: "textEmbeddingModel"
|
|
10273
|
+
});
|
|
10274
|
+
};
|
|
10275
|
+
provider.tools = anthropicTools;
|
|
10276
|
+
return provider;
|
|
10277
|
+
}
|
|
10278
|
+
var anthropic = createAnthropic();
|
|
10279
|
+
|
|
10280
|
+
//#endregion
|
|
10281
|
+
//#region ../mcp-core/dist/anthropic-provider-BGKT8f9G.js
|
|
10282
|
+
const DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-5";
|
|
10283
|
+
let configuredBaseUrl;
|
|
10284
|
+
/**
|
|
10285
|
+
* Configure the Anthropic base URL (CLI flag only, not environment variable).
|
|
10286
|
+
* This must be called explicitly - it cannot be set via environment variables for security.
|
|
10287
|
+
*/
|
|
10288
|
+
function setAnthropicBaseUrl(baseUrl) {
|
|
10289
|
+
configuredBaseUrl = baseUrl;
|
|
10290
|
+
}
|
|
10291
|
+
/**
|
|
10292
|
+
* Retrieve an Anthropic language model configured from environment variables and explicit config.
|
|
10293
|
+
*
|
|
10294
|
+
* Configuration:
|
|
10295
|
+
* - ANTHROPIC_MODEL: Model to use (default: "claude-sonnet-4-5") - env var OK
|
|
10296
|
+
* - Base URL: Must be set via setAnthropicBaseUrl() - NOT from env vars (security risk)
|
|
10297
|
+
*/
|
|
10298
|
+
function getAnthropicModel(model) {
|
|
10299
|
+
const defaultModel = process.env.ANTHROPIC_MODEL || DEFAULT_ANTHROPIC_MODEL;
|
|
10300
|
+
const factory = createAnthropic({
|
|
10301
|
+
...configuredBaseUrl && { baseURL: configuredBaseUrl },
|
|
10302
|
+
headers: { "User-Agent": require_stdio.USER_AGENT }
|
|
10303
|
+
});
|
|
10304
|
+
return factory(model ?? defaultModel);
|
|
10305
|
+
}
|
|
10306
|
+
|
|
10307
|
+
//#endregion
|
|
10308
|
+
//#region ../mcp-core/dist/provider-factory-Bxvb4LE7.js
|
|
10309
|
+
let configuredProvider;
|
|
10310
|
+
/**
|
|
10311
|
+
* Configure the embedded agent provider explicitly.
|
|
10312
|
+
* Call this from CLI to override auto-detection.
|
|
10313
|
+
*/
|
|
10314
|
+
function setAgentProvider(provider) {
|
|
10315
|
+
configuredProvider = provider;
|
|
10316
|
+
}
|
|
10317
|
+
/**
|
|
10318
|
+
* Configure base URLs for providers (called from CLI).
|
|
10319
|
+
*/
|
|
10320
|
+
function setProviderBaseUrls(config) {
|
|
10321
|
+
if (config.openaiBaseUrl) setOpenAIBaseUrl(config.openaiBaseUrl);
|
|
10322
|
+
if (config.anthropicBaseUrl) setAnthropicBaseUrl(config.anthropicBaseUrl);
|
|
10323
|
+
}
|
|
10324
|
+
/**
|
|
10325
|
+
* Check if the API key exists for a given provider type.
|
|
10326
|
+
*/
|
|
10327
|
+
function hasApiKeyForProvider(type) {
|
|
10328
|
+
switch (type) {
|
|
10329
|
+
case "anthropic": return Boolean(process.env.ANTHROPIC_API_KEY);
|
|
10330
|
+
case "openai": return Boolean(process.env.OPENAI_API_KEY);
|
|
10331
|
+
}
|
|
10332
|
+
}
|
|
10333
|
+
/**
|
|
10334
|
+
* Get the expected API key name for a provider type.
|
|
10335
|
+
*/
|
|
10336
|
+
function getApiKeyName(type) {
|
|
10337
|
+
switch (type) {
|
|
10338
|
+
case "anthropic": return "ANTHROPIC_API_KEY";
|
|
10339
|
+
case "openai": return "OPENAI_API_KEY";
|
|
10340
|
+
}
|
|
10341
|
+
}
|
|
10342
|
+
/**
|
|
10343
|
+
* Build a provider instance for the given type.
|
|
10344
|
+
*/
|
|
10345
|
+
function buildProvider(type) {
|
|
10346
|
+
switch (type) {
|
|
10347
|
+
case "anthropic": return {
|
|
10348
|
+
type: "anthropic",
|
|
10349
|
+
getModel: getAnthropicModel,
|
|
10350
|
+
getProviderOptions: () => ({}),
|
|
10351
|
+
getTemperature: () => void 0
|
|
10352
|
+
};
|
|
10353
|
+
case "openai": return {
|
|
10354
|
+
type: "openai",
|
|
10355
|
+
getModel: getOpenAIModel,
|
|
10356
|
+
getProviderOptions: () => ({ openai: {
|
|
10357
|
+
structuredOutputs: false,
|
|
10358
|
+
strictJsonSchema: false
|
|
10359
|
+
} }),
|
|
10360
|
+
getTemperature: () => 1
|
|
10361
|
+
};
|
|
10362
|
+
}
|
|
10363
|
+
}
|
|
10364
|
+
/**
|
|
10365
|
+
* Get the current agent provider based on configuration.
|
|
10366
|
+
*
|
|
10367
|
+
* Resolution order:
|
|
10368
|
+
* 1. Explicit configuration via setAgentProvider()
|
|
10369
|
+
* 2. EMBEDDED_AGENT_PROVIDER environment variable
|
|
10370
|
+
* 3. Auto-detect: check ANTHROPIC_API_KEY, then OPENAI_API_KEY
|
|
10371
|
+
* 4. Throw ConfigurationError if no provider available
|
|
10372
|
+
*/
|
|
10373
|
+
function getAgentProvider() {
|
|
10374
|
+
let providerType = configuredProvider;
|
|
10375
|
+
if (!providerType) {
|
|
10376
|
+
const envProvider = process.env.EMBEDDED_AGENT_PROVIDER?.toLowerCase();
|
|
10377
|
+
if (envProvider === "openai" || envProvider === "anthropic") providerType = envProvider;
|
|
10378
|
+
}
|
|
10379
|
+
if (providerType && !hasApiKeyForProvider(providerType)) throw new ConfigurationError(`Provider "${providerType}" is configured but ${getApiKeyName(providerType)} is not set. Please set the API key environment variable.`);
|
|
10380
|
+
if (!providerType) {
|
|
10381
|
+
if (process.env.ANTHROPIC_API_KEY) providerType = "anthropic";
|
|
10382
|
+
else if (process.env.OPENAI_API_KEY) providerType = "openai";
|
|
10383
|
+
}
|
|
10384
|
+
if (!providerType) throw new ConfigurationError("No embedded agent provider configured. Set OPENAI_API_KEY or ANTHROPIC_API_KEY environment variable, or use --agent-provider flag to specify a provider.");
|
|
10385
|
+
return buildProvider(providerType);
|
|
10386
|
+
}
|
|
10387
|
+
/**
|
|
10388
|
+
* Check if an embedded agent provider is available.
|
|
10389
|
+
* Returns true if getAgentProvider() would succeed.
|
|
10390
|
+
*/
|
|
10391
|
+
function hasAgentProvider() {
|
|
10392
|
+
try {
|
|
10393
|
+
getAgentProvider();
|
|
10394
|
+
return true;
|
|
10395
|
+
} catch {
|
|
10396
|
+
return false;
|
|
10397
|
+
}
|
|
10398
|
+
}
|
|
10399
|
+
/**
|
|
10400
|
+
* Get the resolved provider type without throwing.
|
|
10401
|
+
* Returns undefined if no provider is available or API key is missing.
|
|
10402
|
+
*/
|
|
10403
|
+
function getResolvedProviderType() {
|
|
10404
|
+
if (configuredProvider) return hasApiKeyForProvider(configuredProvider) ? configuredProvider : void 0;
|
|
10405
|
+
const envProvider = process.env.EMBEDDED_AGENT_PROVIDER?.toLowerCase();
|
|
10406
|
+
if (envProvider === "openai" || envProvider === "anthropic") return hasApiKeyForProvider(envProvider) ? envProvider : void 0;
|
|
10407
|
+
if (process.env.ANTHROPIC_API_KEY) return "anthropic";
|
|
10408
|
+
if (process.env.OPENAI_API_KEY) return "openai";
|
|
10409
|
+
return void 0;
|
|
10410
|
+
}
|
|
10411
|
+
|
|
10412
|
+
//#endregion
|
|
10413
|
+
//#region ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
10414
|
+
const ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
10415
|
+
const defaultOptions = {
|
|
10416
|
+
name: void 0,
|
|
10417
|
+
$refStrategy: "root",
|
|
10418
|
+
basePath: ["#"],
|
|
10419
|
+
effectStrategy: "input",
|
|
10420
|
+
pipeStrategy: "all",
|
|
10421
|
+
dateStrategy: "format:date-time",
|
|
10422
|
+
mapStrategy: "entries",
|
|
10423
|
+
removeAdditionalStrategy: "passthrough",
|
|
10424
|
+
allowedAdditionalProperties: true,
|
|
10425
|
+
rejectedAdditionalProperties: false,
|
|
10426
|
+
definitionPath: "definitions",
|
|
10427
|
+
target: "jsonSchema7",
|
|
10428
|
+
strictUnions: false,
|
|
10429
|
+
definitions: {},
|
|
10430
|
+
errorMessages: false,
|
|
10431
|
+
markdownDescription: false,
|
|
10432
|
+
patternStrategy: "escape",
|
|
10433
|
+
applyRegexFlags: false,
|
|
10434
|
+
emailStrategy: "format:email",
|
|
10435
|
+
base64Strategy: "contentEncoding:base64",
|
|
10436
|
+
nameStrategy: "ref",
|
|
10437
|
+
openAiAnyTypeName: "OpenAiAnyType"
|
|
10438
|
+
};
|
|
10439
|
+
const getDefaultOptions = (options) => typeof options === "string" ? {
|
|
10440
|
+
...defaultOptions,
|
|
10441
|
+
name: options
|
|
10442
|
+
} : {
|
|
10443
|
+
...defaultOptions,
|
|
10444
|
+
...options
|
|
10445
|
+
};
|
|
10446
|
+
|
|
10447
|
+
//#endregion
|
|
10448
|
+
//#region ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
10449
|
+
const getRefs = (options) => {
|
|
10450
|
+
const _options = getDefaultOptions(options);
|
|
10451
|
+
const currentPath = _options.name !== void 0 ? [
|
|
10452
|
+
..._options.basePath,
|
|
10453
|
+
_options.definitionPath,
|
|
10454
|
+
_options.name
|
|
10455
|
+
] : _options.basePath;
|
|
10456
|
+
return {
|
|
10457
|
+
..._options,
|
|
10458
|
+
flags: { hasReferencedOpenAiAnyType: false },
|
|
10459
|
+
currentPath,
|
|
10460
|
+
propertyPath: void 0,
|
|
10461
|
+
seen: new Map(Object.entries(_options.definitions).map(([name$2, def]) => [def._def, {
|
|
10462
|
+
def: def._def,
|
|
10463
|
+
path: [
|
|
10464
|
+
..._options.basePath,
|
|
10465
|
+
_options.definitionPath,
|
|
10466
|
+
name$2
|
|
10467
|
+
],
|
|
10468
|
+
jsonSchema: void 0
|
|
10469
|
+
}]))
|
|
10470
|
+
};
|
|
10471
|
+
};
|
|
10472
|
+
|
|
10473
|
+
//#endregion
|
|
10474
|
+
//#region ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
10475
|
+
function addErrorMessage(res, key, errorMessage, refs) {
|
|
10476
|
+
if (!refs?.errorMessages) return;
|
|
10477
|
+
if (errorMessage) res.errorMessage = {
|
|
10478
|
+
...res.errorMessage,
|
|
10479
|
+
[key]: errorMessage
|
|
10480
|
+
};
|
|
10481
|
+
}
|
|
10482
|
+
function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
10483
|
+
res[key] = value;
|
|
10484
|
+
addErrorMessage(res, key, errorMessage, refs);
|
|
10485
|
+
}
|
|
10486
|
+
|
|
10487
|
+
//#endregion
|
|
10488
|
+
//#region ../../node_modules/.pnpm/zod-to-json-schema@3.25.0_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
9050
10489
|
const getRelativePath = (pathA, pathB) => {
|
|
9051
10490
|
let i = 0;
|
|
9052
10491
|
for (; i < pathA.length && i < pathB.length; i++) if (pathA[i] !== pathB[i]) break;
|
|
@@ -13822,8 +15261,8 @@ var SseMCPTransport = class {
|
|
|
13822
15261
|
this.headers = headers;
|
|
13823
15262
|
}
|
|
13824
15263
|
async start() {
|
|
13825
|
-
return new Promise((resolve, reject) => {
|
|
13826
|
-
if (this.connected) return resolve();
|
|
15264
|
+
return new Promise((resolve$1, reject) => {
|
|
15265
|
+
if (this.connected) return resolve$1();
|
|
13827
15266
|
this.abortController = new AbortController();
|
|
13828
15267
|
const establishConnection = async () => {
|
|
13829
15268
|
var _a17, _b, _c;
|
|
@@ -13858,7 +15297,7 @@ var SseMCPTransport = class {
|
|
|
13858
15297
|
this.endpoint = new URL(data, this.url);
|
|
13859
15298
|
if (this.endpoint.origin !== this.url.origin) throw new MCPClientError({ message: `MCP SSE Transport Error: Endpoint origin does not match connection origin: ${this.endpoint.origin}` });
|
|
13860
15299
|
this.connected = true;
|
|
13861
|
-
resolve();
|
|
15300
|
+
resolve$1();
|
|
13862
15301
|
} else if (event === "message") try {
|
|
13863
15302
|
const message = JSONRPCMessageSchema.parse(JSON.parse(data));
|
|
13864
15303
|
(_a18 = this.onmessage) == null || _a18.call(this, message);
|
|
@@ -13997,7 +15436,7 @@ var MCPClient = class {
|
|
|
13997
15436
|
}
|
|
13998
15437
|
}
|
|
13999
15438
|
async request({ request, resultSchema, options }) {
|
|
14000
|
-
return new Promise((resolve, reject) => {
|
|
15439
|
+
return new Promise((resolve$1, reject) => {
|
|
14001
15440
|
if (this.isClosed) return reject(new MCPClientError({ message: "Attempted to send a request from a closed client" }));
|
|
14002
15441
|
this.assertCapability(request.method);
|
|
14003
15442
|
const signal = options == null ? void 0 : options.signal;
|
|
@@ -14019,7 +15458,7 @@ var MCPClient = class {
|
|
|
14019
15458
|
if (response instanceof Error) return reject(response);
|
|
14020
15459
|
try {
|
|
14021
15460
|
const result = resultSchema.parse(response.result);
|
|
14022
|
-
resolve(result);
|
|
15461
|
+
resolve$1(result);
|
|
14023
15462
|
} catch (error) {
|
|
14024
15463
|
const parseError = new MCPClientError({
|
|
14025
15464
|
message: "Failed to parse server response",
|
|
@@ -14246,7 +15685,7 @@ function trimStartOfStream() {
|
|
|
14246
15685
|
var HANGING_STREAM_WARNING_TIME_MS = 15 * 1e3;
|
|
14247
15686
|
|
|
14248
15687
|
//#endregion
|
|
14249
|
-
//#region ../mcp-core/dist/callEmbeddedAgent
|
|
15688
|
+
//#region ../mcp-core/dist/callEmbeddedAgent--R3kwqbb.js
|
|
14250
15689
|
/**
|
|
14251
15690
|
* Call an embedded agent with tool call capture
|
|
14252
15691
|
* This is the standard way to call embedded AI agents within MCP tools
|
|
@@ -14257,22 +15696,20 @@ var HANGING_STREAM_WARNING_TIME_MS = 15 * 1e3;
|
|
|
14257
15696
|
*/
|
|
14258
15697
|
async function callEmbeddedAgent({ system, prompt, tools, schema }) {
|
|
14259
15698
|
const capturedToolCalls = [];
|
|
15699
|
+
const provider = getAgentProvider();
|
|
14260
15700
|
const result = await generateText({
|
|
14261
|
-
model:
|
|
15701
|
+
model: provider.getModel(),
|
|
14262
15702
|
system,
|
|
14263
15703
|
prompt,
|
|
14264
15704
|
tools,
|
|
14265
15705
|
maxSteps: 5,
|
|
14266
|
-
temperature:
|
|
15706
|
+
...provider.getTemperature() !== void 0 && { temperature: provider.getTemperature() },
|
|
14267
15707
|
experimental_output: output_exports.object({ schema }),
|
|
14268
15708
|
experimental_telemetry: {
|
|
14269
15709
|
isEnabled: true,
|
|
14270
15710
|
functionId: "callEmbeddedAgent"
|
|
14271
15711
|
},
|
|
14272
|
-
providerOptions:
|
|
14273
|
-
structuredOutputs: false,
|
|
14274
|
-
strictJsonSchema: false
|
|
14275
|
-
} },
|
|
15712
|
+
providerOptions: provider.getProviderOptions(),
|
|
14276
15713
|
onStepFinish: (event) => {
|
|
14277
15714
|
if (event.toolCalls && event.toolCalls.length > 0) for (const toolCall of event.toolCalls) capturedToolCalls.push({
|
|
14278
15715
|
toolName: toolCall.toolName,
|
|
@@ -14292,7 +15729,7 @@ async function callEmbeddedAgent({ system, prompt, tools, schema }) {
|
|
|
14292
15729
|
}
|
|
14293
15730
|
|
|
14294
15731
|
//#endregion
|
|
14295
|
-
//#region ../mcp-core/dist/utils-
|
|
15732
|
+
//#region ../mcp-core/dist/utils-BhgZ4dUB.js
|
|
14296
15733
|
/**
|
|
14297
15734
|
* Standard response schema for all embedded agent tools.
|
|
14298
15735
|
* Tools return either an error message or the result data, never both.
|
|
@@ -14374,7 +15811,7 @@ function agentTool(config) {
|
|
|
14374
15811
|
}
|
|
14375
15812
|
|
|
14376
15813
|
//#endregion
|
|
14377
|
-
//#region ../mcp-core/dist/otel-semantics-
|
|
15814
|
+
//#region ../mcp-core/dist/otel-semantics-B5qAIqUa.js
|
|
14378
15815
|
var namespace$72 = "android";
|
|
14379
15816
|
var description$72 = "The Android platform on which the Android application is running.\n";
|
|
14380
15817
|
var attributes$72 = {
|
|
@@ -19220,7 +20657,7 @@ function createOtelLookupTool(options) {
|
|
|
19220
20657
|
}
|
|
19221
20658
|
|
|
19222
20659
|
//#endregion
|
|
19223
|
-
//#region ../mcp-core/dist/whoami-
|
|
20660
|
+
//#region ../mcp-core/dist/whoami-CnHpsyv0.js
|
|
19224
20661
|
/**
|
|
19225
20662
|
* Get the current authenticated user's information from Sentry API
|
|
19226
20663
|
*/
|
|
@@ -19249,7 +20686,7 @@ function createWhoamiTool(options) {
|
|
|
19249
20686
|
}
|
|
19250
20687
|
|
|
19251
20688
|
//#endregion
|
|
19252
|
-
//#region ../mcp-core/dist/utils-
|
|
20689
|
+
//#region ../mcp-core/dist/utils-CRDu-UNV.js
|
|
19253
20690
|
function getStringValue(event, key, defaultValue = "") {
|
|
19254
20691
|
const value = event[key];
|
|
19255
20692
|
return typeof value === "string" ? value : defaultValue;
|
|
@@ -19302,14 +20739,14 @@ function createDatasetAttributesTool(options) {
|
|
|
19302
20739
|
"logs"
|
|
19303
20740
|
]).describe("The dataset to query attributes for") }),
|
|
19304
20741
|
execute: async ({ dataset }) => {
|
|
19305
|
-
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$
|
|
20742
|
+
const { BASE_COMMON_FIELDS, DATASET_FIELDS, RECOMMENDED_FIELDS: RECOMMENDED_FIELDS$2, NUMERIC_FIELDS, DATASET_EXAMPLES } = await Promise.resolve().then(() => require("./config-CwE3_vz4.cjs"));
|
|
19306
20743
|
const { attributes: customAttributes, fieldTypes } = await fetchCustomAttributes(apiService, organizationSlug, dataset, projectId);
|
|
19307
20744
|
const allFields = {
|
|
19308
20745
|
...BASE_COMMON_FIELDS,
|
|
19309
20746
|
...DATASET_FIELDS[dataset],
|
|
19310
20747
|
...customAttributes
|
|
19311
20748
|
};
|
|
19312
|
-
const recommendedFields = RECOMMENDED_FIELDS$
|
|
20749
|
+
const recommendedFields = RECOMMENDED_FIELDS$2[dataset];
|
|
19313
20750
|
const allFieldTypes = { ...fieldTypes };
|
|
19314
20751
|
const staticNumericFields = NUMERIC_FIELDS[dataset] || /* @__PURE__ */ new Set();
|
|
19315
20752
|
for (const field of staticNumericFields) allFieldTypes[field] = "number";
|
|
@@ -19337,7 +20774,7 @@ Use these examples as patterns for constructing your query.`;
|
|
|
19337
20774
|
}
|
|
19338
20775
|
|
|
19339
20776
|
//#endregion
|
|
19340
|
-
//#region ../mcp-core/dist/agent-
|
|
20777
|
+
//#region ../mcp-core/dist/agent-C5-b2G06.js
|
|
19341
20778
|
const searchEventsAgentOutputSchema = zod.z.object({
|
|
19342
20779
|
dataset: zod.z.enum([
|
|
19343
20780
|
"spans",
|
|
@@ -19366,7 +20803,6 @@ const searchEventsAgentOutputSchema = zod.z.object({
|
|
|
19366
20803
|
* This returns both the translated query result AND the tool calls made by the agent
|
|
19367
20804
|
*/
|
|
19368
20805
|
async function searchEventsAgent(options) {
|
|
19369
|
-
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for semantic search");
|
|
19370
20806
|
const datasetAttributesTool = createDatasetAttributesTool({
|
|
19371
20807
|
apiService: options.apiService,
|
|
19372
20808
|
organizationSlug: options.organizationSlug,
|
|
@@ -19379,7 +20815,7 @@ async function searchEventsAgent(options) {
|
|
|
19379
20815
|
});
|
|
19380
20816
|
const whoamiTool = createWhoamiTool({ apiService: options.apiService });
|
|
19381
20817
|
return await callEmbeddedAgent({
|
|
19382
|
-
system:
|
|
20818
|
+
system: require_config_CEjP2CYO.systemPrompt,
|
|
19383
20819
|
prompt: options.query,
|
|
19384
20820
|
tools: {
|
|
19385
20821
|
datasetAttributes: datasetAttributesTool,
|
|
@@ -19391,7 +20827,7 @@ async function searchEventsAgent(options) {
|
|
|
19391
20827
|
}
|
|
19392
20828
|
|
|
19393
20829
|
//#endregion
|
|
19394
|
-
//#region ../mcp-core/dist/formatters-
|
|
20830
|
+
//#region ../mcp-core/dist/formatters-CJK-ciCF.js
|
|
19395
20831
|
/**
|
|
19396
20832
|
* Format an explanation for how a natural language query was translated
|
|
19397
20833
|
*/
|
|
@@ -19609,7 +21045,7 @@ function formatSpanResults(params) {
|
|
|
19609
21045
|
}
|
|
19610
21046
|
|
|
19611
21047
|
//#endregion
|
|
19612
|
-
//#region ../mcp-core/dist/handler-
|
|
21048
|
+
//#region ../mcp-core/dist/handler-BDtOWjBO.js
|
|
19613
21049
|
var handler_default = defineTool({
|
|
19614
21050
|
name: "search_events",
|
|
19615
21051
|
skills: [
|
|
@@ -19689,7 +21125,7 @@ var handler_default = defineTool({
|
|
|
19689
21125
|
});
|
|
19690
21126
|
const parsed = agentResult.result;
|
|
19691
21127
|
const dataset = parsed.dataset;
|
|
19692
|
-
const recommendedFields =
|
|
21128
|
+
const recommendedFields = require_config_CEjP2CYO.RECOMMENDED_FIELDS[dataset];
|
|
19693
21129
|
if (!parsed.sort) 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, '-count()' for highest count).`);
|
|
19694
21130
|
const sentryQuery = parsed.query || "";
|
|
19695
21131
|
const requestedFields = parsed.fields || [];
|
|
@@ -19750,7 +21186,7 @@ var handler_default = defineTool({
|
|
|
19750
21186
|
});
|
|
19751
21187
|
|
|
19752
21188
|
//#endregion
|
|
19753
|
-
//#region ../mcp-core/dist/create-team-
|
|
21189
|
+
//#region ../mcp-core/dist/create-team-BNRuwaPN.js
|
|
19754
21190
|
var create_team_default = defineTool({
|
|
19755
21191
|
name: "create_team",
|
|
19756
21192
|
skills: ["project-management"],
|
|
@@ -19805,7 +21241,7 @@ var create_team_default = defineTool({
|
|
|
19805
21241
|
});
|
|
19806
21242
|
|
|
19807
21243
|
//#endregion
|
|
19808
|
-
//#region ../mcp-core/dist/create-project-
|
|
21244
|
+
//#region ../mcp-core/dist/create-project-CagAItcQ.js
|
|
19809
21245
|
var create_project_default = defineTool({
|
|
19810
21246
|
name: "create_project",
|
|
19811
21247
|
skills: ["project-management"],
|
|
@@ -19882,7 +21318,7 @@ var create_project_default = defineTool({
|
|
|
19882
21318
|
});
|
|
19883
21319
|
|
|
19884
21320
|
//#endregion
|
|
19885
|
-
//#region ../mcp-core/dist/update-project-
|
|
21321
|
+
//#region ../mcp-core/dist/update-project-C3HNKHy3.js
|
|
19886
21322
|
var update_project_default = defineTool({
|
|
19887
21323
|
name: "update_project",
|
|
19888
21324
|
skills: ["project-management"],
|
|
@@ -20000,7 +21436,7 @@ var update_project_default = defineTool({
|
|
|
20000
21436
|
});
|
|
20001
21437
|
|
|
20002
21438
|
//#endregion
|
|
20003
|
-
//#region ../mcp-core/dist/create-dsn-
|
|
21439
|
+
//#region ../mcp-core/dist/create-dsn-qX9dkWBv.js
|
|
20004
21440
|
var create_dsn_default = defineTool({
|
|
20005
21441
|
name: "create_dsn",
|
|
20006
21442
|
skills: ["project-management"],
|
|
@@ -20060,7 +21496,7 @@ var create_dsn_default = defineTool({
|
|
|
20060
21496
|
});
|
|
20061
21497
|
|
|
20062
21498
|
//#endregion
|
|
20063
|
-
//#region ../mcp-core/dist/find-dsns-
|
|
21499
|
+
//#region ../mcp-core/dist/find-dsns-DQL7wv5D.js
|
|
20064
21500
|
var find_dsns_default = defineTool({
|
|
20065
21501
|
name: "find_dsns",
|
|
20066
21502
|
skills: ["project-management"],
|
|
@@ -20111,7 +21547,7 @@ var find_dsns_default = defineTool({
|
|
|
20111
21547
|
});
|
|
20112
21548
|
|
|
20113
21549
|
//#endregion
|
|
20114
|
-
//#region ../mcp-core/dist/fetch-utils-
|
|
21550
|
+
//#region ../mcp-core/dist/fetch-utils-LjUGSOvJ.js
|
|
20115
21551
|
/**
|
|
20116
21552
|
* Fetch with timeout using AbortController
|
|
20117
21553
|
* @param url - The URL to fetch
|
|
@@ -20154,14 +21590,14 @@ async function retryWithBackoff(fn, { maxRetries = 3, initialDelay = 1e3, should
|
|
|
20154
21590
|
} catch (error) {
|
|
20155
21591
|
lastError = error;
|
|
20156
21592
|
if (attempt === maxRetries || !shouldRetry(error)) throw error;
|
|
20157
|
-
await new Promise((resolve) => setTimeout(resolve, delay$1));
|
|
21593
|
+
await new Promise((resolve$1) => setTimeout(resolve$1, delay$1));
|
|
20158
21594
|
delay$1 = Math.min(delay$1 * 2, 3e4);
|
|
20159
21595
|
}
|
|
20160
21596
|
throw lastError;
|
|
20161
21597
|
}
|
|
20162
21598
|
|
|
20163
21599
|
//#endregion
|
|
20164
|
-
//#region ../mcp-core/dist/analyze-issue-with-seer-
|
|
21600
|
+
//#region ../mcp-core/dist/analyze-issue-with-seer-B6aDeTwi.js
|
|
20165
21601
|
var analyze_issue_with_seer_default = defineTool({
|
|
20166
21602
|
name: "analyze_issue_with_seer",
|
|
20167
21603
|
skills: ["seer"],
|
|
@@ -20221,7 +21657,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20221
21657
|
},
|
|
20222
21658
|
async handler(params, context$1) {
|
|
20223
21659
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
20224
|
-
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams({
|
|
21660
|
+
const { organizationSlug: orgSlug, issueId: parsedIssueId } = parseIssueParams$1({
|
|
20225
21661
|
organizationSlug: params.organizationSlug,
|
|
20226
21662
|
issueId: params.issueId,
|
|
20227
21663
|
issueUrl: params.issueUrl
|
|
@@ -20246,7 +21682,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20246
21682
|
instruction: params.instruction
|
|
20247
21683
|
});
|
|
20248
21684
|
output += `Analysis started with Run ID: ${startResult.run_id}\n\n`;
|
|
20249
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
21685
|
+
await new Promise((resolve$1) => setTimeout(resolve$1, 1e3));
|
|
20250
21686
|
autofixState = await retryWithBackoff(() => apiService.getAutofixState({
|
|
20251
21687
|
organizationSlug: orgSlug,
|
|
20252
21688
|
issueId: parsedIssueId
|
|
@@ -20303,7 +21739,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20303
21739
|
if (activeStep) output += `Processing: ${activeStep.title}...\n`;
|
|
20304
21740
|
lastStatus = status;
|
|
20305
21741
|
}
|
|
20306
|
-
await new Promise((resolve) => setTimeout(resolve, SEER_POLLING_INTERVAL));
|
|
21742
|
+
await new Promise((resolve$1) => setTimeout(resolve$1, SEER_POLLING_INTERVAL));
|
|
20307
21743
|
try {
|
|
20308
21744
|
autofixState = await retryWithBackoff(() => apiService.getAutofixState({
|
|
20309
21745
|
organizationSlug: orgSlug,
|
|
@@ -20349,7 +21785,7 @@ var analyze_issue_with_seer_default = defineTool({
|
|
|
20349
21785
|
});
|
|
20350
21786
|
|
|
20351
21787
|
//#endregion
|
|
20352
|
-
//#region ../mcp-core/dist/search-docs-
|
|
21788
|
+
//#region ../mcp-core/dist/search-docs-yQc8o0ap.js
|
|
20353
21789
|
var search_docs_default = defineTool({
|
|
20354
21790
|
name: "search_docs",
|
|
20355
21791
|
skills: ["docs"],
|
|
@@ -20432,7 +21868,7 @@ var search_docs_default = defineTool({
|
|
|
20432
21868
|
});
|
|
20433
21869
|
|
|
20434
21870
|
//#endregion
|
|
20435
|
-
//#region ../mcp-core/dist/get-doc-
|
|
21871
|
+
//#region ../mcp-core/dist/get-doc-BuXsge2G.js
|
|
20436
21872
|
var get_doc_default = defineTool({
|
|
20437
21873
|
name: "get_doc",
|
|
20438
21874
|
skills: ["docs"],
|
|
@@ -20509,7 +21945,7 @@ var get_doc_default = defineTool({
|
|
|
20509
21945
|
});
|
|
20510
21946
|
|
|
20511
21947
|
//#endregion
|
|
20512
|
-
//#region ../mcp-core/dist/dataset-fields-
|
|
21948
|
+
//#region ../mcp-core/dist/dataset-fields-ClLuCTh4.js
|
|
20513
21949
|
/**
|
|
20514
21950
|
* Discover available fields for a dataset by querying Sentry's tags API
|
|
20515
21951
|
*/
|
|
@@ -20659,11 +22095,11 @@ function getCommonPatterns(dataset) {
|
|
|
20659
22095
|
}
|
|
20660
22096
|
|
|
20661
22097
|
//#endregion
|
|
20662
|
-
//#region ../mcp-core/dist/config-
|
|
22098
|
+
//#region ../mcp-core/dist/config-C3fctASk.js
|
|
20663
22099
|
/**
|
|
20664
22100
|
* Configuration for the search-issues agent
|
|
20665
22101
|
*/
|
|
20666
|
-
const systemPrompt$
|
|
22102
|
+
const systemPrompt$3 = `You are a Sentry issue search query translator. Convert natural language queries to Sentry issue search syntax.
|
|
20667
22103
|
|
|
20668
22104
|
IMPORTANT RULES:
|
|
20669
22105
|
1. Use Sentry issue search syntax, NOT SQL
|
|
@@ -20677,13 +22113,16 @@ BUILT-IN FIELDS:
|
|
|
20677
22113
|
- level: Severity level (error, warning, info, debug, fatal)
|
|
20678
22114
|
IMPORTANT: Almost NEVER use this field. Terms like "critical", "important", "severe" refer to IMPACT not level.
|
|
20679
22115
|
Only use if user explicitly says "error level", "warning level", etc.
|
|
22116
|
+
- issueCategory: Issue classification (error, performance, metric, feedback)
|
|
22117
|
+
IMPORTANT: User feedback from the User Feedback Widget is stored as issues with issueCategory:feedback
|
|
22118
|
+
Use this field when users ask about "user feedback", "feedback submissions", "user reports", etc.
|
|
20680
22119
|
- environment: Deployment environment (production, staging, development)
|
|
20681
22120
|
- release: Version/release identifier
|
|
20682
22121
|
- firstSeen: When the issue was FIRST encountered (use for "new issues", "started", "began")
|
|
20683
22122
|
WARNING: Excludes ongoing issues that started before the time window
|
|
20684
22123
|
- lastSeen: When the issue was LAST encountered (use for "from the last", "recent", "active")
|
|
20685
22124
|
This includes ALL issues seen during the time window, regardless of when they started
|
|
20686
|
-
- assigned: Issues explicitly assigned to a user (email or "me")
|
|
22125
|
+
- assigned: Issues explicitly assigned to a user (email or "me")
|
|
20687
22126
|
- assignedOrSuggested: Issues assigned to OR suggested for a user (broader match)
|
|
20688
22127
|
- userCount: Number of unique users affected
|
|
20689
22128
|
- eventCount: Total number of events
|
|
@@ -20695,6 +22134,9 @@ COMMON QUERY PATTERNS:
|
|
|
20695
22134
|
- New issues: firstSeen:-7d
|
|
20696
22135
|
- High impact: userCount:>100
|
|
20697
22136
|
- My work: assignedOrSuggested:me
|
|
22137
|
+
- User feedback: issueCategory:feedback
|
|
22138
|
+
- Recent feedback: issueCategory:feedback lastSeen:-7d
|
|
22139
|
+
- Feedback from production: issueCategory:feedback environment:production
|
|
20698
22140
|
|
|
20699
22141
|
SORTING RULES:
|
|
20700
22142
|
1. CRITICAL: Sort MUST go in the separate "sort" field, NEVER in the "query" field
|
|
@@ -20718,6 +22160,8 @@ EXAMPLES:
|
|
|
20718
22160
|
"critical bugs" → query: "level:error is:unresolved", sort: "date"
|
|
20719
22161
|
"worst issues affecting the most users" → query: "is:unresolved", sort: "user"
|
|
20720
22162
|
"assigned to john@example.com" → query: "assignedOrSuggested:john@example.com", sort: "date"
|
|
22163
|
+
"show me user feedback" → query: "issueCategory:feedback", sort: "date"
|
|
22164
|
+
"feedback from the last week" → query: "issueCategory:feedback lastSeen:-7d", sort: "date"
|
|
20721
22165
|
|
|
20722
22166
|
NEVER: query: "is:unresolved sort:user" ← Sort goes in separate field!
|
|
20723
22167
|
|
|
@@ -20731,7 +22175,7 @@ Always use the issueFields tool to discover available fields when needed.
|
|
|
20731
22175
|
Use the whoami tool when you need to resolve 'me' references.`;
|
|
20732
22176
|
|
|
20733
22177
|
//#endregion
|
|
20734
|
-
//#region ../mcp-core/dist/agent-
|
|
22178
|
+
//#region ../mcp-core/dist/agent-BDHlBFe8.js
|
|
20735
22179
|
const searchIssuesAgentOutputSchema = zod.z.object({
|
|
20736
22180
|
query: zod.z.string().describe("The Sentry issue search query"),
|
|
20737
22181
|
sort: zod.z.enum([
|
|
@@ -20747,9 +22191,8 @@ const searchIssuesAgentOutputSchema = zod.z.object({
|
|
|
20747
22191
|
* This returns both the translated query result AND the tool calls made by the agent
|
|
20748
22192
|
*/
|
|
20749
22193
|
async function searchIssuesAgent(options) {
|
|
20750
|
-
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for semantic search");
|
|
20751
22194
|
return await callEmbeddedAgent({
|
|
20752
|
-
system: systemPrompt$
|
|
22195
|
+
system: systemPrompt$3,
|
|
20753
22196
|
prompt: options.query,
|
|
20754
22197
|
tools: {
|
|
20755
22198
|
issueFields: createDatasetFieldsTool({
|
|
@@ -20765,7 +22208,7 @@ async function searchIssuesAgent(options) {
|
|
|
20765
22208
|
}
|
|
20766
22209
|
|
|
20767
22210
|
//#endregion
|
|
20768
|
-
//#region ../mcp-core/dist/formatters-
|
|
22211
|
+
//#region ../mcp-core/dist/formatters-BcLCXcro.js
|
|
20769
22212
|
/**
|
|
20770
22213
|
* Format an explanation for how a natural language query was translated
|
|
20771
22214
|
*/
|
|
@@ -20808,6 +22251,7 @@ function formatIssueResults(params) {
|
|
|
20808
22251
|
output += `## ${index + 1}. [${issue.shortId}](${issueUrl})\n\n`;
|
|
20809
22252
|
output += `**${issue.title}**\n\n`;
|
|
20810
22253
|
output += `- **Status**: ${issue.status}\n`;
|
|
22254
|
+
if (issue.issueCategory && issue.issueCategory !== "error") output += `- **Category**: ${issue.issueCategory}\n`;
|
|
20811
22255
|
output += `- **Users**: ${issue.userCount || 0}\n`;
|
|
20812
22256
|
output += `- **Events**: ${issue.count || 0}\n`;
|
|
20813
22257
|
if (issue.assignedTo) {
|
|
@@ -20824,6 +22268,8 @@ function formatIssueResults(params) {
|
|
|
20824
22268
|
output += "- Get more details about a specific issue: Use the Issue ID with get_issue_details\n";
|
|
20825
22269
|
output += "- Update issue status: Use update_issue to resolve or assign issues\n";
|
|
20826
22270
|
output += "- View event counts: Use search_events for aggregated statistics\n";
|
|
22271
|
+
const hasFeedback = issues.some((i) => i.issueCategory === "feedback");
|
|
22272
|
+
if (hasFeedback) output += "- View feedback details: Use get_issue_details to see full feedback content and linked error events\n";
|
|
20827
22273
|
return output;
|
|
20828
22274
|
}
|
|
20829
22275
|
/**
|
|
@@ -20842,11 +22288,11 @@ function formatDate(dateString) {
|
|
|
20842
22288
|
if (diffHours < 24) return `${diffHours} hour${diffHours === 1 ? "" : "s"} ago`;
|
|
20843
22289
|
const diffDays = Math.floor(diffHours / 24);
|
|
20844
22290
|
if (diffDays < 30) return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`;
|
|
20845
|
-
return date.
|
|
22291
|
+
return date.toISOString().split("T")[0];
|
|
20846
22292
|
}
|
|
20847
22293
|
|
|
20848
22294
|
//#endregion
|
|
20849
|
-
//#region ../mcp-core/dist/handler-
|
|
22295
|
+
//#region ../mcp-core/dist/handler-CzGXq51l.js
|
|
20850
22296
|
var handler_default$1 = defineTool({
|
|
20851
22297
|
name: "search_issues",
|
|
20852
22298
|
skills: [
|
|
@@ -20866,6 +22312,7 @@ var handler_default$1 = defineTool({
|
|
|
20866
22312
|
"- Filtered issue lists: 'unresolved issues', 'critical bugs'",
|
|
20867
22313
|
"- Issues by impact: 'errors affecting more than 100 users'",
|
|
20868
22314
|
"- Issues by assignment: 'issues assigned to me'",
|
|
22315
|
+
"- User feedback: 'show me user feedback', 'feedback from last week'",
|
|
20869
22316
|
"",
|
|
20870
22317
|
"DO NOT USE FOR COUNTS/AGGREGATIONS:",
|
|
20871
22318
|
"- 'how many errors' → use search_events",
|
|
@@ -20883,6 +22330,7 @@ var handler_default$1 = defineTool({
|
|
|
20883
22330
|
"search_issues(organizationSlug='my-org', naturalLanguageQuery='critical bugs from last week')",
|
|
20884
22331
|
"search_issues(organizationSlug='my-org', naturalLanguageQuery='unhandled errors affecting 100+ users')",
|
|
20885
22332
|
"search_issues(organizationSlug='my-org', naturalLanguageQuery='issues assigned to me')",
|
|
22333
|
+
"search_issues(organizationSlug='my-org', naturalLanguageQuery='user feedback from production')",
|
|
20886
22334
|
"</examples>",
|
|
20887
22335
|
"",
|
|
20888
22336
|
"<hints>",
|
|
@@ -20905,69 +22353,625 @@ var handler_default$1 = defineTool({
|
|
|
20905
22353
|
},
|
|
20906
22354
|
async handler(params, context$1) {
|
|
20907
22355
|
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
20908
|
-
(0, __sentry_core.setTag)("organization.slug", params.organizationSlug);
|
|
20909
|
-
if (params.projectSlugOrId) if (isNumericId(params.projectSlugOrId)) (0, __sentry_core.setTag)("project.id", params.projectSlugOrId);
|
|
20910
|
-
else (0, __sentry_core.setTag)("project.slug", params.projectSlugOrId);
|
|
22356
|
+
(0, __sentry_core.setTag)("organization.slug", params.organizationSlug);
|
|
22357
|
+
if (params.projectSlugOrId) if (isNumericId(params.projectSlugOrId)) (0, __sentry_core.setTag)("project.id", params.projectSlugOrId);
|
|
22358
|
+
else (0, __sentry_core.setTag)("project.slug", params.projectSlugOrId);
|
|
22359
|
+
let projectId;
|
|
22360
|
+
if (params.projectSlugOrId) if (isNumericId(params.projectSlugOrId)) projectId = params.projectSlugOrId;
|
|
22361
|
+
else {
|
|
22362
|
+
const project = await apiService.getProject({
|
|
22363
|
+
organizationSlug: params.organizationSlug,
|
|
22364
|
+
projectSlugOrId: params.projectSlugOrId
|
|
22365
|
+
});
|
|
22366
|
+
projectId = String(project.id);
|
|
22367
|
+
}
|
|
22368
|
+
const agentResult = await searchIssuesAgent({
|
|
22369
|
+
query: params.naturalLanguageQuery,
|
|
22370
|
+
organizationSlug: params.organizationSlug,
|
|
22371
|
+
apiService,
|
|
22372
|
+
projectId
|
|
22373
|
+
});
|
|
22374
|
+
const translatedQuery = agentResult.result;
|
|
22375
|
+
const issues = await apiService.listIssues({
|
|
22376
|
+
organizationSlug: params.organizationSlug,
|
|
22377
|
+
projectSlug: params.projectSlugOrId ?? void 0,
|
|
22378
|
+
query: translatedQuery.query ?? void 0,
|
|
22379
|
+
sortBy: translatedQuery.sort || "date",
|
|
22380
|
+
limit: params.limit
|
|
22381
|
+
});
|
|
22382
|
+
let output = "";
|
|
22383
|
+
if (params.includeExplanation) {
|
|
22384
|
+
output += `# Search Results for "${params.naturalLanguageQuery}"\n\n`;
|
|
22385
|
+
output += `⚠️ **IMPORTANT**: Display these issues as highlighted cards with status indicators, assignee info, and clickable Issue IDs.\n\n`;
|
|
22386
|
+
output += `## Query Translation\n`;
|
|
22387
|
+
output += `Natural language: "${params.naturalLanguageQuery}"\n`;
|
|
22388
|
+
output += `Sentry query: \`${translatedQuery.query}\``;
|
|
22389
|
+
if (translatedQuery.sort) output += `\nSort: ${translatedQuery.sort}`;
|
|
22390
|
+
output += `\n\n`;
|
|
22391
|
+
if (translatedQuery.explanation) {
|
|
22392
|
+
output += formatExplanation(translatedQuery.explanation);
|
|
22393
|
+
output += `\n\n`;
|
|
22394
|
+
}
|
|
22395
|
+
output += formatIssueResults({
|
|
22396
|
+
issues,
|
|
22397
|
+
organizationSlug: params.organizationSlug,
|
|
22398
|
+
projectSlugOrId: params.projectSlugOrId ?? void 0,
|
|
22399
|
+
query: translatedQuery.query,
|
|
22400
|
+
regionUrl: params.regionUrl ?? void 0,
|
|
22401
|
+
naturalLanguageQuery: params.naturalLanguageQuery,
|
|
22402
|
+
skipHeader: true
|
|
22403
|
+
});
|
|
22404
|
+
} else output = formatIssueResults({
|
|
22405
|
+
issues,
|
|
22406
|
+
organizationSlug: params.organizationSlug,
|
|
22407
|
+
projectSlugOrId: params.projectSlugOrId ?? void 0,
|
|
22408
|
+
query: translatedQuery.query,
|
|
22409
|
+
regionUrl: params.regionUrl ?? void 0,
|
|
22410
|
+
naturalLanguageQuery: params.naturalLanguageQuery,
|
|
22411
|
+
skipHeader: false
|
|
22412
|
+
});
|
|
22413
|
+
return output;
|
|
22414
|
+
}
|
|
22415
|
+
});
|
|
22416
|
+
|
|
22417
|
+
//#endregion
|
|
22418
|
+
//#region ../mcp-core/dist/config-mlP4H0sA.js
|
|
22419
|
+
const systemPrompt$2 = `You are a Sentry issue event filter translator. Your job is to:
|
|
22420
|
+
1. Translate natural language queries into Sentry tag filters for events within a SPECIFIC issue
|
|
22421
|
+
2. Select appropriate fields to return in the results
|
|
22422
|
+
3. Determine sort order and time ranges
|
|
22423
|
+
|
|
22424
|
+
IMPORTANT CONTEXT:
|
|
22425
|
+
- You are filtering events WITHIN a specific issue (the API endpoint is already scoped to that issue)
|
|
22426
|
+
- DO NOT include "issue:" in your query - the endpoint filters by issue automatically
|
|
22427
|
+
- Focus on tag-based filtering: release, environment, user, trace ID, URL, etc.
|
|
22428
|
+
- You are working with the "errors" dataset (issues are groups of error events)
|
|
22429
|
+
|
|
22430
|
+
CRITICAL - TAG FIELD VERIFICATION:
|
|
22431
|
+
Before using ANY tag or field, you should call the issueEventFields tool to verify it exists:
|
|
22432
|
+
1. Available tags vary by project and what data is being sent
|
|
22433
|
+
2. Using non-existent tags will cause query failures
|
|
22434
|
+
3. The issueEventFields tool returns ALL available tags for the issue's project
|
|
22435
|
+
4. Field names may not be what you expect (e.g., "user_agent.original" not "browser")
|
|
22436
|
+
|
|
22437
|
+
TOOL USAGE GUIDELINES:
|
|
22438
|
+
1. Use issueEventFields tool (no parameters) to discover available tags and fields
|
|
22439
|
+
2. Use whoami tool when queries reference "me", "my", or "myself" for user.id/user.email
|
|
22440
|
+
3. CRITICAL: All tools return {error?, result?} format - check for errors before using results
|
|
22441
|
+
|
|
22442
|
+
QUERY CONSTRUCTION:
|
|
22443
|
+
Your query should contain ONLY the filter expressions (tags, operators, values):
|
|
22444
|
+
- CORRECT: "environment:production release:v1.0.5"
|
|
22445
|
+
- CORRECT: "user.email:alice@example.com"
|
|
22446
|
+
- CORRECT: 'url:"*/checkout/*"'
|
|
22447
|
+
- WRONG: "issue:MCP-41 environment:production" ← DO NOT include issue: prefix
|
|
22448
|
+
|
|
22449
|
+
COMMON TAG PATTERNS:
|
|
22450
|
+
- release:VERSION - Filter by software release/version
|
|
22451
|
+
- environment:ENV - Filter by environment (production, staging, development)
|
|
22452
|
+
- user:USER_ID or user.email:EMAIL - Filter by user
|
|
22453
|
+
- trace:TRACE_ID - Filter by distributed trace ID
|
|
22454
|
+
- url:URL_PATTERN - Filter by request URL (use wildcards: "*/path/*")
|
|
22455
|
+
- transaction:NAME - Filter by transaction name
|
|
22456
|
+
- level:LEVEL - Filter by error level (error, warning, fatal, info)
|
|
22457
|
+
- device:DEVICE - Filter by device identifier
|
|
22458
|
+
- os:OS_NAME - Filter by operating system
|
|
22459
|
+
- browser:BROWSER - Filter by browser name
|
|
22460
|
+
- runtime:RUNTIME - Filter by runtime version (e.g., "python 3.11")
|
|
22461
|
+
|
|
22462
|
+
WILDCARD MATCHING:
|
|
22463
|
+
- Use "*" for wildcards in string values
|
|
22464
|
+
- Example: url:"*/checkout/*" matches any URL containing /checkout/
|
|
22465
|
+
- Example: release:"1.2.*" matches any 1.2.x release
|
|
22466
|
+
|
|
22467
|
+
TIME RANGE HANDLING:
|
|
22468
|
+
For time-based queries ("last hour", "yesterday", "from Dec 16"):
|
|
22469
|
+
- Relative: Use statsPeriod ("1h", "24h", "7d", "14d", "30d")
|
|
22470
|
+
- "last hour" → {"statsPeriod": "1h"}
|
|
22471
|
+
- "yesterday" → {"statsPeriod": "24h"}
|
|
22472
|
+
- "last week" → {"statsPeriod": "7d"}
|
|
22473
|
+
- Absolute: Use start/end (ISO 8601 format)
|
|
22474
|
+
- "from Dec 16 2025 17:50 UTC" → {"start": "2025-12-16T17:50:00Z", "end": "2025-12-17T23:59:59Z"}
|
|
22475
|
+
- Default: If no time mentioned, use {"statsPeriod": "14d"}
|
|
22476
|
+
|
|
22477
|
+
FIELD SELECTION:
|
|
22478
|
+
- Use recommended default fields unless user asks for specific data
|
|
22479
|
+
- For custom fields, verify availability with issueEventFields tool
|
|
22480
|
+
- Common useful fields:
|
|
22481
|
+
- id: Event ID
|
|
22482
|
+
- timestamp: When event occurred
|
|
22483
|
+
- title: Event title/message
|
|
22484
|
+
- message: Full error message
|
|
22485
|
+
- level: Error severity
|
|
22486
|
+
- environment: Deployment environment
|
|
22487
|
+
- release: Release version
|
|
22488
|
+
- user.display: User identifier
|
|
22489
|
+
- trace: Trace ID
|
|
22490
|
+
- url: Request URL
|
|
22491
|
+
- device: Device identifier
|
|
22492
|
+
- os: Operating system
|
|
22493
|
+
- runtime: Runtime environment
|
|
22494
|
+
|
|
22495
|
+
SORTING RULES (CRITICAL):
|
|
22496
|
+
1. ALWAYS specify a sort parameter
|
|
22497
|
+
2. Default: "-timestamp" (newest first) for time-based browsing
|
|
22498
|
+
3. Use "-" prefix for descending order
|
|
22499
|
+
4. CRITICAL: Sort field MUST be included in your fields array
|
|
22500
|
+
5. Examples:
|
|
22501
|
+
- sort: "-timestamp", fields: ["id", "timestamp", "message"] ✓ CORRECT
|
|
22502
|
+
- sort: "-level", fields: ["id", "timestamp"] ✗ WRONG (level not in fields)
|
|
22503
|
+
|
|
22504
|
+
DO NOT USE:
|
|
22505
|
+
- Aggregate functions (count, avg, sum) - this tool returns individual events, not statistics
|
|
22506
|
+
- SQL syntax (IS NULL, yesterday(), etc.) - use has: operator and timeRange instead
|
|
22507
|
+
- Field existence checks unless necessary (has:field_name, !has:field_name)
|
|
22508
|
+
|
|
22509
|
+
HANDLING "ME" REFERENCES:
|
|
22510
|
+
- If query contains "me", "my errors", "assigned to me", use whoami tool
|
|
22511
|
+
- Replace "me" with actual user.id or user.email value
|
|
22512
|
+
- Example: "my errors" + whoami returns user.email:"alice@example.com"
|
|
22513
|
+
→ query: "user.email:alice@example.com"
|
|
22514
|
+
|
|
22515
|
+
YOUR RESPONSE FORMAT:
|
|
22516
|
+
Return a JSON object with:
|
|
22517
|
+
- "query": Tag filter expressions (empty string "" for no filters)
|
|
22518
|
+
- "fields": Array of field names to return (use recommended defaults if not specified)
|
|
22519
|
+
- "sort": Sort parameter (REQUIRED - default to "-timestamp")
|
|
22520
|
+
- "timeRange": Optional time range
|
|
22521
|
+
- Relative: {"statsPeriod": "24h"}
|
|
22522
|
+
- Absolute: {"start": "2025-01-01T00:00:00Z", "end": "2025-01-02T00:00:00Z"}
|
|
22523
|
+
- Omit for default 14-day window
|
|
22524
|
+
- "explanation": Brief explanation of how you translated the query
|
|
22525
|
+
|
|
22526
|
+
CORRECT QUERY EXAMPLES:
|
|
22527
|
+
1. "events from last hour"
|
|
22528
|
+
→ {
|
|
22529
|
+
"query": "",
|
|
22530
|
+
"fields": ["id", "timestamp", "title", "message", "level"],
|
|
22531
|
+
"sort": "-timestamp",
|
|
22532
|
+
"timeRange": {"statsPeriod": "1h"},
|
|
22533
|
+
"explanation": "Filtering to events from last hour, sorted newest first"
|
|
22534
|
+
}
|
|
22535
|
+
|
|
22536
|
+
2. "production events with release v1.0.5"
|
|
22537
|
+
→ {
|
|
22538
|
+
"query": "environment:production release:v1.0.5",
|
|
22539
|
+
"fields": ["id", "timestamp", "title", "environment", "release"],
|
|
22540
|
+
"sort": "-timestamp",
|
|
22541
|
+
"timeRange": {"statsPeriod": "14d"},
|
|
22542
|
+
"explanation": "Filtering to production environment with specific release"
|
|
22543
|
+
}
|
|
22544
|
+
|
|
22545
|
+
3. "errors affecting user alice@example.com"
|
|
22546
|
+
→ {
|
|
22547
|
+
"query": "user.email:alice@example.com",
|
|
22548
|
+
"fields": ["id", "timestamp", "title", "user.display", "message"],
|
|
22549
|
+
"sort": "-timestamp",
|
|
22550
|
+
"timeRange": {"statsPeriod": "14d"},
|
|
22551
|
+
"explanation": "Filtering to events affecting specific user"
|
|
22552
|
+
}
|
|
22553
|
+
|
|
22554
|
+
4. "events with trace ID abc123"
|
|
22555
|
+
→ {
|
|
22556
|
+
"query": "trace:abc123",
|
|
22557
|
+
"fields": ["id", "timestamp", "title", "trace", "url", "transaction"],
|
|
22558
|
+
"sort": "-timestamp",
|
|
22559
|
+
"timeRange": {"statsPeriod": "14d"},
|
|
22560
|
+
"explanation": "Filtering to events with specific trace ID"
|
|
22561
|
+
}
|
|
22562
|
+
|
|
22563
|
+
PROCESS:
|
|
22564
|
+
1. Analyze the user's natural language query
|
|
22565
|
+
2. Call issueEventFields tool to discover available tags (if needed)
|
|
22566
|
+
3. Call whoami tool if query references "me" (if needed)
|
|
22567
|
+
4. Construct tag filters (WITHOUT "issue:" prefix)
|
|
22568
|
+
5. Select appropriate fields
|
|
22569
|
+
6. Determine sort order (default: "-timestamp")
|
|
22570
|
+
7. Determine time range (if applicable)
|
|
22571
|
+
8. Return JSON response with explanation
|
|
22572
|
+
|
|
22573
|
+
COMMON ERRORS TO AVOID:
|
|
22574
|
+
- Including "issue:" in query (handler adds this automatically)
|
|
22575
|
+
- Using aggregate functions like count() or avg()
|
|
22576
|
+
- Using non-existent field names (verify with issueEventFields tool)
|
|
22577
|
+
- Forgetting to include sort field in fields array
|
|
22578
|
+
- Using SQL syntax instead of Sentry query syntax`;
|
|
22579
|
+
const ISSUE_EVENT_TAGS = {
|
|
22580
|
+
release: "Software version/release identifier",
|
|
22581
|
+
environment: "Deployment environment (production, staging, development, etc.)",
|
|
22582
|
+
level: "Error severity level (error, warning, fatal, info, debug)",
|
|
22583
|
+
user: "User identifier",
|
|
22584
|
+
"user.id": "User ID",
|
|
22585
|
+
"user.email": "User email address",
|
|
22586
|
+
"user.username": "Username",
|
|
22587
|
+
"user.display": "User display name (formatted)",
|
|
22588
|
+
transaction: "Transaction name/route",
|
|
22589
|
+
url: "Request URL",
|
|
22590
|
+
trace: "Distributed trace ID",
|
|
22591
|
+
device: "Device identifier",
|
|
22592
|
+
"device.family": "Device family",
|
|
22593
|
+
os: "Operating system name",
|
|
22594
|
+
"os.name": "OS name",
|
|
22595
|
+
"os.version": "OS version",
|
|
22596
|
+
runtime: "Runtime environment",
|
|
22597
|
+
"runtime.name": "Runtime name (e.g., CPython)",
|
|
22598
|
+
"runtime.version": "Runtime version",
|
|
22599
|
+
browser: "Browser identifier",
|
|
22600
|
+
"browser.name": "Browser name",
|
|
22601
|
+
"browser.version": "Browser version",
|
|
22602
|
+
handled: "Whether error was handled (true/false)",
|
|
22603
|
+
mechanism: "Error mechanism type",
|
|
22604
|
+
"error.type": "Exception type/class name",
|
|
22605
|
+
"stack.filename": "Source file where error occurred",
|
|
22606
|
+
"stack.function": "Function where error occurred",
|
|
22607
|
+
"stack.module": "Module where error occurred",
|
|
22608
|
+
platform: "SDK platform (javascript, python, etc.)",
|
|
22609
|
+
"sdk.name": "SDK name",
|
|
22610
|
+
"sdk.version": "SDK version",
|
|
22611
|
+
"http.method": "HTTP request method",
|
|
22612
|
+
"http.status_code": "HTTP status code",
|
|
22613
|
+
"user_agent.original": "Original user agent string"
|
|
22614
|
+
};
|
|
22615
|
+
const RECOMMENDED_FIELDS$1 = [
|
|
22616
|
+
"id",
|
|
22617
|
+
"timestamp",
|
|
22618
|
+
"title",
|
|
22619
|
+
"message",
|
|
22620
|
+
"level",
|
|
22621
|
+
"environment",
|
|
22622
|
+
"release",
|
|
22623
|
+
"user.display",
|
|
22624
|
+
"trace",
|
|
22625
|
+
"url"
|
|
22626
|
+
];
|
|
22627
|
+
const EXAMPLE_QUERIES = [
|
|
22628
|
+
{
|
|
22629
|
+
description: "Events from last hour",
|
|
22630
|
+
output: {
|
|
22631
|
+
query: "",
|
|
22632
|
+
fields: RECOMMENDED_FIELDS$1,
|
|
22633
|
+
sort: "-timestamp",
|
|
22634
|
+
timeRange: { statsPeriod: "1h" }
|
|
22635
|
+
}
|
|
22636
|
+
},
|
|
22637
|
+
{
|
|
22638
|
+
description: "Production events with specific release",
|
|
22639
|
+
output: {
|
|
22640
|
+
query: "environment:production release:09f66121-a5a3-4947-8be1-1454c4cefa3d",
|
|
22641
|
+
fields: [
|
|
22642
|
+
"id",
|
|
22643
|
+
"timestamp",
|
|
22644
|
+
"title",
|
|
22645
|
+
"environment",
|
|
22646
|
+
"release",
|
|
22647
|
+
"user.display"
|
|
22648
|
+
],
|
|
22649
|
+
sort: "-timestamp",
|
|
22650
|
+
timeRange: { statsPeriod: "7d" }
|
|
22651
|
+
}
|
|
22652
|
+
},
|
|
22653
|
+
{
|
|
22654
|
+
description: "Events affecting specific user",
|
|
22655
|
+
output: {
|
|
22656
|
+
query: "user.email:alice@example.com",
|
|
22657
|
+
fields: [
|
|
22658
|
+
"id",
|
|
22659
|
+
"timestamp",
|
|
22660
|
+
"title",
|
|
22661
|
+
"user.display",
|
|
22662
|
+
"user.email",
|
|
22663
|
+
"message"
|
|
22664
|
+
],
|
|
22665
|
+
sort: "-timestamp",
|
|
22666
|
+
timeRange: { statsPeriod: "14d" }
|
|
22667
|
+
}
|
|
22668
|
+
},
|
|
22669
|
+
{
|
|
22670
|
+
description: "Events with specific trace ID",
|
|
22671
|
+
output: {
|
|
22672
|
+
query: "trace:abc123def456",
|
|
22673
|
+
fields: [
|
|
22674
|
+
"id",
|
|
22675
|
+
"timestamp",
|
|
22676
|
+
"title",
|
|
22677
|
+
"trace",
|
|
22678
|
+
"url",
|
|
22679
|
+
"transaction"
|
|
22680
|
+
],
|
|
22681
|
+
sort: "-timestamp",
|
|
22682
|
+
timeRange: { statsPeriod: "14d" }
|
|
22683
|
+
}
|
|
22684
|
+
},
|
|
22685
|
+
{
|
|
22686
|
+
description: "Events from checkout flow",
|
|
22687
|
+
output: {
|
|
22688
|
+
query: "url:\"*/checkout/*\"",
|
|
22689
|
+
fields: [
|
|
22690
|
+
"id",
|
|
22691
|
+
"timestamp",
|
|
22692
|
+
"title",
|
|
22693
|
+
"url",
|
|
22694
|
+
"transaction",
|
|
22695
|
+
"user.display"
|
|
22696
|
+
],
|
|
22697
|
+
sort: "-timestamp",
|
|
22698
|
+
timeRange: { statsPeriod: "7d" }
|
|
22699
|
+
}
|
|
22700
|
+
},
|
|
22701
|
+
{
|
|
22702
|
+
description: "Fatal errors only",
|
|
22703
|
+
output: {
|
|
22704
|
+
query: "level:fatal",
|
|
22705
|
+
fields: [
|
|
22706
|
+
"id",
|
|
22707
|
+
"timestamp",
|
|
22708
|
+
"title",
|
|
22709
|
+
"level",
|
|
22710
|
+
"message",
|
|
22711
|
+
"error.type"
|
|
22712
|
+
],
|
|
22713
|
+
sort: "-timestamp",
|
|
22714
|
+
timeRange: { statsPeriod: "30d" }
|
|
22715
|
+
}
|
|
22716
|
+
},
|
|
22717
|
+
{
|
|
22718
|
+
description: "Events on mobile devices",
|
|
22719
|
+
output: {
|
|
22720
|
+
query: "device:mobile OR device.family:mobile",
|
|
22721
|
+
fields: [
|
|
22722
|
+
"id",
|
|
22723
|
+
"timestamp",
|
|
22724
|
+
"title",
|
|
22725
|
+
"device",
|
|
22726
|
+
"device.family",
|
|
22727
|
+
"os",
|
|
22728
|
+
"browser"
|
|
22729
|
+
],
|
|
22730
|
+
sort: "-timestamp",
|
|
22731
|
+
timeRange: { statsPeriod: "7d" }
|
|
22732
|
+
}
|
|
22733
|
+
},
|
|
22734
|
+
{
|
|
22735
|
+
description: "Events from specific browser",
|
|
22736
|
+
output: {
|
|
22737
|
+
query: "browser.name:Chrome",
|
|
22738
|
+
fields: [
|
|
22739
|
+
"id",
|
|
22740
|
+
"timestamp",
|
|
22741
|
+
"title",
|
|
22742
|
+
"browser.name",
|
|
22743
|
+
"browser.version",
|
|
22744
|
+
"os"
|
|
22745
|
+
],
|
|
22746
|
+
sort: "-timestamp",
|
|
22747
|
+
timeRange: { statsPeriod: "7d" }
|
|
22748
|
+
}
|
|
22749
|
+
}
|
|
22750
|
+
];
|
|
22751
|
+
|
|
22752
|
+
//#endregion
|
|
22753
|
+
//#region ../mcp-core/dist/utils-D8xperPO.js
|
|
22754
|
+
/**
|
|
22755
|
+
* Create a tool for the agent to query available tags and fields for issue events
|
|
22756
|
+
* The tool is pre-bound with the API service and organization configured for the appropriate region
|
|
22757
|
+
*/
|
|
22758
|
+
function createIssueEventFieldsTool(options) {
|
|
22759
|
+
const { apiService, organizationSlug, projectId } = options;
|
|
22760
|
+
return agentTool({
|
|
22761
|
+
description: "Get available tags and fields for issue events to understand what filters are available",
|
|
22762
|
+
parameters: zod.z.object({}),
|
|
22763
|
+
execute: async () => {
|
|
22764
|
+
const tagsResponse = await apiService.listTags({
|
|
22765
|
+
organizationSlug,
|
|
22766
|
+
dataset: "events",
|
|
22767
|
+
project: projectId,
|
|
22768
|
+
statsPeriod: "14d",
|
|
22769
|
+
useCache: true,
|
|
22770
|
+
useFlagsBackend: true
|
|
22771
|
+
});
|
|
22772
|
+
const availableTags = {};
|
|
22773
|
+
for (const tag of tagsResponse) if (tag.key) {
|
|
22774
|
+
const knownTagDescription = ISSUE_EVENT_TAGS[tag.key];
|
|
22775
|
+
availableTags[tag.key] = tag.name || knownTagDescription || tag.key;
|
|
22776
|
+
}
|
|
22777
|
+
const allTags = {
|
|
22778
|
+
...ISSUE_EVENT_TAGS,
|
|
22779
|
+
...availableTags
|
|
22780
|
+
};
|
|
22781
|
+
return `Available Tags and Fields (${Object.keys(allTags).length} total):
|
|
22782
|
+
|
|
22783
|
+
Common Tags:
|
|
22784
|
+
${Object.entries(ISSUE_EVENT_TAGS).slice(0, 30).map(([key, desc]) => `- ${key}: ${desc}`).join("\n")}
|
|
22785
|
+
${Object.keys(ISSUE_EVENT_TAGS).length > 30 ? `\n... and ${Object.keys(ISSUE_EVENT_TAGS).length - 30} more common tags` : ""}
|
|
22786
|
+
|
|
22787
|
+
Project-Specific Tags (from API):
|
|
22788
|
+
${Object.entries(availableTags).filter(([key]) => !ISSUE_EVENT_TAGS[key]).slice(0, 20).map(([key, desc]) => `- ${key}: ${desc}`).join("\n")}
|
|
22789
|
+
|
|
22790
|
+
Recommended Fields for Results:
|
|
22791
|
+
${RECOMMENDED_FIELDS$1.map((f) => `- ${f}`).join("\n")}
|
|
22792
|
+
|
|
22793
|
+
EXAMPLE QUERIES:
|
|
22794
|
+
${EXAMPLE_QUERIES.map((ex) => `- "${ex.description}" →\n ${JSON.stringify(ex.output, null, 2)}`).join("\n\n")}
|
|
22795
|
+
|
|
22796
|
+
IMPORTANT:
|
|
22797
|
+
- Use these tag names exactly as shown in your query
|
|
22798
|
+
- Tags are case-insensitive
|
|
22799
|
+
- Use wildcards with quotes: url:"*/checkout/*"
|
|
22800
|
+
- Your query should NOT include "issue:" prefix - the handler adds it automatically`;
|
|
22801
|
+
}
|
|
22802
|
+
});
|
|
22803
|
+
}
|
|
22804
|
+
/**
|
|
22805
|
+
* Parse issue parameters from various input formats
|
|
22806
|
+
* Supports both direct issueId/organizationSlug and issueUrl parsing
|
|
22807
|
+
*/
|
|
22808
|
+
function parseIssueParams(params) {
|
|
22809
|
+
if (params.issueUrl) {
|
|
22810
|
+
const orgMatch = params.issueUrl.match(/\/organizations\/([^/]+)\/issues\/([^/?]+)/) || params.issueUrl.match(/https?:\/\/([^.]+)\.sentry\.io\/issues\/([^/?]+)/);
|
|
22811
|
+
if (!orgMatch) throw new UserInputError(`Invalid issue URL format. Expected format like:
|
|
22812
|
+
- https://sentry.io/organizations/my-org/issues/123/
|
|
22813
|
+
- https://my-org.sentry.io/issues/123/
|
|
22814
|
+
|
|
22815
|
+
Received: ${params.issueUrl}`);
|
|
22816
|
+
return {
|
|
22817
|
+
organizationSlug: orgMatch[1],
|
|
22818
|
+
issueId: orgMatch[2]
|
|
22819
|
+
};
|
|
22820
|
+
}
|
|
22821
|
+
if (!params.issueId) throw new UserInputError("Must provide either issueUrl or issueId parameter. Use issueUrl for convenience, or provide both issueId and organizationSlug.");
|
|
22822
|
+
if (!params.organizationSlug) throw new UserInputError("When using issueId parameter, organizationSlug is required. Alternatively, provide issueUrl which includes both organization and issue ID.");
|
|
22823
|
+
return {
|
|
22824
|
+
organizationSlug: params.organizationSlug,
|
|
22825
|
+
issueId: params.issueId
|
|
22826
|
+
};
|
|
22827
|
+
}
|
|
22828
|
+
|
|
22829
|
+
//#endregion
|
|
22830
|
+
//#region ../mcp-core/dist/agent-zpc_iP4u.js
|
|
22831
|
+
const searchIssueEventsAgentOutputSchema = zod.z.object({
|
|
22832
|
+
query: zod.z.string().describe("Sentry query filters for tags/fields (NOT including issue: prefix - handler adds that)"),
|
|
22833
|
+
fields: zod.z.array(zod.z.string()).describe("Array of field names to return in results"),
|
|
22834
|
+
sort: zod.z.string().describe("Sort parameter for results (e.g., -timestamp)"),
|
|
22835
|
+
timeRange: zod.z.union([
|
|
22836
|
+
zod.z.object({ statsPeriod: zod.z.string().describe("Relative time period like '1h', '24h', '7d', '14d'") }),
|
|
22837
|
+
zod.z.object({
|
|
22838
|
+
start: zod.z.string().describe("ISO 8601 start time"),
|
|
22839
|
+
end: zod.z.string().describe("ISO 8601 end time")
|
|
22840
|
+
}),
|
|
22841
|
+
zod.z.null()
|
|
22842
|
+
]).describe("Time range for filtering events. Use either statsPeriod for relative time or start/end for absolute time. Use null for default 14-day window."),
|
|
22843
|
+
explanation: zod.z.string().describe("Brief explanation of how you translated this query")
|
|
22844
|
+
}).refine((data) => {
|
|
22845
|
+
if (!data.sort || !data.fields || data.fields.length === 0) return true;
|
|
22846
|
+
const sortField = data.sort.startsWith("-") ? data.sort.substring(1) : data.sort;
|
|
22847
|
+
return data.fields.includes(sortField);
|
|
22848
|
+
}, { 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." });
|
|
22849
|
+
/**
|
|
22850
|
+
* Search issue events agent - translates natural language queries to Sentry tag filters for events within a specific issue
|
|
22851
|
+
* Returns both the translated query result AND the tool calls made by the agent
|
|
22852
|
+
*/
|
|
22853
|
+
async function searchIssueEventsAgent(options) {
|
|
22854
|
+
const issueEventFieldsTool = createIssueEventFieldsTool({
|
|
22855
|
+
apiService: options.apiService,
|
|
22856
|
+
organizationSlug: options.organizationSlug,
|
|
22857
|
+
projectId: options.projectId
|
|
22858
|
+
});
|
|
22859
|
+
const whoamiTool = createWhoamiTool({ apiService: options.apiService });
|
|
22860
|
+
return await callEmbeddedAgent({
|
|
22861
|
+
system: systemPrompt$2,
|
|
22862
|
+
prompt: options.query,
|
|
22863
|
+
tools: {
|
|
22864
|
+
issueEventFields: issueEventFieldsTool,
|
|
22865
|
+
whoami: whoamiTool
|
|
22866
|
+
},
|
|
22867
|
+
schema: searchIssueEventsAgentOutputSchema
|
|
22868
|
+
});
|
|
22869
|
+
}
|
|
22870
|
+
|
|
22871
|
+
//#endregion
|
|
22872
|
+
//#region ../mcp-core/dist/handler-9NRJi9hO.js
|
|
22873
|
+
var handler_default$2 = defineTool({
|
|
22874
|
+
name: "search_issue_events",
|
|
22875
|
+
skills: ["inspect", "triage"],
|
|
22876
|
+
requiredScopes: ["event:read"],
|
|
22877
|
+
description: [
|
|
22878
|
+
"Search and filter events within a specific issue using natural language queries.",
|
|
22879
|
+
"",
|
|
22880
|
+
"Use this to filter events by time, environment, release, user, trace ID, or other tags. The tool automatically constrains results to the specified issue.",
|
|
22881
|
+
"",
|
|
22882
|
+
"For cross-issue searches use search_issues, for single event details use get_issue_details.",
|
|
22883
|
+
"",
|
|
22884
|
+
"<examples>",
|
|
22885
|
+
"search_issue_events(issueId='MCP-41', organizationSlug='my-org', naturalLanguageQuery='from last hour')",
|
|
22886
|
+
"search_issue_events(issueUrl='https://sentry.io/.../issues/123/', naturalLanguageQuery='production with release v1.0')",
|
|
22887
|
+
"</examples>"
|
|
22888
|
+
].join("\n"),
|
|
22889
|
+
inputSchema: {
|
|
22890
|
+
organizationSlug: ParamOrganizationSlug.nullable().default(null).describe("Organization slug. Required when using issueId. Not needed when using issueUrl."),
|
|
22891
|
+
issueId: zod.z.string().optional().describe("Issue ID (e.g., 'MCP-41', 'PROJECT-123'). Requires organizationSlug. Alternatively, use issueUrl."),
|
|
22892
|
+
issueUrl: zod.z.string().url().optional().describe("Full Sentry issue URL (e.g., 'https://sentry.io/organizations/my-org/issues/123/'). Includes both organization and issue ID."),
|
|
22893
|
+
naturalLanguageQuery: zod.z.string().trim().min(1).describe("Natural language description of what events you want to find within this issue. Examples: 'from last hour', 'production with release v1.0', 'affecting user alice@example.com', 'with trace ID abc123'"),
|
|
22894
|
+
projectSlug: ParamProjectSlug.nullable().default(null).describe("Project slug for better tag discovery. Optional - helps find project-specific tags."),
|
|
22895
|
+
regionUrl: ParamRegionUrl.nullable().default(null).describe("Sentry region URL. Optional - defaults to main region."),
|
|
22896
|
+
limit: zod.z.number().min(1).max(100).default(50).describe("Maximum number of events to return (1-100, default: 50)"),
|
|
22897
|
+
includeExplanation: zod.z.boolean().default(false).describe("Include explanation of how the natural language query was translated to Sentry syntax")
|
|
22898
|
+
},
|
|
22899
|
+
annotations: {
|
|
22900
|
+
readOnlyHint: true,
|
|
22901
|
+
openWorldHint: true
|
|
22902
|
+
},
|
|
22903
|
+
async handler(params, context$1) {
|
|
22904
|
+
const { organizationSlug, issueId } = parseIssueParams({
|
|
22905
|
+
organizationSlug: params.organizationSlug,
|
|
22906
|
+
issueId: params.issueId,
|
|
22907
|
+
issueUrl: params.issueUrl
|
|
22908
|
+
});
|
|
22909
|
+
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
22910
|
+
(0, __sentry_core.setTag)("organization.slug", organizationSlug);
|
|
22911
|
+
(0, __sentry_core.setTag)("issue.id", issueId);
|
|
22912
|
+
if (params.projectSlug) (0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
20911
22913
|
let projectId;
|
|
20912
|
-
if (params.
|
|
20913
|
-
else {
|
|
22914
|
+
if (params.projectSlug) try {
|
|
20914
22915
|
const project = await apiService.getProject({
|
|
20915
|
-
organizationSlug
|
|
20916
|
-
projectSlugOrId: params.
|
|
22916
|
+
organizationSlug,
|
|
22917
|
+
projectSlugOrId: params.projectSlug
|
|
20917
22918
|
});
|
|
20918
22919
|
projectId = String(project.id);
|
|
22920
|
+
} catch (error) {
|
|
22921
|
+
console.warn(`Could not resolve project ${params.projectSlug}:`, error);
|
|
20919
22922
|
}
|
|
20920
|
-
const agentResult = await
|
|
22923
|
+
const agentResult = await searchIssueEventsAgent({
|
|
20921
22924
|
query: params.naturalLanguageQuery,
|
|
20922
|
-
organizationSlug
|
|
22925
|
+
organizationSlug,
|
|
20923
22926
|
apiService,
|
|
20924
22927
|
projectId
|
|
20925
22928
|
});
|
|
20926
|
-
const
|
|
20927
|
-
|
|
20928
|
-
|
|
20929
|
-
|
|
20930
|
-
|
|
20931
|
-
|
|
20932
|
-
|
|
20933
|
-
|
|
20934
|
-
|
|
20935
|
-
|
|
20936
|
-
|
|
20937
|
-
|
|
20938
|
-
output += `## Query Translation\n`;
|
|
20939
|
-
output += `Natural language: "${params.naturalLanguageQuery}"\n`;
|
|
20940
|
-
output += `Sentry query: \`${translatedQuery.query}\``;
|
|
20941
|
-
if (translatedQuery.sort) output += `\nSort: ${translatedQuery.sort}`;
|
|
20942
|
-
output += `\n\n`;
|
|
20943
|
-
if (translatedQuery.explanation) {
|
|
20944
|
-
output += formatExplanation(translatedQuery.explanation);
|
|
20945
|
-
output += `\n\n`;
|
|
22929
|
+
const parsed = agentResult.result;
|
|
22930
|
+
if (!parsed.sort) throw new UserInputError(`Search Issue 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).`);
|
|
22931
|
+
const query = parsed.query || "";
|
|
22932
|
+
const requestedFields = parsed.fields || [];
|
|
22933
|
+
const fields = requestedFields.length > 0 ? requestedFields : RECOMMENDED_FIELDS$1;
|
|
22934
|
+
const sortParam = parsed.sort;
|
|
22935
|
+
const timeParams = {};
|
|
22936
|
+
if (parsed.timeRange) {
|
|
22937
|
+
if ("statsPeriod" in parsed.timeRange) timeParams.statsPeriod = parsed.timeRange.statsPeriod;
|
|
22938
|
+
else if ("start" in parsed.timeRange && "end" in parsed.timeRange) {
|
|
22939
|
+
timeParams.start = parsed.timeRange.start;
|
|
22940
|
+
timeParams.end = parsed.timeRange.end;
|
|
20946
22941
|
}
|
|
20947
|
-
|
|
20948
|
-
|
|
20949
|
-
|
|
20950
|
-
|
|
20951
|
-
|
|
20952
|
-
|
|
20953
|
-
|
|
20954
|
-
|
|
20955
|
-
|
|
20956
|
-
|
|
20957
|
-
|
|
20958
|
-
|
|
20959
|
-
|
|
20960
|
-
|
|
20961
|
-
|
|
20962
|
-
|
|
20963
|
-
|
|
22942
|
+
} else timeParams.statsPeriod = "14d";
|
|
22943
|
+
const eventsResponse = await apiService.listEventsForIssue({
|
|
22944
|
+
organizationSlug,
|
|
22945
|
+
issueId,
|
|
22946
|
+
query,
|
|
22947
|
+
limit: params.limit,
|
|
22948
|
+
sort: sortParam,
|
|
22949
|
+
...timeParams
|
|
22950
|
+
});
|
|
22951
|
+
const explorerQuery = query ? `issue:${issueId} ${query}` : `issue:${issueId}`;
|
|
22952
|
+
const explorerUrl = apiService.getEventsExplorerUrl(organizationSlug, explorerQuery, projectId, "errors", fields, sortParam, [], [], timeParams.statsPeriod, timeParams.start, timeParams.end);
|
|
22953
|
+
function isValidEventArray(data) {
|
|
22954
|
+
return Array.isArray(data) && data.every((item) => typeof item === "object" && item !== null);
|
|
22955
|
+
}
|
|
22956
|
+
if (!isValidEventArray(eventsResponse)) throw new Error("Invalid event data format from Sentry API: expected array of objects");
|
|
22957
|
+
const eventData = eventsResponse;
|
|
22958
|
+
const naturalLanguageContext = `Events in issue ${issueId}: ${params.naturalLanguageQuery}`;
|
|
22959
|
+
return formatErrorResults({
|
|
22960
|
+
eventData,
|
|
22961
|
+
naturalLanguageQuery: naturalLanguageContext,
|
|
22962
|
+
includeExplanation: params.includeExplanation,
|
|
22963
|
+
apiService,
|
|
22964
|
+
organizationSlug,
|
|
22965
|
+
explorerUrl,
|
|
22966
|
+
sentryQuery: explorerQuery,
|
|
22967
|
+
fields,
|
|
22968
|
+
explanation: parsed.explanation
|
|
20964
22969
|
});
|
|
20965
|
-
return output;
|
|
20966
22970
|
}
|
|
20967
22971
|
});
|
|
20968
22972
|
|
|
20969
22973
|
//#endregion
|
|
20970
|
-
//#region ../mcp-core/dist/config-
|
|
22974
|
+
//#region ../mcp-core/dist/config-BJzhfINu.js
|
|
20971
22975
|
/**
|
|
20972
22976
|
* Configuration for the use_sentry embedded agent.
|
|
20973
22977
|
*
|
|
@@ -20986,7 +22990,7 @@ The user may include various parameters to pass to those tools in their prompt.
|
|
|
20986
22990
|
You MUST return tool results directly without interpreting them.`;
|
|
20987
22991
|
|
|
20988
22992
|
//#endregion
|
|
20989
|
-
//#region ../mcp-core/dist/agent-
|
|
22993
|
+
//#region ../mcp-core/dist/agent-C0SOl71m.js
|
|
20990
22994
|
/**
|
|
20991
22995
|
* Output schema for the embedded agent.
|
|
20992
22996
|
* The agent returns the final result string directly from its tool calls.
|
|
@@ -20997,7 +23001,6 @@ const outputSchema = zod.z.object({ result: zod.z.string().describe("The final r
|
|
|
20997
23001
|
* This returns the final result AND the tool calls made by the agent
|
|
20998
23002
|
*/
|
|
20999
23003
|
async function useSentryAgent(options) {
|
|
21000
|
-
if (!process.env.OPENAI_API_KEY) throw new ConfigurationError("OPENAI_API_KEY environment variable is required for use_sentry tool");
|
|
21001
23004
|
const prompt = options.request;
|
|
21002
23005
|
return await callEmbeddedAgent({
|
|
21003
23006
|
system: systemPrompt$1,
|
|
@@ -21008,7 +23011,296 @@ async function useSentryAgent(options) {
|
|
|
21008
23011
|
}
|
|
21009
23012
|
|
|
21010
23013
|
//#endregion
|
|
21011
|
-
//#region ../mcp-core/dist/
|
|
23014
|
+
//#region ../mcp-core/dist/list-issues-DSk9smZ1.js
|
|
23015
|
+
var list_issues_default = defineTool({
|
|
23016
|
+
name: "list_issues",
|
|
23017
|
+
skills: [
|
|
23018
|
+
"inspect",
|
|
23019
|
+
"triage",
|
|
23020
|
+
"seer"
|
|
23021
|
+
],
|
|
23022
|
+
requiredScopes: ["event:read"],
|
|
23023
|
+
description: [
|
|
23024
|
+
"List issues using Sentry query syntax directly (no AI/LLM required).",
|
|
23025
|
+
"",
|
|
23026
|
+
"Use this tool when:",
|
|
23027
|
+
"- You know Sentry query syntax already",
|
|
23028
|
+
"- AI-powered search is unavailable (no OPENAI_API_KEY or ANTHROPIC_API_KEY)",
|
|
23029
|
+
"- You want precise control over the query",
|
|
23030
|
+
"",
|
|
23031
|
+
"For natural language queries, use search_issues instead.",
|
|
23032
|
+
"",
|
|
23033
|
+
"Common Query Syntax:",
|
|
23034
|
+
"- is:unresolved - Show unresolved issues only",
|
|
23035
|
+
"- is:unassigned - Show unassigned issues",
|
|
23036
|
+
"- level:error - Filter by error level",
|
|
23037
|
+
"- firstSeen:-24h - First seen in last 24 hours",
|
|
23038
|
+
"- lastSeen:-1h - Last seen in last hour",
|
|
23039
|
+
"- has:user - Issues with user context",
|
|
23040
|
+
"- user.email:user@example.com - Filter by user email",
|
|
23041
|
+
"- environment:production - Filter by environment",
|
|
23042
|
+
"- release:1.0.0 - Filter by release version",
|
|
23043
|
+
"",
|
|
23044
|
+
"Combine queries: is:unresolved is:unassigned level:error",
|
|
23045
|
+
"",
|
|
23046
|
+
"<examples>",
|
|
23047
|
+
"list_issues(organizationSlug='my-org', query='is:unresolved is:unassigned')",
|
|
23048
|
+
"list_issues(organizationSlug='my-org', query='level:error firstSeen:-24h', sort='freq')",
|
|
23049
|
+
"list_issues(organizationSlug='my-org', projectSlugOrId='my-project', query='is:unresolved')",
|
|
23050
|
+
"</examples>",
|
|
23051
|
+
"",
|
|
23052
|
+
"<hints>",
|
|
23053
|
+
"- If the user passes a parameter in the form of name/otherName, it's likely in the format of <organizationSlug>/<projectSlugOrId>.",
|
|
23054
|
+
"- The projectSlugOrId parameter accepts both project slugs (e.g., 'my-project') and numeric IDs (e.g., '123456').",
|
|
23055
|
+
"</hints>"
|
|
23056
|
+
].join("\n"),
|
|
23057
|
+
inputSchema: {
|
|
23058
|
+
organizationSlug: ParamOrganizationSlug,
|
|
23059
|
+
query: zod.z.string().trim().default("is:unresolved").describe("Sentry issue search query syntax"),
|
|
23060
|
+
projectSlugOrId: zod.z.string().toLowerCase().trim().superRefine(validateSlugOrId).nullable().default(null).describe("Filter by project slug or numeric ID (optional)"),
|
|
23061
|
+
sort: zod.z.enum([
|
|
23062
|
+
"date",
|
|
23063
|
+
"freq",
|
|
23064
|
+
"new",
|
|
23065
|
+
"user"
|
|
23066
|
+
]).default("date").describe("Sort order: date (last seen), freq (frequency), new (first seen), user (user count)"),
|
|
23067
|
+
limit: zod.z.number().min(1).max(100).default(10).describe("Maximum number of issues to return (1-100)"),
|
|
23068
|
+
regionUrl: ParamRegionUrl.nullable().default(null)
|
|
23069
|
+
},
|
|
23070
|
+
annotations: {
|
|
23071
|
+
readOnlyHint: true,
|
|
23072
|
+
openWorldHint: true
|
|
23073
|
+
},
|
|
23074
|
+
async handler(params, context$1) {
|
|
23075
|
+
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
23076
|
+
(0, __sentry_core.setTag)("organization.slug", params.organizationSlug);
|
|
23077
|
+
if (params.projectSlugOrId) if (isNumericId(params.projectSlugOrId)) (0, __sentry_core.setTag)("project.id", params.projectSlugOrId);
|
|
23078
|
+
else (0, __sentry_core.setTag)("project.slug", params.projectSlugOrId);
|
|
23079
|
+
const issues = await apiService.listIssues({
|
|
23080
|
+
organizationSlug: params.organizationSlug,
|
|
23081
|
+
projectSlug: params.projectSlugOrId ?? void 0,
|
|
23082
|
+
query: params.query,
|
|
23083
|
+
sortBy: params.sort,
|
|
23084
|
+
limit: params.limit
|
|
23085
|
+
});
|
|
23086
|
+
return formatIssueResults({
|
|
23087
|
+
issues,
|
|
23088
|
+
organizationSlug: params.organizationSlug,
|
|
23089
|
+
projectSlugOrId: params.projectSlugOrId ?? void 0,
|
|
23090
|
+
query: params.query,
|
|
23091
|
+
regionUrl: params.regionUrl ?? void 0
|
|
23092
|
+
});
|
|
23093
|
+
}
|
|
23094
|
+
});
|
|
23095
|
+
|
|
23096
|
+
//#endregion
|
|
23097
|
+
//#region ../mcp-core/dist/list-events-BVY0RUTR.js
|
|
23098
|
+
const DEFAULT_FIELDS = {
|
|
23099
|
+
errors: require_config_CEjP2CYO.RECOMMENDED_FIELDS.errors.basic,
|
|
23100
|
+
logs: require_config_CEjP2CYO.RECOMMENDED_FIELDS.logs.basic,
|
|
23101
|
+
spans: require_config_CEjP2CYO.RECOMMENDED_FIELDS.spans.basic
|
|
23102
|
+
};
|
|
23103
|
+
var list_events_default = defineTool({
|
|
23104
|
+
name: "list_events",
|
|
23105
|
+
skills: [
|
|
23106
|
+
"inspect",
|
|
23107
|
+
"triage",
|
|
23108
|
+
"seer"
|
|
23109
|
+
],
|
|
23110
|
+
requiredScopes: ["event:read"],
|
|
23111
|
+
description: [
|
|
23112
|
+
"Search events using Sentry query syntax directly (no AI/LLM required).",
|
|
23113
|
+
"",
|
|
23114
|
+
"Use this tool when:",
|
|
23115
|
+
"- You know Sentry query syntax already",
|
|
23116
|
+
"- AI-powered search is unavailable (no OPENAI_API_KEY or ANTHROPIC_API_KEY)",
|
|
23117
|
+
"- You want precise control over the query",
|
|
23118
|
+
"",
|
|
23119
|
+
"For natural language queries, use search_events instead.",
|
|
23120
|
+
"",
|
|
23121
|
+
"Datasets:",
|
|
23122
|
+
"- errors: Exception/crash events",
|
|
23123
|
+
"- logs: Log entries",
|
|
23124
|
+
"- spans: Performance data, traces, AI/LLM calls",
|
|
23125
|
+
"",
|
|
23126
|
+
"Query Syntax Examples:",
|
|
23127
|
+
"- message:\"connection timeout\"",
|
|
23128
|
+
"- level:error",
|
|
23129
|
+
"- span.op:http.client span.status_code:500",
|
|
23130
|
+
"- log.level:error",
|
|
23131
|
+
"- transaction:/api/users",
|
|
23132
|
+
"",
|
|
23133
|
+
"<examples>",
|
|
23134
|
+
"list_events(organizationSlug='my-org', dataset='errors', query='level:error')",
|
|
23135
|
+
"list_events(organizationSlug='my-org', dataset='spans', query='span.op:db')",
|
|
23136
|
+
"list_events(organizationSlug='my-org', dataset='logs', query='severity:error')",
|
|
23137
|
+
"list_events(organizationSlug='my-org', dataset='errors', fields=['issue', 'count()'], sort='-count()')",
|
|
23138
|
+
"</examples>",
|
|
23139
|
+
"",
|
|
23140
|
+
"<hints>",
|
|
23141
|
+
"- If the user passes a parameter in the form of name/otherName, it's likely in the format of <organizationSlug>/<projectSlug>.",
|
|
23142
|
+
"- Use fields with aggregate functions like count(), avg(), sum() for statistics",
|
|
23143
|
+
"- Sort by -count() for most common, -timestamp for newest",
|
|
23144
|
+
"</hints>"
|
|
23145
|
+
].join("\n"),
|
|
23146
|
+
inputSchema: {
|
|
23147
|
+
organizationSlug: ParamOrganizationSlug,
|
|
23148
|
+
dataset: zod.z.enum([
|
|
23149
|
+
"errors",
|
|
23150
|
+
"logs",
|
|
23151
|
+
"spans"
|
|
23152
|
+
]).default("errors").describe("Dataset to query: errors (exceptions), logs, or spans (traces)"),
|
|
23153
|
+
query: zod.z.string().trim().default("").describe("Sentry event search query syntax (empty for all events)"),
|
|
23154
|
+
fields: zod.z.array(zod.z.string()).nullable().default(null).describe("Fields to return. If not specified, uses sensible defaults. Include aggregate functions like count(), avg() for statistics."),
|
|
23155
|
+
sort: zod.z.string().default("-timestamp").describe("Sort field (prefix with - for descending). Use -count() for aggregations."),
|
|
23156
|
+
projectSlug: ParamProjectSlug.nullable().default(null),
|
|
23157
|
+
statsPeriod: zod.z.string().default("14d").describe("Time period: 1h, 24h, 7d, 14d, 30d, etc."),
|
|
23158
|
+
limit: zod.z.number().min(1).max(100).default(10).describe("Maximum number of results to return (1-100)"),
|
|
23159
|
+
regionUrl: ParamRegionUrl.nullable().default(null)
|
|
23160
|
+
},
|
|
23161
|
+
annotations: {
|
|
23162
|
+
readOnlyHint: true,
|
|
23163
|
+
openWorldHint: true
|
|
23164
|
+
},
|
|
23165
|
+
async handler(params, context$1) {
|
|
23166
|
+
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
23167
|
+
(0, __sentry_core.setTag)("organization.slug", params.organizationSlug);
|
|
23168
|
+
if (params.projectSlug) (0, __sentry_core.setTag)("project.slug", params.projectSlug);
|
|
23169
|
+
let projectId;
|
|
23170
|
+
if (params.projectSlug) {
|
|
23171
|
+
const project = await apiService.getProject({
|
|
23172
|
+
organizationSlug: params.organizationSlug,
|
|
23173
|
+
projectSlugOrId: params.projectSlug
|
|
23174
|
+
});
|
|
23175
|
+
projectId = String(project.id);
|
|
23176
|
+
}
|
|
23177
|
+
const fields = params.fields ?? DEFAULT_FIELDS[params.dataset];
|
|
23178
|
+
const eventsResponse = await apiService.searchEvents({
|
|
23179
|
+
organizationSlug: params.organizationSlug,
|
|
23180
|
+
query: params.query,
|
|
23181
|
+
fields,
|
|
23182
|
+
limit: params.limit,
|
|
23183
|
+
projectId,
|
|
23184
|
+
dataset: params.dataset,
|
|
23185
|
+
sort: params.sort,
|
|
23186
|
+
statsPeriod: params.statsPeriod
|
|
23187
|
+
});
|
|
23188
|
+
function isValidResponse(response) {
|
|
23189
|
+
return typeof response === "object" && response !== null;
|
|
23190
|
+
}
|
|
23191
|
+
function isValidEventArray(data) {
|
|
23192
|
+
return Array.isArray(data) && data.every((item) => typeof item === "object" && item !== null);
|
|
23193
|
+
}
|
|
23194
|
+
if (!isValidResponse(eventsResponse)) throw new Error("Invalid response format from Sentry API");
|
|
23195
|
+
const eventData = eventsResponse.data;
|
|
23196
|
+
if (!isValidEventArray(eventData)) throw new Error("Invalid event data format from Sentry API");
|
|
23197
|
+
const aggregateFunctions = fields.filter((field) => field.includes("(") && field.includes(")"));
|
|
23198
|
+
const groupByFields = fields.filter((field) => !field.includes("(") && !field.includes(")"));
|
|
23199
|
+
const explorerUrl = apiService.getEventsExplorerUrl(params.organizationSlug, params.query, projectId, params.dataset, fields, params.sort, aggregateFunctions, groupByFields, params.statsPeriod);
|
|
23200
|
+
const formatParams = {
|
|
23201
|
+
eventData,
|
|
23202
|
+
naturalLanguageQuery: params.query || `${params.dataset} events`,
|
|
23203
|
+
includeExplanation: false,
|
|
23204
|
+
apiService,
|
|
23205
|
+
organizationSlug: params.organizationSlug,
|
|
23206
|
+
explorerUrl,
|
|
23207
|
+
sentryQuery: params.query,
|
|
23208
|
+
fields
|
|
23209
|
+
};
|
|
23210
|
+
switch (params.dataset) {
|
|
23211
|
+
case "errors": return formatErrorResults(formatParams);
|
|
23212
|
+
case "logs": return formatLogResults(formatParams);
|
|
23213
|
+
case "spans": return formatSpanResults(formatParams);
|
|
23214
|
+
}
|
|
23215
|
+
}
|
|
23216
|
+
});
|
|
23217
|
+
|
|
23218
|
+
//#endregion
|
|
23219
|
+
//#region ../mcp-core/dist/list-issue-events-BOIBq62n.js
|
|
23220
|
+
var list_issue_events_default = defineTool({
|
|
23221
|
+
name: "list_issue_events",
|
|
23222
|
+
skills: ["inspect", "triage"],
|
|
23223
|
+
requiredScopes: ["event:read"],
|
|
23224
|
+
description: [
|
|
23225
|
+
"List events within a specific issue using Sentry query syntax (no AI/LLM required).",
|
|
23226
|
+
"",
|
|
23227
|
+
"Use this tool when:",
|
|
23228
|
+
"- You know Sentry query syntax already",
|
|
23229
|
+
"- AI-powered search is unavailable (no OPENAI_API_KEY or ANTHROPIC_API_KEY)",
|
|
23230
|
+
"- You want precise control over the query",
|
|
23231
|
+
"",
|
|
23232
|
+
"For natural language queries, use search_issue_events instead.",
|
|
23233
|
+
"",
|
|
23234
|
+
"Common Query Filters:",
|
|
23235
|
+
"- environment:production - Filter by environment",
|
|
23236
|
+
"- release:1.0.0 - Filter by release version",
|
|
23237
|
+
"- user.email:alice@example.com - Filter by user email",
|
|
23238
|
+
"- timestamp:>2024-01-01 - Filter by timestamp",
|
|
23239
|
+
"",
|
|
23240
|
+
"<examples>",
|
|
23241
|
+
"list_issue_events(issueUrl='https://sentry.io/organizations/my-org/issues/123/', query='environment:production')",
|
|
23242
|
+
"list_issue_events(issueId='MCP-41', organizationSlug='my-org', query='release:v1.0.0')",
|
|
23243
|
+
"list_issue_events(issueId='PROJECT-123', organizationSlug='my-org', statsPeriod='1h')",
|
|
23244
|
+
"</examples>",
|
|
23245
|
+
"",
|
|
23246
|
+
"<hints>",
|
|
23247
|
+
"- Use issueUrl for convenience (includes org + issue ID)",
|
|
23248
|
+
"- Or provide both issueId and organizationSlug",
|
|
23249
|
+
"- The query filters events WITHIN the issue, no need for issue: prefix",
|
|
23250
|
+
"</hints>"
|
|
23251
|
+
].join("\n"),
|
|
23252
|
+
inputSchema: {
|
|
23253
|
+
organizationSlug: ParamOrganizationSlug.nullable().default(null).describe("Organization slug. Required when using issueId. Not needed when using issueUrl."),
|
|
23254
|
+
issueId: zod.z.string().optional().describe("Issue ID (e.g., 'MCP-41', 'PROJECT-123'). Requires organizationSlug."),
|
|
23255
|
+
issueUrl: zod.z.string().url().optional().describe("Full Sentry issue URL. Includes both organization and issue ID."),
|
|
23256
|
+
query: zod.z.string().trim().default("").describe("Sentry event search query syntax (empty for all events)"),
|
|
23257
|
+
sort: zod.z.string().default("-timestamp").describe("Sort field (prefix with - for descending). Default: -timestamp"),
|
|
23258
|
+
statsPeriod: zod.z.string().default("14d").describe("Time period: 1h, 24h, 7d, 14d, 30d, etc."),
|
|
23259
|
+
limit: zod.z.number().min(1).max(100).default(50).describe("Maximum number of events to return (1-100)"),
|
|
23260
|
+
regionUrl: ParamRegionUrl.nullable().default(null)
|
|
23261
|
+
},
|
|
23262
|
+
annotations: {
|
|
23263
|
+
readOnlyHint: true,
|
|
23264
|
+
openWorldHint: true
|
|
23265
|
+
},
|
|
23266
|
+
async handler(params, context$1) {
|
|
23267
|
+
const { organizationSlug, issueId } = parseIssueParams({
|
|
23268
|
+
organizationSlug: params.organizationSlug,
|
|
23269
|
+
issueId: params.issueId,
|
|
23270
|
+
issueUrl: params.issueUrl
|
|
23271
|
+
});
|
|
23272
|
+
const apiService = apiServiceFromContext(context$1, { regionUrl: params.regionUrl ?? void 0 });
|
|
23273
|
+
(0, __sentry_core.setTag)("organization.slug", organizationSlug);
|
|
23274
|
+
(0, __sentry_core.setTag)("issue.id", issueId);
|
|
23275
|
+
const eventsResponse = await apiService.listEventsForIssue({
|
|
23276
|
+
organizationSlug,
|
|
23277
|
+
issueId,
|
|
23278
|
+
query: params.query,
|
|
23279
|
+
limit: params.limit,
|
|
23280
|
+
sort: params.sort,
|
|
23281
|
+
statsPeriod: params.statsPeriod
|
|
23282
|
+
});
|
|
23283
|
+
function isValidEventArray(data) {
|
|
23284
|
+
return Array.isArray(data) && data.every((item) => typeof item === "object" && item !== null);
|
|
23285
|
+
}
|
|
23286
|
+
if (!isValidEventArray(eventsResponse)) throw new Error("Invalid event data format from Sentry API: expected array of objects");
|
|
23287
|
+
const explorerQuery = params.query ? `issue:${issueId} ${params.query}` : `issue:${issueId}`;
|
|
23288
|
+
const explorerUrl = apiService.getEventsExplorerUrl(organizationSlug, explorerQuery, void 0, "errors", RECOMMENDED_FIELDS$1, params.sort, [], [], params.statsPeriod);
|
|
23289
|
+
return formatErrorResults({
|
|
23290
|
+
eventData: eventsResponse,
|
|
23291
|
+
naturalLanguageQuery: `Events in issue ${issueId}`,
|
|
23292
|
+
includeExplanation: false,
|
|
23293
|
+
apiService,
|
|
23294
|
+
organizationSlug,
|
|
23295
|
+
explorerUrl,
|
|
23296
|
+
sentryQuery: explorerQuery,
|
|
23297
|
+
fields: RECOMMENDED_FIELDS$1
|
|
23298
|
+
});
|
|
23299
|
+
}
|
|
23300
|
+
});
|
|
23301
|
+
|
|
23302
|
+
//#endregion
|
|
23303
|
+
//#region ../mcp-core/dist/error-handling-DFJ-iOAP.js
|
|
21012
23304
|
/**
|
|
21013
23305
|
* Type guard to identify user input validation errors.
|
|
21014
23306
|
*/
|
|
@@ -21099,7 +23391,7 @@ async function formatErrorForUser(error) {
|
|
|
21099
23391
|
}
|
|
21100
23392
|
|
|
21101
23393
|
//#endregion
|
|
21102
|
-
//#region ../mcp-core/dist/constraint-helpers-
|
|
23394
|
+
//#region ../mcp-core/dist/constraint-helpers-D80X658i.js
|
|
21103
23395
|
/**
|
|
21104
23396
|
* Determines which tool parameter keys should be filtered out of the schema
|
|
21105
23397
|
* because they will be injected from constraints.
|
|
@@ -21161,7 +23453,7 @@ function getConstraintParametersToInject(constraints, toolInputSchema) {
|
|
|
21161
23453
|
}
|
|
21162
23454
|
|
|
21163
23455
|
//#endregion
|
|
21164
|
-
//#region ../mcp-core/dist/server-
|
|
23456
|
+
//#region ../mcp-core/dist/server-obGNre-1.js
|
|
21165
23457
|
/**
|
|
21166
23458
|
* Format tool calls into a readable trace
|
|
21167
23459
|
*/
|
|
@@ -21180,7 +23472,7 @@ function formatToolCallTrace(toolCalls) {
|
|
|
21180
23472
|
}
|
|
21181
23473
|
return trace$1;
|
|
21182
23474
|
}
|
|
21183
|
-
var handler_default$
|
|
23475
|
+
var handler_default$3 = defineTool({
|
|
21184
23476
|
name: "use_sentry",
|
|
21185
23477
|
skills: [],
|
|
21186
23478
|
requiredScopes: [],
|
|
@@ -21223,7 +23515,8 @@ var handler_default$2 = defineTool({
|
|
|
21223
23515
|
},
|
|
21224
23516
|
async handler(params, context$1) {
|
|
21225
23517
|
const [clientTransport, serverTransport] = __modelcontextprotocol_sdk_inMemory_js.InMemoryTransport.createLinkedPair();
|
|
21226
|
-
const
|
|
23518
|
+
const toolsToExclude = new Set(["use_sentry", ...SIMPLE_REPLACEMENT_TOOLS]);
|
|
23519
|
+
const toolsForAgent = Object.fromEntries(Object.entries(tools_default).filter(([key]) => !toolsToExclude.has(key)));
|
|
21227
23520
|
const server$1 = buildServer({
|
|
21228
23521
|
context: context$1,
|
|
21229
23522
|
tools: toolsForAgent
|
|
@@ -21251,6 +23544,25 @@ var handler_default$2 = defineTool({
|
|
|
21251
23544
|
}
|
|
21252
23545
|
}
|
|
21253
23546
|
});
|
|
23547
|
+
/**
|
|
23548
|
+
* Tools that require an embedded agent provider (LLM-powered).
|
|
23549
|
+
* These are excluded when no agent provider is configured.
|
|
23550
|
+
* Note: use_sentry is handled separately via agentMode.
|
|
23551
|
+
*/
|
|
23552
|
+
const AGENT_DEPENDENT_TOOLS = [
|
|
23553
|
+
"search_events",
|
|
23554
|
+
"search_issues",
|
|
23555
|
+
"search_issue_events"
|
|
23556
|
+
];
|
|
23557
|
+
/**
|
|
23558
|
+
* Simple tools that replace agent-dependent tools when no provider is available.
|
|
23559
|
+
* These are excluded when an agent provider IS configured.
|
|
23560
|
+
*/
|
|
23561
|
+
const SIMPLE_REPLACEMENT_TOOLS = [
|
|
23562
|
+
"list_issues",
|
|
23563
|
+
"list_events",
|
|
23564
|
+
"list_issue_events"
|
|
23565
|
+
];
|
|
21254
23566
|
var tools_default = {
|
|
21255
23567
|
whoami: whoami_default,
|
|
21256
23568
|
find_organizations: find_organizations_default,
|
|
@@ -21258,6 +23570,7 @@ var tools_default = {
|
|
|
21258
23570
|
find_projects: find_projects_default,
|
|
21259
23571
|
find_releases: find_releases_default,
|
|
21260
23572
|
get_issue_details: get_issue_details_default,
|
|
23573
|
+
get_issue_tag_values: get_issue_tag_values_default,
|
|
21261
23574
|
get_trace_details: get_trace_details_default,
|
|
21262
23575
|
get_event_attachment: get_event_attachment_default,
|
|
21263
23576
|
update_issue: update_issue_default,
|
|
@@ -21271,7 +23584,11 @@ var tools_default = {
|
|
|
21271
23584
|
search_docs: search_docs_default,
|
|
21272
23585
|
get_doc: get_doc_default,
|
|
21273
23586
|
search_issues: handler_default$1,
|
|
21274
|
-
|
|
23587
|
+
search_issue_events: handler_default$2,
|
|
23588
|
+
use_sentry: handler_default$3,
|
|
23589
|
+
list_issues: list_issues_default,
|
|
23590
|
+
list_events: list_events_default,
|
|
23591
|
+
list_issue_events: list_issue_events_default
|
|
21275
23592
|
};
|
|
21276
23593
|
/**
|
|
21277
23594
|
* Creates and configures a complete MCP server with Sentry instrumentation.
|
|
@@ -21332,7 +23649,12 @@ function buildServer({ context: context$1, agentMode = false, tools: customTools
|
|
|
21332
23649
|
* In agent mode, only the use_sentry tool is registered, bypassing authorization checks.
|
|
21333
23650
|
*/
|
|
21334
23651
|
function configureServer({ server: server$1, context: context$1, agentMode = false, tools: customTools }) {
|
|
21335
|
-
|
|
23652
|
+
let toolsToRegister = agentMode ? { use_sentry: tools_default.use_sentry } : customTools ?? tools_default;
|
|
23653
|
+
if (!agentMode && !customTools) {
|
|
23654
|
+
const hasAgent = hasAgentProvider();
|
|
23655
|
+
const toolsToExclude = new Set(hasAgent ? SIMPLE_REPLACEMENT_TOOLS : AGENT_DEPENDENT_TOOLS);
|
|
23656
|
+
toolsToRegister = Object.fromEntries(Object.entries(toolsToRegister).filter(([key]) => !toolsToExclude.has(key)));
|
|
23657
|
+
}
|
|
21336
23658
|
const grantedSkills = context$1.grantedSkills ? new Set(context$1.grantedSkills) : void 0;
|
|
21337
23659
|
server$1.server.onerror = (error) => {
|
|
21338
23660
|
const transportLogOptions = {
|
|
@@ -21413,7 +23735,7 @@ function configureServer({ server: server$1, context: context$1, agentMode = fal
|
|
|
21413
23735
|
}
|
|
21414
23736
|
|
|
21415
23737
|
//#endregion
|
|
21416
|
-
//#region ../mcp-core/dist/sentry-
|
|
23738
|
+
//#region ../mcp-core/dist/sentry-CTKJG5Bs.js
|
|
21417
23739
|
const SCRUB_PATTERNS = [
|
|
21418
23740
|
{
|
|
21419
23741
|
pattern: /\bsk-[a-zA-Z0-9]{48}\b/g,
|
|
@@ -21504,8 +23826,11 @@ function scrubValue(value, depth = 0) {
|
|
|
21504
23826
|
}
|
|
21505
23827
|
/**
|
|
21506
23828
|
* Sentry beforeSend hook that scrubs sensitive data from events
|
|
23829
|
+
* and applies custom fingerprinting for specific error types.
|
|
21507
23830
|
*/
|
|
21508
23831
|
function sentryBeforeSend(event, hint) {
|
|
23832
|
+
const firstException = event?.exception?.values?.[0];
|
|
23833
|
+
if (firstException?.type === "AI_APICallError" && firstException.value) event.fingerprint = ["AI_APICallError", firstException.value];
|
|
21509
23834
|
const [scrubbedEvent, didScrub, descriptions] = scrubValue(event);
|
|
21510
23835
|
if (didScrub) {
|
|
21511
23836
|
const uniqueDescriptions = [...new Set(descriptions)];
|
|
@@ -21546,16 +23871,21 @@ const cfg = (() => {
|
|
|
21546
23871
|
die(err instanceof Error ? err.message : String(err));
|
|
21547
23872
|
}
|
|
21548
23873
|
})();
|
|
21549
|
-
if (
|
|
21550
|
-
|
|
23874
|
+
if (cfg.agentProvider) setAgentProvider(cfg.agentProvider);
|
|
23875
|
+
setProviderBaseUrls({
|
|
23876
|
+
openaiBaseUrl: cfg.openaiBaseUrl,
|
|
23877
|
+
anthropicBaseUrl: cfg.anthropicBaseUrl
|
|
23878
|
+
});
|
|
23879
|
+
if (cfg.openaiModel) process.env.OPENAI_MODEL = cfg.openaiModel;
|
|
23880
|
+
if (cfg.anthropicModel) process.env.ANTHROPIC_MODEL = cfg.anthropicModel;
|
|
23881
|
+
const resolvedProvider = getResolvedProviderType();
|
|
23882
|
+
if (!resolvedProvider) {
|
|
23883
|
+
console.warn("Warning: No LLM API key found (OPENAI_API_KEY or ANTHROPIC_API_KEY).");
|
|
21551
23884
|
console.warn("The following AI-powered search tools will be unavailable:");
|
|
21552
|
-
console.warn(" - search_events
|
|
21553
|
-
console.warn("
|
|
21554
|
-
console.warn("All other tools will function normally. To enable AI-powered search, set OPENAI_API_KEY.");
|
|
23885
|
+
console.warn(" - search_events, search_issues, search_issue_events, use_sentry");
|
|
23886
|
+
console.warn("Use list_issues and list_events for direct Sentry query syntax instead.");
|
|
21555
23887
|
console.warn("");
|
|
21556
|
-
}
|
|
21557
|
-
setOpenAIBaseUrl(cfg.openaiBaseUrl);
|
|
21558
|
-
if (cfg.openaiModel) process.env.OPENAI_MODEL = cfg.openaiModel;
|
|
23888
|
+
} else console.warn(`Using ${resolvedProvider} for AI-powered search tools.`);
|
|
21559
23889
|
__sentry_node.init({
|
|
21560
23890
|
dsn: cfg.sentryDsn,
|
|
21561
23891
|
sendDefaultPii: true,
|