@carrierllc/mcp 0.13.60 → 0.13.62
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/index.js
CHANGED
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
verifyStorefront,
|
|
83
83
|
withOcsListSummary,
|
|
84
84
|
withTemplateResellerId
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-SZR42TUZ.js";
|
|
86
86
|
import "./chunk-SHKKVIIA.js";
|
|
87
87
|
|
|
88
88
|
// src/index.ts
|
|
@@ -1180,22 +1180,22 @@ function boundZonesResult(raw, opts = {}) {
|
|
|
1180
1180
|
const { verbose = false, resellerId } = opts;
|
|
1181
1181
|
const maxZones = opts.maxZones ?? ZONES_MAX_ZONES;
|
|
1182
1182
|
const maxOperators = opts.maxOperators ?? (verbose ? ZONES_VERBOSE_MAX_OPERATORS : ZONES_MAX_OPERATORS);
|
|
1183
|
-
const totalOperators = all.reduce((n,
|
|
1183
|
+
const totalOperators = all.reduce((n, z28) => n + (z28.operators?.length ?? 0), 0);
|
|
1184
1184
|
const keptZones = all.slice(0, maxZones);
|
|
1185
1185
|
let budget = maxOperators;
|
|
1186
1186
|
let returnedOperators = 0;
|
|
1187
|
-
const zones = keptZones.map((
|
|
1188
|
-
const ops =
|
|
1187
|
+
const zones = keptZones.map((z28) => {
|
|
1188
|
+
const ops = z28.operators ?? [];
|
|
1189
1189
|
const take = Math.max(0, Math.min(ops.length, budget));
|
|
1190
1190
|
budget -= take;
|
|
1191
1191
|
returnedOperators += take;
|
|
1192
1192
|
const sliced = ops.slice(0, take);
|
|
1193
1193
|
if (verbose) {
|
|
1194
|
-
return { ...
|
|
1194
|
+
return { ...z28, operators: sliced, operatorCount: ops.length };
|
|
1195
1195
|
}
|
|
1196
1196
|
return {
|
|
1197
|
-
zoneId:
|
|
1198
|
-
zoneName:
|
|
1197
|
+
zoneId: z28.zoneId,
|
|
1198
|
+
zoneName: z28.zoneName,
|
|
1199
1199
|
operatorCount: ops.length,
|
|
1200
1200
|
operators: sliced.map((o) => ({
|
|
1201
1201
|
net: o.networkId,
|
|
@@ -5268,7 +5268,7 @@ function registerAllBacklogTools(server2, ctx) {
|
|
|
5268
5268
|
}
|
|
5269
5269
|
|
|
5270
5270
|
// src/tools-carrier-ask.ts
|
|
5271
|
-
import { z as
|
|
5271
|
+
import { z as z16 } from "zod";
|
|
5272
5272
|
|
|
5273
5273
|
// src/tools-ui-agent.ts
|
|
5274
5274
|
import { z as z4 } from "zod";
|
|
@@ -6184,11 +6184,23 @@ function registerUiAgentAskTools(server2, ctx, runtime) {
|
|
|
6184
6184
|
}
|
|
6185
6185
|
|
|
6186
6186
|
// src/carrier-api-tools.ts
|
|
6187
|
+
import { z as z6 } from "zod";
|
|
6187
6188
|
var CARRIER_API_TOOL_SCOPES = {
|
|
6188
|
-
list_connectivity_offering_templates: "read"
|
|
6189
|
+
list_connectivity_offering_templates: "read",
|
|
6190
|
+
create_benefit_campaign: "write",
|
|
6191
|
+
claim_benefit: "write",
|
|
6192
|
+
issue_benefit_claim: "write",
|
|
6193
|
+
set_benefit_campaign_status: "write",
|
|
6194
|
+
create_benefit_entitlement: "write",
|
|
6195
|
+
reconcile_benefit_claim: "write",
|
|
6196
|
+
record_experiment_event: "write",
|
|
6197
|
+
experiment_report: "read"
|
|
6189
6198
|
};
|
|
6199
|
+
var CAMPAIGN_ID_PATTERN = /^cbc_[0-9a-f]{32}$/;
|
|
6200
|
+
var CLAIM_ID_PATTERN = /^cbl_[0-9a-f]{32}$/;
|
|
6190
6201
|
var DEFAULT_API_BASE_URL = "https://api.carrier.llc";
|
|
6191
6202
|
var REQUEST_TIMEOUT_MS = 1e4;
|
|
6203
|
+
var WRITE_TIMEOUT_MS = 3e4;
|
|
6192
6204
|
function jsonResult2(body2, isError = false) {
|
|
6193
6205
|
return {
|
|
6194
6206
|
...isError ? { isError: true } : {},
|
|
@@ -6209,14 +6221,21 @@ async function carrierApiRequest(ctx, extra, req) {
|
|
|
6209
6221
|
const base = (ctx.env.CARRIER_API_BASE_URL ?? DEFAULT_API_BASE_URL).replace(/\/+$/, "");
|
|
6210
6222
|
let response;
|
|
6211
6223
|
try {
|
|
6224
|
+
const isPost = req.method === "POST";
|
|
6212
6225
|
response = await fetch(`${base}${req.path}`, {
|
|
6213
6226
|
method: req.method,
|
|
6214
6227
|
redirect: "error",
|
|
6215
|
-
headers: {
|
|
6216
|
-
|
|
6228
|
+
headers: {
|
|
6229
|
+
Accept: "application/json",
|
|
6230
|
+
Authorization: `Bearer ${token2}`,
|
|
6231
|
+
...isPost ? { "Content-Type": "application/json" } : {}
|
|
6232
|
+
},
|
|
6233
|
+
...isPost && req.body !== void 0 ? { body: JSON.stringify(req.body) } : {},
|
|
6234
|
+
signal: AbortSignal.timeout(isPost ? WRITE_TIMEOUT_MS : REQUEST_TIMEOUT_MS)
|
|
6217
6235
|
});
|
|
6218
6236
|
} catch (err9) {
|
|
6219
|
-
|
|
6237
|
+
const outcome = req.method === "POST" ? " The request may or may not have been applied: read the current state before you retry." : "";
|
|
6238
|
+
return apiError("CARRIER_API_UNREACHABLE", `Carrier API request failed: ${err9 instanceof Error ? err9.name : "error"}.${outcome}`);
|
|
6220
6239
|
}
|
|
6221
6240
|
let text;
|
|
6222
6241
|
try {
|
|
@@ -6234,7 +6253,7 @@ async function carrierApiRequest(ctx, extra, req) {
|
|
|
6234
6253
|
if (parsed === void 0) {
|
|
6235
6254
|
return apiError("CARRIER_API_BAD_RESPONSE", "Carrier API returned a non-JSON success body.", { http_status: response.status });
|
|
6236
6255
|
}
|
|
6237
|
-
return jsonResult2(parsed);
|
|
6256
|
+
return jsonResult2(req.method === "POST" ? { http_status: response.status, result: parsed } : parsed);
|
|
6238
6257
|
}
|
|
6239
6258
|
const body2 = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
6240
6259
|
const nested = body2["error"];
|
|
@@ -6247,6 +6266,7 @@ async function carrierApiRequest(ctx, extra, req) {
|
|
|
6247
6266
|
api_error: pick("error") ?? pick("message")
|
|
6248
6267
|
});
|
|
6249
6268
|
}
|
|
6269
|
+
var idPathError = (field) => apiError("INVALID_ID", `${field} is not a valid id. No request was made.`);
|
|
6250
6270
|
function registerCarrierApiTools(server2, ctx) {
|
|
6251
6271
|
server2.registerTool(
|
|
6252
6272
|
"list_connectivity_offering_templates",
|
|
@@ -6265,10 +6285,244 @@ function registerCarrierApiTools(server2, ctx) {
|
|
|
6265
6285
|
{ skipUserToken: true }
|
|
6266
6286
|
)
|
|
6267
6287
|
);
|
|
6288
|
+
server2.registerTool(
|
|
6289
|
+
"create_benefit_campaign",
|
|
6290
|
+
{
|
|
6291
|
+
title: "Create a benefit campaign",
|
|
6292
|
+
description: "Create a member-benefit campaign: a capped number of eSIM claims for one offering revision, each costing a fixed amount from your sponsor wallet. Calls POST /v1/connectivity/benefit-campaigns on api.carrier.llc with your own MCP access token and returns the new campaign id. Needs write scope. A campaign cannot be deleted once created. cost_cents above the deployment ceiling is rejected with cost_above_limit and creates nothing. Params: offering_id, revision (>=1), max_claims (>=1), cost_cents (>=1, per claim), expires_at (epoch milliseconds), product_id (optional, an active product of your organization). Do NOT use this to claim or issue an eSIM \u2014 that is claim_benefit and issue_benefit_claim.",
|
|
6293
|
+
inputSchema: {
|
|
6294
|
+
offering_id: z6.string().min(1).max(200).describe("Offering the campaign issues from."),
|
|
6295
|
+
revision: z6.number().int().min(1).max(Number.MAX_SAFE_INTEGER).describe("Offering revision, 1 or higher."),
|
|
6296
|
+
max_claims: z6.number().int().min(1).max(Number.MAX_SAFE_INTEGER).describe("Most claims the campaign accepts."),
|
|
6297
|
+
cost_cents: z6.number().int().min(1).max(Number.MAX_SAFE_INTEGER).describe("Cost of one claim in cents. The API enforces a ceiling."),
|
|
6298
|
+
expires_at: z6.number().int().min(1).max(Number.MAX_SAFE_INTEGER).describe("Expiry as epoch milliseconds."),
|
|
6299
|
+
product_id: z6.string().min(1).max(200).optional().describe("Optional product to issue from.")
|
|
6300
|
+
},
|
|
6301
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }
|
|
6302
|
+
},
|
|
6303
|
+
wrapHandler(
|
|
6304
|
+
"create_benefit_campaign",
|
|
6305
|
+
"carrier-api.benefit-campaigns.create",
|
|
6306
|
+
"write",
|
|
6307
|
+
ctx,
|
|
6308
|
+
(args, _token, extra) => carrierApiRequest(ctx, extra, {
|
|
6309
|
+
method: "POST",
|
|
6310
|
+
path: "/v1/connectivity/benefit-campaigns",
|
|
6311
|
+
body: {
|
|
6312
|
+
offering_id: args.offering_id,
|
|
6313
|
+
revision: args.revision,
|
|
6314
|
+
max_claims: args.max_claims,
|
|
6315
|
+
cost_cents: args.cost_cents,
|
|
6316
|
+
expires_at: args.expires_at,
|
|
6317
|
+
...args.product_id !== void 0 ? { product_id: args.product_id } : {}
|
|
6318
|
+
}
|
|
6319
|
+
}),
|
|
6320
|
+
{ skipUserToken: true }
|
|
6321
|
+
)
|
|
6322
|
+
);
|
|
6323
|
+
server2.registerTool(
|
|
6324
|
+
"claim_benefit",
|
|
6325
|
+
{
|
|
6326
|
+
title: "Claim a benefit",
|
|
6327
|
+
description: "Claim one benefit from a campaign for an external reference, which places a hold on the sponsor wallet. Calls POST /v1/connectivity/benefit-campaigns/{id}/claims on api.carrier.llc with your own MCP access token. Needs write scope. Safe to repeat with the same external_ref: the same claim comes back (HTTP 200) and nothing is held twice. Results: 201 held, 200 replay of an existing claim, 202 funding outcome unknown (repeat the call), 402 wallet cannot fund the claim, 409 campaign paused, expired or full. Params: campaign_id (cbc_ plus 32 hex), external_ref (1 to 200 characters, your own reference for the person). Do NOT use this to issue the eSIM \u2014 that is issue_benefit_claim, called with the claim id from this result.",
|
|
6328
|
+
inputSchema: {
|
|
6329
|
+
campaign_id: z6.string().regex(CAMPAIGN_ID_PATTERN).describe("Campaign id, cbc_ followed by 32 hex characters."),
|
|
6330
|
+
external_ref: z6.string().min(1).max(200).describe("Your own reference for the claimant, 1 to 200 characters.")
|
|
6331
|
+
},
|
|
6332
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true }
|
|
6333
|
+
},
|
|
6334
|
+
wrapHandler(
|
|
6335
|
+
"claim_benefit",
|
|
6336
|
+
"carrier-api.benefit-claims.create",
|
|
6337
|
+
"write",
|
|
6338
|
+
ctx,
|
|
6339
|
+
(args, _token, extra) => {
|
|
6340
|
+
if (typeof args.campaign_id !== "string" || !CAMPAIGN_ID_PATTERN.test(args.campaign_id)) return Promise.resolve(idPathError("campaign_id"));
|
|
6341
|
+
return carrierApiRequest(ctx, extra, {
|
|
6342
|
+
method: "POST",
|
|
6343
|
+
path: `/v1/connectivity/benefit-campaigns/${args.campaign_id}/claims`,
|
|
6344
|
+
body: { external_ref: args.external_ref }
|
|
6345
|
+
});
|
|
6346
|
+
},
|
|
6347
|
+
{ skipUserToken: true }
|
|
6348
|
+
)
|
|
6349
|
+
);
|
|
6350
|
+
server2.registerTool(
|
|
6351
|
+
"issue_benefit_claim",
|
|
6352
|
+
{
|
|
6353
|
+
title: "Issue the eSIM for a held claim",
|
|
6354
|
+
description: "Issue ONE REAL eSIM for a held claim and settle the wallet hold. This spends money and cannot be undone. Calls POST /v1/connectivity/benefit-campaigns/{id}/claims/{claimId}/issue on api.carrier.llc with your own MCP access token. Needs write scope. A retry returns the same eSIM and never a second one, but do not retry blindly: on 202 the outcome is unknown and the hold is kept, so wait and call again once. Results: 200 settled with the eSIM, 202 outcome unknown, 404 not found (or issuing is switched off), 409 the claim is not issuable. Params: campaign_id (cbc_ plus 32 hex), claim_id (cbl_ plus 32 hex, from claim_benefit). No other params. Do NOT use this before claim_benefit returned a held claim.",
|
|
6355
|
+
inputSchema: {
|
|
6356
|
+
campaign_id: z6.string().regex(CAMPAIGN_ID_PATTERN).describe("Campaign id, cbc_ followed by 32 hex characters."),
|
|
6357
|
+
claim_id: z6.string().regex(CLAIM_ID_PATTERN).describe("Claim id from claim_benefit, cbl_ followed by 32 hex characters.")
|
|
6358
|
+
},
|
|
6359
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true }
|
|
6360
|
+
},
|
|
6361
|
+
wrapHandler(
|
|
6362
|
+
"issue_benefit_claim",
|
|
6363
|
+
"carrier-api.benefit-claims.issue",
|
|
6364
|
+
"write",
|
|
6365
|
+
ctx,
|
|
6366
|
+
(args, _token, extra) => {
|
|
6367
|
+
if (typeof args.campaign_id !== "string" || !CAMPAIGN_ID_PATTERN.test(args.campaign_id)) return Promise.resolve(idPathError("campaign_id"));
|
|
6368
|
+
if (typeof args.claim_id !== "string" || !CLAIM_ID_PATTERN.test(args.claim_id)) return Promise.resolve(idPathError("claim_id"));
|
|
6369
|
+
return carrierApiRequest(ctx, extra, {
|
|
6370
|
+
method: "POST",
|
|
6371
|
+
path: `/v1/connectivity/benefit-campaigns/${args.campaign_id}/claims/${args.claim_id}/issue`
|
|
6372
|
+
});
|
|
6373
|
+
},
|
|
6374
|
+
{ skipUserToken: true }
|
|
6375
|
+
)
|
|
6376
|
+
);
|
|
6377
|
+
server2.registerTool(
|
|
6378
|
+
"set_benefit_campaign_status",
|
|
6379
|
+
{
|
|
6380
|
+
title: "Pause or resume a benefit campaign",
|
|
6381
|
+
description: "Pause a campaign so it accepts no new claims, or resume it. Calls POST /v1/connectivity/benefit-campaigns/{id}/status on api.carrier.llc with your own MCP access token. Needs write scope. Pausing blocks NEW claims; it does not release holds that were already made. Params: campaign_id (cbc_ plus 32 hex), status (active or paused).",
|
|
6382
|
+
inputSchema: {
|
|
6383
|
+
campaign_id: z6.string().regex(CAMPAIGN_ID_PATTERN).describe("Campaign id, cbc_ followed by 32 hex characters."),
|
|
6384
|
+
status: z6.enum(["active", "paused"]).describe("The status to set.")
|
|
6385
|
+
},
|
|
6386
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true }
|
|
6387
|
+
},
|
|
6388
|
+
wrapHandler(
|
|
6389
|
+
"set_benefit_campaign_status",
|
|
6390
|
+
"carrier-api.benefit-campaigns.status",
|
|
6391
|
+
"write",
|
|
6392
|
+
ctx,
|
|
6393
|
+
(args, _token, extra) => {
|
|
6394
|
+
if (typeof args.campaign_id !== "string" || !CAMPAIGN_ID_PATTERN.test(args.campaign_id)) return Promise.resolve(idPathError("campaign_id"));
|
|
6395
|
+
return carrierApiRequest(ctx, extra, {
|
|
6396
|
+
method: "POST",
|
|
6397
|
+
path: `/v1/connectivity/benefit-campaigns/${args.campaign_id}/status`,
|
|
6398
|
+
body: { status: args.status }
|
|
6399
|
+
});
|
|
6400
|
+
},
|
|
6401
|
+
{ skipUserToken: true }
|
|
6402
|
+
)
|
|
6403
|
+
);
|
|
6404
|
+
server2.registerTool(
|
|
6405
|
+
"create_benefit_entitlement",
|
|
6406
|
+
{
|
|
6407
|
+
title: "Issue a claim right for a booking reference",
|
|
6408
|
+
description: "Issue ONE single-use right for one external booking or member reference, which the claimant presents to claim a benefit. Calls POST /v1/connectivity/benefit-campaigns/{id}/entitlements on api.carrier.llc with your own MCP access token. Needs write scope. The token is returned once and is never stored in plain text; a second right for the same reference is refused. Params: campaign_id (cbc_ plus 32 hex), external_ref (1 to 200 characters), ttl_ms (optional lifetime in milliseconds).",
|
|
6409
|
+
inputSchema: {
|
|
6410
|
+
campaign_id: z6.string().regex(CAMPAIGN_ID_PATTERN).describe("Campaign id, cbc_ followed by 32 hex characters."),
|
|
6411
|
+
external_ref: z6.string().min(1).max(200).describe("Your own reference for the person, 1 to 200 characters."),
|
|
6412
|
+
ttl_ms: z6.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional().describe("Lifetime of the right in milliseconds. Defaults to 30 days.")
|
|
6413
|
+
},
|
|
6414
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }
|
|
6415
|
+
},
|
|
6416
|
+
wrapHandler(
|
|
6417
|
+
"create_benefit_entitlement",
|
|
6418
|
+
"carrier-api.benefit-entitlements.create",
|
|
6419
|
+
"write",
|
|
6420
|
+
ctx,
|
|
6421
|
+
(args, _token, extra) => {
|
|
6422
|
+
if (typeof args.campaign_id !== "string" || !CAMPAIGN_ID_PATTERN.test(args.campaign_id)) return Promise.resolve(idPathError("campaign_id"));
|
|
6423
|
+
return carrierApiRequest(ctx, extra, {
|
|
6424
|
+
method: "POST",
|
|
6425
|
+
path: `/v1/connectivity/benefit-campaigns/${args.campaign_id}/entitlements`,
|
|
6426
|
+
body: {
|
|
6427
|
+
external_ref: args.external_ref,
|
|
6428
|
+
...args.ttl_ms !== void 0 ? { ttl_ms: args.ttl_ms } : {}
|
|
6429
|
+
}
|
|
6430
|
+
});
|
|
6431
|
+
},
|
|
6432
|
+
{ skipUserToken: true }
|
|
6433
|
+
)
|
|
6434
|
+
);
|
|
6435
|
+
server2.registerTool(
|
|
6436
|
+
"reconcile_benefit_claim",
|
|
6437
|
+
{
|
|
6438
|
+
title: "Close a claim whose issuance outcome is unknown",
|
|
6439
|
+
description: "Ask the provider what happened to a claim whose issuance ended in an unknown outcome. Calls POST /v1/connectivity/benefit-campaigns/{id}/claims/{claimId}/reconcile on api.carrier.llc with your own MCP access token. Needs write scope. It never dispatches a second eSIM: it reads the existing issuance under the same claim id. Results: 200 the claim is closed, 202 the outcome is still unknown (call again later), 409 the claim never started issuing or is not held. Params: campaign_id (cbc_ plus 32 hex), claim_id (cbl_ plus 32 hex).",
|
|
6440
|
+
inputSchema: {
|
|
6441
|
+
campaign_id: z6.string().regex(CAMPAIGN_ID_PATTERN).describe("Campaign id, cbc_ followed by 32 hex characters."),
|
|
6442
|
+
claim_id: z6.string().regex(CLAIM_ID_PATTERN).describe("Claim id, cbl_ followed by 32 hex characters.")
|
|
6443
|
+
},
|
|
6444
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true }
|
|
6445
|
+
},
|
|
6446
|
+
wrapHandler(
|
|
6447
|
+
"reconcile_benefit_claim",
|
|
6448
|
+
"carrier-api.benefit-claims.reconcile",
|
|
6449
|
+
"write",
|
|
6450
|
+
ctx,
|
|
6451
|
+
(args, _token, extra) => {
|
|
6452
|
+
if (typeof args.campaign_id !== "string" || !CAMPAIGN_ID_PATTERN.test(args.campaign_id)) return Promise.resolve(idPathError("campaign_id"));
|
|
6453
|
+
if (typeof args.claim_id !== "string" || !CLAIM_ID_PATTERN.test(args.claim_id)) return Promise.resolve(idPathError("claim_id"));
|
|
6454
|
+
return carrierApiRequest(ctx, extra, {
|
|
6455
|
+
method: "POST",
|
|
6456
|
+
path: `/v1/connectivity/benefit-campaigns/${args.campaign_id}/claims/${args.claim_id}/reconcile`
|
|
6457
|
+
});
|
|
6458
|
+
},
|
|
6459
|
+
{ skipUserToken: true }
|
|
6460
|
+
)
|
|
6461
|
+
);
|
|
6462
|
+
server2.registerTool(
|
|
6463
|
+
"record_experiment_event",
|
|
6464
|
+
{
|
|
6465
|
+
title: "Record one experiment event",
|
|
6466
|
+
description: "Record ONE event of an experiment: what a participant saw or did. Calls POST /v1/connectivity/experiment-events on api.carrier.llc with your own MCP access token. Needs write scope. Safe to repeat with the same event_id: the event is stored once and the replay returns 200. Params: event_id (your own id for this event), experiment_id, revision (>=1), link (the participant), measure (viewed, confirmed, issued or first_data).",
|
|
6467
|
+
inputSchema: {
|
|
6468
|
+
event_id: z6.string().min(1).max(200).describe("Your own id for this event."),
|
|
6469
|
+
experiment_id: z6.string().min(1).max(200).describe("The experiment this event belongs to."),
|
|
6470
|
+
revision: z6.number().int().min(1).max(Number.MAX_SAFE_INTEGER).describe("The revision of the experiment."),
|
|
6471
|
+
link: z6.string().min(1).max(200).describe("The participant this event is about."),
|
|
6472
|
+
measure: z6.enum(["viewed", "confirmed", "issued", "first_data"]).describe("What the participant did.")
|
|
6473
|
+
},
|
|
6474
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true }
|
|
6475
|
+
},
|
|
6476
|
+
wrapHandler(
|
|
6477
|
+
"record_experiment_event",
|
|
6478
|
+
"carrier-api.experiment-events.create",
|
|
6479
|
+
"write",
|
|
6480
|
+
ctx,
|
|
6481
|
+
(args, _token, extra) => carrierApiRequest(ctx, extra, {
|
|
6482
|
+
method: "POST",
|
|
6483
|
+
path: "/v1/connectivity/experiment-events",
|
|
6484
|
+
body: {
|
|
6485
|
+
event_id: args.event_id,
|
|
6486
|
+
experiment_id: args.experiment_id,
|
|
6487
|
+
revision: args.revision,
|
|
6488
|
+
link: args.link,
|
|
6489
|
+
measure: args.measure
|
|
6490
|
+
}
|
|
6491
|
+
}),
|
|
6492
|
+
{ skipUserToken: true }
|
|
6493
|
+
)
|
|
6494
|
+
);
|
|
6495
|
+
server2.registerTool(
|
|
6496
|
+
"experiment_report",
|
|
6497
|
+
{
|
|
6498
|
+
title: "Counts for one experiment",
|
|
6499
|
+
description: "Count the events of one experiment per measure inside a time window. Calls GET /v1/connectivity/experiment-events/{experimentId}/report on api.carrier.llc with your own MCP access token. Needs read scope. The counts describe what happened; they do not say why. A measure without events is absent, never zero. Params: experiment_id, from and to (epoch milliseconds, to is exclusive).",
|
|
6500
|
+
inputSchema: {
|
|
6501
|
+
experiment_id: z6.string().min(1).max(200).describe("The experiment to report on."),
|
|
6502
|
+
from: z6.number().int().min(0).max(Number.MAX_SAFE_INTEGER).describe("Start of the window, epoch milliseconds."),
|
|
6503
|
+
to: z6.number().int().min(0).max(Number.MAX_SAFE_INTEGER).describe("End of the window, epoch milliseconds, exclusive.")
|
|
6504
|
+
},
|
|
6505
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }
|
|
6506
|
+
},
|
|
6507
|
+
wrapHandler(
|
|
6508
|
+
"experiment_report",
|
|
6509
|
+
"carrier-api.experiment-events.report",
|
|
6510
|
+
"read",
|
|
6511
|
+
ctx,
|
|
6512
|
+
(args, _token, extra) => {
|
|
6513
|
+
const q = `from=${encodeURIComponent(String(args.from))}&to=${encodeURIComponent(String(args.to))}`;
|
|
6514
|
+
return carrierApiRequest(ctx, extra, {
|
|
6515
|
+
method: "GET",
|
|
6516
|
+
path: `/v1/connectivity/experiment-events/${encodeURIComponent(args.experiment_id)}/report?${q}`
|
|
6517
|
+
});
|
|
6518
|
+
},
|
|
6519
|
+
{ skipUserToken: true }
|
|
6520
|
+
)
|
|
6521
|
+
);
|
|
6268
6522
|
}
|
|
6269
6523
|
|
|
6270
6524
|
// src/tools-ui-agent-schedule.ts
|
|
6271
|
-
import { z as
|
|
6525
|
+
import { z as z7 } from "zod";
|
|
6272
6526
|
var UI_AGENT_SCHEDULE_TOOL_SCOPES = {
|
|
6273
6527
|
ui_agent_schedule_create: "admin",
|
|
6274
6528
|
ui_agent_schedule_list: "read",
|
|
@@ -6306,14 +6560,14 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
|
|
|
6306
6560
|
title: "Create UI Agent Schedule",
|
|
6307
6561
|
description: "Creates a recurring browser-agent run on a cron schedule, to automate periodic OCS audits, fleet health checks, or any recurring browser-automation task. Minimum interval: 5 minutes. Requires admin scope." + STDIO_NOTE,
|
|
6308
6562
|
inputSchema: {
|
|
6309
|
-
name:
|
|
6310
|
-
cron:
|
|
6563
|
+
name: z7.string().describe("Human-readable name for this schedule"),
|
|
6564
|
+
cron: z7.string().describe(
|
|
6311
6565
|
"Standard 5-field cron expression (minute hour day month weekday). Minimum interval: 5 minutes. Example: '0 */6 * * *' = every 6 hours."
|
|
6312
6566
|
),
|
|
6313
|
-
prompt_template:
|
|
6567
|
+
prompt_template: z7.string().describe(
|
|
6314
6568
|
"Agent prompt/task template the browser agent will execute on each run"
|
|
6315
6569
|
),
|
|
6316
|
-
profile:
|
|
6570
|
+
profile: z7.string().optional().describe(
|
|
6317
6571
|
"Browser-agent profile to use. Defaults to the deployment's configured profile."
|
|
6318
6572
|
)
|
|
6319
6573
|
}
|
|
@@ -6335,7 +6589,7 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
|
|
|
6335
6589
|
title: "Delete UI Agent Schedule",
|
|
6336
6590
|
description: "Permanently deletes a recurring browser-agent schedule. This cannot be undone. Use ui_agent_schedule_pause to temporarily suspend instead. Requires admin scope." + STDIO_NOTE,
|
|
6337
6591
|
inputSchema: {
|
|
6338
|
-
schedule_id:
|
|
6592
|
+
schedule_id: z7.string().describe("ID of the schedule to delete")
|
|
6339
6593
|
}
|
|
6340
6594
|
},
|
|
6341
6595
|
async () => !ctx.props.scope.includes("admin") ? scopeDenied(ctx, "ui_agent_schedule_delete", "admin") : uiAgentStubError("ui_agent_schedule_delete", "recurring_runtime")
|
|
@@ -6346,7 +6600,7 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
|
|
|
6346
6600
|
title: "Pause UI Agent Schedule",
|
|
6347
6601
|
description: "Pauses an active recurring browser-agent schedule. The schedule is preserved and can be resumed later with ui_agent_schedule_resume. Requires admin scope." + STDIO_NOTE,
|
|
6348
6602
|
inputSchema: {
|
|
6349
|
-
schedule_id:
|
|
6603
|
+
schedule_id: z7.string().describe("ID of the schedule to pause")
|
|
6350
6604
|
}
|
|
6351
6605
|
},
|
|
6352
6606
|
async () => !ctx.props.scope.includes("admin") ? scopeDenied(ctx, "ui_agent_schedule_pause", "admin") : uiAgentStubError("ui_agent_schedule_pause", "recurring_runtime")
|
|
@@ -6357,7 +6611,7 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
|
|
|
6357
6611
|
title: "Resume UI Agent Schedule",
|
|
6358
6612
|
description: "Resumes a paused recurring browser-agent schedule. Requires admin scope." + STDIO_NOTE,
|
|
6359
6613
|
inputSchema: {
|
|
6360
|
-
schedule_id:
|
|
6614
|
+
schedule_id: z7.string().describe("ID of the schedule to resume")
|
|
6361
6615
|
}
|
|
6362
6616
|
},
|
|
6363
6617
|
async () => !ctx.props.scope.includes("admin") ? scopeDenied(ctx, "ui_agent_schedule_resume", "admin") : uiAgentStubError("ui_agent_schedule_resume", "recurring_runtime")
|
|
@@ -6414,7 +6668,7 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
|
|
|
6414
6668
|
}
|
|
6415
6669
|
|
|
6416
6670
|
// src/wallet-tools.ts
|
|
6417
|
-
import { z as
|
|
6671
|
+
import { z as z8 } from "zod";
|
|
6418
6672
|
import * as Sentry2 from "@sentry/cloudflare";
|
|
6419
6673
|
|
|
6420
6674
|
// src/audit-schema.ts
|
|
@@ -6874,13 +7128,13 @@ function registerWalletTools(server2, ctx) {
|
|
|
6874
7128
|
// — returns null here. Requiring a number turned that, the most common
|
|
6875
7129
|
// state a new operator is in, into an output validation error.
|
|
6876
7130
|
outputSchema: {
|
|
6877
|
-
org_id:
|
|
6878
|
-
balance_eur_cents:
|
|
6879
|
-
auto_topup_enabled:
|
|
6880
|
-
auto_topup_threshold_cents:
|
|
7131
|
+
org_id: z8.string().describe("Carrier organisation the wallet belongs to"),
|
|
7132
|
+
balance_eur_cents: z8.number().int().describe("Current balance in EUR cents"),
|
|
7133
|
+
auto_topup_enabled: z8.boolean(),
|
|
7134
|
+
auto_topup_threshold_cents: z8.number().int().nullable().describe(
|
|
6881
7135
|
"Balance at or below which an auto top-up fires, EUR cents. Null when auto-top-up is unconfigured."
|
|
6882
7136
|
),
|
|
6883
|
-
auto_topup_pack_cents:
|
|
7137
|
+
auto_topup_pack_cents: z8.number().int().nullable().describe(
|
|
6884
7138
|
"Amount an auto top-up charges, EUR cents. Null when auto-top-up is unconfigured."
|
|
6885
7139
|
)
|
|
6886
7140
|
},
|
|
@@ -6922,7 +7176,7 @@ function registerWalletTools(server2, ctx) {
|
|
|
6922
7176
|
title: "Wallet Top-up Checkout",
|
|
6923
7177
|
description: "Create a Stripe Checkout link so a human can top up the Carrier prepaid wallet by card. This tool charges nothing itself: it returns a hosted URL, and the wallet is credited (pack amount + bonus) only after someone completes the payment in a browser. Params: `pack` (optional \u2014 pack id `pack_25`/`pack_50`/`pack_100`/`pack_500`/`pack_1000`/`pack_2500`/`pack_5000`, or an exact EUR-cents amount matching a catalog pack; omit to list the packs and their bonuses without creating a session). Returns: { pack_id, pack_eur_cents, bonus_eur_cents, checkout_session_id, checkout_url } \u2014 amounts in EUR cents. Do NOT use this when the wallet must be funded now with no human in the loop \u2014 use `wallet_auto_topup`, which charges the saved card immediately. Do NOT use this to move money in OCS \u2014 `modify_account_balance` and `modify_subscriber_balance` are unrelated ledgers.",
|
|
6924
7178
|
inputSchema: {
|
|
6925
|
-
pack:
|
|
7179
|
+
pack: z8.string().optional().describe(
|
|
6926
7180
|
"Pack id (pack_25/pack_50/pack_100/pack_500/pack_1000/pack_2500/pack_5000) or exact EUR-cents amount. Omit to list packs."
|
|
6927
7181
|
)
|
|
6928
7182
|
},
|
|
@@ -6935,21 +7189,21 @@ function registerWalletTools(server2, ctx) {
|
|
|
6935
7189
|
* documented here. Marking either arm required would break the other.
|
|
6936
7190
|
*/
|
|
6937
7191
|
outputSchema: {
|
|
6938
|
-
packs:
|
|
6939
|
-
|
|
6940
|
-
id:
|
|
6941
|
-
eur_cents:
|
|
6942
|
-
bonus_pct:
|
|
6943
|
-
bonus_eur_cents:
|
|
6944
|
-
credited_eur_cents:
|
|
7192
|
+
packs: z8.array(
|
|
7193
|
+
z8.object({
|
|
7194
|
+
id: z8.string(),
|
|
7195
|
+
eur_cents: z8.number().int(),
|
|
7196
|
+
bonus_pct: z8.number(),
|
|
7197
|
+
bonus_eur_cents: z8.number().int(),
|
|
7198
|
+
credited_eur_cents: z8.number().int()
|
|
6945
7199
|
})
|
|
6946
7200
|
).optional().describe("Catalogue arm \u2014 present only when `pack` was omitted."),
|
|
6947
|
-
org_id:
|
|
6948
|
-
pack_id:
|
|
6949
|
-
pack_eur_cents:
|
|
6950
|
-
bonus_eur_cents:
|
|
6951
|
-
checkout_session_id:
|
|
6952
|
-
checkout_url:
|
|
7201
|
+
org_id: z8.string().optional().describe("Session arm."),
|
|
7202
|
+
pack_id: z8.string().optional().describe("Session arm."),
|
|
7203
|
+
pack_eur_cents: z8.number().int().optional().describe("Session arm."),
|
|
7204
|
+
bonus_eur_cents: z8.number().int().optional().describe("Session arm."),
|
|
7205
|
+
checkout_session_id: z8.string().optional().describe("Session arm."),
|
|
7206
|
+
checkout_url: z8.string().nullable().optional().describe("Session arm. Stripe may return null for a session URL.")
|
|
6953
7207
|
},
|
|
6954
7208
|
annotations: annotationsFor("wallet_topup_checkout", "write")
|
|
6955
7209
|
},
|
|
@@ -7006,7 +7260,7 @@ function registerWalletTools(server2, ctx) {
|
|
|
7006
7260
|
title: "Wallet Auto Top-up (charges card now)",
|
|
7007
7261
|
description: "Charge the organisation's saved card off-session, right now, and credit the Carrier prepaid wallet with the pack. This spends real money without any browser step or human confirmation, so only call it when the user has asked to be charged. Params: `pack_cents` (optional integer, EUR cents \u2014 must match a catalog pack; omit to use the organisation's configured auto-top-up pack). Returns on success: { org_id, charged: true, credited_eur_cents, balance_after_cents, payment_intent_id } \u2014 amounts in EUR cents. Returns { charged: false, reason } as an error when the card declines or no payment method is saved. Do NOT use this to let a human pay in a browser \u2014 use `wallet_topup_checkout`, which only returns a link. Do NOT use this to change the threshold that triggers automatic top-ups; this tool performs one charge and does not edit the configuration. Do NOT use this to credit an OCS reseller account or subscriber \u2014 see `modify_account_balance` and `modify_subscriber_balance`.",
|
|
7008
7262
|
inputSchema: {
|
|
7009
|
-
pack_cents:
|
|
7263
|
+
pack_cents: z8.number().int().positive().optional().describe("Override pack amount in EUR cents (must match a catalog pack).")
|
|
7010
7264
|
},
|
|
7011
7265
|
/**
|
|
7012
7266
|
* Only the charged arm is described here — `charged: false` returns
|
|
@@ -7021,12 +7275,12 @@ function registerWalletTools(server2, ctx) {
|
|
|
7021
7275
|
* into a validation error.
|
|
7022
7276
|
*/
|
|
7023
7277
|
outputSchema: {
|
|
7024
|
-
org_id:
|
|
7025
|
-
charged:
|
|
7026
|
-
credited_eur_cents:
|
|
7027
|
-
balance_after_cents:
|
|
7028
|
-
payment_intent_id:
|
|
7029
|
-
note:
|
|
7278
|
+
org_id: z8.string(),
|
|
7279
|
+
charged: z8.literal(true),
|
|
7280
|
+
credited_eur_cents: z8.number().int(),
|
|
7281
|
+
balance_after_cents: z8.number().int().optional().describe("Absent when the charge succeeded but crediting is pending."),
|
|
7282
|
+
payment_intent_id: z8.string().optional(),
|
|
7283
|
+
note: z8.string().optional().describe("Present when the charge landed but the credit is still pending.")
|
|
7030
7284
|
},
|
|
7031
7285
|
annotations: annotationsFor("wallet_auto_topup", "write")
|
|
7032
7286
|
},
|
|
@@ -7072,7 +7326,7 @@ function registerWalletTools(server2, ctx) {
|
|
|
7072
7326
|
}
|
|
7073
7327
|
|
|
7074
7328
|
// src/stripe-connect-tools.ts
|
|
7075
|
-
import { z as
|
|
7329
|
+
import { z as z9 } from "zod";
|
|
7076
7330
|
import * as Sentry3 from "@sentry/cloudflare";
|
|
7077
7331
|
|
|
7078
7332
|
// src/binding-unavailable.ts
|
|
@@ -7228,7 +7482,7 @@ function registerStripeConnectTools(server2, ctx) {
|
|
|
7228
7482
|
title: "Stripe Connect Status",
|
|
7229
7483
|
description: "Read-only: returns the Stripe Connect account status, capabilities, and requirements for the authenticated operator.",
|
|
7230
7484
|
inputSchema: {
|
|
7231
|
-
operator_id:
|
|
7485
|
+
operator_id: z9.string().optional().describe("Override operator_id (admin use). Defaults to caller's org/user.")
|
|
7232
7486
|
},
|
|
7233
7487
|
annotations: annotationsFor("stripe_connect_status", "read")
|
|
7234
7488
|
},
|
|
@@ -7289,8 +7543,8 @@ function registerStripeConnectTools(server2, ctx) {
|
|
|
7289
7543
|
title: "List Stripe Payouts",
|
|
7290
7544
|
description: "List money Stripe has already sent from the operator's connected account to their bank, newest first. Read-only. Params: `limit` (1-50, default 10), `status` (optional Stripe payout status, e.g. 'paid', 'pending', 'failed'). Returns: { payouts: [{ id, amount, currency, status, arrival_date, automatic, created }], has_more } \u2014 amount in the currency's smallest unit. Do NOT use this for money still sitting at Stripe and not yet paid out \u2014 use `stripe_connect_balance`.",
|
|
7291
7545
|
inputSchema: {
|
|
7292
|
-
limit:
|
|
7293
|
-
status:
|
|
7546
|
+
limit: z9.number().int().min(1).max(50).default(10).describe("Number of payouts to return."),
|
|
7547
|
+
status: z9.enum(["pending", "paid", "failed", "canceled", "in_transit"]).optional().describe("Filter by payout status.")
|
|
7294
7548
|
},
|
|
7295
7549
|
annotations: annotationsFor("stripe_connect_payouts", "read")
|
|
7296
7550
|
},
|
|
@@ -7329,8 +7583,8 @@ function registerStripeConnectTools(server2, ctx) {
|
|
|
7329
7583
|
title: "Stripe Connect Charges",
|
|
7330
7584
|
description: "List recent payments (charges) on the operator's connected Stripe account, e.g. storefront purchases. Read-only. Params: limit (1-100), starting_after (charge id for paging). Returns: { charges: [{ id, amount, amount_refunded, currency, status, paid, captured, refunded, created, payment_intent, payment_method_type, metadata }], has_more }. Do NOT use this for payouts to the bank \u2014 use `stripe_connect_payouts`.",
|
|
7331
7585
|
inputSchema: {
|
|
7332
|
-
limit:
|
|
7333
|
-
starting_after:
|
|
7586
|
+
limit: z9.number().int().min(1).max(100).default(20).describe("Number of charges to return."),
|
|
7587
|
+
starting_after: z9.string().regex(/^(ch|py)_[A-Za-z0-9]+$/).optional().describe("Charge id to page after.")
|
|
7334
7588
|
},
|
|
7335
7589
|
annotations: annotationsFor("stripe_connect_charges_list", "read")
|
|
7336
7590
|
},
|
|
@@ -7426,10 +7680,10 @@ function registerStripeConnectTools(server2, ctx) {
|
|
|
7426
7680
|
title: "Refund a Charge (moves real money)",
|
|
7427
7681
|
description: "Refund money to a customer on one charge in the operator's connected Stripe account. This returns real funds and Stripe cannot reverse a refund once issued. Two-step by design: call without `confirm_token` to get a token and a summary of what would be refunded, then call again with that token to execute. The token expires in 5 minutes. Params: `charge_id` (Stripe charge id, `ch_...`), `amount_cents` (optional integer in the charge's smallest currency unit \u2014 omit for a full refund), `reason` ('duplicate' | 'fraudulent' | 'requested_by_customer', optional), `confirm_token`. Returns: the refund id and status. Requires `write` scope. Do NOT use this on a payment that was authorized but not captured \u2014 cancel its PaymentIntent instead (Stripe POST /v1/payment_intents/:id/cancel). Do NOT use this to contest a chargeback \u2014 read the case with `stripe_connect_dispute_list` first, since refunding a disputed charge can cost the operator twice.",
|
|
7428
7682
|
inputSchema: {
|
|
7429
|
-
charge_id:
|
|
7430
|
-
amount_cents:
|
|
7431
|
-
reason:
|
|
7432
|
-
confirm_token:
|
|
7683
|
+
charge_id: z9.string().min(1).describe("Stripe charge ID (ch_...)."),
|
|
7684
|
+
amount_cents: z9.number().int().min(1).optional().describe("Partial refund amount in cents. Omit for full refund."),
|
|
7685
|
+
reason: z9.enum(["duplicate", "fraudulent", "requested_by_customer"]).optional(),
|
|
7686
|
+
confirm_token: z9.string().optional().describe("Confirmation token from previous call. Required to execute.")
|
|
7433
7687
|
},
|
|
7434
7688
|
annotations: annotationsFor("stripe_connect_refund", "write")
|
|
7435
7689
|
},
|
|
@@ -7488,8 +7742,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
|
|
|
7488
7742
|
title: "List Chargeback Disputes",
|
|
7489
7743
|
description: "List chargebacks customers have raised with their bank against the operator's connected Stripe account. Read-only \u2014 responding to one is Dashboard work. Params: `limit` (1-50, default 10), `status` (optional Stripe dispute status, e.g. 'needs_response', 'under_review'). Returns: { disputes: [{ id, charge, amount, currency, status, reason, evidence_details.due_by }], has_more } \u2014 amount in the currency's smallest unit, `due_by` a Unix timestamp or null. Do NOT use this for charges Stripe is holding for fraud review before they settle \u2014 those are `radar_review_list`. Check this before refunding: refunding a disputed charge can cost the operator the amount twice.",
|
|
7490
7744
|
inputSchema: {
|
|
7491
|
-
limit:
|
|
7492
|
-
status:
|
|
7745
|
+
limit: z9.number().int().min(1).max(50).default(10),
|
|
7746
|
+
status: z9.string().optional().describe("Filter by dispute status (e.g. needs_response, under_review).")
|
|
7493
7747
|
},
|
|
7494
7748
|
annotations: annotationsFor("stripe_connect_dispute_list", "read")
|
|
7495
7749
|
},
|
|
@@ -7528,8 +7782,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
|
|
|
7528
7782
|
title: "List Radar Fraud Reviews",
|
|
7529
7783
|
description: "List the Stripe Radar fraud reviews waiting on a manual approve/decline decision, newest first. Reads only \u2014 deciding a review is a separate call. Params: `open_only` (boolean, default true; Stripe lists open reviews only, so false returns the same set), `limit` (1-50, default 10). Returns: { reviews: [{ id (`prv_...`), charge, reason, opened_reason, closed_reason, created, closed }], has_more }. Call this first to get the `review_id` that `radar_review_approve` and `radar_review_decline` require. Do NOT use this for chargebacks the customer has already raised with their bank \u2014 use `stripe_connect_dispute_list`.",
|
|
7530
7784
|
inputSchema: {
|
|
7531
|
-
open_only:
|
|
7532
|
-
limit:
|
|
7785
|
+
open_only: z9.boolean().default(true).describe("Stripe lists only open (undecided) reviews; kept for compatibility."),
|
|
7786
|
+
limit: z9.number().int().min(1).max(50).default(10)
|
|
7533
7787
|
},
|
|
7534
7788
|
annotations: annotationsFor("radar_review_list", "read")
|
|
7535
7789
|
},
|
|
@@ -7571,8 +7825,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
|
|
|
7571
7825
|
title: "Approve Radar Review (captures charge)",
|
|
7572
7826
|
description: "Clear a Stripe Radar fraud review so the held charge is captured and the money is taken. Approving overrides Radar's fraud signal, so a genuinely fraudulent charge approved here usually returns later as a chargeback plus a fee. Two-step by design: call without `confirm_token` to get a token, then call again with it to execute. Params: `review_id` (`prv_...`, from `radar_review_list`), `confirm_token`. Requires `admin` scope. Do NOT call this to turn a suspicious charge away \u2014 Stripe has no review decline; refund the charge (`stripe_connect_refund`) or cancel an uncaptured PaymentIntent. Do NOT call this to return money on a charge that already went through \u2014 that is `stripe_connect_refund`.",
|
|
7573
7827
|
inputSchema: {
|
|
7574
|
-
review_id:
|
|
7575
|
-
confirm_token:
|
|
7828
|
+
review_id: z9.string().min(1).describe("Stripe Radar review ID (prv_...)."),
|
|
7829
|
+
confirm_token: z9.string().optional()
|
|
7576
7830
|
},
|
|
7577
7831
|
annotations: annotationsFor("radar_review_approve", "admin")
|
|
7578
7832
|
},
|
|
@@ -7628,8 +7882,8 @@ Call again with confirm_token="${token2}" to execute. Expires in 5 minutes.`
|
|
|
7628
7882
|
title: "Decline Radar Review (not supported by Stripe)",
|
|
7629
7883
|
description: "Always refuses and calls nothing: Stripe has no endpoint to decline a Radar review (its Reviews API only lists, retrieves and approves). Payments in review have usually already been processed. To turn one away, refund the charge on Carrier's platform account in Stripe itself (Dashboard, or platform-scoped POST /v1/refunds with no Stripe-Account header): `stripe_connect_refund` always acts as the operator's connected account, so it will NOT find a platform charge from this review list. or, for a payment authorized but not captured, cancel its PaymentIntent (Stripe POST /v1/payment_intents/:id/cancel); either closes the review. Params: `review_id` (`prv_...`), `confirm_token` (ignored). Requires `admin` scope. Do NOT call this expecting a charge to be blocked; nothing happens.",
|
|
7630
7884
|
inputSchema: {
|
|
7631
|
-
review_id:
|
|
7632
|
-
confirm_token:
|
|
7885
|
+
review_id: z9.string().min(1),
|
|
7886
|
+
confirm_token: z9.string().optional()
|
|
7633
7887
|
},
|
|
7634
7888
|
annotations: annotationsFor("radar_review_decline", "admin")
|
|
7635
7889
|
},
|
|
@@ -7650,9 +7904,9 @@ Call again with confirm_token="${token2}" to execute. Expires in 5 minutes.`
|
|
|
7650
7904
|
title: "Add Value to Radar List",
|
|
7651
7905
|
description: "Add one value to an existing Stripe Radar value list, changing how every future charge is scored. Whether the value ends up blocked or allowed depends entirely on which list you name in `value_list_id` \u2014 this tool does not choose, and putting a value on the allow list when you meant the block list silently lets fraud through. Confirm the list's purpose before calling. Two-step by design: call without `confirm_token` to get a token, then call again with it to execute. Params: `value_list_id` (`rsl_...`, an existing list), `value` (one email, IP address, card fingerprint, or ISO country code \u2014 one item per call), `confirm_token`. Requires `admin` scope. Do NOT use this to decide a single charge that is already under review \u2014 use `radar_review_approve` or `radar_review_decline`. Do NOT use this to create a list or a rule: only `value` is added, and rules cannot be edited through this API at all (see `radar_rule_toggle`).",
|
|
7652
7906
|
inputSchema: {
|
|
7653
|
-
value_list_id:
|
|
7654
|
-
value:
|
|
7655
|
-
confirm_token:
|
|
7907
|
+
value_list_id: z9.string().min(1).describe("Stripe Radar value list ID (rsl_...)."),
|
|
7908
|
+
value: z9.string().min(1).describe("The value to add (email, IP address, country code, etc.)."),
|
|
7909
|
+
confirm_token: z9.string().optional()
|
|
7656
7910
|
},
|
|
7657
7911
|
annotations: annotationsFor("radar_value_list_add", "admin")
|
|
7658
7912
|
},
|
|
@@ -7707,8 +7961,8 @@ Expires in 5 minutes.`
|
|
|
7707
7961
|
title: "Radar Rule Toggle (instructions only)",
|
|
7708
7962
|
description: "Return the Stripe Dashboard steps for enabling or disabling a Radar rule. This tool changes nothing: Stripe has no public API for rule state, so the call always succeeds and the rule stays exactly as it was. Never report the rule as toggled. Params: `rule_id` (Stripe Radar rule id), `enabled` (true for the enable instructions, false for disable). Returns: the Dashboard URL and steps for a human to follow. Requires `admin` scope. Do NOT use this when a change must actually take effect from an agent \u2014 the only Radar state reachable through this API is value-list membership, via `radar_value_list_add`.",
|
|
7709
7963
|
inputSchema: {
|
|
7710
|
-
rule_id:
|
|
7711
|
-
enabled:
|
|
7964
|
+
rule_id: z9.string().min(1).describe("Stripe Radar rule ID."),
|
|
7965
|
+
enabled: z9.boolean().describe("true = enable, false = disable.")
|
|
7712
7966
|
},
|
|
7713
7967
|
annotations: annotationsFor("radar_rule_toggle", "admin")
|
|
7714
7968
|
},
|
|
@@ -7733,7 +7987,7 @@ Note: If you need this automated, use the Radar for Platforms beta \u2014 contac
|
|
|
7733
7987
|
}
|
|
7734
7988
|
|
|
7735
7989
|
// src/tools-storefront-logo.ts
|
|
7736
|
-
import { z as
|
|
7990
|
+
import { z as z10 } from "zod";
|
|
7737
7991
|
var STOREFRONT_LOGO_TOOL_SCOPES = {
|
|
7738
7992
|
generate_storefront_logo: "read"
|
|
7739
7993
|
};
|
|
@@ -7746,9 +8000,9 @@ function registerStorefrontLogoTools(server2, env = {}, props2) {
|
|
|
7746
8000
|
title: "Generate Storefront Logo",
|
|
7747
8001
|
description: "Generate a storefront logo (SVG always; PNG when an image key is configured on the Carrier worker). Works for any authenticated Carrier MCP user \u2014 no local image-API key required. Write the SVG to public/brand/logo.svg in the storefront.",
|
|
7748
8002
|
inputSchema: {
|
|
7749
|
-
name:
|
|
7750
|
-
accent:
|
|
7751
|
-
tagline:
|
|
8003
|
+
name: z10.string().min(1).describe("Brand / shop name, e.g. Bananas"),
|
|
8004
|
+
accent: z10.string().regex(/^#?[0-9A-Fa-f]{6}$/).optional().describe("Accent hex, e.g. #FF8A00"),
|
|
8005
|
+
tagline: z10.string().optional().describe("Optional tagline for AI-enhanced marks")
|
|
7752
8006
|
},
|
|
7753
8007
|
annotations: annotationsFor("generate_storefront_logo", "read")
|
|
7754
8008
|
},
|
|
@@ -7782,7 +8036,7 @@ function registerStorefrontLogoTools(server2, env = {}, props2) {
|
|
|
7782
8036
|
}
|
|
7783
8037
|
|
|
7784
8038
|
// src/tools-storefront-deploy.ts
|
|
7785
|
-
import { z as
|
|
8039
|
+
import { z as z11 } from "zod";
|
|
7786
8040
|
var STOREFRONT_DEPLOY_TOOL_SCOPES = {
|
|
7787
8041
|
list_deploy_targets: "read",
|
|
7788
8042
|
deploy_storefront: "write",
|
|
@@ -7799,7 +8053,7 @@ function registerStorefrontDeployTools(server2, props2) {
|
|
|
7799
8053
|
title: "List Deploy Targets",
|
|
7800
8054
|
description: "Report which storefront deploy hosts (Cloudflare, Vercel, Netlify, Fly) are installed, logged in, and ready on this machine, and which one a deploy would pick.",
|
|
7801
8055
|
inputSchema: {
|
|
7802
|
-
dir:
|
|
8056
|
+
dir: z11.string().min(1).describe("Path to the scaffolded storefront directory")
|
|
7803
8057
|
},
|
|
7804
8058
|
annotations: annotationsFor("list_deploy_targets", "read")
|
|
7805
8059
|
},
|
|
@@ -7825,17 +8079,17 @@ function registerStorefrontDeployTools(server2, props2) {
|
|
|
7825
8079
|
title: "Deploy Storefront",
|
|
7826
8080
|
description: "Build and deploy a scaffolded storefront to whichever host is available on this machine, then push its runtime secrets (CARRIER_API_KEY, CLERK_SECRET_KEY) to that host.",
|
|
7827
8081
|
inputSchema: {
|
|
7828
|
-
dir:
|
|
7829
|
-
target:
|
|
7830
|
-
name:
|
|
7831
|
-
force:
|
|
8082
|
+
dir: z11.string().min(1).describe("Path to the scaffolded storefront directory"),
|
|
8083
|
+
target: z11.enum(TARGET_IDS).optional().describe("Force a host instead of auto-detecting"),
|
|
8084
|
+
name: z11.string().optional().describe("Project/worker name (defaults from brand)"),
|
|
8085
|
+
force: z11.boolean().optional().describe(
|
|
7832
8086
|
'Acknowledge the scaffold-default-name risk: required when the resolved name is the scaffold default "storefront"'
|
|
7833
8087
|
),
|
|
7834
|
-
skip_build:
|
|
7835
|
-
push_secrets:
|
|
7836
|
-
provision_clerk:
|
|
7837
|
-
verify:
|
|
7838
|
-
domain:
|
|
8088
|
+
skip_build: z11.boolean().optional().describe("Deploy the existing build without rebuilding"),
|
|
8089
|
+
push_secrets: z11.boolean().optional().describe("Stage runtime secrets on the host before deploy (default true)"),
|
|
8090
|
+
provision_clerk: z11.boolean().optional().default(true).describe("Provision and configure Clerk automatically (default true)"),
|
|
8091
|
+
verify: z11.boolean().optional().describe("Probe the deployed URL and report whether it actually serves (default true)"),
|
|
8092
|
+
domain: z11.boolean().optional().describe("Route the brand domain to the deployment (Cloudflare provisions DNS + cert)")
|
|
7839
8093
|
},
|
|
7840
8094
|
annotations: annotationsFor("deploy_storefront", "write")
|
|
7841
8095
|
},
|
|
@@ -7955,11 +8209,11 @@ function registerStorefrontDeployTools(server2, props2) {
|
|
|
7955
8209
|
title: "Provision Storefront Clerk App",
|
|
7956
8210
|
description: "Create a Clerk application (Platform API) or reuse Clerk keys already on this machine, write them into the storefront .env.local, and configure allowed origins and redirect URLs on the instance.",
|
|
7957
8211
|
inputSchema: {
|
|
7958
|
-
dir:
|
|
7959
|
-
name:
|
|
7960
|
-
production:
|
|
7961
|
-
no_create:
|
|
7962
|
-
url:
|
|
8212
|
+
dir: z11.string().min(1).describe("Path to the scaffolded storefront directory"),
|
|
8213
|
+
name: z11.string().optional().describe("Clerk application name (defaults from brand)"),
|
|
8214
|
+
production: z11.boolean().optional().describe("Also create a production instance (Platform API only)"),
|
|
8215
|
+
no_create: z11.boolean().optional().describe("Never create a new application; only reuse existing keys"),
|
|
8216
|
+
url: z11.string().optional().describe("Deployed URL to whitelist as origin and redirect")
|
|
7963
8217
|
},
|
|
7964
8218
|
annotations: annotationsFor("provision_storefront_clerk", "write")
|
|
7965
8219
|
},
|
|
@@ -8015,7 +8269,7 @@ function registerStorefrontDeployTools(server2, props2) {
|
|
|
8015
8269
|
}
|
|
8016
8270
|
|
|
8017
8271
|
// src/tools-storefront-plan.ts
|
|
8018
|
-
import { z as
|
|
8272
|
+
import { z as z12 } from "zod";
|
|
8019
8273
|
|
|
8020
8274
|
// src/lib/storefront-plan-update.ts
|
|
8021
8275
|
var STRIPE_PRICE_ID_RE = /^price_[A-Za-z0-9_]+$/;
|
|
@@ -8121,7 +8375,7 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
|
|
|
8121
8375
|
server2.registerTool(name, {
|
|
8122
8376
|
title: name === "list_storefronts" ? "List Storefronts" : "Get Storefront",
|
|
8123
8377
|
description: "Read hosted storefront plans including stored OCS account ids and account_status.",
|
|
8124
|
-
inputSchema: name === "get_storefront" ? { storefront_id:
|
|
8378
|
+
inputSchema: name === "get_storefront" ? { storefront_id: z12.string().min(1) } : {},
|
|
8125
8379
|
annotations: annotationsFor(name, "read")
|
|
8126
8380
|
}, async (args) => {
|
|
8127
8381
|
const denied = denyUnlessScoped(props2, name, STOREFRONT_PLAN_TOOL_SCOPES);
|
|
@@ -8140,14 +8394,14 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
|
|
|
8140
8394
|
title: "Update Storefront Plan",
|
|
8141
8395
|
description: "Change the retail price, whether a plan is for sale, its OCS account, its display order, or the stored Stripe Price on the caller's own hosted storefront. The plan must already exist. A price of zero or less is refused. stripe_price_id and stripe_price_mode are set together; null clears both. The id must look like price_\u2026 and be 1-255 characters. A plan on another storefront is not found and is left unchanged. The Price is stored, not yet charged. This does not create a Stripe Price, and a buyer cannot set one. The later checkout must verify the Price on the connected account.",
|
|
8142
8396
|
inputSchema: {
|
|
8143
|
-
ocs_account_id:
|
|
8144
|
-
storefront_id:
|
|
8145
|
-
slug:
|
|
8146
|
-
price_cents:
|
|
8147
|
-
active:
|
|
8148
|
-
sort_order:
|
|
8149
|
-
stripe_price_id:
|
|
8150
|
-
stripe_price_mode:
|
|
8397
|
+
ocs_account_id: z12.number().int().positive().optional().describe("Owned OCS account override. Omit for automatic resolution."),
|
|
8398
|
+
storefront_id: z12.string().min(1).describe("Id of the hosted storefront"),
|
|
8399
|
+
slug: z12.string().min(1).describe("Plan slug, such as eu-1gb"),
|
|
8400
|
+
price_cents: z12.number().int().positive().optional().describe("Retail price in minor units. Must be greater than zero. Omit to leave the price."),
|
|
8401
|
+
active: z12.boolean().optional().describe("Whether the plan is for sale. Omit to leave it."),
|
|
8402
|
+
sort_order: z12.number().int().nonnegative().optional().describe("Display order, lowest first. Omit to leave it."),
|
|
8403
|
+
stripe_price_id: z12.string().regex(/^price_[A-Za-z0-9_]+$/).max(255).nullable().optional().describe("Existing Stripe Price id (price_\u2026, 1-255 characters), stored, not yet charged. Set with stripe_price_mode. Null clears both. Omit to leave them."),
|
|
8404
|
+
stripe_price_mode: z12.enum(["test", "live"]).nullable().optional().describe("test or live. Set with stripe_price_id. Null clears both. Omit to leave them.")
|
|
8151
8405
|
},
|
|
8152
8406
|
annotations: annotationsFor("update_storefront_plan", "write")
|
|
8153
8407
|
},
|
|
@@ -8175,7 +8429,7 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
|
|
|
8175
8429
|
}
|
|
8176
8430
|
|
|
8177
8431
|
// src/tools-atlas.ts
|
|
8178
|
-
import { z as
|
|
8432
|
+
import { z as z13 } from "zod";
|
|
8179
8433
|
|
|
8180
8434
|
// src/atlas-public.ts
|
|
8181
8435
|
var ATLAS_PUBLIC_BASE_URL = "https://atlas.carrier.llc";
|
|
@@ -8233,13 +8487,13 @@ var ATLAS_TOOL_SCOPES = {
|
|
|
8233
8487
|
get_atlas_network_status: "read"
|
|
8234
8488
|
};
|
|
8235
8489
|
var coverageSchema = {
|
|
8236
|
-
country:
|
|
8237
|
-
status:
|
|
8238
|
-
technology:
|
|
8490
|
+
country: z13.string().regex(/^[A-Za-z]{2}$/, "country must be a 2-letter ISO code").describe("ISO 3166-1 alpha-2 country code, for example JP or NL"),
|
|
8491
|
+
status: z13.enum(["up", "degraded", "down", "unknown"]).optional().describe("Keep only networks whose latest probe has this status"),
|
|
8492
|
+
technology: z13.enum(["2G", "3G", "4G", "5G"]).optional().describe("Keep only networks of this radio generation")
|
|
8239
8493
|
};
|
|
8240
8494
|
var networkSchema = {
|
|
8241
|
-
mcc:
|
|
8242
|
-
mnc:
|
|
8495
|
+
mcc: z13.string().regex(/^\d{3}$/, "mcc must be 3 digits").describe("Mobile Country Code"),
|
|
8496
|
+
mnc: z13.string().regex(/^\d{2,3}$/, "mnc must be 2 or 3 digits").describe("Mobile Network Code")
|
|
8243
8497
|
};
|
|
8244
8498
|
function jsonResult3(body2) {
|
|
8245
8499
|
return {
|
|
@@ -8294,15 +8548,15 @@ function registerAtlasTools(server2, ctx) {
|
|
|
8294
8548
|
}
|
|
8295
8549
|
|
|
8296
8550
|
// src/tools-network-default.ts
|
|
8297
|
-
import { z as
|
|
8551
|
+
import { z as z14 } from "zod";
|
|
8298
8552
|
var NETWORK_DEFAULT_TOOL_SCOPES = {
|
|
8299
8553
|
get_network_default: "read",
|
|
8300
8554
|
set_network_default: "write",
|
|
8301
8555
|
plan_network_default: "read"
|
|
8302
8556
|
};
|
|
8303
|
-
var choiceShape =
|
|
8304
|
-
mode:
|
|
8305
|
-
steeringListId:
|
|
8557
|
+
var choiceShape = z14.object({
|
|
8558
|
+
mode: z14.enum(NETWORK_DEFAULT_MODES),
|
|
8559
|
+
steeringListId: z14.number().int().positive().optional()
|
|
8306
8560
|
}).describe("`cheapest_available`, `all`, or `custom` with a steeringListId from list_steering_lists");
|
|
8307
8561
|
function ioFor(ctx, token2) {
|
|
8308
8562
|
const kv = ctx.env.CARRIER_USERS;
|
|
@@ -8357,9 +8611,9 @@ function registerNetworkDefaultTools(server2, ctx) {
|
|
|
8357
8611
|
title: "Set Network Default",
|
|
8358
8612
|
description: "Use this to set the organisation's network default to `cheapest_available`, `all`, or `custom` (a steering list id from `list_steering_lists`, which must exist). This only stores the setting. It changes no SIM, writes nothing to OCS and does not migrate existing customers: it applies to NEW assignments. A single assignment can still override it with `plan_network_default`'s `simOverride`. Params: `mode` (required), `steeringListId` (required when mode is `custom`), `dry_run` (preview only). Do NOT use this to assign a list to one SIM \u2014 use `modify_subscriber_steering_list`.",
|
|
8359
8613
|
inputSchema: {
|
|
8360
|
-
mode:
|
|
8361
|
-
steeringListId:
|
|
8362
|
-
dry_run:
|
|
8614
|
+
mode: z14.enum(NETWORK_DEFAULT_MODES).describe("cheapest_available | all | custom"),
|
|
8615
|
+
steeringListId: z14.number().int().positive().optional().describe("Required when mode is custom"),
|
|
8616
|
+
dry_run: z14.boolean().optional().describe("If true, validate and return what would be stored; store nothing")
|
|
8363
8617
|
},
|
|
8364
8618
|
annotations: { readOnlyHint: false, idempotentHint: true, destructiveHint: false }
|
|
8365
8619
|
},
|
|
@@ -8388,10 +8642,10 @@ function registerNetworkDefaultTools(server2, ctx) {
|
|
|
8388
8642
|
title: "Plan Network Default",
|
|
8389
8643
|
description: "Use this to see which networks a SIM would be given in one or more countries, before anything is assigned. By default that is the cheapest available network per country (lowest data rate above zero, among rules really in force). Precedence: `simOverride`, then `packageOverride`, then the org default, then `cheapest_available`. Read only: `applied` is always false. If the tariff is missing or cannot be compared it falls back to ALL networks and says so in `warnings` and `summary` (`fellBackToAll: true`); never present that as a cheapest choice. The price basis is the wholesale data rate per MB, not the end price. Creating a steering list has no OCS REST method, so when no existing list matches the result is `needs_list`, not a created list. Params: `countries` (ISO-3166 alpha-2 codes, required), `simOverride`, `packageOverride`, `resellerId` (optional).",
|
|
8390
8644
|
inputSchema: {
|
|
8391
|
-
countries:
|
|
8645
|
+
countries: z14.array(z14.string().length(2)).min(1).describe('ISO-3166 alpha-2 codes, e.g. ["CA"]'),
|
|
8392
8646
|
simOverride: choiceShape.optional(),
|
|
8393
8647
|
packageOverride: choiceShape.optional(),
|
|
8394
|
-
resellerId:
|
|
8648
|
+
resellerId: z14.number().int().positive().optional().describe("Omit to use the token owner's reseller")
|
|
8395
8649
|
},
|
|
8396
8650
|
annotations: { readOnlyHint: true }
|
|
8397
8651
|
},
|
|
@@ -8406,7 +8660,7 @@ function registerNetworkDefaultTools(server2, ctx) {
|
|
|
8406
8660
|
}
|
|
8407
8661
|
|
|
8408
8662
|
// src/affiliate-tools.ts
|
|
8409
|
-
import { z as
|
|
8663
|
+
import { z as z15 } from "zod";
|
|
8410
8664
|
var AFFILIATE_TOOL_SCOPES = {
|
|
8411
8665
|
affiliate_status: "read",
|
|
8412
8666
|
affiliate_commissions: "read",
|
|
@@ -8477,7 +8731,7 @@ function registerAffiliateTools(server2, ctx) {
|
|
|
8477
8731
|
title: "Affiliate Commissions",
|
|
8478
8732
|
description: "Read-only: returns the list of commission records for the authenticated operator.",
|
|
8479
8733
|
inputSchema: {
|
|
8480
|
-
limit:
|
|
8734
|
+
limit: z15.number().int().min(1).max(200).optional().default(50).describe("Maximum number of commission records to return (1-200, default: 50).")
|
|
8481
8735
|
},
|
|
8482
8736
|
annotations: annotationsFor("affiliate_commissions", "read")
|
|
8483
8737
|
},
|
|
@@ -10628,15 +10882,15 @@ function registerAllCarrierAskTools(server2, ctx) {
|
|
|
10628
10882
|
title: "Natural Language Carrier Tool Router",
|
|
10629
10883
|
description: "Use this when you want to perform a carrier operation but don't know which specific tool to call. Describe your intent in plain language and carrier_ask will identify the correct tool(s) and suggest the required parameters. For simple read intents, it executes directly and returns results. For destructive operations it returns a confirm_token that you must pass in a second call. Params: `intent` (string \u2014 natural language description of what you want to do), `context` (optional: iccid, account_id, reseller_id if already known). Returns: RouteResult \u2014 confirmed | pending_confirm | ambiguous | none. Do NOT use this when you know the right tool \u2014 direct calls are faster and cheaper.",
|
|
10630
10884
|
inputSchema: {
|
|
10631
|
-
intent:
|
|
10885
|
+
intent: z16.string().min(3).describe(
|
|
10632
10886
|
"Natural-language description of the operation to perform (e.g. 'suspend ICCID 89316 until next month', 'show fleet health', 'assign Europe 5GB package to subscriber 89316...')"
|
|
10633
10887
|
),
|
|
10634
|
-
context:
|
|
10635
|
-
iccid:
|
|
10636
|
-
account_id:
|
|
10637
|
-
reseller_id:
|
|
10888
|
+
context: z16.object({
|
|
10889
|
+
iccid: z16.string().optional().describe("Subscriber ICCID if already known"),
|
|
10890
|
+
account_id: z16.number().optional().describe("Account ID if already known"),
|
|
10891
|
+
reseller_id: z16.number().optional().describe("Reseller ID if already known")
|
|
10638
10892
|
}).optional().describe("Optional pre-resolved context to improve routing accuracy"),
|
|
10639
|
-
confirm_token:
|
|
10893
|
+
confirm_token: z16.string().optional().describe(
|
|
10640
10894
|
"One-time token from a previous carrier_ask call with confirm_required=true. Providing this executes the previously staged destructive operation."
|
|
10641
10895
|
)
|
|
10642
10896
|
}
|
|
@@ -10840,7 +11094,7 @@ function registerAllCarrierAskTools(server2, ctx) {
|
|
|
10840
11094
|
title: "Describe a Carrier Tool",
|
|
10841
11095
|
description: "Get full documentation for any registered Carrier MCP tool: description, parameters, 2-3 example invocations, required scope, destructive flag, and guidance. Params: `tool_name` (exact MCP tool name, e.g. 'assign_package'). Returns: structured tool metadata. Does NOT execute the tool.",
|
|
10842
11096
|
inputSchema: {
|
|
10843
|
-
tool_name:
|
|
11097
|
+
tool_name: z16.string().describe("The exact MCP tool name to describe (e.g. 'assign_package', 'hlr_set_bitrate')")
|
|
10844
11098
|
}
|
|
10845
11099
|
},
|
|
10846
11100
|
wrapHandler(
|
|
@@ -10933,7 +11187,7 @@ function buildExamples(toolName) {
|
|
|
10933
11187
|
}
|
|
10934
11188
|
|
|
10935
11189
|
// src/list-recent-ocs-events.ts
|
|
10936
|
-
import { z as
|
|
11190
|
+
import { z as z17 } from "zod";
|
|
10937
11191
|
|
|
10938
11192
|
// ../../packages/ocs-spec/src/ocs-event-buffer-read.ts
|
|
10939
11193
|
var LIFECYCLE_RESELLER_ID2 = 1170;
|
|
@@ -11062,10 +11316,10 @@ var ALLOWED_EVENT_TYPES = [
|
|
|
11062
11316
|
"usage.anomaly"
|
|
11063
11317
|
];
|
|
11064
11318
|
var listRecentOcsEventsSchema = {
|
|
11065
|
-
iccid:
|
|
11066
|
-
limit:
|
|
11067
|
-
event_types:
|
|
11068
|
-
since:
|
|
11319
|
+
iccid: z17.string().regex(/^\d{19,20}$/).describe("ICCID, 19 or 20 digits, ITU-T E.118 format"),
|
|
11320
|
+
limit: z17.number().int().min(1).max(50).default(20).describe("Max events to return, newest first"),
|
|
11321
|
+
event_types: z17.array(z17.enum(ALLOWED_EVENT_TYPES)).optional().describe("Filter to specific event types"),
|
|
11322
|
+
since: z17.string().datetime().optional().describe("ISO-8601 timestamp; only events after this point")
|
|
11069
11323
|
};
|
|
11070
11324
|
async function listRecentOcsEvents2(iccid, limit, eventTypes, since, kv) {
|
|
11071
11325
|
return listRecentOcsEvents(iccid, limit, eventTypes, since, kv);
|
|
@@ -11128,7 +11382,7 @@ function registerListRecentOcsEventsTool(server2, ctx) {
|
|
|
11128
11382
|
}
|
|
11129
11383
|
|
|
11130
11384
|
// src/tools-rate-governor.ts
|
|
11131
|
-
import { z as
|
|
11385
|
+
import { z as z18 } from "zod";
|
|
11132
11386
|
var MONITORED_ENDPOINTS = [
|
|
11133
11387
|
"subscriberNetworkEventsOverPeriod",
|
|
11134
11388
|
// 30/min
|
|
@@ -11160,7 +11414,7 @@ function registerRateLimitStatusTool(server2, ctx) {
|
|
|
11160
11414
|
title: "API Rate-Limit Governor Status",
|
|
11161
11415
|
description: "Inspect Bridge4IP OCS rate-limit governor state \u2014 bucket fill levels, per-endpoint limits, and 80% alert thresholds. Use this to answer: 'are we rate limited', 'check ocs quota', 'how full is the rate limit bucket', 'rate limit status'. Params: `endpoint` (optional \u2014 OCS camelCase method name to inspect a single bucket, e.g. 'subscriberUsageOverPeriod'; omit for all monitored endpoints). Returns: per-endpoint { limit_per_min, batch_cap_per_min, calls_in_window, batch_calls_in_window, utilisation_pct, alert (true when \u226580% of limit) }. Note: counts come from the in-process sliding-window log (same key as OCS calls: API token + endpoint) \u2014 they reset when the Worker isolate recycles. Use as a relative signal, not an exact counter. Do NOT use this to adjust limits \u2014 limits are set by Bridge4IP contract and cannot be changed via MCP.",
|
|
11162
11416
|
inputSchema: {
|
|
11163
|
-
endpoint:
|
|
11417
|
+
endpoint: z18.string().optional().describe(
|
|
11164
11418
|
"OCS method name in camelCase (e.g. 'subscriberUsageOverPeriod'). Omit to return status for all monitored endpoints."
|
|
11165
11419
|
)
|
|
11166
11420
|
},
|
|
@@ -11216,7 +11470,7 @@ function registerRateLimitStatusTool(server2, ctx) {
|
|
|
11216
11470
|
}
|
|
11217
11471
|
|
|
11218
11472
|
// src/tools-depletion-events.ts
|
|
11219
|
-
import { z as
|
|
11473
|
+
import { z as z19 } from "zod";
|
|
11220
11474
|
function ok6(payload) {
|
|
11221
11475
|
return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
|
|
11222
11476
|
}
|
|
@@ -11244,10 +11498,10 @@ function registerDepletionEventsTool(server2, ctx) {
|
|
|
11244
11498
|
title: "Subscriber Bundle Depletion Events",
|
|
11245
11499
|
description: "Look up bundle depletion events for a subscriber (or list recent fleet-wide depletions). Returns the most recent bundle.depleted event stored when the prepaid usage webhook received a last_slice notification. Events are retained for 7 days. Use subscriberId to check a specific subscriber, or omit to list the 20 most recent fleet-wide depletions. Requires 'read' scope.",
|
|
11246
11500
|
inputSchema: {
|
|
11247
|
-
subscriberId:
|
|
11501
|
+
subscriberId: z19.string().optional().describe(
|
|
11248
11502
|
"OCS subscriber ID to look up. Omit to list the 20 most recent fleet-wide depletions."
|
|
11249
11503
|
),
|
|
11250
|
-
since:
|
|
11504
|
+
since: z19.string().optional().describe(
|
|
11251
11505
|
"ISO-8601 timestamp \u2014 only return events at or after this time (for single-subscriber lookup)."
|
|
11252
11506
|
)
|
|
11253
11507
|
},
|
|
@@ -11362,7 +11616,7 @@ function registerDepletionEventsTool(server2, ctx) {
|
|
|
11362
11616
|
}
|
|
11363
11617
|
|
|
11364
11618
|
// src/tools-country-history.ts
|
|
11365
|
-
import { z as
|
|
11619
|
+
import { z as z20 } from "zod";
|
|
11366
11620
|
function isoDate(now, daysAgo = 0) {
|
|
11367
11621
|
const d = new Date(now.getTime() - daysAgo * 864e5);
|
|
11368
11622
|
return d.toISOString().slice(0, 10);
|
|
@@ -11385,10 +11639,10 @@ function registerCountryHistoryTool(server2, ctx) {
|
|
|
11385
11639
|
title: "Subscriber Country History",
|
|
11386
11640
|
description: "Return cross-border movement history for a subscriber, reconstructed from OCS Gy charging events. Reads `gyAnswer.events` from `subscriberNetworkEventsOverPeriod` \u2014 every Gy record carries its own country, operator and MCC \u2014 and collapses consecutive same-country records into stays with first-seen and last-seen timestamps. This needs no webhook: it works with Relay LU and Relay Gy off. Relay `country.entered` events from the 24h ring-buffer are merged in as a supplement when present. Use this to answer: 'where has subscriber X traveled', 'show country history for ICCID', 'border crossings for this SIM'. Params: `subscriberId` (ICCID, 19\u201320 digits), `startDate`/`endDate` (YYYY-MM-DD, max 7 days apart, default the last 7 days), `limit` (1\u201350, default 20, newest first). Returns: `stays` ({ country, country_name, first_seen, last_seen, operators, mccs, event_count, used_bytes }), `transitions` ({ from, to, at }), and `country_events` in the legacy flat shape. `used_bytes` already handles the string-typed `usedUnits` and its 'N/A' values. Do NOT use this for raw per-session records \u2014 use `subscriber_network_events` for those.",
|
|
11387
11641
|
inputSchema: {
|
|
11388
|
-
subscriberId:
|
|
11389
|
-
startDate:
|
|
11390
|
-
endDate:
|
|
11391
|
-
limit:
|
|
11642
|
+
subscriberId: z20.string().regex(/^\d{19,20}$/, "subscriberId must be a 19\u201320 digit ICCID").describe("Subscriber ICCID (19\u201320 digits, ITU-T E.118)"),
|
|
11643
|
+
startDate: z20.string().regex(/^\d{4}-\d{2}-\d{2}$/, "startDate must be YYYY-MM-DD").optional().describe("Start of the period, YYYY-MM-DD inclusive (default: 7 days ago)"),
|
|
11644
|
+
endDate: z20.string().regex(/^\d{4}-\d{2}-\d{2}$/, "endDate must be YYYY-MM-DD").optional().describe("End of the period, YYYY-MM-DD inclusive, max 7 days from start (default: today)"),
|
|
11645
|
+
limit: z20.number().int().min(1).max(50).default(20).optional().describe("Maximum number of country_events to return, newest first (default 20, max 50)")
|
|
11392
11646
|
},
|
|
11393
11647
|
annotations: { readOnlyHint: true, idempotentHint: true }
|
|
11394
11648
|
},
|
|
@@ -11496,7 +11750,7 @@ function registerCountryHistoryTool(server2, ctx) {
|
|
|
11496
11750
|
}
|
|
11497
11751
|
|
|
11498
11752
|
// src/apps/fleet-health-app.ts
|
|
11499
|
-
import { z as
|
|
11753
|
+
import { z as z21 } from "zod";
|
|
11500
11754
|
import {
|
|
11501
11755
|
registerAppTool,
|
|
11502
11756
|
registerAppResource,
|
|
@@ -11612,7 +11866,7 @@ function registerFleetHealthApp(server2, ctx) {
|
|
|
11612
11866
|
title: "Fleet Health Dashboard",
|
|
11613
11867
|
description: "Draw the fleet overview as an interactive panel: eSIM status, per-account breakdown and low-balance alerts. Returns structuredContent for the panel, so it only helps a client that can render MCP UI resources. Do NOT use this when the answer has to be readable text, or in any headless or scripted context \u2014 `fleet_health` returns the same data as prose.",
|
|
11614
11868
|
inputSchema: {
|
|
11615
|
-
accountId:
|
|
11869
|
+
accountId: z21.number().optional().describe("Filter to a specific account (omit for all)")
|
|
11616
11870
|
},
|
|
11617
11871
|
annotations: { readOnlyHint: true },
|
|
11618
11872
|
_meta: {
|
|
@@ -11655,7 +11909,7 @@ function registerFleetHealthApp(server2, ctx) {
|
|
|
11655
11909
|
}
|
|
11656
11910
|
|
|
11657
11911
|
// src/apps/provisioning-wizard.ts
|
|
11658
|
-
import { z as
|
|
11912
|
+
import { z as z22 } from "zod";
|
|
11659
11913
|
import {
|
|
11660
11914
|
registerAppTool as registerAppTool2,
|
|
11661
11915
|
registerAppResource as registerAppResource2,
|
|
@@ -11760,10 +12014,10 @@ function registerProvisioningWizard(server2, ctx) {
|
|
|
11760
12014
|
title: "eSIM Provisioning Wizard",
|
|
11761
12015
|
description: "Interactive 3-step wizard to provision an eSIM: select subscriber, choose package template, preview (dry_run) and confirm execution.",
|
|
11762
12016
|
inputSchema: {
|
|
11763
|
-
step:
|
|
11764
|
-
wizardId:
|
|
11765
|
-
subscriber_iccid:
|
|
11766
|
-
package_template_id:
|
|
12017
|
+
step: z22.enum(["init", "select-package", "preview", "confirm"]).describe("Current wizard step"),
|
|
12018
|
+
wizardId: z22.string().optional().describe("Wizard session ID (absent on init)"),
|
|
12019
|
+
subscriber_iccid: z22.string().optional().describe("Subscriber ICCID (required for select-package)"),
|
|
12020
|
+
package_template_id: z22.number().optional().describe("Package template ID (required for preview)")
|
|
11767
12021
|
},
|
|
11768
12022
|
_meta: {
|
|
11769
12023
|
ui: {
|
|
@@ -12033,7 +12287,7 @@ function registerProvisioningWizard(server2, ctx) {
|
|
|
12033
12287
|
}
|
|
12034
12288
|
|
|
12035
12289
|
// src/apps/balance-topup.ts
|
|
12036
|
-
import { z as
|
|
12290
|
+
import { z as z23 } from "zod";
|
|
12037
12291
|
import {
|
|
12038
12292
|
registerAppTool as registerAppTool3,
|
|
12039
12293
|
registerAppResource as registerAppResource3,
|
|
@@ -12086,9 +12340,9 @@ function registerBalanceTopupApp(server2, ctx) {
|
|
|
12086
12340
|
title: "Balance Top-up Form",
|
|
12087
12341
|
description: "Adjust the OCS reseller-account balance behind one subscriber, through a form panel the user can review before it commits. Defaults to preview: a call that omits `preview` returns a projection and writes nothing. Only `preview: false` performs the OCS write. Params: `iccid` (subscriber identifier used to find the account), `delta` (amount to add when positive, deduct when negative), `preview` (boolean, default true). Requires `admin` scope plus recent MFA, and a client that can render UI panels. Do NOT use this in a headless or scripted context \u2014 call `modify_account_balance` directly, which takes an `accountId` and needs no panel. Do NOT use this for a subscriber's own balance \u2014 the `iccid` here only locates the account; per-subscriber money is `modify_subscriber_balance`. Do NOT use this for the Carrier prepaid wallet or MCP credits \u2014 see `wallet_topup_checkout` and `credit_balance`.",
|
|
12088
12342
|
inputSchema: {
|
|
12089
|
-
iccid:
|
|
12090
|
-
delta:
|
|
12091
|
-
preview:
|
|
12343
|
+
iccid: z23.string().describe("The subscriber ICCID for the account lookup"),
|
|
12344
|
+
delta: z23.number().describe("Amount to add (positive) or deduct (negative) from the account balance"),
|
|
12345
|
+
preview: z23.boolean().default(true).describe("If true, return preview without writing. If false, execute the balance change.")
|
|
12092
12346
|
},
|
|
12093
12347
|
annotations: { destructiveHint: true },
|
|
12094
12348
|
_meta: {
|
|
@@ -12171,7 +12425,7 @@ function registerAllApps(server2, ctx) {
|
|
|
12171
12425
|
}
|
|
12172
12426
|
|
|
12173
12427
|
// src/prompts.ts
|
|
12174
|
-
import { z as
|
|
12428
|
+
import { z as z24 } from "zod";
|
|
12175
12429
|
function registerAllPrompts(server2) {
|
|
12176
12430
|
server2.registerPrompt(
|
|
12177
12431
|
"fleet_health_report",
|
|
@@ -12207,7 +12461,7 @@ Format as a structured report with sections, tables, and actionable recommendati
|
|
|
12207
12461
|
{
|
|
12208
12462
|
title: "Subscriber Deep Dive",
|
|
12209
12463
|
description: "Comprehensive analysis of a single subscriber: profile, packages, usage patterns, location history, recommendations.",
|
|
12210
|
-
argsSchema: { iccid:
|
|
12464
|
+
argsSchema: { iccid: z24.string().describe("The subscriber ICCID to analyse") }
|
|
12211
12465
|
},
|
|
12212
12466
|
async ({ iccid }) => ({
|
|
12213
12467
|
messages: [
|
|
@@ -12306,7 +12560,7 @@ Analyze and present:
|
|
|
12306
12560
|
{
|
|
12307
12561
|
title: "Bulk Operations Planner",
|
|
12308
12562
|
description: "Plan bulk operations safely: mass package assignments, account migrations, balance adjustments, or status changes.",
|
|
12309
|
-
argsSchema: { operation:
|
|
12563
|
+
argsSchema: { operation: z24.string().describe("Describe the bulk operation you want to perform") }
|
|
12310
12564
|
},
|
|
12311
12565
|
async ({ operation }) => ({
|
|
12312
12566
|
messages: [
|
|
@@ -12339,7 +12593,7 @@ NEVER execute destructive operations without confirmation.`
|
|
|
12339
12593
|
}
|
|
12340
12594
|
|
|
12341
12595
|
// src/tools-pricing.ts
|
|
12342
|
-
import { z as
|
|
12596
|
+
import { z as z25 } from "zod";
|
|
12343
12597
|
function registerAllPricingTools(server2, ctx) {
|
|
12344
12598
|
const allTools = [...PRICING_TOOLS, ...PROJECTS_TOOLS];
|
|
12345
12599
|
for (const tool of allTools) {
|
|
@@ -12446,19 +12700,19 @@ function buildZodSchema(schema) {
|
|
|
12446
12700
|
for (const [key, prop] of Object.entries(properties)) {
|
|
12447
12701
|
let field;
|
|
12448
12702
|
if (prop.enum) {
|
|
12449
|
-
field =
|
|
12703
|
+
field = z25.enum(prop.enum);
|
|
12450
12704
|
} else if (prop.type === "number") {
|
|
12451
|
-
field =
|
|
12705
|
+
field = z25.number();
|
|
12452
12706
|
} else if (prop.type === "boolean") {
|
|
12453
|
-
field =
|
|
12707
|
+
field = z25.boolean();
|
|
12454
12708
|
} else if (prop.type === "array") {
|
|
12455
12709
|
if (prop.items?.type === "number") {
|
|
12456
|
-
field =
|
|
12710
|
+
field = z25.array(z25.number());
|
|
12457
12711
|
} else {
|
|
12458
|
-
field =
|
|
12712
|
+
field = z25.array(z25.string());
|
|
12459
12713
|
}
|
|
12460
12714
|
} else {
|
|
12461
|
-
field =
|
|
12715
|
+
field = z25.string();
|
|
12462
12716
|
}
|
|
12463
12717
|
const required = schema.required ?? [];
|
|
12464
12718
|
if (!required.includes(key)) {
|
|
@@ -12473,7 +12727,7 @@ function buildZodSchema(schema) {
|
|
|
12473
12727
|
}
|
|
12474
12728
|
|
|
12475
12729
|
// src/tools-greenzone.ts
|
|
12476
|
-
import { z as
|
|
12730
|
+
import { z as z26 } from "zod";
|
|
12477
12731
|
|
|
12478
12732
|
// src/greenzone-whitelist.ts
|
|
12479
12733
|
var STATE_KEY = "greenzone:state";
|
|
@@ -12764,9 +13018,9 @@ function registerGreenzoneTools(server2, ctx) {
|
|
|
12764
13018
|
title: "Greenzone Whitelist \u2014 Add",
|
|
12765
13019
|
description: "Add a hostname and/or IP address to the Bridge4IP Greenzone whitelist. The Greenzone whitelist controls which hosts/IPs are exempt from data charging after a subscriber's bundle is depleted. This operates via browser automation (Kapture) against the OCS portal \u2014 no REST API exists for this surface. Provide `host` (e.g. 'example.com') and/or `ip` (e.g. '203.0.113.0/24'). At least one of host or ip must be provided. Returns Kapture step sequence for Claude Code to execute. Requires 'write' scope and Kapture running in Sam's Chrome.",
|
|
12766
13020
|
inputSchema: {
|
|
12767
|
-
host:
|
|
12768
|
-
ip:
|
|
12769
|
-
dry_run:
|
|
13021
|
+
host: z26.string().optional().describe("Hostname to whitelist (e.g. 'example.com')"),
|
|
13022
|
+
ip: z26.string().optional().describe("IP address or CIDR to whitelist (e.g. '203.0.113.0/24')"),
|
|
13023
|
+
dry_run: z26.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
|
|
12770
13024
|
},
|
|
12771
13025
|
annotations: { destructiveHint: true }
|
|
12772
13026
|
},
|
|
@@ -12825,9 +13079,9 @@ function registerGreenzoneTools(server2, ctx) {
|
|
|
12825
13079
|
title: "Greenzone Whitelist \u2014 Remove",
|
|
12826
13080
|
description: "Remove a hostname and/or IP address from the Bridge4IP Greenzone whitelist. This operates via browser automation (Kapture) against the OCS portal. Provide `host` and/or `ip` to remove \u2014 at least one required. Returns Kapture step sequence for Claude Code to execute. Requires 'write' scope and Kapture running in Sam's Chrome.",
|
|
12827
13081
|
inputSchema: {
|
|
12828
|
-
host:
|
|
12829
|
-
ip:
|
|
12830
|
-
dry_run:
|
|
13082
|
+
host: z26.string().optional().describe("Hostname to remove from whitelist"),
|
|
13083
|
+
ip: z26.string().optional().describe("IP address or CIDR to remove from whitelist"),
|
|
13084
|
+
dry_run: z26.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
|
|
12831
13085
|
},
|
|
12832
13086
|
annotations: { destructiveHint: true }
|
|
12833
13087
|
},
|
|
@@ -12886,7 +13140,7 @@ function registerGreenzoneTools(server2, ctx) {
|
|
|
12886
13140
|
title: "Greenzone Whitelist \u2014 List",
|
|
12887
13141
|
description: "List current Greenzone whitelist entries from the KV cache. Returns all whitelisted hosts and IPs, when the state was last synced, and whether the last hourly reconciliation detected drift from the portal. This is a fast read from KV \u2014 no browser automation required. Use `from_portal: true` to trigger a live portal read via Kapture instead of KV. Requires 'read' scope.",
|
|
12888
13142
|
inputSchema: {
|
|
12889
|
-
from_portal:
|
|
13143
|
+
from_portal: z26.boolean().optional().describe(
|
|
12890
13144
|
"When true, return Kapture steps to read live portal state instead of KV cache"
|
|
12891
13145
|
)
|
|
12892
13146
|
},
|
|
@@ -12938,7 +13192,7 @@ function registerGreenzoneTools(server2, ctx) {
|
|
|
12938
13192
|
}
|
|
12939
13193
|
|
|
12940
13194
|
// src/tools-ui-agent-generic.ts
|
|
12941
|
-
import { z as
|
|
13195
|
+
import { z as z27 } from "zod";
|
|
12942
13196
|
var COST_PER_STEP_USD = 0.014;
|
|
12943
13197
|
var SESSION_OVERHEAD_USD = 5e-3;
|
|
12944
13198
|
function estimateCostUsd2(steps) {
|
|
@@ -12980,13 +13234,13 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
|
|
|
12980
13234
|
title: "Dispatch Generic Browsing Agent",
|
|
12981
13235
|
description: "Send a plain-language task to a hosted browsing agent, which drives a real browser on the open web \u2014 navigating pages, searching, extracting content, filling forms outside the OCS portal. Each run costs roughly $0.20-1.00 in model spend against your own BROWSER_USE_API_KEY, so treat it as the expensive last resort, not a lookup. Limited to CARRIER_BROWSER_USE_MAX_RUNS runs per CLI session (default 10). Params: `prompt` (1-4000 chars \u2014 name the target URL and the exact data or action), `max_steps` (1-30, default 15; prices the dry-run estimate only), `dry_run` (true returns only `estimated_cost_usd` and creates no session). Returns the finished result: unlike the hosted Worker, a local CLI has no background runtime, so this call blocks for the length of the run. Requires `write` scope. Do NOT use this to work out which Carrier tool answers a request \u2014 that is `carrier_ask`, which costs nothing. Do NOT use this for anything the OCS API already covers; every other tool here is faster, free, and audited.",
|
|
12982
13236
|
inputSchema: {
|
|
12983
|
-
prompt:
|
|
13237
|
+
prompt: z27.string().min(1).max(4e3).describe(
|
|
12984
13238
|
"Natural-language task description for the browsing agent. Be specific: include target URLs, data to extract, or actions to perform."
|
|
12985
13239
|
),
|
|
12986
|
-
max_steps:
|
|
13240
|
+
max_steps: z27.number().int().min(1).max(30).optional().describe(
|
|
12987
13241
|
"Advisory step budget (1\u201330, default 15). Prices the dry-run estimate; the hosted agent sets its own depth."
|
|
12988
13242
|
),
|
|
12989
|
-
dry_run:
|
|
13243
|
+
dry_run: z27.boolean().optional().describe(
|
|
12990
13244
|
"Preview cost estimate without dispatching. Returns estimated_cost_usd only \u2014 no browser session is created."
|
|
12991
13245
|
)
|
|
12992
13246
|
}
|
|
@@ -13123,7 +13377,7 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
|
|
|
13123
13377
|
title: "Poll Browsing Agent Task Status",
|
|
13124
13378
|
description: "Returns the current state of a browsing-agent task by `task_id`, including its result once finished. In the local CLI, ui_agent_ask already returns the finished result, so this is mainly for re-reading a task within the same session. Task records do not survive the CLI process exiting. Requires `read` scope.",
|
|
13125
13379
|
inputSchema: {
|
|
13126
|
-
task_id:
|
|
13380
|
+
task_id: z27.string().describe("Task ID returned by ui_agent_ask")
|
|
13127
13381
|
}
|
|
13128
13382
|
},
|
|
13129
13383
|
async (args) => {
|