@carrierllc/mcp 0.13.60 → 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-6J2ZU3T5.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";
@@ -6184,11 +6184,18 @@ 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"
6189
6193
  };
6194
+ var CAMPAIGN_ID_PATTERN = /^cbc_[0-9a-f]{32}$/;
6195
+ var CLAIM_ID_PATTERN = /^cbl_[0-9a-f]{32}$/;
6190
6196
  var DEFAULT_API_BASE_URL = "https://api.carrier.llc";
6191
6197
  var REQUEST_TIMEOUT_MS = 1e4;
6198
+ var WRITE_TIMEOUT_MS = 3e4;
6192
6199
  function jsonResult2(body2, isError = false) {
6193
6200
  return {
6194
6201
  ...isError ? { isError: true } : {},
@@ -6209,14 +6216,21 @@ async function carrierApiRequest(ctx, extra, req) {
6209
6216
  const base = (ctx.env.CARRIER_API_BASE_URL ?? DEFAULT_API_BASE_URL).replace(/\/+$/, "");
6210
6217
  let response;
6211
6218
  try {
6219
+ const isPost = req.method === "POST";
6212
6220
  response = await fetch(`${base}${req.path}`, {
6213
6221
  method: req.method,
6214
6222
  redirect: "error",
6215
- headers: { Accept: "application/json", Authorization: `Bearer ${token2}` },
6216
- signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
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)
6217
6230
  });
6218
6231
  } catch (err9) {
6219
- return apiError("CARRIER_API_UNREACHABLE", `Carrier API request failed: ${err9 instanceof Error ? err9.name : "error"}.`);
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}`);
6220
6234
  }
6221
6235
  let text;
6222
6236
  try {
@@ -6234,7 +6248,7 @@ async function carrierApiRequest(ctx, extra, req) {
6234
6248
  if (parsed === void 0) {
6235
6249
  return apiError("CARRIER_API_BAD_RESPONSE", "Carrier API returned a non-JSON success body.", { http_status: response.status });
6236
6250
  }
6237
- return jsonResult2(parsed);
6251
+ return jsonResult2(req.method === "POST" ? { http_status: response.status, result: parsed } : parsed);
6238
6252
  }
6239
6253
  const body2 = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
6240
6254
  const nested = body2["error"];
@@ -6247,6 +6261,7 @@ async function carrierApiRequest(ctx, extra, req) {
6247
6261
  api_error: pick("error") ?? pick("message")
6248
6262
  });
6249
6263
  }
6264
+ var idPathError = (field) => apiError("INVALID_ID", `${field} is not a valid id. No request was made.`);
6250
6265
  function registerCarrierApiTools(server2, ctx) {
6251
6266
  server2.registerTool(
6252
6267
  "list_connectivity_offering_templates",
@@ -6265,10 +6280,99 @@ function registerCarrierApiTools(server2, ctx) {
6265
6280
  { skipUserToken: true }
6266
6281
  )
6267
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
+ );
6268
6372
  }
6269
6373
 
6270
6374
  // src/tools-ui-agent-schedule.ts
6271
- import { z as z6 } from "zod";
6375
+ import { z as z7 } from "zod";
6272
6376
  var UI_AGENT_SCHEDULE_TOOL_SCOPES = {
6273
6377
  ui_agent_schedule_create: "admin",
6274
6378
  ui_agent_schedule_list: "read",
@@ -6306,14 +6410,14 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
6306
6410
  title: "Create UI Agent Schedule",
6307
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,
6308
6412
  inputSchema: {
6309
- name: z6.string().describe("Human-readable name for this schedule"),
6310
- cron: z6.string().describe(
6413
+ name: z7.string().describe("Human-readable name for this schedule"),
6414
+ cron: z7.string().describe(
6311
6415
  "Standard 5-field cron expression (minute hour day month weekday). Minimum interval: 5 minutes. Example: '0 */6 * * *' = every 6 hours."
6312
6416
  ),
6313
- prompt_template: z6.string().describe(
6417
+ prompt_template: z7.string().describe(
6314
6418
  "Agent prompt/task template the browser agent will execute on each run"
6315
6419
  ),
6316
- profile: z6.string().optional().describe(
6420
+ profile: z7.string().optional().describe(
6317
6421
  "Browser-agent profile to use. Defaults to the deployment's configured profile."
6318
6422
  )
6319
6423
  }
@@ -6335,7 +6439,7 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
6335
6439
  title: "Delete UI Agent Schedule",
6336
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,
6337
6441
  inputSchema: {
6338
- schedule_id: z6.string().describe("ID of the schedule to delete")
6442
+ schedule_id: z7.string().describe("ID of the schedule to delete")
6339
6443
  }
6340
6444
  },
6341
6445
  async () => !ctx.props.scope.includes("admin") ? scopeDenied(ctx, "ui_agent_schedule_delete", "admin") : uiAgentStubError("ui_agent_schedule_delete", "recurring_runtime")
@@ -6346,7 +6450,7 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
6346
6450
  title: "Pause UI Agent Schedule",
6347
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,
6348
6452
  inputSchema: {
6349
- schedule_id: z6.string().describe("ID of the schedule to pause")
6453
+ schedule_id: z7.string().describe("ID of the schedule to pause")
6350
6454
  }
6351
6455
  },
6352
6456
  async () => !ctx.props.scope.includes("admin") ? scopeDenied(ctx, "ui_agent_schedule_pause", "admin") : uiAgentStubError("ui_agent_schedule_pause", "recurring_runtime")
@@ -6357,7 +6461,7 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
6357
6461
  title: "Resume UI Agent Schedule",
6358
6462
  description: "Resumes a paused recurring browser-agent schedule. Requires admin scope." + STDIO_NOTE,
6359
6463
  inputSchema: {
6360
- schedule_id: z6.string().describe("ID of the schedule to resume")
6464
+ schedule_id: z7.string().describe("ID of the schedule to resume")
6361
6465
  }
6362
6466
  },
6363
6467
  async () => !ctx.props.scope.includes("admin") ? scopeDenied(ctx, "ui_agent_schedule_resume", "admin") : uiAgentStubError("ui_agent_schedule_resume", "recurring_runtime")
@@ -6414,7 +6518,7 @@ function registerScheduleAndUsageTools(server2, ctx, runtime) {
6414
6518
  }
6415
6519
 
6416
6520
  // src/wallet-tools.ts
6417
- import { z as z7 } from "zod";
6521
+ import { z as z8 } from "zod";
6418
6522
  import * as Sentry2 from "@sentry/cloudflare";
6419
6523
 
6420
6524
  // src/audit-schema.ts
@@ -6874,13 +6978,13 @@ function registerWalletTools(server2, ctx) {
6874
6978
  // — returns null here. Requiring a number turned that, the most common
6875
6979
  // state a new operator is in, into an output validation error.
6876
6980
  outputSchema: {
6877
- org_id: z7.string().describe("Carrier organisation the wallet belongs to"),
6878
- balance_eur_cents: z7.number().int().describe("Current balance in EUR cents"),
6879
- auto_topup_enabled: z7.boolean(),
6880
- 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(
6881
6985
  "Balance at or below which an auto top-up fires, EUR cents. Null when auto-top-up is unconfigured."
6882
6986
  ),
6883
- auto_topup_pack_cents: z7.number().int().nullable().describe(
6987
+ auto_topup_pack_cents: z8.number().int().nullable().describe(
6884
6988
  "Amount an auto top-up charges, EUR cents. Null when auto-top-up is unconfigured."
6885
6989
  )
6886
6990
  },
@@ -6922,7 +7026,7 @@ function registerWalletTools(server2, ctx) {
6922
7026
  title: "Wallet Top-up Checkout",
6923
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.",
6924
7028
  inputSchema: {
6925
- pack: z7.string().optional().describe(
7029
+ pack: z8.string().optional().describe(
6926
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."
6927
7031
  )
6928
7032
  },
@@ -6935,21 +7039,21 @@ function registerWalletTools(server2, ctx) {
6935
7039
  * documented here. Marking either arm required would break the other.
6936
7040
  */
6937
7041
  outputSchema: {
6938
- packs: z7.array(
6939
- z7.object({
6940
- id: z7.string(),
6941
- eur_cents: z7.number().int(),
6942
- bonus_pct: z7.number(),
6943
- bonus_eur_cents: z7.number().int(),
6944
- 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()
6945
7049
  })
6946
7050
  ).optional().describe("Catalogue arm \u2014 present only when `pack` was omitted."),
6947
- org_id: z7.string().optional().describe("Session arm."),
6948
- pack_id: z7.string().optional().describe("Session arm."),
6949
- pack_eur_cents: z7.number().int().optional().describe("Session arm."),
6950
- bonus_eur_cents: z7.number().int().optional().describe("Session arm."),
6951
- checkout_session_id: z7.string().optional().describe("Session arm."),
6952
- 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.")
6953
7057
  },
6954
7058
  annotations: annotationsFor("wallet_topup_checkout", "write")
6955
7059
  },
@@ -7006,7 +7110,7 @@ function registerWalletTools(server2, ctx) {
7006
7110
  title: "Wallet Auto Top-up (charges card now)",
7007
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`.",
7008
7112
  inputSchema: {
7009
- 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).")
7010
7114
  },
7011
7115
  /**
7012
7116
  * Only the charged arm is described here — `charged: false` returns
@@ -7021,12 +7125,12 @@ function registerWalletTools(server2, ctx) {
7021
7125
  * into a validation error.
7022
7126
  */
7023
7127
  outputSchema: {
7024
- org_id: z7.string(),
7025
- charged: z7.literal(true),
7026
- credited_eur_cents: z7.number().int(),
7027
- balance_after_cents: z7.number().int().optional().describe("Absent when the charge succeeded but crediting is pending."),
7028
- payment_intent_id: z7.string().optional(),
7029
- 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.")
7030
7134
  },
7031
7135
  annotations: annotationsFor("wallet_auto_topup", "write")
7032
7136
  },
