@carrierllc/mcp 0.13.59 → 0.13.61

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-55BZWMUL.js";
85
+ } from "./chunk-JEIKZQ4Z.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, z27) => n + (z27.operators?.length ?? 0), 0);
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((z27) => {
1188
- const ops = z27.operators ?? [];
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 { ...z27, operators: sliced, operatorCount: ops.length };
1194
+ return { ...z28, operators: sliced, operatorCount: ops.length };
1195
1195
  }
1196
1196
  return {
1197
- zoneId: z27.zoneId,
1198
- zoneName: z27.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 z15 } from "zod";
5271
+ import { z as z16 } from "zod";
5272
5272
 
5273
5273
  // src/tools-ui-agent.ts
5274
5274
  import { z as z4 } from "zod";
@@ -6183,8 +6183,196 @@ function registerUiAgentAskTools(server2, ctx, runtime) {
6183
6183
  );
6184
6184
  }
6185
6185
 
6186
- // src/tools-ui-agent-schedule.ts
6186
+ // src/carrier-api-tools.ts
6187
6187
  import { z as z6 } from "zod";
6188
+ var CARRIER_API_TOOL_SCOPES = {
6189
+ list_connectivity_offering_templates: "read",
6190
+ create_benefit_campaign: "write",
6191
+ claim_benefit: "write",
6192
+ issue_benefit_claim: "write"
6193
+ };
6194
+ var CAMPAIGN_ID_PATTERN = /^cbc_[0-9a-f]{32}$/;
6195
+ var CLAIM_ID_PATTERN = /^cbl_[0-9a-f]{32}$/;
6196
+ var DEFAULT_API_BASE_URL = "https://api.carrier.llc";
6197
+ var REQUEST_TIMEOUT_MS = 1e4;
6198
+ var WRITE_TIMEOUT_MS = 3e4;
6199
+ function jsonResult2(body2, isError = false) {
6200
+ return {
6201
+ ...isError ? { isError: true } : {},
6202
+ content: [{ type: "text", text: JSON.stringify(body2, null, 2) }]
6203
+ };
6204
+ }
6205
+ function apiError(code, message, detail = {}) {
6206
+ return jsonResult2({ ...detail, code, message }, true);
6207
+ }
6208
+ async function carrierApiRequest(ctx, extra, req) {
6209
+ const token2 = await ctx.getApiToken?.(extra);
6210
+ if (!token2) {
6211
+ return apiError(
6212
+ "CARRIER_API_AUTH_REQUIRED",
6213
+ "This tool needs the OAuth access token of your MCP session, and this connection did not present one. Reconnect with the OAuth flow instead of a ?TOKEN= reseller token. No request was made."
6214
+ );
6215
+ }
6216
+ const base = (ctx.env.CARRIER_API_BASE_URL ?? DEFAULT_API_BASE_URL).replace(/\/+$/, "");
6217
+ let response;
6218
+ try {
6219
+ const isPost = req.method === "POST";
6220
+ response = await fetch(`${base}${req.path}`, {
6221
+ method: req.method,
6222
+ redirect: "error",
6223
+ headers: {
6224
+ Accept: "application/json",
6225
+ Authorization: `Bearer ${token2}`,
6226
+ ...isPost ? { "Content-Type": "application/json" } : {}
6227
+ },
6228
+ ...isPost && req.body !== void 0 ? { body: JSON.stringify(req.body) } : {},
6229
+ signal: AbortSignal.timeout(isPost ? WRITE_TIMEOUT_MS : REQUEST_TIMEOUT_MS)
6230
+ });
6231
+ } catch (err9) {
6232
+ const outcome = req.method === "POST" ? " The request may or may not have been applied: read the current state before you retry." : "";
6233
+ return apiError("CARRIER_API_UNREACHABLE", `Carrier API request failed: ${err9 instanceof Error ? err9.name : "error"}.${outcome}`);
6234
+ }
6235
+ let text;
6236
+ try {
6237
+ text = await response.text();
6238
+ } catch {
6239
+ return apiError("CARRIER_API_UNREADABLE", "Carrier API response could not be read.", { http_status: response.status });
6240
+ }
6241
+ let parsed;
6242
+ try {
6243
+ parsed = JSON.parse(text);
6244
+ } catch {
6245
+ parsed = void 0;
6246
+ }
6247
+ if (response.ok) {
6248
+ if (parsed === void 0) {
6249
+ return apiError("CARRIER_API_BAD_RESPONSE", "Carrier API returned a non-JSON success body.", { http_status: response.status });
6250
+ }
6251
+ return jsonResult2(req.method === "POST" ? { http_status: response.status, result: parsed } : parsed);
6252
+ }
6253
+ const body2 = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
6254
+ const nested = body2["error"];
6255
+ const source = nested && typeof nested === "object" && !Array.isArray(nested) ? nested : body2;
6256
+ const pick = (k) => typeof source[k] === "string" ? source[k].slice(0, 300) : void 0;
6257
+ const hint = response.status === 401 ? "The API did not accept your MCP access token. Reconnect to refresh it." : response.status === 403 ? "Your grant does not allow this operation. Re-authorize with a broader scope if you need it." : "The Carrier API returned an error.";
6258
+ return apiError("CARRIER_API_ERROR", hint, {
6259
+ http_status: response.status,
6260
+ api_code: pick("code"),
6261
+ api_error: pick("error") ?? pick("message")
6262
+ });
6263
+ }
6264
+ var idPathError = (field) => apiError("INVALID_ID", `${field} is not a valid id. No request was made.`);
6265
+ function registerCarrierApiTools(server2, ctx) {
6266
+ server2.registerTool(
6267
+ "list_connectivity_offering_templates",
6268
+ {
6269
+ title: "List connectivity offering templates",
6270
+ description: "List the versioned starter templates for a connectivity offering, for example travel-booking, own-brand and member-benefit. Calls GET /v1/connectivity/offerings/templates on api.carrier.llc with your own MCP access token, so the result is limited to what your organization may see. Use this before choosing a concept for a new offering. Params: none. Do NOT use this to list the offerings you already created, or OCS package templates \u2014 that is list_package_templates.",
6271
+ inputSchema: {},
6272
+ annotations: { readOnlyHint: true }
6273
+ },
6274
+ wrapHandler(
6275
+ "list_connectivity_offering_templates",
6276
+ "carrier-api.offering-templates",
6277
+ "read",
6278
+ ctx,
6279
+ (_args, _token, extra) => carrierApiRequest(ctx, extra, { method: "GET", path: "/v1/connectivity/offerings/templates" }),
6280
+ { skipUserToken: true }
6281
+ )
6282
+ );
6283
+ server2.registerTool(
6284
+ "create_benefit_campaign",
6285
+ {
6286
+ title: "Create a benefit campaign",
6287
+ 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.",
6288
+ inputSchema: {
6289
+ offering_id: z6.string().min(1).max(200).describe("Offering the campaign issues from."),
6290
+ revision: z6.number().int().min(1).max(Number.MAX_SAFE_INTEGER).describe("Offering revision, 1 or higher."),
6291
+ max_claims: z6.number().int().min(1).max(Number.MAX_SAFE_INTEGER).describe("Most claims the campaign accepts."),
6292
+ cost_cents: z6.number().int().min(1).max(Number.MAX_SAFE_INTEGER).describe("Cost of one claim in cents. The API enforces a ceiling."),
6293
+ expires_at: z6.number().int().min(1).max(Number.MAX_SAFE_INTEGER).describe("Expiry as epoch milliseconds."),
6294
+ product_id: z6.string().min(1).max(200).optional().describe("Optional product to issue from.")
6295
+ },
6296
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }
6297
+ },
6298
+ wrapHandler(
6299
+ "create_benefit_campaign",
6300
+ "carrier-api.benefit-campaigns.create",
6301
+ "write",
6302
+ ctx,
6303
+ (args, _token, extra) => carrierApiRequest(ctx, extra, {
6304
+ method: "POST",
6305
+ path: "/v1/connectivity/benefit-campaigns",
6306
+ body: {
6307
+ offering_id: args.offering_id,
6308
+ revision: args.revision,
6309
+ max_claims: args.max_claims,
6310
+ cost_cents: args.cost_cents,
6311
+ expires_at: args.expires_at,
6312
+ ...args.product_id !== void 0 ? { product_id: args.product_id } : {}
6313
+ }
6314
+ }),
6315
+ { skipUserToken: true }
6316
+ )
6317
+ );
6318
+ server2.registerTool(
6319
+ "claim_benefit",
6320
+ {
6321
+ title: "Claim a benefit",
6322
+ 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.",
6323
+ inputSchema: {
6324
+ campaign_id: z6.string().regex(CAMPAIGN_ID_PATTERN).describe("Campaign id, cbc_ followed by 32 hex characters."),
6325
+ external_ref: z6.string().min(1).max(200).describe("Your own reference for the claimant, 1 to 200 characters.")
6326
+ },
6327
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true }
6328
+ },
6329
+ wrapHandler(
6330
+ "claim_benefit",
6331
+ "carrier-api.benefit-claims.create",
6332
+ "write",
6333
+ ctx,
6334
+ (args, _token, extra) => {
6335
+ if (typeof args.campaign_id !== "string" || !CAMPAIGN_ID_PATTERN.test(args.campaign_id)) return Promise.resolve(idPathError("campaign_id"));
6336
+ return carrierApiRequest(ctx, extra, {
6337
+ method: "POST",
6338
+ path: `/v1/connectivity/benefit-campaigns/${args.campaign_id}/claims`,
6339
+ body: { external_ref: args.external_ref }
6340
+ });
6341
+ },
6342
+ { skipUserToken: true }
6343
+ )
6344
+ );
6345
+ server2.registerTool(
6346
+ "issue_benefit_claim",
6347
+ {
6348
+ title: "Issue the eSIM for a held claim",
6349
+ 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.",
6350
+ inputSchema: {
6351
+ campaign_id: z6.string().regex(CAMPAIGN_ID_PATTERN).describe("Campaign id, cbc_ followed by 32 hex characters."),
6352
+ claim_id: z6.string().regex(CLAIM_ID_PATTERN).describe("Claim id from claim_benefit, cbl_ followed by 32 hex characters.")
6353
+ },
6354
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true }
6355
+ },
6356
+ wrapHandler(
6357
+ "issue_benefit_claim",
6358
+ "carrier-api.benefit-claims.issue",
6359
+ "write",
6360
+ ctx,
6361
+ (args, _token, extra) => {
6362
+ if (typeof args.campaign_id !== "string" || !CAMPAIGN_ID_PATTERN.test(args.campaign_id)) return Promise.resolve(idPathError("campaign_id"));
6363
+ if (typeof args.claim_id !== "string" || !CLAIM_ID_PATTERN.test(args.claim_id)) return Promise.resolve(idPathError("claim_id"));
6364
+ return carrierApiRequest(ctx, extra, {
6365
+ method: "POST",
6366
+ path: `/v1/connectivity/benefit-campaigns/${args.campaign_id}/claims/${args.claim_id}/issue`
6367
+ });
6368
+ },
6369
+ { skipUserToken: true }
6370
+ )
6371
+ );
6372
+ }
6373
+
6374
+ // src/tools-ui-agent-schedule.ts
6375
+ import { z as z7 } from "zod";
6188
6376
  var UI_AGENT_SCHEDULE_TOOL_SCOPES = {
6189
6377
  ui_agent_schedule_create: "admin",
6190
6378
  ui_agent_schedule_list: "read",
@@ -6222,14 +6410,14 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
6222
6410
  title: "Create UI Agent Schedule",
6223
6411
  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,
6224
6412
  inputSchema: {
6225
- name: z6.string().describe("Human-readable name for this schedule"),
6226
- cron: z6.string().describe(
6413
+ name: z7.string().describe("Human-readable name for this schedule"),
6414
+ cron: z7.string().describe(
6227
6415
  "Standard 5-field cron expression (minute hour day month weekday). Minimum interval: 5 minutes. Example: '0 */6 * * *' = every 6 hours."
6228
6416
  ),
6229
- prompt_template: z6.string().describe(
6417
+ prompt_template: z7.string().describe(
6230
6418
  "Agent prompt/task template the browser agent will execute on each run"
6231
6419
  ),
6232
- profile: z6.string().optional().describe(
6420
+ profile: z7.string().optional().describe(
6233
6421
  "Browser-agent profile to use. Defaults to the deployment's configured profile."
6234
6422
  )
6235
6423
  }
@@ -6251,7 +6439,7 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
6251
6439
  title: "Delete UI Agent Schedule",
6252
6440
  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,
6253
6441
  inputSchema: {
6254
- schedule_id: z6.string().describe("ID of the schedule to delete")
6442
+ schedule_id: z7.string().describe("ID of the schedule to delete")
6255
6443
  }
6256
6444
  },
6257
6445
  async () => !ctx.props.scope.includes("admin") ? scopeDenied(ctx, "ui_agent_schedule_delete", "admin") : uiAgentStubError("ui_agent_schedule_delete", "recurring_runtime")
@@ -6262,7 +6450,7 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
6262
6450
  title: "Pause UI Agent Schedule",
6263
6451
  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,
6264
6452
  inputSchema: {
6265
- schedule_id: z6.string().describe("ID of the schedule to pause")
6453
+ schedule_id: z7.string().describe("ID of the schedule to pause")
6266
6454
  }
6267
6455
  },
6268
6456
  async () => !ctx.props.scope.includes("admin") ? scopeDenied(ctx, "ui_agent_schedule_pause", "admin") : uiAgentStubError("ui_agent_schedule_pause", "recurring_runtime")
@@ -6273,7 +6461,7 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
6273
6461
  title: "Resume UI Agent Schedule",
6274
6462
  description: "Resumes a paused recurring browser-agent schedule. Requires admin scope." + STDIO_NOTE,
6275
6463
  inputSchema: {
6276
- schedule_id: z6.string().describe("ID of the schedule to resume")
6464
+ schedule_id: z7.string().describe("ID of the schedule to resume")
6277
6465
  }
6278
6466
  },
6279
6467
  async () => !ctx.props.scope.includes("admin") ? scopeDenied(ctx, "ui_agent_schedule_resume", "admin") : uiAgentStubError("ui_agent_schedule_resume", "recurring_runtime")
@@ -6330,7 +6518,7 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
6330
6518
  }
