@carrierllc/mcp 0.13.73 → 0.13.75
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/{chunk-G2DAODML.js → chunk-LO324UTL.js} +109 -109
- package/dist/{chunk-G2DAODML.js.map → chunk-LO324UTL.js.map} +1 -1
- package/dist/cli.js +27 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.js +225 -134
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
verifyStorefront,
|
|
92
92
|
withOcsListSummary,
|
|
93
93
|
withTemplateResellerId
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-LO324UTL.js";
|
|
95
95
|
import "./chunk-SHKKVIIA.js";
|
|
96
96
|
|
|
97
97
|
// src/index.ts
|
|
@@ -354,6 +354,8 @@ function createAiCreditBilling(env) {
|
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
|
+
var MIN_AI_TOPUP_CENTS = 1e3;
|
|
358
|
+
var MAX_AI_TOPUP_CENTS = 1e5;
|
|
357
359
|
var AI_TIER_POLICY = {
|
|
358
360
|
free: { limit: 5, window: "day" },
|
|
359
361
|
pro: { limit: 1e3, window: "month" },
|
|
@@ -1370,22 +1372,22 @@ function boundZonesResult(raw, opts = {}) {
|
|
|
1370
1372
|
const { verbose = false, resellerId } = opts;
|
|
1371
1373
|
const maxZones = opts.maxZones ?? ZONES_MAX_ZONES;
|
|
1372
1374
|
const maxOperators = opts.maxOperators ?? (verbose ? ZONES_VERBOSE_MAX_OPERATORS : ZONES_MAX_OPERATORS);
|
|
1373
|
-
const totalOperators = all.reduce((n,
|
|
1375
|
+
const totalOperators = all.reduce((n, z30) => n + (z30.operators?.length ?? 0), 0);
|
|
1374
1376
|
const keptZones = all.slice(0, maxZones);
|
|
1375
1377
|
let budget = maxOperators;
|
|
1376
1378
|
let returnedOperators = 0;
|
|
1377
|
-
const zones = keptZones.map((
|
|
1378
|
-
const ops =
|
|
1379
|
+
const zones = keptZones.map((z30) => {
|
|
1380
|
+
const ops = z30.operators ?? [];
|
|
1379
1381
|
const take = Math.max(0, Math.min(ops.length, budget));
|
|
1380
1382
|
budget -= take;
|
|
1381
1383
|
returnedOperators += take;
|
|
1382
1384
|
const sliced = ops.slice(0, take);
|
|
1383
1385
|
if (verbose) {
|
|
1384
|
-
return { ...
|
|
1386
|
+
return { ...z30, operators: sliced, operatorCount: ops.length };
|
|
1385
1387
|
}
|
|
1386
1388
|
return {
|
|
1387
|
-
zoneId:
|
|
1388
|
-
zoneName:
|
|
1389
|
+
zoneId: z30.zoneId,
|
|
1390
|
+
zoneName: z30.zoneName,
|
|
1389
1391
|
operatorCount: ops.length,
|
|
1390
1392
|
operators: sliced.map((o) => ({
|
|
1391
1393
|
net: o.networkId,
|
|
@@ -5451,7 +5453,7 @@ function registerAllBacklogTools(server2, ctx) {
|
|
|
5451
5453
|
}
|
|
5452
5454
|
|
|
5453
5455
|
// src/tools-carrier-ask.ts
|
|
5454
|
-
import { z as
|
|
5456
|
+
import { z as z18 } from "zod";
|
|
5455
5457
|
|
|
5456
5458
|
// src/tools-ui-agent.ts
|
|
5457
5459
|
import { z as z5 } from "zod";
|
|
@@ -7512,8 +7514,94 @@ function registerWalletTools(server2, ctx) {
|
|
|
7512
7514
|
);
|
|
7513
7515
|
}
|
|
7514
7516
|
|
|
7515
|
-
// src/
|
|
7517
|
+
// src/ai-wallet-tools.ts
|
|
7516
7518
|
import { z as z10 } from "zod";
|
|
7519
|
+
var AI_WALLET_TOOL_SCOPES = {
|
|
7520
|
+
ai_wallet_auto_topup: "write"
|
|
7521
|
+
};
|
|
7522
|
+
async function aiWallet(env, orgId, method, body2) {
|
|
7523
|
+
const response = await fetch(
|
|
7524
|
+
`${env.ATLAS_BASE_URL ?? "https://atlas.carrier.llc"}/internal/ai-topup/${encodeURIComponent(orgId)}`,
|
|
7525
|
+
{
|
|
7526
|
+
method,
|
|
7527
|
+
headers: {
|
|
7528
|
+
"Content-Type": "application/json",
|
|
7529
|
+
"X-Carrier-Internal-Key": env.CARRIER_INTERNAL_API_KEY ?? ""
|
|
7530
|
+
},
|
|
7531
|
+
...body2 === void 0 ? {} : { body: JSON.stringify(body2) }
|
|
7532
|
+
}
|
|
7533
|
+
);
|
|
7534
|
+
if (!response.ok) throw new Error(`AI wallet request failed (${response.status})`);
|
|
7535
|
+
return response.json();
|
|
7536
|
+
}
|
|
7537
|
+
function registerAiWalletTools(server2, ctx) {
|
|
7538
|
+
const orgId = ctx.props.org_id ?? ctx.props.sub;
|
|
7539
|
+
server2.registerTool(
|
|
7540
|
+
"ai_wallet_auto_topup",
|
|
7541
|
+
{
|
|
7542
|
+
title: "AI Wallet Auto Top-up Settings",
|
|
7543
|
+
description: "Read or change automatic EUR replenishment for the separate AI-credit wallet. This does not charge a card and does not change the eSIM connectivity wallet. Params: enabled (optional boolean), amount_cents (optional integer nominal EUR cents, minimum 1000, maximum 100000). Omitting both reads the current setting. Omitting amount while disabling preserves the saved amount. Sending only an amount changes the amount and keeps the current on/off setting. Reading is open to any organisation member; org admin required to change.",
|
|
7544
|
+
inputSchema: {
|
|
7545
|
+
enabled: z10.boolean().optional(),
|
|
7546
|
+
amount_cents: z10.number().int().min(MIN_AI_TOPUP_CENTS).max(MAX_AI_TOPUP_CENTS).optional()
|
|
7547
|
+
},
|
|
7548
|
+
outputSchema: {
|
|
7549
|
+
org_id: z10.string(),
|
|
7550
|
+
balance_eur_micros: z10.number().int(),
|
|
7551
|
+
auto_topup_enabled: z10.boolean(),
|
|
7552
|
+
auto_topup_amount_cents: z10.number().int()
|
|
7553
|
+
},
|
|
7554
|
+
// Changes a setting only, never charges, and repeating a call is harmless.
|
|
7555
|
+
annotations: annotationsFor("ai_wallet_auto_topup", "write", { idempotentHint: true })
|
|
7556
|
+
},
|
|
7557
|
+
async ({ enabled, amount_cents }) => {
|
|
7558
|
+
const denied = denyUnlessScoped(ctx.props, "ai_wallet_auto_topup", AI_WALLET_TOOL_SCOPES);
|
|
7559
|
+
if (denied) return denied;
|
|
7560
|
+
if (ctx.env.CARRIER_AI_AUTO_TOPUP_ENABLED !== "true") {
|
|
7561
|
+
return {
|
|
7562
|
+
isError: true,
|
|
7563
|
+
content: [{ type: "text", text: "AI auto top-up is not available on this deployment." }]
|
|
7564
|
+
};
|
|
7565
|
+
}
|
|
7566
|
+
const writing = enabled !== void 0 || amount_cents !== void 0;
|
|
7567
|
+
let admin = false;
|
|
7568
|
+
if (writing && ctx.props.org_id && ctx.props.org_role === "org:admin" && ctx.isOrgAdmin) {
|
|
7569
|
+
try {
|
|
7570
|
+
admin = await ctx.isOrgAdmin(ctx.props.org_id);
|
|
7571
|
+
} catch {
|
|
7572
|
+
admin = false;
|
|
7573
|
+
}
|
|
7574
|
+
}
|
|
7575
|
+
if (writing && ctx.props.org_id && !admin) {
|
|
7576
|
+
return {
|
|
7577
|
+
isError: true,
|
|
7578
|
+
content: [{
|
|
7579
|
+
type: "text",
|
|
7580
|
+
text: "Changing AI auto top-up needs an organisation admin. Sign in again as an org admin, or ask one to change it. Reading the setting is still allowed."
|
|
7581
|
+
}]
|
|
7582
|
+
};
|
|
7583
|
+
}
|
|
7584
|
+
try {
|
|
7585
|
+
const state = enabled === void 0 && amount_cents === void 0 ? await aiWallet(ctx.env, orgId, "GET") : await aiWallet(ctx.env, orgId, "PUT", {
|
|
7586
|
+
...enabled === void 0 ? {} : { enabled },
|
|
7587
|
+
...amount_cents === void 0 ? {} : { amount_cents }
|
|
7588
|
+
});
|
|
7589
|
+
return {
|
|
7590
|
+
content: [{ type: "text", text: JSON.stringify(state) }],
|
|
7591
|
+
structuredContent: { ...state }
|
|
7592
|
+
};
|
|
7593
|
+
} catch (error) {
|
|
7594
|
+
return {
|
|
7595
|
+
isError: true,
|
|
7596
|
+
content: [{ type: "text", text: error instanceof Error ? error.message : "AI wallet unavailable" }]
|
|
7597
|
+
};
|
|
7598
|
+
}
|
|
7599
|
+
}
|
|
7600
|
+
);
|
|
7601
|
+
}
|
|
7602
|
+
|
|
7603
|
+
// src/stripe-connect-tools.ts
|
|
7604
|
+
import { z as z11 } from "zod";
|
|
7517
7605
|
import * as Sentry3 from "@sentry/cloudflare";
|
|
7518
7606
|
|
|
7519
7607
|
// src/binding-unavailable.ts
|
|
@@ -7669,7 +7757,7 @@ function registerStripeConnectTools(server2, ctx) {
|
|
|
7669
7757
|
title: "Stripe Connect Status",
|
|
7670
7758
|
description: "Read-only: returns the Stripe Connect account status, capabilities, and requirements for the authenticated operator.",
|
|
7671
7759
|
inputSchema: {
|
|
7672
|
-
operator_id:
|
|
7760
|
+
operator_id: z11.string().optional().describe("Override operator_id (admin use). Defaults to caller's org/user.")
|
|
7673
7761
|
},
|
|
7674
7762
|
annotations: annotationsFor("stripe_connect_status", "read")
|
|
7675
7763
|
},
|
|
@@ -7730,8 +7818,8 @@ function registerStripeConnectTools(server2, ctx) {
|
|
|
7730
7818
|
title: "List Stripe Payouts",
|
|
7731
7819
|
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`.",
|
|
7732
7820
|
inputSchema: {
|
|
7733
|
-
limit:
|
|
7734
|
-
status:
|
|
7821
|
+
limit: z11.number().int().min(1).max(50).default(10).describe("Number of payouts to return."),
|
|
7822
|
+
status: z11.enum(["pending", "paid", "failed", "canceled", "in_transit"]).optional().describe("Filter by payout status.")
|
|
7735
7823
|
},
|
|
7736
7824
|
annotations: annotationsFor("stripe_connect_payouts", "read")
|
|
7737
7825
|
},
|
|
@@ -7770,8 +7858,8 @@ function registerStripeConnectTools(server2, ctx) {
|
|
|
7770
7858
|
title: "Stripe Connect Charges",
|
|
7771
7859
|
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`.",
|
|
7772
7860
|
inputSchema: {
|
|
7773
|
-
limit:
|
|
7774
|
-
starting_after:
|
|
7861
|
+
limit: z11.number().int().min(1).max(100).default(20).describe("Number of charges to return."),
|
|
7862
|
+
starting_after: z11.string().regex(/^(ch|py)_[A-Za-z0-9]+$/).optional().describe("Charge id to page after.")
|
|
7775
7863
|
},
|
|
7776
7864
|
annotations: annotationsFor("stripe_connect_charges_list", "read")
|
|
7777
7865
|
},
|
|
@@ -7867,10 +7955,10 @@ function registerStripeConnectTools(server2, ctx) {
|
|
|
7867
7955
|
title: "Refund a Charge (moves real money)",
|
|
7868
7956
|
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.",
|
|
7869
7957
|
inputSchema: {
|
|
7870
|
-
charge_id:
|
|
7871
|
-
amount_cents:
|
|
7872
|
-
reason:
|
|
7873
|
-
confirm_token:
|
|
7958
|
+
charge_id: z11.string().min(1).describe("Stripe charge ID (ch_...)."),
|
|
7959
|
+
amount_cents: z11.number().int().min(1).optional().describe("Partial refund amount in cents. Omit for full refund."),
|
|
7960
|
+
reason: z11.enum(["duplicate", "fraudulent", "requested_by_customer"]).optional(),
|
|
7961
|
+
confirm_token: z11.string().optional().describe("Confirmation token from previous call. Required to execute.")
|
|
7874
7962
|
},
|
|
7875
7963
|
annotations: annotationsFor("stripe_connect_refund", "write")
|
|
7876
7964
|
},
|
|
@@ -7929,8 +8017,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
|
|
|
7929
8017
|
title: "List Chargeback Disputes",
|
|
7930
8018
|
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.",
|
|
7931
8019
|
inputSchema: {
|
|
7932
|
-
limit:
|
|
7933
|
-
status:
|
|
8020
|
+
limit: z11.number().int().min(1).max(50).default(10),
|
|
8021
|
+
status: z11.string().optional().describe("Filter by dispute status (e.g. needs_response, under_review).")
|
|
7934
8022
|
},
|
|
7935
8023
|
annotations: annotationsFor("stripe_connect_dispute_list", "read")
|
|
7936
8024
|
},
|
|
@@ -7969,8 +8057,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
|
|
|
7969
8057
|
title: "List Radar Fraud Reviews",
|
|
7970
8058
|
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`.",
|
|
7971
8059
|
inputSchema: {
|
|
7972
|
-
open_only:
|
|
7973
|
-
limit:
|
|
8060
|
+
open_only: z11.boolean().default(true).describe("Stripe lists only open (undecided) reviews; kept for compatibility."),
|
|
8061
|
+
limit: z11.number().int().min(1).max(50).default(10)
|
|
7974
8062
|
},
|
|
7975
8063
|
annotations: annotationsFor("radar_review_list", "read")
|
|
7976
8064
|
},
|
|
@@ -8012,8 +8100,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
|
|
|
8012
8100
|
title: "Approve Radar Review (captures charge)",
|
|
8013
8101
|
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`.",
|
|
8014
8102
|
inputSchema: {
|
|
8015
|
-
review_id:
|
|
8016
|
-
confirm_token:
|
|
8103
|
+
review_id: z11.string().min(1).describe("Stripe Radar review ID (prv_...)."),
|
|
8104
|
+
confirm_token: z11.string().optional()
|
|
8017
8105
|
},
|
|
8018
8106
|
annotations: annotationsFor("radar_review_approve", "admin")
|
|
8019
8107
|
},
|
|
@@ -8069,8 +8157,8 @@ Call again with confirm_token="${token2}" to execute. Expires in 5 minutes.`
|
|
|
8069
8157
|
title: "Decline Radar Review (not supported by Stripe)",
|
|
8070
8158
|
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.",
|
|
8071
8159
|
inputSchema: {
|
|
8072
|
-
review_id:
|
|
8073
|
-
confirm_token:
|
|
8160
|
+
review_id: z11.string().min(1),
|
|
8161
|
+
confirm_token: z11.string().optional()
|
|
8074
8162
|
},
|
|
8075
8163
|
annotations: annotationsFor("radar_review_decline", "admin")
|
|
8076
8164
|
},
|
|
@@ -8091,9 +8179,9 @@ Call again with confirm_token="${token2}" to execute. Expires in 5 minutes.`
|
|
|
8091
8179
|
title: "Add Value to Radar List",
|
|
8092
8180
|
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`).",
|
|
8093
8181
|
inputSchema: {
|
|
8094
|
-
value_list_id:
|
|
8095
|
-
value:
|
|
8096
|
-
confirm_token:
|
|
8182
|
+
value_list_id: z11.string().min(1).describe("Stripe Radar value list ID (rsl_...)."),
|
|
8183
|
+
value: z11.string().min(1).describe("The value to add (email, IP address, country code, etc.)."),
|
|
8184
|
+
confirm_token: z11.string().optional()
|
|
8097
8185
|
},
|
|
8098
8186
|
annotations: annotationsFor("radar_value_list_add", "admin")
|
|
8099
8187
|
},
|
|
@@ -8148,8 +8236,8 @@ Expires in 5 minutes.`
|
|
|
8148
8236
|
title: "Radar Rule Toggle (instructions only)",
|
|
8149
8237
|
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`.",
|
|
8150
8238
|
inputSchema: {
|
|
8151
|
-
rule_id:
|
|
8152
|
-
enabled:
|
|
8239
|
+
rule_id: z11.string().min(1).describe("Stripe Radar rule ID."),
|
|
8240
|
+
enabled: z11.boolean().describe("true = enable, false = disable.")
|
|
8153
8241
|
},
|
|
8154
8242
|
annotations: annotationsFor("radar_rule_toggle", "admin")
|
|
8155
8243
|
},
|
|
@@ -8174,7 +8262,7 @@ Note: If you need this automated, use the Radar for Platforms beta \u2014 contac
|
|
|
8174
8262
|
}
|
|
8175
8263
|
|
|
8176
8264
|
// src/tools-storefront-logo.ts
|
|
8177
|
-
import { z as
|
|
8265
|
+
import { z as z12 } from "zod";
|
|
8178
8266
|
var STOREFRONT_LOGO_TOOL_SCOPES = {
|
|
8179
8267
|
generate_storefront_logo: "read"
|
|
8180
8268
|
};
|
|
@@ -8187,9 +8275,9 @@ function registerStorefrontLogoTools(server2, env = {}, props2) {
|
|
|
8187
8275
|
title: "Generate Storefront Logo",
|
|
8188
8276
|
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.",
|
|
8189
8277
|
inputSchema: {
|
|
8190
|
-
name:
|
|
8191
|
-
accent:
|
|
8192
|
-
tagline:
|
|
8278
|
+
name: z12.string().min(1).describe("Brand / shop name, e.g. Bananas"),
|
|
8279
|
+
accent: z12.string().regex(/^#?[0-9A-Fa-f]{6}$/).optional().describe("Accent hex, e.g. #FF8A00"),
|
|
8280
|
+
tagline: z12.string().optional().describe("Optional tagline for AI-enhanced marks")
|
|
8193
8281
|
},
|
|
8194
8282
|
annotations: annotationsFor("generate_storefront_logo", "read")
|
|
8195
8283
|
},
|
|
@@ -8223,7 +8311,7 @@ function registerStorefrontLogoTools(server2, env = {}, props2) {
|
|
|
8223
8311
|
}
|
|
8224
8312
|
|
|
8225
8313
|
// src/tools-storefront-deploy.ts
|
|
8226
|
-
import { z as
|
|
8314
|
+
import { z as z13 } from "zod";
|
|
8227
8315
|
var STOREFRONT_DEPLOY_TOOL_SCOPES = {
|
|
8228
8316
|
list_deploy_targets: "read",
|
|
8229
8317
|
deploy_storefront: "write",
|
|
@@ -8240,7 +8328,7 @@ function registerStorefrontDeployTools(server2, props2) {
|
|
|
8240
8328
|
title: "List Deploy Targets",
|
|
8241
8329
|
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.",
|
|
8242
8330
|
inputSchema: {
|
|
8243
|
-
dir:
|
|
8331
|
+
dir: z13.string().min(1).describe("Path to the scaffolded storefront directory")
|
|
8244
8332
|
},
|
|
8245
8333
|
annotations: annotationsFor("list_deploy_targets", "read")
|
|
8246
8334
|
},
|
|
@@ -8266,17 +8354,17 @@ function registerStorefrontDeployTools(server2, props2) {
|
|
|
8266
8354
|
title: "Deploy Storefront",
|
|
8267
8355
|
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.",
|
|
8268
8356
|
inputSchema: {
|
|
8269
|
-
dir:
|
|
8270
|
-
target:
|
|
8271
|
-
name:
|
|
8272
|
-
force:
|
|
8357
|
+
dir: z13.string().min(1).describe("Path to the scaffolded storefront directory"),
|
|
8358
|
+
target: z13.enum(TARGET_IDS).optional().describe("Force a host instead of auto-detecting"),
|
|
8359
|
+
name: z13.string().optional().describe("Project/worker name (defaults from brand)"),
|
|
8360
|
+
force: z13.boolean().optional().describe(
|
|
8273
8361
|
'Acknowledge the scaffold-default-name risk: required when the resolved name is the scaffold default "storefront"'
|
|
8274
8362
|
),
|
|
8275
|
-
skip_build:
|
|
8276
|
-
push_secrets:
|
|
8277
|
-
provision_clerk:
|
|
8278
|
-
verify:
|
|
8279
|
-
domain:
|
|
8363
|
+
skip_build: z13.boolean().optional().describe("Deploy the existing build without rebuilding"),
|
|
8364
|
+
push_secrets: z13.boolean().optional().describe("Stage runtime secrets on the host before deploy (default true)"),
|
|
8365
|
+
provision_clerk: z13.boolean().optional().default(true).describe("Provision and configure Clerk automatically (default true)"),
|
|
8366
|
+
verify: z13.boolean().optional().describe("Probe the deployed URL and report whether it actually serves (default true)"),
|
|
8367
|
+
domain: z13.boolean().optional().describe("Route the brand domain to the deployment (Cloudflare provisions DNS + cert)")
|
|
8280
8368
|
},
|
|
8281
8369
|
annotations: annotationsFor("deploy_storefront", "write")
|
|
8282
8370
|
},
|
|
@@ -8396,11 +8484,11 @@ function registerStorefrontDeployTools(server2, props2) {
|
|
|
8396
8484
|
title: "Provision Storefront Clerk App",
|
|
8397
8485
|
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.",
|
|
8398
8486
|
inputSchema: {
|
|
8399
|
-
dir:
|
|
8400
|
-
name:
|
|
8401
|
-
production:
|
|
8402
|
-
no_create:
|
|
8403
|
-
url:
|
|
8487
|
+
dir: z13.string().min(1).describe("Path to the scaffolded storefront directory"),
|
|
8488
|
+
name: z13.string().optional().describe("Clerk application name (defaults from brand)"),
|
|
8489
|
+
production: z13.boolean().optional().describe("Also create a production instance (Platform API only)"),
|
|
8490
|
+
no_create: z13.boolean().optional().describe("Never create a new application; only reuse existing keys"),
|
|
8491
|
+
url: z13.string().optional().describe("Deployed URL to whitelist as origin and redirect")
|
|
8404
8492
|
},
|
|
8405
8493
|
annotations: annotationsFor("provision_storefront_clerk", "write")
|
|
8406
8494
|
},
|
|
@@ -8456,7 +8544,7 @@ function registerStorefrontDeployTools(server2, props2) {
|
|
|
8456
8544
|
}
|
|
8457
8545
|
|
|
8458
8546
|
// src/tools-storefront-plan.ts
|
|
8459
|
-
import { z as
|
|
8547
|
+
import { z as z14 } from "zod";
|
|
8460
8548
|
|
|
8461
8549
|
// src/lib/storefront-plan-update.ts
|
|
8462
8550
|
var STRIPE_PRICE_ID_RE = /^price_[A-Za-z0-9_]+$/;
|
|
@@ -8562,7 +8650,7 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
|
|
|
8562
8650
|
server2.registerTool(name, {
|
|
8563
8651
|
title: name === "list_storefronts" ? "List Storefronts" : "Get Storefront",
|
|
8564
8652
|
description: "Read hosted storefront plans including stored OCS account ids and account_status.",
|
|
8565
|
-
inputSchema: name === "get_storefront" ? { storefront_id:
|
|
8653
|
+
inputSchema: name === "get_storefront" ? { storefront_id: z14.string().min(1) } : {},
|
|
8566
8654
|
annotations: annotationsFor(name, "read")
|
|
8567
8655
|
}, async (args) => {
|
|
8568
8656
|
const denied = denyUnlessScoped(props2, name, STOREFRONT_PLAN_TOOL_SCOPES);
|
|
@@ -8581,14 +8669,14 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
|
|
|
8581
8669
|
title: "Update Storefront Plan",
|
|
8582
8670
|
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.",
|
|
8583
8671
|
inputSchema: {
|
|
8584
|
-
ocs_account_id:
|
|
8585
|
-
storefront_id:
|
|
8586
|
-
slug:
|
|
8587
|
-
price_cents:
|
|
8588
|
-
active:
|
|
8589
|
-
sort_order:
|
|
8590
|
-
stripe_price_id:
|
|
8591
|
-
stripe_price_mode:
|
|
8672
|
+
ocs_account_id: z14.number().int().positive().optional().describe("Owned OCS account override. Omit for automatic resolution."),
|
|
8673
|
+
storefront_id: z14.string().min(1).describe("Id of the hosted storefront"),
|
|
8674
|
+
slug: z14.string().min(1).describe("Plan slug, such as eu-1gb"),
|
|
8675
|
+
price_cents: z14.number().int().positive().optional().describe("Retail price in minor units. Must be greater than zero. Omit to leave the price."),
|
|
8676
|
+
active: z14.boolean().optional().describe("Whether the plan is for sale. Omit to leave it."),
|
|
8677
|
+
sort_order: z14.number().int().nonnegative().optional().describe("Display order, lowest first. Omit to leave it."),
|
|
8678
|
+
stripe_price_id: z14.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."),
|
|
8679
|
+
stripe_price_mode: z14.enum(["test", "live"]).nullable().optional().describe("test or live. Set with stripe_price_id. Null clears both. Omit to leave them.")
|
|
8592
8680
|
},
|
|
8593
8681
|
annotations: annotationsFor("update_storefront_plan", "write")
|
|
8594
8682
|
},
|
|
@@ -8616,7 +8704,7 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
|
|
|
8616
8704
|
}
|
|
8617
8705
|
|
|
8618
8706
|
// src/tools-atlas.ts
|
|
8619
|
-
import { z as
|
|
8707
|
+
import { z as z15 } from "zod";
|
|
8620
8708
|
|
|
8621
8709
|
// src/atlas-public.ts
|
|
8622
8710
|
var ATLAS_PUBLIC_BASE_URL = "https://atlas.carrier.llc";
|
|
@@ -8674,13 +8762,13 @@ var ATLAS_TOOL_SCOPES = {
|
|
|
8674
8762
|
get_atlas_network_status: "read"
|
|
8675
8763
|
};
|
|
8676
8764
|
var coverageSchema = {
|
|
8677
|
-
country:
|
|
8678
|
-
status:
|
|
8679
|
-
technology:
|
|
8765
|
+
country: z15.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"),
|
|
8766
|
+
status: z15.enum(["up", "degraded", "down", "unknown"]).optional().describe("Keep only networks whose latest probe has this status"),
|
|
8767
|
+
technology: z15.enum(["2G", "3G", "4G", "5G"]).optional().describe("Keep only networks of this radio generation")
|
|
8680
8768
|
};
|
|
8681
8769
|
var networkSchema = {
|
|
8682
|
-
mcc:
|
|
8683
|
-
mnc:
|
|
8770
|
+
mcc: z15.string().regex(/^\d{3}$/, "mcc must be 3 digits").describe("Mobile Country Code"),
|
|
8771
|
+
mnc: z15.string().regex(/^\d{2,3}$/, "mnc must be 2 or 3 digits").describe("Mobile Network Code")
|
|
8684
8772
|
};
|
|
8685
8773
|
function jsonResult3(body2) {
|
|
8686
8774
|
return {
|
|
@@ -8735,15 +8823,15 @@ function registerAtlasTools(server2, ctx) {
|
|
|
8735
8823
|
}
|
|
8736
8824
|
|
|
8737
8825
|
// src/tools-network-default.ts
|
|
8738
|
-
import { z as
|
|
8826
|
+
import { z as z16 } from "zod";
|
|
8739
8827
|
var NETWORK_DEFAULT_TOOL_SCOPES = {
|
|
8740
8828
|
get_network_default: "read",
|
|
8741
8829
|
set_network_default: "write",
|
|
8742
8830
|
plan_network_default: "read"
|
|
8743
8831
|
};
|
|
8744
|
-
var choiceShape =
|
|
8745
|
-
mode:
|
|
8746
|
-
steeringListId:
|
|
8832
|
+
var choiceShape = z16.object({
|
|
8833
|
+
mode: z16.enum(NETWORK_DEFAULT_MODES),
|
|
8834
|
+
steeringListId: z16.number().int().positive().optional()
|
|
8747
8835
|
}).describe("`cheapest_available`, `all`, or `custom` with a steeringListId from list_steering_lists");
|
|
8748
8836
|
function ioFor(ctx, token2) {
|
|
8749
8837
|
const kv = ctx.env.CARRIER_USERS;
|
|
@@ -8798,9 +8886,9 @@ function registerNetworkDefaultTools(server2, ctx) {
|
|
|
8798
8886
|
title: "Set Network Default",
|
|
8799
8887
|
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`.",
|
|
8800
8888
|
inputSchema: {
|
|
8801
|
-
mode:
|
|
8802
|
-
steeringListId:
|
|
8803
|
-
dry_run:
|
|
8889
|
+
mode: z16.enum(NETWORK_DEFAULT_MODES).describe("cheapest_available | all | custom"),
|
|
8890
|
+
steeringListId: z16.number().int().positive().optional().describe("Required when mode is custom"),
|
|
8891
|
+
dry_run: z16.boolean().optional().describe("If true, validate and return what would be stored; store nothing")
|
|
8804
8892
|
},
|
|
8805
8893
|
annotations: { readOnlyHint: false, idempotentHint: true, destructiveHint: false }
|
|
8806
8894
|
},
|
|
@@ -8829,10 +8917,10 @@ function registerNetworkDefaultTools(server2, ctx) {
|
|
|
8829
8917
|
title: "Plan Network Default",
|
|
8830
8918
|
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).",
|
|
8831
8919
|
inputSchema: {
|
|
8832
|
-
countries:
|
|
8920
|
+
countries: z16.array(z16.string().length(2)).min(1).describe('ISO-3166 alpha-2 codes, e.g. ["CA"]'),
|
|
8833
8921
|
simOverride: choiceShape.optional(),
|
|
8834
8922
|
packageOverride: choiceShape.optional(),
|
|
8835
|
-
resellerId:
|
|
8923
|
+
resellerId: z16.number().int().positive().optional().describe("Omit to use the token owner's reseller")
|
|
8836
8924
|
},
|
|
8837
8925
|
annotations: { readOnlyHint: true }
|
|
8838
8926
|
},
|
|
@@ -8847,7 +8935,7 @@ function registerNetworkDefaultTools(server2, ctx) {
|
|
|
8847
8935
|
}
|
|
8848
8936
|
|
|
8849
8937
|
// src/affiliate-tools.ts
|
|
8850
|
-
import { z as
|
|
8938
|
+
import { z as z17 } from "zod";
|
|
8851
8939
|
var AFFILIATE_TOOL_SCOPES = {
|
|
8852
8940
|
affiliate_status: "read",
|
|
8853
8941
|
affiliate_commissions: "read",
|
|
@@ -8918,7 +9006,7 @@ function registerAffiliateTools(server2, ctx) {
|
|
|
8918
9006
|
title: "Affiliate Commissions",
|
|
8919
9007
|
description: "Read-only: returns the list of commission records for the authenticated operator.",
|
|
8920
9008
|
inputSchema: {
|
|
8921
|
-
limit:
|
|
9009
|
+
limit: z17.number().int().min(1).max(200).optional().default(50).describe("Maximum number of commission records to return (1-200, default: 50).")
|
|
8922
9010
|
},
|
|
8923
9011
|
annotations: annotationsFor("affiliate_commissions", "read")
|
|
8924
9012
|
},
|
|
@@ -10408,6 +10496,7 @@ var ALL_TOOL_SCOPES = Object.freeze({
|
|
|
10408
10496
|
...UI_AGENT_SCHEDULE_TOOL_SCOPES,
|
|
10409
10497
|
...UI_AGENT_GENERIC_TOOL_SCOPES,
|
|
10410
10498
|
...WALLET_TOOL_SCOPES,
|
|
10499
|
+
...AI_WALLET_TOOL_SCOPES,
|
|
10411
10500
|
...STRIPE_CONNECT_TOOL_SCOPES,
|
|
10412
10501
|
...GREENZONE_TOOL_SCOPES,
|
|
10413
10502
|
...CARRIER_ASK_TOOL_SCOPES,
|
|
@@ -11098,15 +11187,15 @@ function registerAllCarrierAskTools(server2, ctx) {
|
|
|
11098
11187
|
title: "Natural Language Carrier Tool Router",
|
|
11099
11188
|
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.",
|
|
11100
11189
|
inputSchema: {
|
|
11101
|
-
intent:
|
|
11190
|
+
intent: z18.string().min(3).describe(
|
|
11102
11191
|
"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...')"
|
|
11103
11192
|
),
|
|
11104
|
-
context:
|
|
11105
|
-
iccid:
|
|
11106
|
-
account_id:
|
|
11107
|
-
reseller_id:
|
|
11193
|
+
context: z18.object({
|
|
11194
|
+
iccid: z18.string().optional().describe("Subscriber ICCID if already known"),
|
|
11195
|
+
account_id: z18.number().optional().describe("Account ID if already known"),
|
|
11196
|
+
reseller_id: z18.number().optional().describe("Reseller ID if already known")
|
|
11108
11197
|
}).optional().describe("Optional pre-resolved context to improve routing accuracy"),
|
|
11109
|
-
confirm_token:
|
|
11198
|
+
confirm_token: z18.string().optional().describe(
|
|
11110
11199
|
"One-time token from a previous carrier_ask call with confirm_required=true. Providing this executes the previously staged destructive operation."
|
|
11111
11200
|
)
|
|
11112
11201
|
}
|
|
@@ -11310,7 +11399,7 @@ function registerAllCarrierAskTools(server2, ctx) {
|
|
|
11310
11399
|
title: "Describe a Carrier Tool",
|
|
11311
11400
|
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.",
|
|
11312
11401
|
inputSchema: {
|
|
11313
|
-
tool_name:
|
|
11402
|
+
tool_name: z18.string().describe("The exact MCP tool name to describe (e.g. 'assign_package', 'hlr_set_bitrate')")
|
|
11314
11403
|
}
|
|
11315
11404
|
},
|
|
11316
11405
|
wrapHandler(
|
|
@@ -11403,7 +11492,7 @@ function buildExamples(toolName) {
|
|
|
11403
11492
|
}
|
|
11404
11493
|
|
|
11405
11494
|
// src/list-recent-ocs-events.ts
|
|
11406
|
-
import { z as
|
|
11495
|
+
import { z as z19 } from "zod";
|
|
11407
11496
|
|
|
11408
11497
|
// ../../packages/ocs-spec/src/ocs-event-buffer-read.ts
|
|
11409
11498
|
var LIFECYCLE_RESELLER_ID2 = 1170;
|
|
@@ -11532,10 +11621,10 @@ var ALLOWED_EVENT_TYPES = [
|
|
|
11532
11621
|
"usage.anomaly"
|
|
11533
11622
|
];
|
|
11534
11623
|
var listRecentOcsEventsSchema = {
|
|
11535
|
-
iccid:
|
|
11536
|
-
limit:
|
|
11537
|
-
event_types:
|
|
11538
|
-
since:
|
|
11624
|
+
iccid: z19.string().regex(/^\d{19,20}$/).describe("ICCID, 19 or 20 digits, ITU-T E.118 format"),
|
|
11625
|
+
limit: z19.number().int().min(1).max(50).default(20).describe("Max events to return, newest first"),
|
|
11626
|
+
event_types: z19.array(z19.enum(ALLOWED_EVENT_TYPES)).optional().describe("Filter to specific event types"),
|
|
11627
|
+
since: z19.string().datetime().optional().describe("ISO-8601 timestamp; only events after this point")
|
|
11539
11628
|
};
|
|
11540
11629
|
async function listRecentOcsEvents2(iccid, limit, eventTypes, since, kv) {
|
|
11541
11630
|
return listRecentOcsEvents(iccid, limit, eventTypes, since, kv);
|
|
@@ -11598,7 +11687,7 @@ function registerListRecentOcsEventsTool(server2, ctx) {
|
|
|
11598
11687
|
}
|
|
11599
11688
|
|
|
11600
11689
|
// src/tools-rate-governor.ts
|
|
11601
|
-
import { z as
|
|
11690
|
+
import { z as z20 } from "zod";
|
|
11602
11691
|
var MONITORED_ENDPOINTS = [
|
|
11603
11692
|
"subscriberNetworkEventsOverPeriod",
|
|
11604
11693
|
// 30/min
|
|
@@ -11630,7 +11719,7 @@ function registerRateLimitStatusTool(server2, ctx) {
|
|
|
11630
11719
|
title: "API Rate-Limit Governor Status",
|
|
11631
11720
|
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.",
|
|
11632
11721
|
inputSchema: {
|
|
11633
|
-
endpoint:
|
|
11722
|
+
endpoint: z20.string().optional().describe(
|
|
11634
11723
|
"OCS method name in camelCase (e.g. 'subscriberUsageOverPeriod'). Omit to return status for all monitored endpoints."
|
|
11635
11724
|
)
|
|
11636
11725
|
},
|
|
@@ -11686,7 +11775,7 @@ function registerRateLimitStatusTool(server2, ctx) {
|
|
|
11686
11775
|
}
|
|
11687
11776
|
|
|
11688
11777
|
// src/tools-depletion-events.ts
|
|
11689
|
-
import { z as
|
|
11778
|
+
import { z as z21 } from "zod";
|
|
11690
11779
|
function ok6(payload) {
|
|
11691
11780
|
return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
|
|
11692
11781
|
}
|
|
@@ -11714,10 +11803,10 @@ function registerDepletionEventsTool(server2, ctx) {
|
|
|
11714
11803
|
title: "Subscriber Bundle Depletion Events",
|
|
11715
11804
|
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.",
|
|
11716
11805
|
inputSchema: {
|
|
11717
|
-
subscriberId:
|
|
11806
|
+
subscriberId: z21.string().optional().describe(
|
|
11718
11807
|
"OCS subscriber ID to look up. Omit to list the 20 most recent fleet-wide depletions."
|
|
11719
11808
|
),
|
|
11720
|
-
since:
|
|
11809
|
+
since: z21.string().optional().describe(
|
|
11721
11810
|
"ISO-8601 timestamp \u2014 only return events at or after this time (for single-subscriber lookup)."
|
|
11722
11811
|
)
|
|
11723
11812
|
},
|
|
@@ -11832,7 +11921,7 @@ function registerDepletionEventsTool(server2, ctx) {
|
|
|
11832
11921
|
}
|
|
11833
11922
|
|
|
11834
11923
|
// src/tools-country-history.ts
|
|
11835
|
-
import { z as
|
|
11924
|
+
import { z as z22 } from "zod";
|
|
11836
11925
|
function isoDate(now, daysAgo = 0) {
|
|
11837
11926
|
const d = new Date(now.getTime() - daysAgo * 864e5);
|
|
11838
11927
|
return d.toISOString().slice(0, 10);
|
|
@@ -11855,10 +11944,10 @@ function registerCountryHistoryTool(server2, ctx) {
|
|
|
11855
11944
|
title: "Subscriber Country History",
|
|
11856
11945
|
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.",
|
|
11857
11946
|
inputSchema: {
|
|
11858
|
-
subscriberId:
|
|
11859
|
-
startDate:
|
|
11860
|
-
endDate:
|
|
11861
|
-
limit:
|
|
11947
|
+
subscriberId: z22.string().regex(/^\d{19,20}$/, "subscriberId must be a 19\u201320 digit ICCID").describe("Subscriber ICCID (19\u201320 digits, ITU-T E.118)"),
|
|
11948
|
+
startDate: z22.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)"),
|
|
11949
|
+
endDate: z22.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)"),
|
|
11950
|
+
limit: z22.number().int().min(1).max(50).default(20).optional().describe("Maximum number of country_events to return, newest first (default 20, max 50)")
|
|
11862
11951
|
},
|
|
11863
11952
|
annotations: { readOnlyHint: true, idempotentHint: true }
|
|
11864
11953
|
},
|
|
@@ -11966,7 +12055,7 @@ function registerCountryHistoryTool(server2, ctx) {
|
|
|
11966
12055
|
}
|
|
11967
12056
|
|
|
11968
12057
|
// src/apps/fleet-health-app.ts
|
|
11969
|
-
import { z as
|
|
12058
|
+
import { z as z23 } from "zod";
|
|
11970
12059
|
import {
|
|
11971
12060
|
registerAppTool,
|
|
11972
12061
|
registerAppResource,
|
|
@@ -12082,7 +12171,7 @@ function registerFleetHealthApp(server2, ctx) {
|
|
|
12082
12171
|
title: "Fleet Health Dashboard",
|
|
12083
12172
|
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.",
|
|
12084
12173
|
inputSchema: {
|
|
12085
|
-
accountId:
|
|
12174
|
+
accountId: z23.number().optional().describe("Filter to a specific account (omit for all)")
|
|
12086
12175
|
},
|
|
12087
12176
|
annotations: { readOnlyHint: true },
|
|
12088
12177
|
_meta: {
|
|
@@ -12125,7 +12214,7 @@ function registerFleetHealthApp(server2, ctx) {
|
|
|
12125
12214
|
}
|
|
12126
12215
|
|
|
12127
12216
|
// src/apps/provisioning-wizard.ts
|
|
12128
|
-
import { z as
|
|
12217
|
+
import { z as z24 } from "zod";
|
|
12129
12218
|
import {
|
|
12130
12219
|
registerAppTool as registerAppTool2,
|
|
12131
12220
|
registerAppResource as registerAppResource2,
|
|
@@ -12230,10 +12319,10 @@ function registerProvisioningWizard(server2, ctx) {
|
|
|
12230
12319
|
title: "eSIM Provisioning Wizard",
|
|
12231
12320
|
description: "Interactive 3-step wizard to provision an eSIM: select subscriber, choose package template, preview (dry_run) and confirm execution.",
|
|
12232
12321
|
inputSchema: {
|
|
12233
|
-
step:
|
|
12234
|
-
wizardId:
|
|
12235
|
-
subscriber_iccid:
|
|
12236
|
-
package_template_id:
|
|
12322
|
+
step: z24.enum(["init", "select-package", "preview", "confirm"]).describe("Current wizard step"),
|
|
12323
|
+
wizardId: z24.string().optional().describe("Wizard session ID (absent on init)"),
|
|
12324
|
+
subscriber_iccid: z24.string().optional().describe("Subscriber ICCID (required for select-package)"),
|
|
12325
|
+
package_template_id: z24.number().optional().describe("Package template ID (required for preview)")
|
|
12237
12326
|
},
|
|
12238
12327
|
_meta: {
|
|
12239
12328
|
ui: {
|
|
@@ -12503,7 +12592,7 @@ function registerProvisioningWizard(server2, ctx) {
|
|
|
12503
12592
|
}
|
|
12504
12593
|
|
|
12505
12594
|
// src/apps/balance-topup.ts
|
|
12506
|
-
import { z as
|
|
12595
|
+
import { z as z25 } from "zod";
|
|
12507
12596
|
import {
|
|
12508
12597
|
registerAppTool as registerAppTool3,
|
|
12509
12598
|
registerAppResource as registerAppResource3,
|
|
@@ -12556,9 +12645,9 @@ function registerBalanceTopupApp(server2, ctx) {
|
|
|
12556
12645
|
title: "Balance Top-up Form",
|
|
12557
12646
|
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`.",
|
|
12558
12647
|
inputSchema: {
|
|
12559
|
-
iccid:
|
|
12560
|
-
delta:
|
|
12561
|
-
preview:
|
|
12648
|
+
iccid: z25.string().describe("The subscriber ICCID for the account lookup"),
|
|
12649
|
+
delta: z25.number().describe("Amount to add (positive) or deduct (negative) from the account balance"),
|
|
12650
|
+
preview: z25.boolean().default(true).describe("If true, return preview without writing. If false, execute the balance change.")
|
|
12562
12651
|
},
|
|
12563
12652
|
annotations: { destructiveHint: true },
|
|
12564
12653
|
_meta: {
|
|
@@ -12641,7 +12730,7 @@ function registerAllApps(server2, ctx) {
|
|
|
12641
12730
|
}
|
|
12642
12731
|
|
|
12643
12732
|
// src/prompts.ts
|
|
12644
|
-
import { z as
|
|
12733
|
+
import { z as z26 } from "zod";
|
|
12645
12734
|
function registerAllPrompts(server2) {
|
|
12646
12735
|
server2.registerPrompt(
|
|
12647
12736
|
"fleet_health_report",
|
|
@@ -12677,7 +12766,7 @@ Format as a structured report with sections, tables, and actionable recommendati
|
|
|
12677
12766
|
{
|
|
12678
12767
|
title: "Subscriber Deep Dive",
|
|
12679
12768
|
description: "Comprehensive analysis of a single subscriber: profile, packages, usage patterns, location history, recommendations.",
|
|
12680
|
-
argsSchema: { iccid:
|
|
12769
|
+
argsSchema: { iccid: z26.string().describe("The subscriber ICCID to analyse") }
|
|
12681
12770
|
},
|
|
12682
12771
|
async ({ iccid }) => ({
|
|
12683
12772
|
messages: [
|
|
@@ -12776,7 +12865,7 @@ Analyze and present:
|
|
|
12776
12865
|
{
|
|
12777
12866
|
title: "Bulk Operations Planner",
|
|
12778
12867
|
description: "Plan bulk operations safely: mass package assignments, account migrations, balance adjustments, or status changes.",
|
|
12779
|
-
argsSchema: { operation:
|
|
12868
|
+
argsSchema: { operation: z26.string().describe("Describe the bulk operation you want to perform") }
|
|
12780
12869
|
},
|
|
12781
12870
|
async ({ operation }) => ({
|
|
12782
12871
|
messages: [
|
|
@@ -12809,7 +12898,7 @@ NEVER execute destructive operations without confirmation.`
|
|
|
12809
12898
|
}
|
|
12810
12899
|
|
|
12811
12900
|
// src/tools-pricing.ts
|
|
12812
|
-
import { z as
|
|
12901
|
+
import { z as z27 } from "zod";
|
|
12813
12902
|
function registerAllPricingTools(server2, ctx) {
|
|
12814
12903
|
const allTools = [...PRICING_TOOLS, ...PROJECTS_TOOLS];
|
|
12815
12904
|
for (const tool of allTools) {
|
|
@@ -12916,19 +13005,19 @@ function buildZodSchema(schema) {
|
|
|
12916
13005
|
for (const [key, prop] of Object.entries(properties)) {
|
|
12917
13006
|
let field;
|
|
12918
13007
|
if (prop.enum) {
|
|
12919
|
-
field =
|
|
13008
|
+
field = z27.enum(prop.enum);
|
|
12920
13009
|
} else if (prop.type === "number") {
|
|
12921
|
-
field =
|
|
13010
|
+
field = z27.number();
|
|
12922
13011
|
} else if (prop.type === "boolean") {
|
|
12923
|
-
field =
|
|
13012
|
+
field = z27.boolean();
|
|
12924
13013
|
} else if (prop.type === "array") {
|
|
12925
13014
|
if (prop.items?.type === "number") {
|
|
12926
|
-
field =
|
|
13015
|
+
field = z27.array(z27.number());
|
|
12927
13016
|
} else {
|
|
12928
|
-
field =
|
|
13017
|
+
field = z27.array(z27.string());
|
|
12929
13018
|
}
|
|
12930
13019
|
} else {
|
|
12931
|
-
field =
|
|
13020
|
+
field = z27.string();
|
|
12932
13021
|
}
|
|
12933
13022
|
const required = schema.required ?? [];
|
|
12934
13023
|
if (!required.includes(key)) {
|
|
@@ -12943,7 +13032,7 @@ function buildZodSchema(schema) {
|
|
|
12943
13032
|
}
|
|
12944
13033
|
|
|
12945
13034
|
// src/tools-greenzone.ts
|
|
12946
|
-
import { z as
|
|
13035
|
+
import { z as z28 } from "zod";
|
|
12947
13036
|
|
|
12948
13037
|
// src/greenzone-whitelist.ts
|
|
12949
13038
|
var STATE_KEY = "greenzone:state";
|
|
@@ -13234,9 +13323,9 @@ function registerGreenzoneTools(server2, ctx) {
|
|
|
13234
13323
|
title: "Greenzone Whitelist \u2014 Add",
|
|
13235
13324
|
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.",
|
|
13236
13325
|
inputSchema: {
|
|
13237
|
-
host:
|
|
13238
|
-
ip:
|
|
13239
|
-
dry_run:
|
|
13326
|
+
host: z28.string().optional().describe("Hostname to whitelist (e.g. 'example.com')"),
|
|
13327
|
+
ip: z28.string().optional().describe("IP address or CIDR to whitelist (e.g. '203.0.113.0/24')"),
|
|
13328
|
+
dry_run: z28.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
|
|
13240
13329
|
},
|
|
13241
13330
|
annotations: { destructiveHint: true }
|
|
13242
13331
|
},
|
|
@@ -13295,9 +13384,9 @@ function registerGreenzoneTools(server2, ctx) {
|
|
|
13295
13384
|
title: "Greenzone Whitelist \u2014 Remove",
|
|
13296
13385
|
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.",
|
|
13297
13386
|
inputSchema: {
|
|
13298
|
-
host:
|
|
13299
|
-
ip:
|
|
13300
|
-
dry_run:
|
|
13387
|
+
host: z28.string().optional().describe("Hostname to remove from whitelist"),
|
|
13388
|
+
ip: z28.string().optional().describe("IP address or CIDR to remove from whitelist"),
|
|
13389
|
+
dry_run: z28.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
|
|
13301
13390
|
},
|
|
13302
13391
|
annotations: { destructiveHint: true }
|
|
13303
13392
|
},
|
|
@@ -13356,7 +13445,7 @@ function registerGreenzoneTools(server2, ctx) {
|
|
|
13356
13445
|
title: "Greenzone Whitelist \u2014 List",
|
|
13357
13446
|
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.",
|
|
13358
13447
|
inputSchema: {
|
|
13359
|
-
from_portal:
|
|
13448
|
+
from_portal: z28.boolean().optional().describe(
|
|
13360
13449
|
"When true, return Kapture steps to read live portal state instead of KV cache"
|
|
13361
13450
|
)
|
|
13362
13451
|
},
|
|
@@ -13408,7 +13497,7 @@ function registerGreenzoneTools(server2, ctx) {
|
|
|
13408
13497
|
}
|
|
13409
13498
|
|
|
13410
13499
|
// src/tools-ui-agent-generic.ts
|
|
13411
|
-
import { z as
|
|
13500
|
+
import { z as z29 } from "zod";
|
|
13412
13501
|
var COST_PER_STEP_USD = 0.014;
|
|
13413
13502
|
var SESSION_OVERHEAD_USD = 5e-3;
|
|
13414
13503
|
function estimateCostUsd2(steps) {
|
|
@@ -13450,13 +13539,13 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
|
|
|
13450
13539
|
title: "Dispatch Generic Browsing Agent",
|
|
13451
13540
|
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.",
|
|
13452
13541
|
inputSchema: {
|
|
13453
|
-
prompt:
|
|
13542
|
+
prompt: z29.string().min(1).max(4e3).describe(
|
|
13454
13543
|
"Natural-language task description for the browsing agent. Be specific: include target URLs, data to extract, or actions to perform."
|
|
13455
13544
|
),
|
|
13456
|
-
max_steps:
|
|
13545
|
+
max_steps: z29.number().int().min(1).max(30).optional().describe(
|
|
13457
13546
|
"Advisory step budget (1\u201330, default 15). Prices the dry-run estimate; the hosted agent sets its own depth."
|
|
13458
13547
|
),
|
|
13459
|
-
dry_run:
|
|
13548
|
+
dry_run: z29.boolean().optional().describe(
|
|
13460
13549
|
"Preview cost estimate without dispatching. Returns estimated_cost_usd only \u2014 no browser session is created."
|
|
13461
13550
|
)
|
|
13462
13551
|
}
|
|
@@ -13593,7 +13682,7 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
|
|
|
13593
13682
|
title: "Poll Browsing Agent Task Status",
|
|
13594
13683
|
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.",
|
|
13595
13684
|
inputSchema: {
|
|
13596
|
-
task_id:
|
|
13685
|
+
task_id: z29.string().describe("Task ID returned by ui_agent_ask")
|
|
13597
13686
|
}
|
|
13598
13687
|
},
|
|
13599
13688
|
async (args) => {
|
|
@@ -13646,6 +13735,7 @@ if (!token && !process.env.CARRIER_API_TOKEN) {
|
|
|
13646
13735
|
var stdioEnv = {
|
|
13647
13736
|
CARRIER_API_TOKEN: process.env.CARRIER_API_TOKEN,
|
|
13648
13737
|
CARRIER_AI_CREDITS_ENABLED: process.env.CARRIER_AI_CREDITS_ENABLED,
|
|
13738
|
+
CARRIER_AI_AUTO_TOPUP_ENABLED: process.env.CARRIER_AI_AUTO_TOPUP_ENABLED,
|
|
13649
13739
|
AI_CREDIT_PRICING_JSON: process.env.AI_CREDIT_PRICING_JSON,
|
|
13650
13740
|
CARRIER_API_BASE_URL: process.env.CARRIER_API_BASE_URL ?? "https://api.carrier.llc",
|
|
13651
13741
|
CARRIER_OCS_BASE_URL: baseUrl,
|
|
@@ -13755,6 +13845,7 @@ registerStripeConnectTools(server, { env: stdioEnv, props });
|
|
|
13755
13845
|
registerAffiliateTools(server, { env: stdioEnv, props });
|
|
13756
13846
|
registerCarrierApiTools(server, toolCtx);
|
|
13757
13847
|
registerWalletTools(server, { env: stdioEnv, props });
|
|
13848
|
+
registerAiWalletTools(server, { env: stdioEnv, props });
|
|
13758
13849
|
registerGreenzoneTools(server, toolCtx);
|
|
13759
13850
|
registerUiAgentGenericTools(server, toolCtx, uiAgentRuntime);
|
|
13760
13851
|
registerStorefrontLogoTools(
|