@@ -7072,7 +7176,7 @@ function registerWalletTools(server2, ctx) {
7072
7176
  }
7073
7177
 
7074
7178
  // src/stripe-connect-tools.ts
7075
- import { z as z8 } from "zod";
7179
+ import { z as z9 } from "zod";
7076
7180
  import * as Sentry3 from "@sentry/cloudflare";
7077
7181
 
7078
7182
  // src/binding-unavailable.ts
@@ -7228,7 +7332,7 @@ function registerStripeConnectTools(server2, ctx) {
7228
7332
  title: "Stripe Connect Status",
7229
7333
  description: "Read-only: returns the Stripe Connect account status, capabilities, and requirements for the authenticated operator.",
7230
7334
  inputSchema: {
7231
- 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.")
7232
7336
  },
7233
7337
  annotations: annotationsFor("stripe_connect_status", "read")
7234
7338
  },
@@ -7289,8 +7393,8 @@ function registerStripeConnectTools(server2, ctx) {
7289
7393
  title: "List Stripe Payouts",
7290
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`.",
7291
7395
  inputSchema: {
7292
- limit: z8.number().int().min(1).max(50).default(10).describe("Number of payouts to return."),
7293
- 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.")
7294
7398
  },
7295
7399
  annotations: annotationsFor("stripe_connect_payouts", "read")
7296
7400
  },
@@ -7329,8 +7433,8 @@ function registerStripeConnectTools(server2, ctx) {
7329
7433
  title: "Stripe Connect Charges",
7330
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`.",
7331
7435
  inputSchema: {
7332
- limit: z8.number().int().min(1).max(100).default(20).describe("Number of charges to return."),
7333
- 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.")
7334
7438
  },
7335
7439
  annotations: annotationsFor("stripe_connect_charges_list", "read")
7336
7440
  },
