@topolo/mcp 0.9.11 → 0.10.1

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/http.js CHANGED
@@ -3098,9 +3098,9 @@ var require_data = __commonJS({
3098
3098
  }
3099
3099
  });
3100
3100
 
3101
- // ../../node_modules/.pnpm/fast-uri@3.1.4/node_modules/fast-uri/lib/utils.js
3101
+ // ../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/utils.js
3102
3102
  var require_utils = __commonJS({
3103
- "../../node_modules/.pnpm/fast-uri@3.1.4/node_modules/fast-uri/lib/utils.js"(exports, module) {
3103
+ "../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/utils.js"(exports, module) {
3104
3104
  "use strict";
3105
3105
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3106
3106
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
@@ -3411,9 +3411,9 @@ var require_utils = __commonJS({
3411
3411
  }
3412
3412
  });
3413
3413
 
3414
- // ../../node_modules/.pnpm/fast-uri@3.1.4/node_modules/fast-uri/lib/schemes.js
3414
+ // ../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/schemes.js
3415
3415
  var require_schemes = __commonJS({
3416
- "../../node_modules/.pnpm/fast-uri@3.1.4/node_modules/fast-uri/lib/schemes.js"(exports, module) {
3416
+ "../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/schemes.js"(exports, module) {
3417
3417
  "use strict";
3418
3418
  var { isUUID } = require_utils();
3419
3419
  var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
@@ -3621,9 +3621,9 @@ var require_schemes = __commonJS({
3621
3621
  }
3622
3622
  });
3623
3623
 
3624
- // ../../node_modules/.pnpm/fast-uri@3.1.4/node_modules/fast-uri/index.js
3624
+ // ../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/index.js
3625
3625
  var require_fast_uri = __commonJS({
3626
- "../../node_modules/.pnpm/fast-uri@3.1.4/node_modules/fast-uri/index.js"(exports, module) {
3626
+ "../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/index.js"(exports, module) {
3627
3627
  "use strict";
3628
3628
  var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3629
3629
  var { SCHEMES, getSchemeHandler } = require_schemes();
@@ -3639,7 +3639,12 @@ var require_fast_uri = __commonJS({
3639
3639
  }
3640
3640
  function resolve(baseURI, relativeURI, options) {
3641
3641
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3642
- const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
3642
+ const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
3643
+ const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
3644
+ if (baseMalformed || relativeMalformed) {
3645
+ throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
3646
+ }
3647
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
3643
3648
  schemelessOptions.skipEscape = true;
3644
3649
  return serialize(resolved, schemelessOptions);
3645
3650
  }
@@ -3765,6 +3770,7 @@ var require_fast_uri = __commonJS({
3765
3770
  }
3766
3771
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
3767
3772
  var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
3773
+ var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
3768
3774
  function getParseError(parsed, matches) {
3769
3775
  if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
3770
3776
  return 'URI path must start with "/" when authority is present.';
@@ -3799,6 +3805,20 @@ var require_fast_uri = __commonJS({
3799
3805
  parsed.error = "URI authority must not contain a literal backslash.";
3800
3806
  malformedAuthorityOrPort = true;
3801
3807
  }
3808
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
3809
+ if (introducerMatch !== null) {
3810
+ const region = introducerMatch[1];
3811
+ const normalizedRegion = region.replace(/[\t\n\r]/g, "");
3812
+ if (normalizedRegion.length >= 2) {
3813
+ if (normalizedRegion.slice(0, 2) !== "//") {
3814
+ parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
3815
+ malformedAuthorityOrPort = true;
3816
+ } else if (region.length !== normalizedRegion.length) {
3817
+ parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
3818
+ malformedAuthorityOrPort = true;
3819
+ }
3820
+ }
3821
+ }
3802
3822
  const matches = uri.match(URI_PARSE);
3803
3823
  if (matches) {
3804
3824
  parsed.scheme = matches[1];
@@ -15830,11 +15850,16 @@ import { TopoloAuthError, TopoloHttpError, TopoloPermissionError } from "@topolo
15830
15850
  import {
15831
15851
  APPLICATION_REQUIREMENTS,
15832
15852
  APPLICATION_REQUIREMENTS_VERSION,
15833
- APPLICATIONS,
15834
- DEFAULT_APP_URLS,
15835
- auditAllApplicationRequirements,
15853
+ auditApplicationEntries,
15836
15854
  applicationRequirementScopes,
15855
+ compactActionCatalogEntry,
15856
+ compactActionPlan,
15857
+ compactActionValidation,
15858
+ compactApplicationAudit,
15859
+ friendlyAppId,
15860
+ listApplicationDirectory,
15837
15861
  requirementsForApplication,
15862
+ resolveApplicationDirectoryEntry,
15838
15863
  resolveCatalogServiceUrl
15839
15864
  } from "@topolo/sdk";
15840
15865
 
@@ -15876,7 +15901,6 @@ function splitService(servicePart) {
15876
15901
  }
15877
15902
 
15878
15903
  // src/tools.ts
15879
- var APPLICATION_IDS = Object.keys(APPLICATIONS).sort();
15880
15904
  var HTTP_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
15881
15905
  function requiredString(args, name) {
15882
15906
  const value = typeof args[name] === "string" ? args[name].trim() : "";
@@ -15892,6 +15916,20 @@ function optionalResourceContext(args) {
15892
15916
  }
15893
15917
  return { resourceType, resourceId };
15894
15918
  }
15919
+ function coerceObjectParam(value, name) {
15920
+ let candidate = value;
15921
+ if (typeof candidate === "string" && candidate.trim().startsWith("{")) {
15922
+ try {
15923
+ candidate = JSON.parse(candidate);
15924
+ } catch {
15925
+ }
15926
+ }
15927
+ if (candidate === void 0) return {};
15928
+ if (!candidate || typeof candidate !== "object" || Array.isArray(candidate)) {
15929
+ throw new TopoloMcpPublicError(`${name} must be an object.`);
15930
+ }
15931
+ return candidate;
15932
+ }
15895
15933
  var TOOLS = [
15896
15934
  {
15897
15935
  name: "topolo_whoami",
@@ -15917,7 +15955,8 @@ var TOOLS = [
15917
15955
  properties: {
15918
15956
  query: { type: "string" },
15919
15957
  cursor: { type: "string" },
15920
- limit: { type: "integer", minimum: 1, maximum: 100, default: 25 }
15958
+ limit: { type: "integer", minimum: 1, maximum: 100, default: 25 },
15959
+ detail: { type: "boolean", description: "Return full schemas and agent contracts. Defaults to compact action guidance." }
15921
15960
  },
15922
15961
  additionalProperties: false
15923
15962
  },
@@ -15971,12 +16010,13 @@ var TOOLS = [
15971
16010
  handler: async (topolo, args) => {
15972
16011
  const service = typeof args["service"] === "string" ? args["service"].trim() : "";
15973
16012
  if (!service) throw new TopoloMcpPublicError("service is required for bounded action discovery.");
15974
- return topolo.client.searchActions({
16013
+ const result = await topolo.client.searchActions({
15975
16014
  service,
15976
16015
  query: typeof args["query"] === "string" ? args["query"] : void 0,
15977
16016
  cursor: typeof args["cursor"] === "string" ? args["cursor"] : void 0,
15978
16017
  limit: typeof args["limit"] === "number" ? args["limit"] : void 0
15979
16018
  });
16019
+ return args["detail"] === true ? result : { actions: result.actions.map(compactActionCatalogEntry), page: result.page };
15980
16020
  }
15981
16021
  },
15982
16022
  {
@@ -16042,14 +16082,11 @@ var TOOLS = [
16042
16082
  handler: async (topolo, args) => {
16043
16083
  const actionId = typeof args["actionId"] === "string" ? args["actionId"].trim() : "";
16044
16084
  if (!actionId) throw new TopoloMcpPublicError("actionId is required.");
16045
- const input = args["input"];
16046
- if (input !== void 0 && (!input || typeof input !== "object" || Array.isArray(input))) {
16047
- throw new TopoloMcpPublicError("input must be an object.");
16048
- }
16085
+ const input = coerceObjectParam(args["input"], "input");
16049
16086
  const resource = optionalResourceContext(args);
16050
16087
  return topolo.client.readAction(
16051
16088
  actionId,
16052
- input ?? {},
16089
+ input,
16053
16090
  resource ? { resource } : {}
16054
16091
  );
16055
16092
  }
@@ -16075,14 +16112,11 @@ var TOOLS = [
16075
16112
  handler: async (topolo, args) => {
16076
16113
  const actionId = typeof args["actionId"] === "string" ? args["actionId"].trim() : "";
16077
16114
  if (!actionId) throw new TopoloMcpPublicError("actionId is required.");
16078
- const input = args["input"];
16079
- if (input !== void 0 && (!input || typeof input !== "object" || Array.isArray(input))) {
16080
- throw new TopoloMcpPublicError("input must be an object.");
16081
- }
16115
+ const input = coerceObjectParam(args["input"], "input");
16082
16116
  const resource = optionalResourceContext(args);
16083
16117
  return topolo.client.callAction(
16084
16118
  actionId,
16085
- input ?? {},
16119
+ input,
16086
16120
  {
16087
16121
  confirm: args["confirm"] === true,
16088
16122
  ...resource ? { resource } : {}
@@ -16121,23 +16155,17 @@ var TOOLS = [
16121
16155
  if (!isCanonicalBase64(contentBase64)) throw new TopoloMcpPublicError("contentBase64 must be canonical base64.");
16122
16156
  if (!contentType) throw new TopoloMcpPublicError("contentType is required.");
16123
16157
  if (!fileName) throw new TopoloMcpPublicError("fileName is required.");
16124
- const input = args["input"];
16125
- if (input !== void 0 && (!input || typeof input !== "object" || Array.isArray(input))) {
16126
- throw new TopoloMcpPublicError("input must be an object.");
16127
- }
16128
- const completionInput = args["completionInput"];
16129
- if (completionInput !== void 0 && (!completionInput || typeof completionInput !== "object" || Array.isArray(completionInput))) {
16130
- throw new TopoloMcpPublicError("completionInput must be an object.");
16131
- }
16158
+ const input = coerceObjectParam(args["input"], "input");
16159
+ const completionInput = coerceObjectParam(args["completionInput"], "completionInput");
16132
16160
  const resource = optionalResourceContext(args);
16133
16161
  return topolo.client.uploadActionBase64(
16134
16162
  actionId,
16135
16163
  contentBase64,
16136
- input ?? {},
16164
+ input,
16137
16165
  {
16138
16166
  fileName,
16139
16167
  contentType,
16140
- completionInput: completionInput ?? {},
16168
+ completionInput,
16141
16169
  confirm: args["confirm"] === true,
16142
16170
  ...resource ? { resource } : {}
16143
16171
  }
@@ -16154,7 +16182,8 @@ var TOOLS = [
16154
16182
  type: "object",
16155
16183
  properties: {
16156
16184
  actionId: { type: "string", minLength: 1 },
16157
- input: { type: "object", additionalProperties: true }
16185
+ input: { type: "object", additionalProperties: true },
16186
+ detail: { type: "boolean", description: "Include the full action contract. Defaults to a compact validation result." }
16158
16187
  },
16159
16188
  required: ["actionId"],
16160
16189
  additionalProperties: false
@@ -16162,11 +16191,9 @@ var TOOLS = [
16162
16191
  handler: async (topolo, args) => {
16163
16192
  const actionId = typeof args["actionId"] === "string" ? args["actionId"].trim() : "";
16164
16193
  if (!actionId) throw new TopoloMcpPublicError("actionId is required.");
16165
- const input = args["input"];
16166
- if (input !== void 0 && (!input || typeof input !== "object" || Array.isArray(input))) {
16167
- throw new TopoloMcpPublicError("input must be an object.");
16168
- }
16169
- return topolo.client.validateActionInput(actionId, input ?? {});
16194
+ const input = coerceObjectParam(args["input"], "input");
16195
+ const result = await topolo.client.validateActionInput(actionId, input);
16196
+ return args["detail"] === true ? result : compactActionValidation(result.action.actionId, result.validation);
16170
16197
  }
16171
16198
  },
16172
16199
  {
@@ -16182,7 +16209,8 @@ var TOOLS = [
16182
16209
  input: { type: "object", additionalProperties: true },
16183
16210
  resourceType: { type: "string", description: "Optional resource-scoping alias published in the app resource catalog (e.g. workspace, brand, merchant)." },
16184
16211
  resourceId: { type: "string", description: "Resource id. Required when resourceType is provided." },
16185
- confirm: { type: "boolean", description: "Include confirmation in the plan without executing the action." }
16212
+ confirm: { type: "boolean", description: "Include confirmation in the plan without executing the action." },
16213
+ detail: { type: "boolean", description: "Include the full action contract. Defaults to the executable request and verification plan." }
16186
16214
  },
16187
16215
  required: ["actionId"],
16188
16216
  additionalProperties: false
@@ -16190,19 +16218,17 @@ var TOOLS = [
16190
16218
  handler: async (topolo, args) => {
16191
16219
  const actionId = typeof args["actionId"] === "string" ? args["actionId"].trim() : "";
16192
16220
  if (!actionId) throw new TopoloMcpPublicError("actionId is required.");
16193
- const input = args["input"];
16194
- if (input !== void 0 && (!input || typeof input !== "object" || Array.isArray(input))) {
16195
- throw new TopoloMcpPublicError("input must be an object.");
16196
- }
16221
+ const input = coerceObjectParam(args["input"], "input");
16197
16222
  const resource = optionalResourceContext(args);
16198
- return topolo.client.planAction(
16223
+ const plan = await topolo.client.planAction(
16199
16224
  actionId,
16200
- input ?? {},
16225
+ input,
16201
16226
  {
16202
16227
  confirm: args["confirm"] === true,
16203
16228
  ...resource ? { resource } : {}
16204
16229
  }
16205
16230
  );
16231
+ return args["detail"] === true ? plan : compactActionPlan(plan);
16206
16232
  }
16207
16233
  },
16208
16234
  {
@@ -16236,14 +16262,18 @@ var TOOLS = [
16236
16262
  destructive: false,
16237
16263
  inputSchema: {
16238
16264
  type: "object",
16239
- properties: { service: { type: "string", minLength: 1 } },
16265
+ properties: {
16266
+ service: { type: "string", minLength: 1 },
16267
+ detail: { type: "boolean", description: "Return full schemas and agent contracts. Defaults to compact capability guidance." }
16268
+ },
16240
16269
  required: ["service"],
16241
16270
  additionalProperties: false
16242
16271
  },
16243
16272
  handler: async (topolo, args) => {
16244
16273
  const service = typeof args["service"] === "string" ? args["service"].trim() : "";
16245
16274
  if (!service) throw new TopoloMcpPublicError("service is required.");
16246
- return topolo.client.searchActions({ service, limit: 100 });
16275
+ const result = await topolo.client.searchActions({ service, limit: 100 });
16276
+ return args["detail"] === true ? result : { actions: result.actions.map(compactActionCatalogEntry), page: result.page };
16247
16277
  }
16248
16278
  },
16249
16279
  {
@@ -16374,7 +16404,7 @@ var TOOLS = [
16374
16404
  },
16375
16405
  additionalProperties: false
16376
16406
  },
16377
- handler: async (_topolo, args) => {
16407
+ handler: async (topolo, args) => {
16378
16408
  const application = args["application"];
16379
16409
  if (application === void 0) {
16380
16410
  return {
@@ -16384,12 +16414,8 @@ var TOOLS = [
16384
16414
  requirements: APPLICATION_REQUIREMENTS
16385
16415
  };
16386
16416
  }
16387
- if (typeof application !== "string" || !APPLICATION_IDS.includes(application)) {
16388
- throw new TopoloMcpPublicError(
16389
- `Unknown application "${String(application)}". ${formatKnownValues(APPLICATION_IDS, "applications")}`
16390
- );
16391
- }
16392
- const app = APPLICATIONS[application];
16417
+ const resolved = await resolveDirectoryApplication(topolo, application);
16418
+ const app = resolved.application;
16393
16419
  return {
16394
16420
  version: APPLICATION_REQUIREMENTS_VERSION,
16395
16421
  application: app,
@@ -16415,11 +16441,15 @@ var TOOLS = [
16415
16441
  type: "string",
16416
16442
  enum: ["missing", "needs_review", "partial"],
16417
16443
  description: "Optional conformance gate. Returns conformanceGate.passed=false when findings at this severity or worse exist."
16444
+ },
16445
+ detail: {
16446
+ type: "boolean",
16447
+ description: "Include every finding and migration item. Defaults to per-app scores and a queue count."
16418
16448
  }
16419
16449
  },
16420
16450
  additionalProperties: false
16421
16451
  },
16422
- handler: async (_topolo, args) => {
16452
+ handler: async (topolo, args) => {
16423
16453
  const application = args["application"];
16424
16454
  const failOn = args["failOn"];
16425
16455
  if (failOn !== void 0 && typeof failOn !== "string") {
@@ -16428,16 +16458,15 @@ var TOOLS = [
16428
16458
  const gate = failOn ? normalizeFailOn(failOn) : null;
16429
16459
  let report;
16430
16460
  if (application === void 0) {
16431
- report = auditAllApplicationRequirements();
16432
- return gate ? { ...report, conformanceGate: evaluateApplicationAuditGate(report, gate) } : report;
16461
+ const directory = await listApplicationDirectory(topolo.client);
16462
+ report = auditApplicationEntries(directory.applications.map((app) => app.application));
16463
+ const output2 = args["detail"] === true ? report : compactApplicationAudit(report);
16464
+ return gate ? { ...output2, conformanceGate: evaluateApplicationAuditGate(report, gate) } : output2;
16433
16465
  }
16434
- if (typeof application !== "string" || !APPLICATION_IDS.includes(application)) {
16435
- throw new TopoloMcpPublicError(
16436
- `Unknown application "${String(application)}". ${formatKnownValues(APPLICATION_IDS, "applications")}`
16437
- );
16438
- }
16439
- report = auditAllApplicationRequirements([application]);
16440
- return gate ? { ...report, conformanceGate: evaluateApplicationAuditGate(report, gate) } : report;
16466
+ const resolved = await resolveDirectoryApplication(topolo, application);
16467
+ report = auditApplicationEntries([resolved.application]);
16468
+ const output = args["detail"] === true ? report : compactApplicationAudit(report);
16469
+ return gate ? { ...output, conformanceGate: evaluateApplicationAuditGate(report, gate) } : output;
16441
16470
  }
16442
16471
  },
16443
16472
  {
@@ -16576,31 +16605,19 @@ function statusesAtOrWorse(threshold) {
16576
16605
  return ["missing", "needs_review", "partial"];
16577
16606
  }
16578
16607
  function displayAppId(entry) {
16579
- for (const value of [entry.slug, entry.name, entry.appId]) {
16580
- if (typeof value !== "string" || !value.trim()) continue;
16581
- for (const candidate of appIdCandidates(value)) {
16582
- if (Object.prototype.hasOwnProperty.call(DEFAULT_APP_URLS, candidate)) {
16583
- return candidate;
16584
- }
16585
- }
16586
- }
16587
- return appIdCandidates(entry.slug || entry.appId)[0] || entry.appId;
16608
+ return friendlyAppId(entry);
16588
16609
  }
16589
- function appIdCandidates(value) {
16590
- const normalized = value.trim().toLowerCase().replace(/\s+/g, "-");
16591
- const withoutTopolo = normalized.startsWith("topolo-") ? normalized.slice("topolo-".length) : normalized;
16592
- return [.../* @__PURE__ */ new Set([
16593
- normalized,
16594
- normalized.replace(/-/g, "_"),
16595
- withoutTopolo,
16596
- withoutTopolo.replace(/-/g, "_")
16597
- ])].filter(Boolean);
16598
- }
16599
- function formatKnownValues(values, label) {
16600
- const sorted = [...values].sort();
16601
- const preview = sorted.slice(0, 25).join(", ");
16602
- const suffix = sorted.length > 25 ? `, ... +${sorted.length - 25} more` : "";
16603
- return `Run discovery for the full ${label} list. Known snapshot sample: ${preview}${suffix}`;
16610
+ async function resolveDirectoryApplication(topolo, application) {
16611
+ if (typeof application !== "string" || !application.trim()) {
16612
+ throw new TopoloMcpPublicError("`application` must be a non-empty string.");
16613
+ }
16614
+ try {
16615
+ return await resolveApplicationDirectoryEntry(topolo.client, application);
16616
+ } catch (error2) {
16617
+ throw new TopoloMcpPublicError(
16618
+ error2 instanceof Error ? error2.message : `Unknown application "${application}".`
16619
+ );
16620
+ }
16604
16621
  }
16605
16622
 
16606
16623
  // src/version.ts