@carrierllc/mcp 0.13.12 → 0.13.13

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
@@ -63,6 +63,7 @@ import {
63
63
  recurringPackageParams,
64
64
  renderHtml,
65
65
  repairPlanFor,
66
+ scopeListSubscriberParams,
66
67
  staleActivePackages,
67
68
  storefrontClerkUrls,
68
69
  subscriberIdParams,
@@ -73,7 +74,7 @@ import {
73
74
  verifyStorefront,
74
75
  withOcsListSummary,
75
76
  withTemplateResellerId
76
- } from "./chunk-IQDAU7WA.js";
77
+ } from "./chunk-OJITGTFO.js";
77
78
  import "./chunk-SHKKVIIA.js";
78
79
 
79
80
  // src/index.ts
@@ -1512,7 +1513,7 @@ function registerAllTools(server2, ctx) {
1512
1513
  "list_subscribers",
1513
1514
  {
1514
1515
  title: "List Subscribers",
1515
- description: "Use this to list subscribers with optional filters and pagination. Good for fleet enumeration, bulk status checks, and finding subscribers by account or status. OCS REQUIRES at least one search key \u2014 provide exactly one of: `imsi`, `iccid`, `activationCode`, `accountId`, or `msisdn`. Calling with no key will be rejected before reaching OCS. Params: `imsi` (string), `iccid` (string), `activationCode` (string), `accountId` (integer), `msisdn` (string), `status` (string, e.g. 'ACTIVE'/'SUSPENDED'), `offset` (integer, pagination \u2014 default 0), `limit` (integer, max results \u2014 always set to avoid unbounded fetches; recommended max 100 per call). Returns: `{ summary, subscriberList: [...] }` \u2014 subscriber summary records with ICCID, status and account, behind a server-counted `summary.total` (rows returned) and `summary.breakdown.status`. Answer 'how many' from `summary`, not by counting rows \u2014 but when `summary.moreAvailable` is set this is one page, so report `summary.upstreamTotal` for the fleet-wide figure, never `total`. Do NOT use this to fetch full details for a specific subscriber \u2014 use `get_subscriber` for that.",
1516
+ description: "Use this to list subscribers with optional filters and pagination. Good for fleet enumeration, bulk status checks, and finding subscribers by account or status. OCS needs a search key: `imsi`, `iccid`, `activationCode`, `accountId` or `msisdn`. With none, Carrier scopes the call to this organization's default account (its preferred_account_id, else the lowest-id account under its reseller) and says so in `default_account`. If no account can be found the call fails with an error \u2014 it never returns an empty list. Params: `imsi` (string), `iccid` (string), `activationCode` (string), `accountId` (integer), `msisdn` (string), `status` (string, e.g. 'ACTIVE'/'SUSPENDED'), `offset` (integer, pagination \u2014 default 0), `limit` (integer, max results \u2014 always set to avoid unbounded fetches; recommended max 100 per call). Returns: `{ summary, subscriberList: [...] }` \u2014 subscriber summary records with ICCID, status and account, behind a server-counted `summary.total` (rows returned) and `summary.breakdown.status`. Answer 'how many' from `summary`, not by counting rows \u2014 but when `summary.moreAvailable` is set this is one page, so report `summary.upstreamTotal` for the fleet-wide figure, never `total`. Do NOT use this to fetch full details for a specific subscriber \u2014 use `get_subscriber` for that.",
1516
1517
  inputSchema: z.object({
1517
1518
  imsi: z.string().optional().describe("Filter by IMSI"),
1518
1519
  iccid: z.string().optional().describe("Filter by ICCID"),
@@ -1522,12 +1523,7 @@ function registerAllTools(server2, ctx) {
1522
1523
  status: z.string().optional().describe("Filter by status"),
1523
1524
  offset: z.number().optional().describe("Pagination offset"),
1524
1525
  limit: z.number().optional().describe("Max results to return")
1525
- }).refine(
1526
- (d) => d.imsi !== void 0 || d.iccid !== void 0 || d.activationCode !== void 0 || d.accountId !== void 0 || d.msisdn !== void 0,
1527
- {
1528
- message: "Provide at least one of: imsi, iccid, activationCode, accountId, msisdn"
1529
- }
1530
- ),
1526
+ }),
1531
1527
  annotations: { readOnlyHint: true }
1532
1528
  },
1533
1529
  wrapHandler(
@@ -1538,13 +1534,25 @@ function registerAllTools(server2, ctx) {
1538
1534
  async (args, token2) => {
1539
1535
  const params = buildListSubscriberParams(args);
1540
1536
  const client2 = new OcsClient(ctx.env.CARRIER_OCS_BASE_URL, token2);
1541
- const raw = await client2.call("listSubscriber", params);
1537
+ const scope = await scopeListSubscriberParams({
1538
+ params,
1539
+ ...ctx.managedAuth.managed ? { managed: true } : {},
1540
+ ...ctx.managedAuth.preferredAccountId ? { preferredAccountId: ctx.managedAuth.preferredAccountId } : {},
1541
+ call: (method, callParams) => client2.call(method, callParams)
1542
+ });
1543
+ if (!scope.ok) throw new Error(scope.message);
1544
+ const raw = await client2.call("listSubscriber", scope.params);
1542
1545
  const payload = applySubscriberFilters(raw, args);
1546
+ const summarised = withOcsListSummary(payload, "subscribers");
1543
1547
  return {
1544
1548
  content: [
1545
1549
  {
1546
1550
  type: "text",
1547
- text: JSON.stringify(withOcsListSummary(payload, "subscribers"), null, 2)
1551
+ text: JSON.stringify(
1552
+ scope.defaultAccount ? { ...summarised, default_account: scope.defaultAccount } : summarised,
1553
+ null,
1554
+ 2
1555
+ )
1548
1556
  }
1549
1557
  ]
1550
1558
  };