@@ -7426,10 +7530,10 @@ function registerStripeConnectTools(server2, ctx) {
7426
7530
  title: "Refund a Charge (moves real money)",
7427
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.",
7428
7532
  inputSchema: {
7429
- charge_id: z8.string().min(1).describe("Stripe charge ID (ch_...)."),
7430
- amount_cents: z8.number().int().min(1).optional().describe("Partial refund amount in cents. Omit for full refund."),
7431
- reason: z8.enum(["duplicate", "fraudulent", "requested_by_customer"]).optional(),
7432
- 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.")
7433
7537
  },
7434
7538
  annotations: annotationsFor("stripe_connect_refund", "write")
7435
7539
  },
@@ -7488,8 +7592,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
7488
7592
  title: "List Chargeback Disputes",
7489
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.",
7490
7594
  inputSchema: {
7491
- limit: z8.number().int().min(1).max(50).default(10),
7492
- 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).")
7493
7597
  },
7494
7598
  annotations: annotationsFor("stripe_connect_dispute_list", "read")
7495
7599
  },
@@ -7528,8 +7632,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
7528
7632
  title: "List Radar Fraud Reviews",
7529
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`.",
7530
7634
  inputSchema: {
7531
- open_only: z8.boolean().default(true).describe("Stripe lists only open (undecided) reviews; kept for compatibility."),
7532
- 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)
7533
7637
  },
7534
7638
  annotations: annotationsFor("radar_review_list", "read")
7535
7639
  },
@@ -7571,8 +7675,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
7571
7675
  title: "Approve Radar Review (captures charge)",
7572
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`.",
7573
7677
  inputSchema: {
7574
- review_id: z8.string().min(1).describe("Stripe Radar review ID (prv_...)."),
7575
- confirm_token: z8.string().optional()
7678
+ review_id: z9.string().min(1).describe("Stripe Radar review ID (prv_...)."),
7679
+ confirm_token: z9.string().optional()
7576
7680
  },
7577
7681
  annotations: annotationsFor("radar_review_approve", "admin")
7578
7682
  },
@@ -7628,8 +7732,8 @@ Call again with confirm_token="${token2}" to execute. Expires in 5 minutes.`
7628
7732
  title: "Decline Radar Review (not supported by Stripe)",
7629
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.",
7630
7734
  inputSchema: {
7631
- review_id: z8.string().min(1),
7632
- confirm_token: z8.string().optional()
7735
+ review_id: z9.string().min(1),
7736
+ confirm_token: z9.string().optional()
7633
7737
  },
7634
7738
  annotations: annotationsFor("radar_review_decline", "admin")
7635
7739
  },
@@ -7650,9 +7754,9 @@ Call again with confirm_token="${token2}" to execute. Expires in 5 minutes.`
7650
7754
  title: "Add Value to Radar List",
7651
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`).",
7652
7756
  inputSchema: {
7653
- value_list_id: z8.string().min(1).describe("Stripe Radar value list ID (rsl_...)."),
7654
- value: z8.string().min(1).describe("The value to add (email, IP address, country code, etc.)."),
7655
- 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()
7656
7760
  },
7657
7761
  annotations: annotationsFor("radar_value_list_add", "admin")
7658
7762
  },
@@ -7707,8 +7811,8 @@ Expires in 5 minutes.`
7707
7811
  title: "Radar Rule Toggle (instructions only)",
