@carrierllc/mcp 0.13.34 → 0.13.35

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
@@ -80,7 +80,7 @@ import {
80
80
  verifyStorefront,
81
81
  withOcsListSummary,
82
82
  withTemplateResellerId
83
- } from "./chunk-DCZ77IHR.js";
83
+ } from "./chunk-EH3ZRLVZ.js";
84
84
  import "./chunk-SHKKVIIA.js";
85
85
 
86
86
  // src/index.ts
@@ -1304,12 +1304,19 @@ function wrapHandler(toolName, ocsMethod, requiredScope, ctx, handler, options)
1304
1304
  content: [{ type: "text", text: `Error: ${message}` }]
1305
1305
  };
1306
1306
  }
1307
+ const handledOcsCode = result2.ocsStatusCode;
1308
+ if (handledOcsCode !== void 0) {
1309
+ const { ocsStatusCode: _auditOnly, ...clientResult } = result2;
1310
+ void _auditOnly;
1311
+ result2 = clientResult;
1312
+ }
1307
1313
  ctx.audit({
1308
1314
  tool_name: toolName,
1309
1315
  ocs_method: ocsMethod,
1310
1316
  status: result2.isError ? "error" : "ok",
1311
1317
  dry_run: isDryRun,
1312
- duration_ms: Date.now() - start
1318
+ duration_ms: Date.now() - start,
1319
+ ...handledOcsCode !== void 0 ? { ocs_status_code: handledOcsCode } : {}
1313
1320
  });
1314
1321
  if (!result2.isError && !isDryRun) {
1315
1322
  recordUsage(ctx.env, ctx.props.sub, ctx.props.tier);
@@ -5041,7 +5048,25 @@ function registerAllBacklogTools(server2, ctx) {
5041
5048
  ctx,
5042
5049
  async ({ voip_plan_id }, token2) => {
5043
5050
  const client2 = new OcsClient(ctx.env.CARRIER_OCS_BASE_URL, token2);
5044
- const result2 = await client2.call("listVoipTariffRule", voip_plan_id);
5051
+ let result2;
5052
+ try {
5053
+ result2 = await client2.call("listVoipTariffRule", voip_plan_id);
5054
+ } catch (err9) {
5055
+ if (err9 instanceof OcsApiError && err9.code === 11) {
5056
+ return {
5057
+ isError: true,
5058
+ // Returned, not thrown, so pass the code to wrapHandler's audit row.
5059
+ ocsStatusCode: 11,
5060
+ content: [
5061
+ {
5062
+ type: "text",
5063
+ text: `No VoIP tariff rules readable for VoIP plan ${voip_plan_id} under this reseller (OCS error 11: Reseller not found). OCS returns this when the plan is not owned by your reseller, for example the get_reseller_info chargingInfo.voipPlan id, which is the plan your parent reseller bills you on. Use a plan id from list_subscriber_voip_tariff; if that returns no rows, this reseller has no VoIP catalog configured.`
5064
+ }
5065
+ ]
5066
+ };
5067
+ }
5068
+ throw err9;
5069
+ }
5045
5070
  return {
5046
5071
  content: [{ type: "text", text: JSON.stringify(result2, null, 2) }]
5047
5072
  };