6331
6519
 
6332
6520
  // src/wallet-tools.ts
6333
- import { z as z7 } from "zod";
6521
+ import { z as z8 } from "zod";
6334
6522
  import * as Sentry2 from "@sentry/cloudflare";
6335
6523
 
6336
6524
  // src/audit-schema.ts
@@ -6790,13 +6978,13 @@ function registerWalletTools(server2, ctx) {
6790
6978
  // — returns null here. Requiring a number turned that, the most common
6791
6979
  // state a new operator is in, into an output validation error.
6792
6980
  outputSchema: {
6793
- org_id: z7.string().describe("Carrier organisation the wallet belongs to"),
6794
- balance_eur_cents: z7.number().int().describe("Current balance in EUR cents"),
6795
- auto_topup_enabled: z7.boolean(),
6796
- auto_topup_threshold_cents: z7.number().int().nullable().describe(
6981
+ org_id: z8.string().describe("Carrier organisation the wallet belongs to"),
6982
+ balance_eur_cents: z8.number().int().describe("Current balance in EUR cents"),
6983
+ auto_topup_enabled: z8.boolean(),
6984
+ auto_topup_threshold_cents: z8.number().int().nullable().describe(
6797
6985
  "Balance at or below which an auto top-up fires, EUR cents. Null when auto-top-up is unconfigured."
6798
6986
  ),
6799
- auto_topup_pack_cents: z7.number().int().nullable().describe(
6987
+ auto_topup_pack_cents: z8.number().int().nullable().describe(
6800
6988
  "Amount an auto top-up charges, EUR cents. Null when auto-top-up is unconfigured."
6801
6989
  )
6802
6990
  },
@@ -6838,7 +7026,7 @@ function registerWalletTools(server2, ctx) {
6838
7026
  title: "Wallet Top-up Checkout",
6839
7027
  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.",
6840
7028
  inputSchema: {
6841
- pack: z7.string().optional().describe(
7029
+ pack: z8.string().optional().describe(
6842
7030
  "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."
6843
7031
  )
6844
7032
  },
@@ -6851,21 +7039,21 @@ function registerWalletTools(server2, ctx) {
6851
7039
  * documented here. Marking either arm required would break the other.
6852
7040
  */
6853
7041
  outputSchema: {
6854
- packs: z7.array(
6855
- z7.object({
6856
- id: z7.string(),
6857
- eur_cents: z7.number().int(),
6858
- bonus_pct: z7.number(),
6859
- bonus_eur_cents: z7.number().int(),
6860
- credited_eur_cents: z7.number().int()
7042
+ packs: z8.array(
7043
+ z8.object({
7044
+ id: z8.string(),
7045
+ eur_cents: z8.number().int(),
7046
+ bonus_pct: z8.number(),
7047
+ bonus_eur_cents: z8.number().int(),
7048
+ credited_eur_cents: z8.number().int()
6861
7049
  })
6862
7050
  ).optional().describe("Catalogue arm \u2014 present only when `pack` was omitted."),
6863
- org_id: z7.string().optional().describe("Session arm."),
6864
- pack_id: z7.string().optional().describe("Session arm."),
6865
- pack_eur_cents: z7.number().int().optional().describe("Session arm."),
6866
- bonus_eur_cents: z7.number().int().optional().describe("Session arm."),
6867
- checkout_session_id: z7.string().optional().describe("Session arm."),
6868
- checkout_url: z7.string().nullable().optional().describe("Session arm. Stripe may return null for a session URL.")
7051
+ org_id: z8.string().optional().describe("Session arm."),
7052
+ pack_id: z8.string().optional().describe("Session arm."),
7053
+ pack_eur_cents: z8.number().int().optional().describe("Session arm."),
7054
+ bonus_eur_cents: z8.number().int().optional().describe("Session arm."),
7055
+ checkout_session_id: z8.string().optional().describe("Session arm."),
7056
+ checkout_url: z8.string().nullable().optional().describe("Session arm. Stripe may return null for a session URL.")
6869
7057
  },
6870
7058
  annotations: annotationsFor("wallet_topup_checkout", "write")
6871
7059
  },
@@ -6922,7 +7110,7 @@ function registerWalletTools(server2, ctx) {
6922
7110
  title: "Wallet Auto Top-up (charges card now)",
6923
7111
  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`.",
6924
7112
  inputSchema: {
6925
- pack_cents: z7.number().int().positive().optional().describe("Override pack amount in EUR cents (must match a catalog pack).")
7113
+ pack_cents: z8.number().int().positive().optional().describe("Override pack amount in EUR cents (must match a catalog pack).")
6926
7114
  },
6927
7115
  /**
6928
7116
  * Only the charged arm is described here — `charged: false` returns
@@ -6937,12 +7125,12 @@ function registerWalletTools(server2, ctx) {
6937
7125
  * into a validation error.
6938
7126
  */
6939
7127
  outputSchema: {
6940
- org_id: z7.string(),
6941
- charged: z7.literal(true),
6942
- credited_eur_cents: z7.number().int(),
6943
- balance_after_cents: z7.number().int().optional().describe("Absent when the charge succeeded but crediting is pending."),
6944
- payment_intent_id: z7.string().optional(),
6945
- note: z7.string().optional().describe("Present when the charge landed but the credit is still pending.")
7128
+ org_id: z8.string(),
7129
+ charged: z8.literal(true),
7130
+ credited_eur_cents: z8.number().int(),
7131
+ balance_after_cents: z8.number().int().optional().describe("Absent when the charge succeeded but crediting is pending."),
7132
+ payment_intent_id: z8.string().optional(),
7133
+ note: z8.string().optional().describe("Present when the charge landed but the credit is still pending.")
6946
7134
  },
6947
7135
  annotations: annotationsFor("wallet_auto_topup", "write")
6948
7136
  },
@@ -6988,7 +7176,7 @@ function registerWalletTools(server2, ctx) {
6988
7176
  }
6989
7177
 
6990
7178
  // src/stripe-connect-tools.ts
6991
- import { z as z8 } from "zod";
7179
+ import { z as z9 } from "zod";
6992
7180
  import * as Sentry3 from "@sentry/cloudflare";
6993
7181
 
6994
7182
  // src/binding-unavailable.ts
@@ -7144,7 +7332,7 @@ function registerStripeConnectTools(server2, ctx) {
7144
7332
  title: "Stripe Connect Status",
7145
7333
  description: "Read-only: returns the Stripe Connect account status, capabilities, and requirements for the authenticated operator.",
7146
7334
  inputSchema: {
7147
- operator_id: z8.string().optional().describe("Override operator_id (admin use). Defaults to caller's org/user.")
7335
+ operator_id: z9.string().optional().describe("Override operator_id (admin use). Defaults to caller's org/user.")
7148
7336
  },
7149
7337
  annotations: annotationsFor("stripe_connect_status", "read")
7150
7338
  },
@@ -7205,8 +7393,8 @@ function registerStripeConnectTools(server2, ctx) {
7205
7393
  title: "List Stripe Payouts",
7206
7394
  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`.",
7207
7395
  inputSchema: {
7208
- limit: z8.number().int().min(1).max(50).default(10).describe("Number of payouts to return."),
7209
- status: z8.enum(["pending", "paid", "failed", "canceled", "in_transit"]).optional().describe("Filter by payout status.")
7396
+ limit: z9.number().int().min(1).max(50).default(10).describe("Number of payouts to return."),
7397
+ status: z9.enum(["pending", "paid", "failed", "canceled", "in_transit"]).optional().describe("Filter by payout status.")
7210
7398
  },
7211
7399
  annotations: annotationsFor("stripe_connect_payouts", "read")
7212
7400
  },
@@ -7245,8 +7433,8 @@ function registerStripeConnectTools(server2, ctx) {
7245
7433
  title: "Stripe Connect Charges",
7246
7434
  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`.",
7247
7435
  inputSchema: {
7248
- limit: z8.number().int().min(1).max(100).default(20).describe("Number of charges to return."),
7249
- starting_after: z8.string().regex(/^(ch|py)_[A-Za-z0-9]+$/).optional().describe("Charge id to page after.")
7436
+ limit: z9.number().int().min(1).max(100).default(20).describe("Number of charges to return."),
7437
+ starting_after: z9.string().regex(/^(ch|py)_[A-Za-z0-9]+$/).optional().describe("Charge id to page after.")
7250
7438
  },
7251
7439
  annotations: annotationsFor("stripe_connect_charges_list", "read")
7252
7440
  },
@@ -7342,10 +7530,10 @@ function registerStripeConnectTools(server2, ctx) {
7342
7530
  title: "Refund a Charge (moves real money)",
7343
7531
  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.",
7344
7532
  inputSchema: {
7345
- charge_id: z8.string().min(1).describe("Stripe charge ID (ch_...)."),
7346
- amount_cents: z8.number().int().min(1).optional().describe("Partial refund amount in cents. Omit for full refund."),
7347
- reason: z8.enum(["duplicate", "fraudulent", "requested_by_customer"]).optional(),
7348
- confirm_token: z8.string().optional().describe("Confirmation token from previous call. Required to execute.")
7533
+ charge_id: z9.string().min(1).describe("Stripe charge ID (ch_...)."),
7534
+ amount_cents: z9.number().int().min(1).optional().describe("Partial refund amount in cents. Omit for full refund."),
7535
+ reason: z9.enum(["duplicate", "fraudulent", "requested_by_customer"]).optional(),
7536
+ confirm_token: z9.string().optional().describe("Confirmation token from previous call. Required to execute.")
7349
7537
  },
7350
7538
  annotations: annotationsFor("stripe_connect_refund", "write")
7351
7539
  },
@@ -7404,8 +7592,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
7404
7592
  title: "List Chargeback Disputes",
7405
7593
  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.",
7406
7594
  inputSchema: {
7407
- limit: z8.number().int().min(1).max(50).default(10),
7408
- status: z8.string().optional().describe("Filter by dispute status (e.g. needs_response, under_review).")
7595
+ limit: z9.number().int().min(1).max(50).default(10),
7596
+ status: z9.string().optional().describe("Filter by dispute status (e.g. needs_response, under_review).")
7409
7597
  },
7410
7598
  annotations: annotationsFor("stripe_connect_dispute_list", "read")
7411
7599
  },
@@ -7444,8 +7632,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
7444
7632
  title: "List Radar Fraud Reviews",
7445
7633
  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`.",
7446
7634
  inputSchema: {
7447
- open_only: z8.boolean().default(true).describe("Stripe lists only open (undecided) reviews; kept for compatibility."),
7448
- limit: z8.number().int().min(1).max(50).default(10)
7635
+ open_only: z9.boolean().default(true).describe("Stripe lists only open (undecided) reviews; kept for compatibility."),
7636
+ limit: z9.number().int().min(1).max(50).default(10)
7449
7637
  },
7450
7638
  annotations: annotationsFor("radar_review_list", "read")
7451
7639
  },
@@ -7487,8 +7675,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
7487
7675
  title: "Approve Radar Review (captures charge)",
7488
7676
  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`.",
7489
7677
  inputSchema: {
7490
- review_id: z8.string().min(1).describe("Stripe Radar review ID (prv_...)."),
7491
- confirm_token: z8.string().optional()
7678
+ review_id: z9.string().min(1).describe("Stripe Radar review ID (prv_...)."),
7679
+ confirm_token: z9.string().optional()
7492
7680
  },
7493
7681
  annotations: annotationsFor("radar_review_approve", "admin")
7494
7682
  },
@@ -7544,8 +7732,8 @@ Call again with confirm_token="${token2}" to execute. Expires in 5 minutes.`
7544
7732
  title: "Decline Radar Review (not supported by Stripe)",
7545
7733
  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.",
7546
7734
  inputSchema: {
7547
- review_id: z8.string().min(1),
7548
- confirm_token: z8.string().optional()
7735
+ review_id: z9.string().min(1),
7736
+ confirm_token: z9.string().optional()
7549
7737
  },
7550
7738
  annotations: annotationsFor("radar_review_decline", "admin")
7551
7739
  },
@@ -7566,9 +7754,9 @@ Call again with confirm_token="${token2}" to execute. Expires in 5 minutes.`
7566
7754
  title: "Add Value to Radar List",
7567
7755
  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`).",
7568
7756
  inputSchema: {
7569
- value_list_id: z8.string().min(1).describe("Stripe Radar value list ID (rsl_...)."),
7570
- value: z8.string().min(1).describe("The value to add (email, IP address, country code, etc.)."),
7571
- confirm_token: z8.string().optional()
7757
+ value_list_id: z9.string().min(1).describe("Stripe Radar value list ID (rsl_...)."),
7758
+ value: z9.string().min(1).describe("The value to add (email, IP address, country code, etc.)."),
7759
+ confirm_token: z9.string().optional()
7572
7760
  },
7573
7761
  annotations: annotationsFor("radar_value_list_add", "admin")
7574
7762
  },
@@ -7623,8 +7811,8 @@ Expires in 5 minutes.`
7623
7811
  title: "Radar Rule Toggle (instructions only)",
7624
7812
  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`.",
7625
7813
  inputSchema: {
7626
- rule_id: z8.string().min(1).describe("Stripe Radar rule ID."),
7627
- enabled: z8.boolean().describe("true = enable, false = disable.")
7814
+ rule_id: z9.string().min(1).describe("Stripe Radar rule ID."),
7815
+ enabled: z9.boolean().describe("true = enable, false = disable.")
7628
7816
  },
7629
7817
  annotations: annotationsFor("radar_rule_toggle", "admin")
7630
7818
  },
@@ -7649,7 +7837,7 @@ Note: If you need this automated, use the Radar for Platforms beta \u2014 contac
7649
7837
  }
7650
7838
 
7651
7839
  // src/tools-storefront-logo.ts
7652
- import { z as z9 } from "zod";
7840
+ import { z as z10 } from "zod";
7653
7841
  var STOREFRONT_LOGO_TOOL_SCOPES = {
7654
7842
  generate_storefront_logo: "read"
7655
7843
  };
@@ -7662,9 +7850,9 @@ function registerStorefrontLogoTools(server2, env = {}, props2) {
7662
7850
  title: "Generate Storefront Logo",
7663
7851
  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.",
7664
7852
  inputSchema: {
7665
- name: z9.string().min(1).describe("Brand / shop name, e.g. Bananas"),
7666
- accent: z9.string().regex(/^#?[0-9A-Fa-f]{6}$/).optional().describe("Accent hex, e.g. #FF8A00"),
7667
- tagline: z9.string().optional().describe("Optional tagline for AI-enhanced marks")
7853
+ name: z10.string().min(1).describe("Brand / shop name, e.g. Bananas"),
7854
+ accent: z10.string().regex(/^#?[0-9A-Fa-f]{6}$/).optional().describe("Accent hex, e.g. #FF8A00"),
7855
+ tagline: z10.string().optional().describe("Optional tagline for AI-enhanced marks")
7668
7856
  },
7669
7857
  annotations: annotationsFor("generate_storefront_logo", "read")
7670
7858
  },
@@ -7698,7 +7886,7 @@ function registerStorefrontLogoTools(server2, env = {}, props2) {
7698
7886
  }
7699
7887
 
7700
7888
  // src/tools-storefront-deploy.ts
7701
- import { z as z10 } from "zod";
7889
+ import { z as z11 } from "zod";
7702
7890
  var STOREFRONT_DEPLOY_TOOL_SCOPES = {
7703
7891
  list_deploy_targets: "read",
7704
7892
  deploy_storefront: "write",
@@ -7715,7 +7903,7 @@ function registerStorefrontDeployTools(server2, props2) {
7715
7903
  title: "List Deploy Targets",
7716
7904
  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.",
7717
7905
  inputSchema: {
7718
- dir: z10.string().min(1).describe("Path to the scaffolded storefront directory")
7906
+ dir: z11.string().min(1).describe("Path to the scaffolded storefront directory")
7719
7907
  },
7720
7908
  annotations: annotationsFor("list_deploy_targets", "read")
7721
7909
  },
@@ -7741,17 +7929,17 @@ function registerStorefrontDeployTools(server2, props2) {
7741
7929
  title: "Deploy Storefront",
7742
7930
  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.",
7743
7931
  inputSchema: {
7744
- dir: z10.string().min(1).describe("Path to the scaffolded storefront directory"),
7745
- target: z10.enum(TARGET_IDS).optional().describe("Force a host instead of auto-detecting"),
7746
- name: z10.string().optional().describe("Project/worker name (defaults from brand)"),
7747
- force: z10.boolean().optional().describe(
7932
+ dir: z11.string().min(1).describe("Path to the scaffolded storefront directory"),
7933
+ target: z11.enum(TARGET_IDS).optional().describe("Force a host instead of auto-detecting"),
7934
+ name: z11.string().optional().describe("Project/worker name (defaults from brand)"),
7935
+ force: z11.boolean().optional().describe(
7748
7936
  'Acknowledge the scaffold-default-name risk: required when the resolved name is the scaffold default "storefront"'
7749
7937
  ),
7750
- skip_build: z10.boolean().optional().describe("Deploy the existing build without rebuilding"),
7751
- push_secrets: z10.boolean().optional().describe("Stage runtime secrets on the host before deploy (default true)"),
7752
- provision_clerk: z10.boolean().optional().default(true).describe("Provision and configure Clerk automatically (default true)"),
7753
- verify: z10.boolean().optional().describe("Probe the deployed URL and report whether it actually serves (default true)"),
7754
- domain: z10.boolean().optional().describe("Route the brand domain to the deployment (Cloudflare provisions DNS + cert)")
7938
+ skip_build: z11.boolean().optional().describe("Deploy the existing build without rebuilding"),
7939
+ push_secrets: z11.boolean().optional().describe("Stage runtime secrets on the host before deploy (default true)"),
7940
+ provision_clerk: z11.boolean().optional().default(true).describe("Provision and configure Clerk automatically (default true)"),
7941
+ verify: z11.boolean().optional().describe("Probe the deployed URL and report whether it actually serves (default true)"),
7942
+ domain: z11.boolean().optional().describe("Route the brand domain to the deployment (Cloudflare provisions DNS + cert)")
7755
7943
  },
7756
7944
  annotations: annotationsFor("deploy_storefront", "write")
7757
7945
  },
@@ -7871,11 +8059,11 @@ function registerStorefrontDeployTools(server2, props2) {
7871
8059
  title: "Provision Storefront Clerk App",
7872
8060
  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.",
7873
8061
  inputSchema: {
7874
- dir: z10.string().min(1).describe("Path to the scaffolded storefront directory"),
7875
- name: z10.string().optional().describe("Clerk application name (defaults from brand)"),
7876
- production: z10.boolean().optional().describe("Also create a production instance (Platform API only)"),
7877
- no_create: z10.boolean().optional().describe("Never create a new application; only reuse existing keys"),
7878
- url: z10.string().optional().describe("Deployed URL to whitelist as origin and redirect")
8062
+ dir: z11.string().min(1).describe("Path to the scaffolded storefront directory"),
8063
+ name: z11.string().optional().describe("Clerk application name (defaults from brand)"),
8064
+ production: z11.boolean().optional().describe("Also create a production instance (Platform API only)"),
8065
+ no_create: z11.boolean().optional().describe("Never create a new application; only reuse existing keys"),
8066
+ url: z11.string().optional().describe("Deployed URL to whitelist as origin and redirect")
7879
8067
  },
7880
8068
  annotations: annotationsFor("provision_storefront_clerk", "write")
7881
8069
  },
@@ -7931,7 +8119,7 @@ function registerStorefrontDeployTools(server2, props2) {
7931
8119
  }
7932
8120
 
7933
8121
  // src/tools-storefront-plan.ts
7934
- import { z as z11 } from "zod";
8122
+ import { z as z12 } from "zod";
7935
8123
 
7936
8124
  // src/lib/storefront-plan-update.ts
7937
8125
  var STRIPE_PRICE_ID_RE = /^price_[A-Za-z0-9_]+$/;
@@ -8037,7 +8225,7 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
8037
8225
  server2.registerTool(name, {
8038
8226
  title: name === "list_storefronts" ? "List Storefronts" : "Get Storefront",
8039
8227
  description: "Read hosted storefront plans including stored OCS account ids and account_status.",
8040
- inputSchema: name === "get_storefront" ? { storefront_id: z11.string().min(1) } : {},
8228
+ inputSchema: name === "get_storefront" ? { storefront_id: z12.string().min(1) } : {},
8041
8229
  annotations: annotationsFor(name, "read")
8042
8230
  }, async (args) => {
8043
8231
  const denied = denyUnlessScoped(props2, name, STOREFRONT_PLAN_TOOL_SCOPES);
@@ -8056,14 +8244,14 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
8056
8244
  title: "Update Storefront Plan",
8057
8245
  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.",
8058
8246
  inputSchema: {
8059
- ocs_account_id: z11.number().int().positive().optional().describe("Owned OCS account override. Omit for automatic resolution."),
8060
- storefront_id: z11.string().min(1).describe("Id of the hosted storefront"),
8061
- slug: z11.string().min(1).describe("Plan slug, such as eu-1gb"),
8062
- price_cents: z11.number().int().positive().optional().describe("Retail price in minor units. Must be greater than zero. Omit to leave the price."),
8063
- active: z11.boolean().optional().describe("Whether the plan is for sale. Omit to leave it."),
8064
- sort_order: z11.number().int().nonnegative().optional().describe("Display order, lowest first. Omit to leave it."),
8065
- stripe_price_id: z11.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."),
8066
- stripe_price_mode: z11.enum(["test", "live"]).nullable().optional().describe("test or live. Set with stripe_price_id. Null clears both. Omit to leave them.")
8247
+ ocs_account_id: z12.number().int().positive().optional().describe("Owned OCS account override. Omit for automatic resolution."),
8248
+ storefront_id: z12.string().min(1).describe("Id of the hosted storefront"),
8249
+ slug: z12.string().min(1).describe("Plan slug, such as eu-1gb"),
8250
+ price_cents: z12.number().int().positive().optional().describe("Retail price in minor units. Must be greater than zero. Omit to leave the price."),
8251
+ active: z12.boolean().optional().describe("Whether the plan is for sale. Omit to leave it."),
8252
+ sort_order: z12.number().int().nonnegative().optional().describe("Display order, lowest first. Omit to leave it."),
8253
+ 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."),
8254
+ 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.")
8067
8255
  },
8068
8256
  annotations: annotationsFor("update_storefront_plan", "write")
8069
8257
  },
@@ -8091,7 +8279,7 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
8091
8279
  }
8092
8280
 
8093
8281
  // src/tools-atlas.ts
8094
- import { z as z12 } from "zod";
8282
+ import { z as z13 } from "zod";
8095
8283
 
8096
8284
  // src/atlas-public.ts
8097
8285
  var ATLAS_PUBLIC_BASE_URL = "https://atlas.carrier.llc";
@@ -8149,15 +8337,15 @@ var ATLAS_TOOL_SCOPES = {
8149
8337
  get_atlas_network_status: "read"
8150
8338
  };
8151
8339
  var coverageSchema = {
8152
- country: z12.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"),
8153
- status: z12.enum(["up", "degraded", "down", "unknown"]).optional().describe("Keep only networks whose latest probe has this status"),
8154
- technology: z12.enum(["2G", "3G", "4G", "5G"]).optional().describe("Keep only networks of this radio generation")
8340
+ 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"),
8341
+ status: z13.enum(["up", "degraded", "down", "unknown"]).optional().describe("Keep only networks whose latest probe has this status"),
8342
+ technology: z13.enum(["2G", "3G", "4G", "5G"]).optional().describe("Keep only networks of this radio generation")
8155
8343
  };
8156
8344
  var networkSchema = {
8157
- mcc: z12.string().regex(/^\d{3}$/, "mcc must be 3 digits").describe("Mobile Country Code"),
8158
- mnc: z12.string().regex(/^\d{2,3}$/, "mnc must be 2 or 3 digits").describe("Mobile Network Code")
8345
+ mcc: z13.string().regex(/^\d{3}$/, "mcc must be 3 digits").describe("Mobile Country Code"),
8346
+ mnc: z13.string().regex(/^\d{2,3}$/, "mnc must be 2 or 3 digits").describe("Mobile Network Code")
8159
8347
  };
8160
- function jsonResult2(body2) {
8348
+ function jsonResult3(body2) {
8161
8349
  return {
8162
8350
  content: [{ type: "text", text: JSON.stringify(body2, null, 2) }]
8163
8351
  };
@@ -8183,7 +8371,7 @@ function registerAtlasTools(server2, ctx) {
8183
8371
  technology: args.technology
8184
8372
  });
8185
8373
  const body2 = await atlasPublicGet(atlasBaseUrl(ctx.env), path);
8186
- return jsonResult2(body2);
8374
+ return jsonResult3(body2);
8187
8375
  }
8188
8376
  )
8189
8377
  );
@@ -8203,22 +8391,22 @@ function registerAtlasTools(server2, ctx) {
8203
8391
  async (args, _token) => {
8204
8392
  const path = atlasNetworkPath(args.mcc, args.mnc);
8205
8393
  const body2 = await atlasPublicGet(atlasBaseUrl(ctx.env), path);
8206
- return jsonResult2(body2);
8394
+ return jsonResult3(body2);
8207
8395
  }
8208
8396
  )
8209
8397
  );
8210
8398
  }
8211
8399
 
8212
8400
  // src/tools-network-default.ts
8213
- import { z as z13 } from "zod";
8401
+ import { z as z14 } from "zod";
8214
8402
  var NETWORK_DEFAULT_TOOL_SCOPES = {
8215
8403
  get_network_default: "read",
8216
8404
  set_network_default: "write",
8217
8405
  plan_network_default: "read"
8218
8406
  };
8219
- var choiceShape = z13.object({
8220
- mode: z13.enum(NETWORK_DEFAULT_MODES),
8221
- steeringListId: z13.number().int().positive().optional()
8407
+ var choiceShape = z14.object({
8408
+ mode: z14.enum(NETWORK_DEFAULT_MODES),
8409
+ steeringListId: z14.number().int().positive().optional()
8222
8410
  }).describe("`cheapest_available`, `all`, or `custom` with a steeringListId from list_steering_lists");
8223
8411
  function ioFor(ctx, token2) {
8224
8412
  const kv = ctx.env.CARRIER_USERS;
@@ -8273,9 +8461,9 @@ function registerNetworkDefaultTools(server2, ctx) {
8273
8461
  title: "Set Network Default",
8274
8462
  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`.",
8275
8463
  inputSchema: {
8276
- mode: z13.enum(NETWORK_DEFAULT_MODES).describe("cheapest_available | all | custom"),
8277
- steeringListId: z13.number().int().positive().optional().describe("Required when mode is custom"),
8278
- dry_run: z13.boolean().optional().describe("If true, validate and return what would be stored; store nothing")
8464
+ mode: z14.enum(NETWORK_DEFAULT_MODES).describe("cheapest_available | all | custom"),
8465
+ steeringListId: z14.number().int().positive().optional().describe("Required when mode is custom"),
8466
+ dry_run: z14.boolean().optional().describe("If true, validate and return what would be stored; store nothing")
8279
8467
  },
8280
8468
  annotations: { readOnlyHint: false, idempotentHint: true, destructiveHint: false }
8281
8469
  },
@@ -8304,10 +8492,10 @@ function registerNetworkDefaultTools(server2, ctx) {
8304
8492
  title: "Plan Network Default",
8305
8493
  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).",
8306
8494
  inputSchema: {
8307
- countries: z13.array(z13.string().length(2)).min(1).describe('ISO-3166 alpha-2 codes, e.g. ["CA"]'),
8495
+ countries: z14.array(z14.string().length(2)).min(1).describe('ISO-3166 alpha-2 codes, e.g. ["CA"]'),
8308
8496
  simOverride: choiceShape.optional(),
8309
8497
  packageOverride: choiceShape.optional(),
8310
- resellerId: z13.number().int().positive().optional().describe("Omit to use the token owner's reseller")
8498
+ resellerId: z14.number().int().positive().optional().describe("Omit to use the token owner's reseller")
8311
8499
  },
8312
8500
  annotations: { readOnlyHint: true }
8313
8501
  },
@@ -8322,7 +8510,7 @@ function registerNetworkDefaultTools(server2, ctx) {
8322
8510
  }
8323
8511
 
8324
8512
  // src/affiliate-tools.ts
8325
- import { z as z14 } from "zod";
8513
+ import { z as z15 } from "zod";
8326
8514
  var AFFILIATE_TOOL_SCOPES = {
8327
8515
  affiliate_status: "read",
8328
8516
  affiliate_commissions: "read",
@@ -8393,7 +8581,7 @@ function registerAffiliateTools(server2, ctx) {
8393
8581
  title: "Affiliate Commissions",
8394
8582
  description: "Read-only: returns the list of commission records for the authenticated operator.",
8395
8583
  inputSchema: {
8396
- limit: z14.number().int().min(1).max(200).optional().default(50).describe("Maximum number of commission records to return (1-200, default: 50).")
8584
+ limit: z15.number().int().min(1).max(200).optional().default(50).describe("Maximum number of commission records to return (1-200, default: 50).")
8397
8585
  },
8398
8586
  annotations: annotationsFor("affiliate_commissions", "read")
8399
8587
  },
@@ -9868,7 +10056,8 @@ var ALL_TOOL_SCOPES = Object.freeze({
9868
10056
  ...STOREFRONT_PLAN_TOOL_SCOPES,
9869
10057
  ...ATLAS_TOOL_SCOPES,
9870
10058
  ...NETWORK_DEFAULT_TOOL_SCOPES,
9871
- ...AFFILIATE_TOOL_SCOPES
10059
+ ...AFFILIATE_TOOL_SCOPES,
10060
+ ...CARRIER_API_TOOL_SCOPES
9872
10061
  });
9873
10062
  var TOOL_REGISTRY = new Set(Object.keys(ALL_TOOL_SCOPES));
9874
10063
  var UNREGISTERED_TOOLS = /* @__PURE__ */ new Set(["stripe_proxy_call"]);
@@ -10543,15 +10732,15 @@ function registerAllCarrierAskTools(server2, ctx) {
10543
10732
  title: "Natural Language Carrier Tool Router",
10544
10733
  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.",
10545
10734
  inputSchema: {
10546
- intent: z15.string().min(3).describe(
10735
+ intent: z16.string().min(3).describe(
10547
10736
  "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...')"
10548
10737
  ),
10549
- context: z15.object({
10550
- iccid: z15.string().optional().describe("Subscriber ICCID if already known"),
10551
- account_id: z15.number().optional().describe("Account ID if already known"),
10552
- reseller_id: z15.number().optional().describe("Reseller ID if already known")
10738
+ context: z16.object({
10739
+ iccid: z16.string().optional().describe("Subscriber ICCID if already known"),
10740
+ account_id: z16.number().optional().describe("Account ID if already known"),
10741
+ reseller_id: z16.number().optional().describe("Reseller ID if already known")
10553
10742
  }).optional().describe("Optional pre-resolved context to improve routing accuracy"),
10554
- confirm_token: z15.string().optional().describe(
10743
+ confirm_token: z16.string().optional().describe(
10555
10744
  "One-time token from a previous carrier_ask call with confirm_required=true. Providing this executes the previously staged destructive operation."
10556
10745
  )
10557
10746
  }
@@ -10755,7 +10944,7 @@ function registerAllCarrierAskTools(server2, ctx) {
10755
10944
  title: "Describe a Carrier Tool",
10756
10945
  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.",
10757
10946
  inputSchema: {
10758
- tool_name: z15.string().describe("The exact MCP tool name to describe (e.g. 'assign_package', 'hlr_set_bitrate')")
10947
+ tool_name: z16.string().describe("The exact MCP tool name to describe (e.g. 'assign_package', 'hlr_set_bitrate')")
10759
10948
  }
10760
10949
  },
10761
10950
  wrapHandler(
@@ -10848,7 +11037,7 @@ function buildExamples(toolName) {
10848
11037
  }
10849
11038
 
10850
11039
  // src/list-recent-ocs-events.ts
10851
- import { z as z16 } from "zod";
11040
+ import { z as z17 } from "zod";
10852
11041
 
10853
11042
  // ../../packages/ocs-spec/src/ocs-event-buffer-read.ts
10854
11043
  var LIFECYCLE_RESELLER_ID2 = 1170;
@@ -10977,10 +11166,10 @@ var ALLOWED_EVENT_TYPES = [
10977
11166
  "usage.anomaly"
10978
11167
  ];
10979
11168
  var listRecentOcsEventsSchema = {
10980
- iccid: z16.string().regex(/^\d{19,20}$/).describe("ICCID, 19 or 20 digits, ITU-T E.118 format"),
10981
- limit: z16.number().int().min(1).max(50).default(20).describe("Max events to return, newest first"),
10982
- event_types: z16.array(z16.enum(ALLOWED_EVENT_TYPES)).optional().describe("Filter to specific event types"),
10983
- since: z16.string().datetime().optional().describe("ISO-8601 timestamp; only events after this point")
11169
+ iccid: z17.string().regex(/^\d{19,20}$/).describe("ICCID, 19 or 20 digits, ITU-T E.118 format"),
11170
+ limit: z17.number().int().min(1).max(50).default(20).describe("Max events to return, newest first"),
11171
+ event_types: z17.array(z17.enum(ALLOWED_EVENT_TYPES)).optional().describe("Filter to specific event types"),
11172
+ since: z17.string().datetime().optional().describe("ISO-8601 timestamp; only events after this point")
10984
11173
  };
10985
11174
  async function listRecentOcsEvents2(iccid, limit, eventTypes, since, kv) {
10986
11175
  return listRecentOcsEvents(iccid, limit, eventTypes, since, kv);
@@ -11043,7 +11232,7 @@ function registerListRecentOcsEventsTool(server2, ctx) {
11043
11232
  }
11044
11233
 
11045
11234
  // src/tools-rate-governor.ts
11046
- import { z as z17 } from "zod";
11235
+ import { z as z18 } from "zod";
11047
11236
  var MONITORED_ENDPOINTS = [
11048
11237
  "subscriberNetworkEventsOverPeriod",
11049
11238
  // 30/min
@@ -11075,7 +11264,7 @@ function registerRateLimitStatusTool(server2, ctx) {
11075
11264
  title: "API Rate-Limit Governor Status",
11076
11265
  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.",
11077
11266
  inputSchema: {
11078
- endpoint: z17.string().optional().describe(
11267
+ endpoint: z18.string().optional().describe(
11079
11268
  "OCS method name in camelCase (e.g. 'subscriberUsageOverPeriod'). Omit to return status for all monitored endpoints."
11080
11269
  )
11081
11270
  },
@@ -11131,7 +11320,7 @@ function registerRateLimitStatusTool(server2, ctx) {
11131
11320
  }
11132
11321
 
11133
11322
  // src/tools-depletion-events.ts
11134
- import { z as z18 } from "zod";
11323
+ import { z as z19 } from "zod";
11135
11324
  function ok6(payload) {
11136
11325
  return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
11137
11326
  }
@@ -11159,10 +11348,10 @@ function registerDepletionEventsTool(server2, ctx) {
11159
11348
  title: "Subscriber Bundle Depletion Events",
11160
11349
  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.",
11161
11350
  inputSchema: {
11162
- subscriberId: z18.string().optional().describe(
11351
+ subscriberId: z19.string().optional().describe(
11163
11352
  "OCS subscriber ID to look up. Omit to list the 20 most recent fleet-wide depletions."
11164
11353
  ),
11165
- since: z18.string().optional().describe(
11354
+ since: z19.string().optional().describe(
11166
11355
  "ISO-8601 timestamp \u2014 only return events at or after this time (for single-subscriber lookup)."
11167
11356
  )
11168
11357
  },
@@ -11277,7 +11466,7 @@ function registerDepletionEventsTool(server2, ctx) {
11277
11466
  }
11278
11467
 
11279
11468
  // src/tools-country-history.ts
11280
- import { z as z19 } from "zod";
11469
+ import { z as z20 } from "zod";
11281
11470
  function isoDate(now, daysAgo = 0) {
11282
11471
  const d = new Date(now.getTime() - daysAgo * 864e5);
11283
11472
  return d.toISOString().slice(0, 10);
@@ -11300,10 +11489,10 @@ function registerCountryHistoryTool(server2, ctx) {
11300
11489
  title: "Subscriber Country History",
11301
11490
  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.",
11302
11491
  inputSchema: {
11303
- subscriberId: z19.string().regex(/^\d{19,20}$/, "subscriberId must be a 19\u201320 digit ICCID").describe("Subscriber ICCID (19\u201320 digits, ITU-T E.118)"),
11304
- startDate: z19.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)"),
11305
- endDate: z19.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)"),
11306
- limit: z19.number().int().min(1).max(50).default(20).optional().describe("Maximum number of country_events to return, newest first (default 20, max 50)")
11492
+ 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)"),
11493
+ 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)"),
11494
+ 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)"),
11495
+ 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)")
11307
11496
  },
11308
11497
  annotations: { readOnlyHint: true, idempotentHint: true }
11309
11498
  },
@@ -11411,7 +11600,7 @@ function registerCountryHistoryTool(server2, ctx) {
11411
11600
  }
11412
11601
 
11413
11602
  // src/apps/fleet-health-app.ts
11414
- import { z as z20 } from "zod";
11603
+ import { z as z21 } from "zod";
11415
11604
  import {
11416
11605
  registerAppTool,
11417
11606
  registerAppResource,
@@ -11527,7 +11716,7 @@ function registerFleetHealthApp(server2, ctx) {
11527
11716
  title: "Fleet Health Dashboard",
11528
11717
  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.",
11529
11718
  inputSchema: {
11530
- accountId: z20.number().optional().describe("Filter to a specific account (omit for all)")
11719
+ accountId: z21.number().optional().describe("Filter to a specific account (omit for all)")
11531
11720
  },
11532
11721
  annotations: { readOnlyHint: true },
11533
11722
  _meta: {
@@ -11570,7 +11759,7 @@ function registerFleetHealthApp(server2, ctx) {
11570
11759
  }
11571
11760
 
11572
11761
  // src/apps/provisioning-wizard.ts
11573
- import { z as z21 } from "zod";
11762
+ import { z as z22 } from "zod";
11574
11763
  import {
11575
11764
  registerAppTool as registerAppTool2,
11576
11765
  registerAppResource as registerAppResource2,
@@ -11675,10 +11864,10 @@ function registerProvisioningWizard(server2, ctx) {
11675
11864
  title: "eSIM Provisioning Wizard",
11676
11865
  description: "Interactive 3-step wizard to provision an eSIM: select subscriber, choose package template, preview (dry_run) and confirm execution.",
11677
11866
  inputSchema: {
11678
- step: z21.enum(["init", "select-package", "preview", "confirm"]).describe("Current wizard step"),
11679
- wizardId: z21.string().optional().describe("Wizard session ID (absent on init)"),
11680
- subscriber_iccid: z21.string().optional().describe("Subscriber ICCID (required for select-package)"),
11681
- package_template_id: z21.number().optional().describe("Package template ID (required for preview)")
11867
+ step: z22.enum(["init", "select-package", "preview", "confirm"]).describe("Current wizard step"),
11868
+ wizardId: z22.string().optional().describe("Wizard session ID (absent on init)"),
11869
+ subscriber_iccid: z22.string().optional().describe("Subscriber ICCID (required for select-package)"),
11870
+ package_template_id: z22.number().optional().describe("Package template ID (required for preview)")
11682
11871
  },
11683
11872
  _meta: {
11684
11873
  ui: {
@@ -11948,7 +12137,7 @@ function registerProvisioningWizard(server2, ctx) {
11948
12137
  }
11949
12138
 
11950
12139
  // src/apps/balance-topup.ts
11951
- import { z as z22 } from "zod";
12140
+ import { z as z23 } from "zod";
11952
12141
  import {
11953
12142
  registerAppTool as registerAppTool3,
11954
12143
  registerAppResource as registerAppResource3,
@@ -12001,9 +12190,9 @@ function registerBalanceTopupApp(server2, ctx) {
12001
12190
  title: "Balance Top-up Form",
12002
12191
  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`.",
12003
12192
  inputSchema: {
12004
- iccid: z22.string().describe("The subscriber ICCID for the account lookup"),
12005
- delta: z22.number().describe("Amount to add (positive) or deduct (negative) from the account balance"),
12006
- preview: z22.boolean().default(true).describe("If true, return preview without writing. If false, execute the balance change.")
12193
+ iccid: z23.string().describe("The subscriber ICCID for the account lookup"),
12194
+ delta: z23.number().describe("Amount to add (positive) or deduct (negative) from the account balance"),
12195
+ preview: z23.boolean().default(true).describe("If true, return preview without writing. If false, execute the balance change.")
12007
12196
  },
12008
12197
  annotations: { destructiveHint: true },
12009
12198
  _meta: {
@@ -12086,7 +12275,7 @@ function registerAllApps(server2, ctx) {
12086
12275
  }
12087
12276
 
12088
12277
  // src/prompts.ts
12089
- import { z as z23 } from "zod";
12278
+ import { z as z24 } from "zod";
12090
12279
  function registerAllPrompts(server2) {
12091
12280
  server2.registerPrompt(
12092
12281
  "fleet_health_report",
@@ -12122,7 +12311,7 @@ Format as a structured report with sections, tables, and actionable recommendati
12122
12311
  {
12123
12312
  title: "Subscriber Deep Dive",
12124
12313
  description: "Comprehensive analysis of a single subscriber: profile, packages, usage patterns, location history, recommendations.",
12125
- argsSchema: { iccid: z23.string().describe("The subscriber ICCID to analyse") }
12314
+ argsSchema: { iccid: z24.string().describe("The subscriber ICCID to analyse") }
12126
12315
  },
12127
12316
  async ({ iccid }) => ({
12128
12317
  messages: [
@@ -12221,7 +12410,7 @@ Analyze and present:
12221
12410
  {
12222
12411
  title: "Bulk Operations Planner",
12223
12412
  description: "Plan bulk operations safely: mass package assignments, account migrations, balance adjustments, or status changes.",
12224
- argsSchema: { operation: z23.string().describe("Describe the bulk operation you want to perform") }
12413
+ argsSchema: { operation: z24.string().describe("Describe the bulk operation you want to perform") }
12225
12414
  },
12226
12415
  async ({ operation }) => ({
12227
12416
  messages: [
@@ -12254,7 +12443,7 @@ NEVER execute destructive operations without confirmation.`
12254
12443
  }
12255
12444
 
12256
12445
  // src/tools-pricing.ts
12257
- import { z as z24 } from "zod";
12446
+ import { z as z25 } from "zod";
12258
12447
  function registerAllPricingTools(server2, ctx) {
12259
12448
  const allTools = [...PRICING_TOOLS, ...PROJECTS_TOOLS];
12260
12449
  for (const tool of allTools) {
@@ -12361,19 +12550,19 @@ function buildZodSchema(schema) {
12361
12550
  for (const [key, prop] of Object.entries(properties)) {
12362
12551
  let field;
12363
12552
  if (prop.enum) {
12364
- field = z24.enum(prop.enum);
12553
+ field = z25.enum(prop.enum);
12365
12554
  } else if (prop.type === "number") {
12366
- field = z24.number();
12555
+ field = z25.number();
12367
12556
  } else if (prop.type === "boolean") {
12368
- field = z24.boolean();
12557
+ field = z25.boolean();
12369
12558
  } else if (prop.type === "array") {
12370
12559
  if (prop.items?.type === "number") {
12371
- field = z24.array(z24.number());
12560
+ field = z25.array(z25.number());
12372
12561
  } else {
12373
- field = z24.array(z24.string());
12562
+ field = z25.array(z25.string());
12374
12563
  }
12375
12564
  } else {
12376
- field = z24.string();
12565
+ field = z25.string();
12377
12566
  }
12378
12567
  const required = schema.required ?? [];
12379
12568
  if (!required.includes(key)) {
@@ -12388,7 +12577,7 @@ function buildZodSchema(schema) {
12388
12577
  }
12389
12578
 
12390
12579
  // src/tools-greenzone.ts
12391
- import { z as z25 } from "zod";
12580
+ import { z as z26 } from "zod";
12392
12581
 
12393
12582
  // src/greenzone-whitelist.ts
12394
12583
  var STATE_KEY = "greenzone:state";
@@ -12679,9 +12868,9 @@ function registerGreenzoneTools(server2, ctx) {
12679
12868
  title: "Greenzone Whitelist \u2014 Add",
12680
12869
  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.",
12681
12870
  inputSchema: {
12682
- host: z25.string().optional().describe("Hostname to whitelist (e.g. 'example.com')"),
12683
- ip: z25.string().optional().describe("IP address or CIDR to whitelist (e.g. '203.0.113.0/24')"),
12684
- dry_run: z25.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
12871
+ host: z26.string().optional().describe("Hostname to whitelist (e.g. 'example.com')"),
12872
+ ip: z26.string().optional().describe("IP address or CIDR to whitelist (e.g. '203.0.113.0/24')"),
12873
+ dry_run: z26.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
12685
12874
  },
12686
12875
  annotations: { destructiveHint: true }
12687
12876
  },
@@ -12740,9 +12929,9 @@ function registerGreenzoneTools(server2, ctx) {
12740
12929
  title: "Greenzone Whitelist \u2014 Remove",
12741
12930
  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.",
12742
12931
  inputSchema: {
12743
- host: z25.string().optional().describe("Hostname to remove from whitelist"),
12744
- ip: z25.string().optional().describe("IP address or CIDR to remove from whitelist"),
12745
- dry_run: z25.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
12932
+ host: z26.string().optional().describe("Hostname to remove from whitelist"),
12933
+ ip: z26.string().optional().describe("IP address or CIDR to remove from whitelist"),
12934
+ dry_run: z26.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
12746
12935
  },
12747
12936
  annotations: { destructiveHint: true }
12748
12937
  },
@@ -12801,7 +12990,7 @@ function registerGreenzoneTools(server2, ctx) {
12801
12990
  title: "Greenzone Whitelist \u2014 List",
12802
12991
  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.",
12803
12992
  inputSchema: {
12804
- from_portal: z25.boolean().optional().describe(
12993
+ from_portal: z26.boolean().optional().describe(
12805
12994
  "When true, return Kapture steps to read live portal state instead of KV cache"
12806
12995
  )
12807
12996
  },
@@ -12853,7 +13042,7 @@ function registerGreenzoneTools(server2, ctx) {
12853
13042
  }
12854
13043
 
12855
13044
  // src/tools-ui-agent-generic.ts
12856
- import { z as z26 } from "zod";
13045
+ import { z as z27 } from "zod";
12857
13046
  var COST_PER_STEP_USD = 0.014;
12858
13047
  var SESSION_OVERHEAD_USD = 5e-3;
12859
13048
  function estimateCostUsd2(steps) {
@@ -12895,13 +13084,13 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
12895
13084
  title: "Dispatch Generic Browsing Agent",
12896
13085
  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.",
12897
13086
  inputSchema: {
12898
- prompt: z26.string().min(1).max(4e3).describe(
13087
+ prompt: z27.string().min(1).max(4e3).describe(
12899
13088
  "Natural-language task description for the browsing agent. Be specific: include target URLs, data to extract, or actions to perform."
12900
13089
  ),
12901
- max_steps: z26.number().int().min(1).max(30).optional().describe(
13090
+ max_steps: z27.number().int().min(1).max(30).optional().describe(
12902
13091
  "Advisory step budget (1\u201330, default 15). Prices the dry-run estimate; the hosted agent sets its own depth."
12903
13092
  ),
12904
- dry_run: z26.boolean().optional().describe(
13093
+ dry_run: z27.boolean().optional().describe(
12905
13094
  "Preview cost estimate without dispatching. Returns estimated_cost_usd only \u2014 no browser session is created."
12906
13095
  )
12907
13096
  }
@@ -13038,7 +13227,7 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
13038
13227
  title: "Poll Browsing Agent Task Status",
13039
13228
  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.",
13040
13229
  inputSchema: {
13041
- task_id: z26.string().describe("Task ID returned by ui_agent_ask")
13230
+ task_id: z27.string().describe("Task ID returned by ui_agent_ask")
13042
13231
  }
13043
13232
  },
13044
13233
  async (args) => {
@@ -13195,6 +13384,7 @@ registerAllUiAgentTools(server, toolCtx, uiAgentRuntime, portalOptIn);
13195
13384
  registerUiAgentAskTools(server, toolCtx, uiAgentRuntime);
13196
13385
  registerStripeConnectTools(server, { env: stdioEnv, props });
13197
13386
  registerAffiliateTools(server, { env: stdioEnv, props });
13387
+ registerCarrierApiTools(server, toolCtx);
13198
13388
  registerWalletTools(server, { env: stdioEnv, props });
13199
13389
  registerGreenzoneTools(server, toolCtx);
13200
13390
  registerUiAgentGenericTools(server, toolCtx, uiAgentRuntime);