7708
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`.",
7709
7813
  inputSchema: {
7710
- rule_id: z8.string().min(1).describe("Stripe Radar rule ID."),
7711
- 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.")
7712
7816
  },
7713
7817
  annotations: annotationsFor("radar_rule_toggle", "admin")
7714
7818
  },
@@ -7733,7 +7837,7 @@ Note: If you need this automated, use the Radar for Platforms beta \u2014 contac
7733
7837
  }
7734
7838
 
7735
7839
  // src/tools-storefront-logo.ts
7736
- import { z as z9 } from "zod";
7840
+ import { z as z10 } from "zod";
7737
7841
  var STOREFRONT_LOGO_TOOL_SCOPES = {
7738
7842
  generate_storefront_logo: "read"
7739
7843
  };
@@ -7746,9 +7850,9 @@ function registerStorefrontLogoTools(server2, env = {}, props2) {
7746
7850
  title: "Generate Storefront Logo",
7747
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.",
7748
7852
  inputSchema: {
7749
- name: z9.string().min(1).describe("Brand / shop name, e.g. Bananas"),
7750
- accent: z9.string().regex(/^#?[0-9A-Fa-f]{6}$/).optional().describe("Accent hex, e.g. #FF8A00"),
7751
- 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")
7752
7856
  },
7753
7857
  annotations: annotationsFor("generate_storefront_logo", "read")
7754
7858
  },
@@ -7782,7 +7886,7 @@ function registerStorefrontLogoTools(server2, env = {}, props2) {
7782
7886
  }
7783
7887
 
7784
7888
  // src/tools-storefront-deploy.ts
7785
- import { z as z10 } from "zod";
7889
+ import { z as z11 } from "zod";
7786
7890
  var STOREFRONT_DEPLOY_TOOL_SCOPES = {
7787
7891
  list_deploy_targets: "read",
7788
7892
  deploy_storefront: "write",
@@ -7799,7 +7903,7 @@ function registerStorefrontDeployTools(server2, props2) {
7799
7903
  title: "List Deploy Targets",
7800
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.",
7801
7905
  inputSchema: {
7802
- 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")
7803
7907
  },
7804
7908
  annotations: annotationsFor("list_deploy_targets", "read")
7805
7909
  },
@@ -7825,17 +7929,17 @@ function registerStorefrontDeployTools(server2, props2) {
7825
7929
  title: "Deploy Storefront",
7826
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.",
7827
7931
  inputSchema: {
7828
- dir: z10.string().min(1).describe("Path to the scaffolded storefront directory"),
7829
- target: z10.enum(TARGET_IDS).optional().describe("Force a host instead of auto-detecting"),
7830
- name: z10.string().optional().describe("Project/worker name (defaults from brand)"),
7831
- 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(
7832
7936
  'Acknowledge the scaffold-default-name risk: required when the resolved name is the scaffold default "storefront"'
7833
7937
  ),
7834
- skip_build: z10.boolean().optional().describe("Deploy the existing build without rebuilding"),
7835
- push_secrets: z10.boolean().optional().describe("Stage runtime secrets on the host before deploy (default true)"),
7836
- provision_clerk: z10.boolean().optional().default(true).describe("Provision and configure Clerk automatically (default true)"),
7837
- verify: z10.boolean().optional().describe("Probe the deployed URL and report whether it actually serves (default true)"),
7838
- 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)")
7839
7943
  },
7840
7944
  annotations: annotationsFor("deploy_storefront", "write")
7841
7945
  },
@@ -7955,11 +8059,11 @@ function registerStorefrontDeployTools(server2, props2) {
7955
8059
  title: "Provision Storefront Clerk App",
7956
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.",
7957
8061
  inputSchema: {
7958
- dir: z10.string().min(1).describe("Path to the scaffolded storefront directory"),
7959
- name: z10.string().optional().describe("Clerk application name (defaults from brand)"),
7960
- production: z10.boolean().optional().describe("Also create a production instance (Platform API only)"),
7961
- no_create: z10.boolean().optional().describe("Never create a new application; only reuse existing keys"),
7962
- 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")
7963
8067
  },
7964
8068
  annotations: annotationsFor("provision_storefront_clerk", "write")
7965
8069
  },
@@ -8015,7 +8119,7 @@ function registerStorefrontDeployTools(server2, props2) {
8015
8119
  }
8016
8120
 
8017
8121
  // src/tools-storefront-plan.ts
8018
- import { z as z11 } from "zod";
8122
+ import { z as z12 } from "zod";
8019
8123
 
8020
8124
  // src/lib/storefront-plan-update.ts
8021
8125
  var STRIPE_PRICE_ID_RE = /^price_[A-Za-z0-9_]+$/;
@@ -8121,7 +8225,7 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
8121
8225
  server2.registerTool(name, {
8122
8226
  title: name === "list_storefronts" ? "List Storefronts" : "Get Storefront",
8123
8227
  description: "Read hosted storefront plans including stored OCS account ids and account_status.",
8124
- inputSchema: name === "get_storefront" ? { storefront_id: z11.string().min(1) } : {},
8228
+ inputSchema: name === "get_storefront" ? { storefront_id: z12.string().min(1) } : {},
8125
8229
  annotations: annotationsFor(name, "read")
8126
8230
  }, async (args) => {
8127
8231
  const denied = denyUnlessScoped(props2, name, STOREFRONT_PLAN_TOOL_SCOPES);
@@ -8140,14 +8244,14 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
8140
8244
  title: "Update Storefront Plan",
8141
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.",
8142
8246
  inputSchema: {
8143
- ocs_account_id: z11.number().int().positive().optional().describe("Owned OCS account override. Omit for automatic resolution."),
8144
- storefront_id: z11.string().min(1).describe("Id of the hosted storefront"),
8145
- slug: z11.string().min(1).describe("Plan slug, such as eu-1gb"),
8146
- price_cents: z11.number().int().positive().optional().describe("Retail price in minor units. Must be greater than zero. Omit to leave the price."),
8147
- active: z11.boolean().optional().describe("Whether the plan is for sale. Omit to leave it."),
8148
- sort_order: z11.number().int().nonnegative().optional().describe("Display order, lowest first. Omit to leave it."),
8149
- 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."),
8150
- 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.")
8151
8255
  },
8152
8256
  annotations: annotationsFor("update_storefront_plan", "write")
8153
8257
  },
@@ -8175,7 +8279,7 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
8175
8279
  }
8176
8280
 
8177
8281
  // src/tools-atlas.ts
8178
- import { z as z12 } from "zod";
8282
+ import { z as z13 } from "zod";
8179
8283
 
8180
8284
  // src/atlas-public.ts
8181
8285
  var ATLAS_PUBLIC_BASE_URL = "https://atlas.carrier.llc";
@@ -8233,13 +8337,13 @@ var ATLAS_TOOL_SCOPES = {
8233
8337
  get_atlas_network_status: "read"
8234
8338
  };
8235
8339
  var coverageSchema = {
8236
- 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"),
8237
- status: z12.enum(["up", "degraded", "down", "unknown"]).optional().describe("Keep only networks whose latest probe has this status"),
8238
- 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")
8239
8343
  };
8240
8344
  var networkSchema = {
8241
- mcc: z12.string().regex(/^\d{3}$/, "mcc must be 3 digits").describe("Mobile Country Code"),
8242
- 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")
8243
8347
  };
8244
8348
  function jsonResult3(body2) {
8245
8349
  return {
@@ -8294,15 +8398,15 @@ function registerAtlasTools(server2, ctx) {
8294
8398
  }
8295
8399
 
8296
8400
  // src/tools-network-default.ts
8297
- import { z as z13 } from "zod";
8401
+ import { z as z14 } from "zod";
8298
8402
  var NETWORK_DEFAULT_TOOL_SCOPES = {
8299
8403
  get_network_default: "read",
8300
8404
  set_network_default: "write",
8301
8405
  plan_network_default: "read"
8302
8406
  };
8303
- var choiceShape = z13.object({
8304
- mode: z13.enum(NETWORK_DEFAULT_MODES),
8305
- 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()
8306
8410
  }).describe("`cheapest_available`, `all`, or `custom` with a steeringListId from list_steering_lists");
8307
8411
  function ioFor(ctx, token2) {
8308
8412
  const kv = ctx.env.CARRIER_USERS;
@@ -8357,9 +8461,9 @@ function registerNetworkDefaultTools(server2, ctx) {
8357
8461
  title: "Set Network Default",
8358
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`.",
8359
8463
  inputSchema: {
8360
- mode: z13.enum(NETWORK_DEFAULT_MODES).describe("cheapest_available | all | custom"),
8361
- steeringListId: z13.number().int().positive().optional().describe("Required when mode is custom"),
8362
- 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")
8363
8467
  },
8364
8468
  annotations: { readOnlyHint: false, idempotentHint: true, destructiveHint: false }
8365
8469
  },
@@ -8388,10 +8492,10 @@ function registerNetworkDefaultTools(server2, ctx) {
8388
8492
  title: "Plan Network Default",
8389
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).",
8390
8494
  inputSchema: {
8391
- 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"]'),
8392
8496
  simOverride: choiceShape.optional(),
8393
8497
  packageOverride: choiceShape.optional(),
8394
- 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")
8395
8499
  },
8396
8500
  annotations: { readOnlyHint: true }
8397
8501
  },
@@ -8406,7 +8510,7 @@ function registerNetworkDefaultTools(server2, ctx) {
8406
8510
  }
8407
8511
 
8408
8512
  // src/affiliate-tools.ts
8409
- import { z as z14 } from "zod";
8513
+ import { z as z15 } from "zod";
8410
8514
  var AFFILIATE_TOOL_SCOPES = {
8411
8515
  affiliate_status: "read",
8412
8516
  affiliate_commissions: "read",
@@ -8477,7 +8581,7 @@ function registerAffiliateTools(server2, ctx) {
8477
8581
  title: "Affiliate Commissions",
8478
8582
  description: "Read-only: returns the list of commission records for the authenticated operator.",
8479
8583
  inputSchema: {
8480
- 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).")
8481
8585
  },
8482
8586
  annotations: annotationsFor("affiliate_commissions", "read")
8483
8587
  },
@@ -10628,15 +10732,15 @@ function registerAllCarrierAskTools(server2, ctx) {
10628
10732
  title: "Natural Language Carrier Tool Router",
10629
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.",
10630
10734
  inputSchema: {
10631
- intent: z15.string().min(3).describe(
10735
+ intent: z16.string().min(3).describe(
10632
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...')"
10633
10737
  ),
10634
- context: z15.object({
10635
- iccid: z15.string().optional().describe("Subscriber ICCID if already known"),
10636
- account_id: z15.number().optional().describe("Account ID if already known"),
10637
- 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")
10638
10742
  }).optional().describe("Optional pre-resolved context to improve routing accuracy"),
10639
- confirm_token: z15.string().optional().describe(
10743
+ confirm_token: z16.string().optional().describe(
10640
10744
  "One-time token from a previous carrier_ask call with confirm_required=true. Providing this executes the previously staged destructive operation."
10641
10745
  )
10642
10746
  }
@@ -10840,7 +10944,7 @@ function registerAllCarrierAskTools(server2, ctx) {
10840
10944
  title: "Describe a Carrier Tool",
10841
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.",
10842
10946
  inputSchema: {
10843
- 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')")
10844
10948
  }
10845
10949
  },
10846
10950
  wrapHandler(
@@ -10933,7 +11037,7 @@ function buildExamples(toolName) {
10933
11037
  }
10934
11038
 
10935
11039
  // src/list-recent-ocs-events.ts
10936
- import { z as z16 } from "zod";
11040
+ import { z as z17 } from "zod";
10937
11041
 
10938
11042
  // ../../packages/ocs-spec/src/ocs-event-buffer-read.ts
10939
11043
  var LIFECYCLE_RESELLER_ID2 = 1170;
@@ -11062,10 +11166,10 @@ var ALLOWED_EVENT_TYPES = [
11062
11166
  "usage.anomaly"
11063
11167
  ];
11064
11168
  var listRecentOcsEventsSchema = {
11065
- iccid: z16.string().regex(/^\d{19,20}$/).describe("ICCID, 19 or 20 digits, ITU-T E.118 format"),
11066
- limit: z16.number().int().min(1).max(50).default(20).describe("Max events to return, newest first"),
11067
- event_types: z16.array(z16.enum(ALLOWED_EVENT_TYPES)).optional().describe("Filter to specific event types"),
11068
- 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")
11069
11173
  };
11070
11174
  async function listRecentOcsEvents2(iccid, limit, eventTypes, since, kv) {
11071
11175
  return listRecentOcsEvents(iccid, limit, eventTypes, since, kv);
@@ -11128,7 +11232,7 @@ function registerListRecentOcsEventsTool(server2, ctx) {
11128
11232
  }
11129
11233
 
11130
11234
  // src/tools-rate-governor.ts
11131
- import { z as z17 } from "zod";
11235
+ import { z as z18 } from "zod";
11132
11236
  var MONITORED_ENDPOINTS = [
11133
11237
  "subscriberNetworkEventsOverPeriod",
11134
11238
  // 30/min
@@ -11160,7 +11264,7 @@ function registerRateLimitStatusTool(server2, ctx) {
11160
11264
  title: "API Rate-Limit Governor Status",
11161
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.",
11162
11266
  inputSchema: {
11163
- endpoint: z17.string().optional().describe(
11267
+ endpoint: z18.string().optional().describe(
11164
11268
  "OCS method name in camelCase (e.g. 'subscriberUsageOverPeriod'). Omit to return status for all monitored endpoints."
11165
11269
  )
11166
11270
  },
@@ -11216,7 +11320,7 @@ function registerRateLimitStatusTool(server2, ctx) {
11216
11320
  }
11217
11321
 
11218
11322
  // src/tools-depletion-events.ts
11219
- import { z as z18 } from "zod";
11323
+ import { z as z19 } from "zod";
11220
11324
  function ok6(payload) {
11221
11325
  return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
11222
11326
  }
@@ -11244,10 +11348,10 @@ function registerDepletionEventsTool(server2, ctx) {
11244
11348
  title: "Subscriber Bundle Depletion Events",
11245
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.",
11246
11350
  inputSchema: {
11247
- subscriberId: z18.string().optional().describe(
11351
+ subscriberId: z19.string().optional().describe(
11248
11352
  "OCS subscriber ID to look up. Omit to list the 20 most recent fleet-wide depletions."
11249
11353
  ),
11250
- since: z18.string().optional().describe(
11354
+ since: z19.string().optional().describe(
11251
11355
  "ISO-8601 timestamp \u2014 only return events at or after this time (for single-subscriber lookup)."
11252
11356
  )
11253
11357
  },
@@ -11362,7 +11466,7 @@ function registerDepletionEventsTool(server2, ctx) {
11362
11466
  }
11363
11467
 
11364
11468
  // src/tools-country-history.ts
11365
- import { z as z19 } from "zod";
11469
+ import { z as z20 } from "zod";
11366
11470
  function isoDate(now, daysAgo = 0) {
11367
11471
  const d = new Date(now.getTime() - daysAgo * 864e5);
11368
11472
  return d.toISOString().slice(0, 10);
@@ -11385,10 +11489,10 @@ function registerCountryHistoryTool(server2, ctx) {
11385
11489
  title: "Subscriber Country History",
11386
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.",
11387
11491
  inputSchema: {
11388
- 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)"),
11389
- 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)"),
11390
- 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)"),
11391
- 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)")
11392
11496
  },
11393
11497
  annotations: { readOnlyHint: true, idempotentHint: true }
11394
11498
  },
@@ -11496,7 +11600,7 @@ function registerCountryHistoryTool(server2, ctx) {
11496
11600
  }
11497
11601
 
11498
11602
  // src/apps/fleet-health-app.ts
11499
- import { z as z20 } from "zod";
11603
+ import { z as z21 } from "zod";
11500
11604
  import {
11501
11605
  registerAppTool,
11502
11606
  registerAppResource,
@@ -11612,7 +11716,7 @@ function registerFleetHealthApp(server2, ctx) {
11612
11716
  title: "Fleet Health Dashboard",
11613
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.",
11614
11718
  inputSchema: {
11615
- 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)")
11616
11720
  },
11617
11721
  annotations: { readOnlyHint: true },
11618
11722
  _meta: {
@@ -11655,7 +11759,7 @@ function registerFleetHealthApp(server2, ctx) {
11655
11759
  }
11656
11760
 
11657
11761
  // src/apps/provisioning-wizard.ts
11658
- import { z as z21 } from "zod";
11762
+ import { z as z22 } from "zod";
11659
11763
  import {
11660
11764
  registerAppTool as registerAppTool2,
11661
11765
  registerAppResource as registerAppResource2,
@@ -11760,10 +11864,10 @@ function registerProvisioningWizard(server2, ctx) {
11760
11864
  title: "eSIM Provisioning Wizard",
11761
11865
  description: "Interactive 3-step wizard to provision an eSIM: select subscriber, choose package template, preview (dry_run) and confirm execution.",
11762
11866
  inputSchema: {
11763
- step: z21.enum(["init", "select-package", "preview", "confirm"]).describe("Current wizard step"),
11764
- wizardId: z21.string().optional().describe("Wizard session ID (absent on init)"),
11765
- subscriber_iccid: z21.string().optional().describe("Subscriber ICCID (required for select-package)"),
11766
- 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)")
11767
11871
  },
11768
11872
  _meta: {
11769
11873
  ui: {
@@ -12033,7 +12137,7 @@ function registerProvisioningWizard(server2, ctx) {
12033
12137
  }
12034
12138
 
12035
12139
  // src/apps/balance-topup.ts
12036
- import { z as z22 } from "zod";
12140
+ import { z as z23 } from "zod";
12037
12141
  import {
12038
12142
  registerAppTool as registerAppTool3,
12039
12143
  registerAppResource as registerAppResource3,
@@ -12086,9 +12190,9 @@ function registerBalanceTopupApp(server2, ctx) {
12086
12190
  title: "Balance Top-up Form",
12087
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`.",
12088
12192
  inputSchema: {
12089
- iccid: z22.string().describe("The subscriber ICCID for the account lookup"),
12090
- delta: z22.number().describe("Amount to add (positive) or deduct (negative) from the account balance"),
12091
- 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.")
12092
12196
  },
12093
12197
  annotations: { destructiveHint: true },
12094
12198
  _meta: {
@@ -12171,7 +12275,7 @@ function registerAllApps(server2, ctx) {
12171
12275
  }
12172
12276
 
12173
12277
  // src/prompts.ts
12174
- import { z as z23 } from "zod";
12278
+ import { z as z24 } from "zod";
12175
12279
  function registerAllPrompts(server2) {
12176
12280
  server2.registerPrompt(
12177
12281
  "fleet_health_report",
@@ -12207,7 +12311,7 @@ Format as a structured report with sections, tables, and actionable recommendati
12207
12311
  {
12208
12312
  title: "Subscriber Deep Dive",
12209
12313
  description: "Comprehensive analysis of a single subscriber: profile, packages, usage patterns, location history, recommendations.",
12210
- argsSchema: { iccid: z23.string().describe("The subscriber ICCID to analyse") }
12314
+ argsSchema: { iccid: z24.string().describe("The subscriber ICCID to analyse") }
12211
12315
  },
12212
12316
  async ({ iccid }) => ({
12213
12317
  messages: [
@@ -12306,7 +12410,7 @@ Analyze and present:
12306
12410
  {
12307
12411
  title: "Bulk Operations Planner",
12308
12412
  description: "Plan bulk operations safely: mass package assignments, account migrations, balance adjustments, or status changes.",
12309
- 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") }
12310
12414
  },
12311
12415
  async ({ operation }) => ({
12312
12416
  messages: [
@@ -12339,7 +12443,7 @@ NEVER execute destructive operations without confirmation.`
12339
12443
  }
12340
12444
 
12341
12445
  // src/tools-pricing.ts
12342
- import { z as z24 } from "zod";
12446
+ import { z as z25 } from "zod";
12343
12447
  function registerAllPricingTools(server2, ctx) {
12344
12448
  const allTools = [...PRICING_TOOLS, ...PROJECTS_TOOLS];
12345
12449
  for (const tool of allTools) {
@@ -12446,19 +12550,19 @@ function buildZodSchema(schema) {
12446
12550
  for (const [key, prop] of Object.entries(properties)) {
12447
12551
  let field;
12448
12552
  if (prop.enum) {
12449
- field = z24.enum(prop.enum);
12553
+ field = z25.enum(prop.enum);
12450
12554
  } else if (prop.type === "number") {
12451
- field = z24.number();
12555
+ field = z25.number();
12452
12556
  } else if (prop.type === "boolean") {
12453
- field = z24.boolean();
12557
+ field = z25.boolean();
12454
12558
  } else if (prop.type === "array") {
12455
12559
  if (prop.items?.type === "number") {
12456
- field = z24.array(z24.number());
12560
+ field = z25.array(z25.number());
12457
12561
  } else {
12458
- field = z24.array(z24.string());
12562
+ field = z25.array(z25.string());
12459
12563
  }
12460
12564
  } else {
12461
- field = z24.string();
12565
+ field = z25.string();
12462
12566
  }
12463
12567
  const required = schema.required ?? [];
12464
12568
  if (!required.includes(key)) {
@@ -12473,7 +12577,7 @@ function buildZodSchema(schema) {
12473
12577
  }
12474
12578
 
12475
12579
  // src/tools-greenzone.ts
12476
- import { z as z25 } from "zod";
12580
+ import { z as z26 } from "zod";
12477
12581
 
12478
12582
  // src/greenzone-whitelist.ts
12479
12583
  var STATE_KEY = "greenzone:state";
@@ -12764,9 +12868,9 @@ function registerGreenzoneTools(server2, ctx) {
12764
12868
  title: "Greenzone Whitelist \u2014 Add",
12765
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.",
12766
12870
  inputSchema: {
12767
- host: z25.string().optional().describe("Hostname to whitelist (e.g. 'example.com')"),
12768
- ip: z25.string().optional().describe("IP address or CIDR to whitelist (e.g. '203.0.113.0/24')"),
12769
- 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")
12770
12874
  },
12771
12875
  annotations: { destructiveHint: true }
12772
12876
  },
@@ -12825,9 +12929,9 @@ function registerGreenzoneTools(server2, ctx) {
12825
12929
  title: "Greenzone Whitelist \u2014 Remove",
12826
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.",
12827
12931
  inputSchema: {
12828
- host: z25.string().optional().describe("Hostname to remove from whitelist"),
12829
- ip: z25.string().optional().describe("IP address or CIDR to remove from whitelist"),
12830
- 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")
12831
12935
  },
12832
12936
  annotations: { destructiveHint: true }
12833
12937
  },
@@ -12886,7 +12990,7 @@ function registerGreenzoneTools(server2, ctx) {
12886
12990
  title: "Greenzone Whitelist \u2014 List",
12887
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.",
12888
12992
  inputSchema: {
12889
- from_portal: z25.boolean().optional().describe(
12993
+ from_portal: z26.boolean().optional().describe(
12890
12994
  "When true, return Kapture steps to read live portal state instead of KV cache"
12891
12995
  )
12892
12996
  },
@@ -12938,7 +13042,7 @@ function registerGreenzoneTools(server2, ctx) {
12938
13042
  }
12939
13043
 
12940
13044
  // src/tools-ui-agent-generic.ts
12941
- import { z as z26 } from "zod";
13045
+ import { z as z27 } from "zod";
12942
13046
  var COST_PER_STEP_USD = 0.014;
12943
13047
  var SESSION_OVERHEAD_USD = 5e-3;
12944
13048
  function estimateCostUsd2(steps) {
@@ -12980,13 +13084,13 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
12980
13084
  title: "Dispatch Generic Browsing Agent",
12981
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.",
12982
13086
  inputSchema: {
12983
- prompt: z26.string().min(1).max(4e3).describe(
13087
+ prompt: z27.string().min(1).max(4e3).describe(
12984
13088
  "Natural-language task description for the browsing agent. Be specific: include target URLs, data to extract, or actions to perform."
12985
13089
  ),
12986
- max_steps: z26.number().int().min(1).max(30).optional().describe(
13090
+ max_steps: z27.number().int().min(1).max(30).optional().describe(
12987
13091
  "Advisory step budget (1\u201330, default 15). Prices the dry-run estimate; the hosted agent sets its own depth."
12988
13092
  ),
12989
- dry_run: z26.boolean().optional().describe(
13093
+ dry_run: z27.boolean().optional().describe(
12990
13094
  "Preview cost estimate without dispatching. Returns estimated_cost_usd only \u2014 no browser session is created."
12991
13095
  )
12992
13096
  }
@@ -13123,7 +13227,7 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
13123
13227
  title: "Poll Browsing Agent Task Status",
13124
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.",
13125
13229
  inputSchema: {
13126
- 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")
13127
13231
  }
13128
13232
  },
13129
13233
  async (args) => {