@uipath/agenthub-tool 1.204.0 → 1.205.0-preview.258

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.
@@ -242,9 +242,9 @@ import {
242
242
  instanceOfUserConnectionResponseDto,
243
243
  mapValues,
244
244
  querystring
245
- } from "./tool-k7bah30d.js";
246
- import"./tool-whbfchmh.js";
247
- import"./tool-ayyhwvs8.js";
245
+ } from "./tool-jyz3xfcz.js";
246
+ import"./tool-gctf3nms.js";
247
+ import"./tool-6mw7b49q.js";
248
248
  import"./tool-1de529jm.js";
249
249
  export {
250
250
  BASE_PATH,
@@ -3,7 +3,7 @@ import {
3
3
  getFileSystem,
4
4
  getFileSystemAsync,
5
5
  setFileSystem
6
- } from "./tool-ayyhwvs8.js";
6
+ } from "./tool-6mw7b49q.js";
7
7
  import"./tool-1de529jm.js";
8
8
  export {
9
9
  NodeFileSystem,
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env bun
2
2
  import {
3
3
  createStandaloneProgram
4
- } from "./tool-gb5hknd4.js";
5
- import"./tool-k7bah30d.js";
6
- import"./tool-1w79gayx.js";
7
- import"./tool-whbfchmh.js";
8
- import"./tool-ayyhwvs8.js";
4
+ } from "./tool-3aw89hpn.js";
5
+ import"./tool-jyz3xfcz.js";
6
+ import"./tool-vw1zddfq.js";
7
+ import"./tool-gctf3nms.js";
8
+ import"./tool-6mw7b49q.js";
9
9
  import"./tool-1de529jm.js";
10
10
 
11
11
  // src/index.ts
@@ -5,7 +5,7 @@ import {
5
5
  SwaggerMcpServersApi,
6
6
  ToolsApi,
7
7
  createApiClient
8
- } from "./tool-k7bah30d.js";
8
+ } from "./tool-jyz3xfcz.js";
9
9
  import {
10
10
  Argument,
11
11
  Command,
@@ -32,13 +32,13 @@ import {
32
32
  requireConfirmation,
33
33
  resolveDeprecatedOptionAlias,
34
34
  warnDeprecatedOptionAlias
35
- } from "./tool-1w79gayx.js";
35
+ } from "./tool-vw1zddfq.js";
36
36
  import {
37
37
  addSdkUserAgentHeader,
38
38
  getLoginStatusAsync,
39
39
  getSdkUserAgentToken,
40
40
  installSdkUserAgentHeader
41
- } from "./tool-whbfchmh.js";
41
+ } from "./tool-gctf3nms.js";
42
42
  import {
43
43
  __require
44
44
  } from "./tool-1de529jm.js";
@@ -47,7 +47,7 @@ var package_default = {
47
47
  name: "@uipath/agenthub-tool",
48
48
  author: "UiPath",
49
49
  license: "SEE LICENSE IN LICENSE.txt",
50
- version: "1.204.0",
50
+ version: "1.205.0-preview.258",
51
51
  description: "Manage UiPath AgentHub MCP server registrations, tools, and remote A2A agents.",
52
52
  private: false,
53
53
  repository: {
@@ -350,7 +350,7 @@ var parseJsonInput = (text, source) => {
350
350
  }
351
351
  };
352
352
  var jsonFromFile = async (file) => {
353
- const { getFileSystem } = await import("./index-r2vc4whd.js");
353
+ const { getFileSystem } = await import("./index-rkqk9b39.js");
354
354
  const fs = getFileSystem();
355
355
  const raw = await fs.readFile(file, "utf-8");
356
356
  if (raw == null) {
@@ -457,10 +457,93 @@ var unkeptEnvMask = unkeptMask(ENV);
457
457
  var unkeptHeaderLinesMask = unkeptLinesMask(HEADER);
458
458
  var unkeptEnvLinesMask = unkeptLinesMask(ENV);
459
459
 
460
+ // src/utils/payload-keys.ts
461
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
462
+ var miscasedKeys = (payload, schema, at = "") => {
463
+ if (Array.isArray(payload)) {
464
+ const items = schema.items;
465
+ if (!isRecord(items))
466
+ return [];
467
+ return payload.flatMap((item, index) => miscasedKeys(item, items, `${at}[${index}]`));
468
+ }
469
+ const properties = schema.properties;
470
+ if (!isRecord(payload) || !isRecord(properties))
471
+ return [];
472
+ const byLowerCase = new Map(Object.keys(properties).map((field) => [field.toLowerCase(), field]));
473
+ return Object.entries(payload).flatMap(([key, value]) => {
474
+ const path = at ? `${at}.${key}` : key;
475
+ const field = Object.hasOwn(properties, key) ? key : byLowerCase.get(key.toLowerCase());
476
+ if (field === undefined)
477
+ return [];
478
+ if (field !== key)
479
+ return [{ path, field }];
480
+ const nested = properties[field];
481
+ return isRecord(nested) ? miscasedKeys(value, nested, path) : [];
482
+ });
483
+ };
484
+ var miscasedKeysError = (payload, schema, schemaHint) => {
485
+ const keys = miscasedKeys(payload, schema);
486
+ if (keys.length === 0)
487
+ return;
488
+ const listed = keys.map(({ path, field }) => `\`${path}\` should be \`${field}\``).join(", ");
489
+ return new InstructedError(`Payload keys differ from their fields only in case: ${listed}. The CLI sends only the camelCase fields, so it would drop ${keys.length === 1 ? "this one" : "these"}.`, `Rename the keys to the camelCase field names, then retry. ${schemaHint}`);
490
+ };
491
+ var text = (maxLength) => ({
492
+ type: "string",
493
+ minLength: 1,
494
+ maxLength
495
+ });
496
+ var uuid = { type: "string", format: "uuid" };
497
+ var jsonString = {
498
+ type: ["string", "null"],
499
+ maxLength: 1e5,
500
+ description: "A JSON document, serialized as a string."
501
+ };
502
+ var CREATE_TOOL_SCHEMA = {
503
+ type: "object",
504
+ required: [
505
+ "type",
506
+ "name",
507
+ "processType",
508
+ "description",
509
+ "targetIdentifier",
510
+ "targetFolderKey"
511
+ ],
512
+ properties: {
513
+ type: { type: "integer", description: "0 for a resource tool." },
514
+ name: text(100),
515
+ mcpName: {
516
+ type: ["string", "null"],
517
+ maxLength: 64,
518
+ pattern: "^[a-zA-Z][a-zA-Z0-9_]*$",
519
+ description: "The tool name MCP clients see. Omitted, the service derives it from name."
520
+ },
521
+ processType: text(100),
522
+ description: text(4000),
523
+ targetIdentifier: uuid,
524
+ targetFolderKey: uuid,
525
+ inputSchema: jsonString,
526
+ outputSchema: jsonString,
527
+ metadata: jsonString
528
+ }
529
+ };
530
+ var UPDATE_TOOL_SCHEMA = {
531
+ type: "object",
532
+ properties: {
533
+ name: text(100),
534
+ description: text(4000),
535
+ targetIdentifier: uuid,
536
+ targetFolderKey: uuid,
537
+ inputSchema: jsonString,
538
+ outputSchema: jsonString,
539
+ metadata: jsonString
540
+ }
541
+ };
542
+
460
543
  // src/utils/platform.ts
461
544
  var addPlatformListOptions = (command) => command.option("--limit <number>", "Page size, up to 10000.", parseLimit, DEFAULT_PAGE_SIZE).option("--offset <number>", "Row offset into the result set.", parseOffset, 0).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--login-validity <minutes>", "Override the interactive-login token lifetime for this call.", (v) => Number.parseInt(v, 10));
462
545
  var createPlatformApi = async (options) => {
463
- const { createApiClient: createApiClient2, PlatformApi } = await import("./index-amhpnrb2.js");
546
+ const { createApiClient: createApiClient2, PlatformApi } = await import("./index-9pe8kz34.js");
464
547
  return await createApiClient2(PlatformApi, {
465
548
  tenant: options.tenant,
466
549
  loginValidity: options.loginValidity
@@ -497,7 +580,11 @@ var emitNotFound = (code, message, instructions) => {
497
580
  });
498
581
  processContext.exit(1);
499
582
  };
500
- var emitPlatformNotEnabled = (code) => emitNotFound(code, "Platform MCP is not enabled on this tenant.", "Platform MCP servers cannot be created on this tenant. Switch tenant with `uip login tenant set <tenant-name>`, or use another MCP server type (`uip agenthub mcp create --help`).");
583
+ var PLATFORM_NOT_ENABLED_STEPS = {
584
+ create: "Platform MCP servers cannot be created on this tenant. Switch tenant with `uip login tenant set <tenant-name>`, or use another MCP server type (`uip agenthub mcp create --help`).",
585
+ change: "Platform MCP servers on this tenant cannot be changed until Platform MCP is enabled for it. Until then, `uip agenthub mcp get <slug>` still reads one and `uip agenthub mcp delete <slug> --yes` removes it."
586
+ };
587
+ var emitPlatformNotEnabled = (code, action = "create") => emitNotFound(code, "Platform MCP is not enabled on this tenant.", PLATFORM_NOT_ENABLED_STEPS[action]);
501
588
 
502
589
  // src/utils/slugs.ts
503
590
  var MCP_SERVER = {
@@ -621,12 +708,12 @@ var addCommonOptions = (command) => {
621
708
  return command.addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-key <key>", "Orchestrator folder key (GUID). Use --folder-path for the folder name or fully-qualified path.").option("--folder-path <path>", "Orchestrator folder display name or fully-qualified path (e.g. 'Shared' or 'Foo/Shared'). Resolved to the folder key via the Orchestrator SDK.").option("--login-validity <minutes>", "Override the interactive-login token lifetime for this call.", (v) => Number.parseInt(v, 10));
622
709
  };
623
710
  var readJsonResponseBody = async (response) => {
624
- const text = await response.clone().text();
625
- if (!text.trim()) {
711
+ const text2 = await response.clone().text();
712
+ if (!text2.trim()) {
626
713
  return {};
627
714
  }
628
715
  try {
629
- return JSON.parse(text);
716
+ return JSON.parse(text2);
630
717
  } catch {
631
718
  return {};
632
719
  }
@@ -718,14 +805,14 @@ var objectSchema = (properties, required = [], extra = {}) => ({
718
805
  ...extra,
719
806
  properties
720
807
  });
721
- var withNote = (text, note) => note ? `${text} ${note}` : text;
722
- var uuid = (description) => ({
808
+ var withNote = (text2, note) => note ? `${text2} ${note}` : text2;
809
+ var uuid2 = (description) => ({
723
810
  type: "string",
724
811
  format: "uuid",
725
812
  ...description ? { description } : {}
726
813
  });
727
814
  var nullableUuid = (description) => ({
728
- ...uuid(description),
815
+ ...uuid2(description),
729
816
  type: ["string", "null"]
730
817
  });
731
818
  var headersSchema = (note) => ({
@@ -755,12 +842,12 @@ var updateCommon = {
755
842
  };
756
843
  var toolsSchema = (note) => ({
757
844
  type: "array",
758
- items: { type: "object" },
759
- description: withNote("CreateToolDto objects with camelCase keys (type, name, processType, description, targetIdentifier, targetFolderKey). `uip agenthub mcp-tools template <resource|raw>` prints these fields PascalCased, so re-case them when copying.", note)
845
+ items: CREATE_TOOL_SCHEMA,
846
+ description: withNote("CreateToolDto objects with camelCase keys. `uip agenthub mcp-tools template resource` prints one.", note)
760
847
  });
761
848
  var codedFields = {
762
- processKey: uuid(),
763
- folderKey: uuid("The server's folder, where the process runs.")
849
+ processKey: uuid2(),
850
+ folderKey: uuid2("The server's folder, where the process runs.")
764
851
  };
765
852
  var environmentVariablesSchema = (note) => ({
766
853
  type: "string",
@@ -850,12 +937,12 @@ var CREATE_SCHEMAS = {
850
937
  var UPDATE_SCHEMAS = {
851
938
  uipath: objectSchema({
852
939
  server: objectSchema(updateCommon),
853
- tools: toolsSchema("Replaces every tool, so send the ones to keep, or [] to remove them all.")
854
- }, ["server", "tools"]),
940
+ tools: toolsSchema("Leave it out to keep every tool. When sent, it replaces every tool: send the ones to keep, or [] to remove them all.")
941
+ }, ["server"]),
855
942
  coded: objectSchema({
856
943
  ...updateCommon,
857
944
  ...codedFields,
858
- folderKey: uuid("The server's folder, where the process runs. The service accepts only the server's own folder, the one the request is scoped to, and refuses any other, so send the folderKey `mcp get` shows.")
945
+ folderKey: uuid2("The server's folder, where the process runs. The service accepts only the server's own folder, the one the request is scoped to, and refuses any other, so send the folderKey `mcp get` shows.")
859
946
  }, ["processKey", "folderKey"]),
860
947
  command: objectSchema({
861
948
  ...updateCommon,
@@ -952,7 +1039,7 @@ var emitPayloadShape = (data) => {
952
1039
  }, { preserveDataKeys: true });
953
1040
  };
954
1041
  var fetchServersAcrossFolders = async (options) => {
955
- const { FoldersApi: FoldersApi2, createOrchestratorConfig: createOrchestratorConfig2 } = await import("./index-tzxetgzv.js");
1042
+ const { FoldersApi: FoldersApi2, createOrchestratorConfig: createOrchestratorConfig2 } = await import("./index-3wn4g1q0.js");
956
1043
  const orchestratorConfig = await createOrchestratorConfig2({
957
1044
  tenant: options.tenant,
958
1045
  loginValidity: options.loginValidity
@@ -1104,6 +1191,21 @@ var registerMcpListCommand = (mcp) => {
1104
1191
  });
1105
1192
  });
1106
1193
  };
1194
+ var withSwaggerUrl = async (server, options) => {
1195
+ const { slug } = server;
1196
+ if (server.type !== MCP_SERVER_TYPE_BY_NAME.swagger || !slug)
1197
+ return server;
1198
+ const [error, swagger] = await catchError((async () => {
1199
+ const api = await createSwaggerApi(options);
1200
+ return await api.apiServersSwaggerMcpSlugGet({ slug });
1201
+ })());
1202
+ if (error) {
1203
+ getOutputSink().writeErr(`[WARN] Could not read the spec URL of the swagger server '${server.slug}': ${error.message}. Showing the server without it.
1204
+ `);
1205
+ return server;
1206
+ }
1207
+ return { ...server, swaggerUrl: swagger.swaggerUrl };
1208
+ };
1107
1209
  var registerMcpGetCommand = (mcp) => {
1108
1210
  addCommonOptions(mcp.command("get").description([
1109
1211
  "Get one MCP server registration by canonical slug.",
@@ -1127,7 +1229,7 @@ var registerMcpGetCommand = (mcp) => {
1127
1229
  OutputFormatter.success({
1128
1230
  Result: RESULTS.Success,
1129
1231
  Code: OUTPUT_CODES.McpGet,
1130
- Data: server
1232
+ Data: await withSwaggerUrl(server, options)
1131
1233
  });
1132
1234
  });
1133
1235
  };
@@ -1246,16 +1348,24 @@ var registerCreateLeaf = (create, type, scalar) => {
1246
1348
  refuseInput(OUTPUT_CODES.McpCreate, TOOL_WITH_ALL_TOOLS, "Drop --tool to expose every tool, or drop --use-all-tools to expose only the tools you name.");
1247
1349
  return;
1248
1350
  }
1249
- const [inputError, payload] = await catchError(objectFromOptions(options, scalar(options), `Run \`uip agenthub mcp create ${type} --print-schema\` to see the expected payload.`));
1351
+ const schemaCommand = `uip agenthub mcp create ${type} --print-schema`;
1352
+ const [inputError, payload] = await catchError(objectFromOptions(options, scalar(options), `Run \`${schemaCommand}\` to see the expected payload.`));
1250
1353
  if (inputError) {
1251
1354
  const code = inputError.code;
1252
1355
  const hint = inputError.hint;
1253
1356
  await emitError(code === "ConflictingInput" || code === "MissingInput" ? OUTPUT_CODES.McpCreate : code ?? OUTPUT_CODES.McpCreate, inputError, hint ? {
1254
- NextCommand: `uip agenthub mcp create ${type} --print-schema`,
1357
+ NextCommand: schemaCommand,
1255
1358
  Instructions: hint
1256
1359
  } : undefined);
1257
1360
  return;
1258
1361
  }
1362
+ const miscased = miscasedKeysError(payload, schemaFor(type, "create"), `\`${schemaCommand}\` lists the fields.`);
1363
+ if (miscased) {
1364
+ await emitError(OUTPUT_CODES.McpCreate, miscased, {
1365
+ NextCommand: schemaCommand
1366
+ });
1367
+ return;
1368
+ }
1259
1369
  const [folderError] = catchError(() => assertFolderContext(options));
1260
1370
  if (folderError) {
1261
1371
  await emitError(OUTPUT_CODES.McpCreate, folderError);
@@ -1709,6 +1819,13 @@ var registerMcpUpdateCommand = (mcp) => {
1709
1819
  });
1710
1820
  return;
1711
1821
  }
1822
+ const miscased = miscasedKeysError(payload, schemaFor(type, "update"), `\`${schemaCommand}\` lists the fields.`);
1823
+ if (miscased) {
1824
+ await emitError(OUTPUT_CODES.McpUpdate, miscased, {
1825
+ NextCommand: schemaCommand
1826
+ });
1827
+ return;
1828
+ }
1712
1829
  const payloadUnkept = !scalars && fields ? unkeptPayloadMask(type, server, fields) : undefined;
1713
1830
  if (payloadUnkept) {
1714
1831
  refuseUpdate(payloadUnkept, `Send **** only under a name exactly as \`uip agenthub mcp get ${shellArg(slug)} ${folder}\` shows it with a **** value, or send the value itself.`);
@@ -1753,10 +1870,6 @@ var registerMcpUpdateCommand = (mcp) => {
1753
1870
  return;
1754
1871
  }
1755
1872
  }
1756
- if (type === "uipath" && !Array.isArray(payload?.tools)) {
1757
- refuseUpdate(`An update of the uipath server '${slug}' must carry its tools: the service replaces every tool with the payload's \`tools\`, and deletes them all when it has none.`, `Send the tools to keep with --file or --body, as {"server": {...}, "tools": [...]}, or "tools": [] to remove them all. List the current tools with \`uip agenthub mcp-tools list --mcp ${shellArg(slug)} ${folder} --limit 1000 --output json\` and check that Total equals Count. That list prints PascalCase keys: send each tool as camelCase CreateToolDto fields (type, name, mcpName, processType, description, targetIdentifier, targetFolderKey, inputSchema, outputSchema, metadata), without id, serverId, createdAt and updatedAt. A list that differs from the stored one in any field recreates every tool with a new id and drops the guardrails of the old tools. See \`uip agenthub mcp update ${shellArg(slug)} ${folder} --print-schema\`.`);
1758
- return;
1759
- }
1760
1873
  if (options.dryRun) {
1761
1874
  OutputFormatter.success({
1762
1875
  Result: RESULTS.Success,
@@ -2009,7 +2122,7 @@ var UPDATE_EXAMPLES = [
2009
2122
  }
2010
2123
  },
2011
2124
  {
2012
- Description: 'Update a uipath MCP server from a payload that lists the tools to keep (`{"server": {...}, "tools": [...]}`); an update without tools is refused, because it would delete them all',
2125
+ Description: 'Replace the tools of a uipath MCP server from a payload that lists the ones to keep (`{"server": {...}, "tools": [...]}`); an update without `tools`, like a scalar one, keeps them',
2013
2126
  Command: "uip agenthub mcp update invoice-mcp --file invoice-mcp.json --folder-path Shared",
2014
2127
  Output: {
2015
2128
  Code: OUTPUT_CODES.McpUpdate,
@@ -2443,7 +2556,7 @@ var package_default2 = {
2443
2556
  name: "@uipath/resourcecatalog-sdk",
2444
2557
  author: "UiPath",
2445
2558
  license: "SEE LICENSE IN LICENSE.txt",
2446
- version: "1.204.0",
2559
+ version: "1.205.0",
2447
2560
  description: "SDK for the UiPath Resource Catalog Service API.",
2448
2561
  repository: {
2449
2562
  type: "git",
@@ -3227,20 +3340,19 @@ var TOOL_DELETE_EXAMPLES = [
3227
3340
  }
3228
3341
  }
3229
3342
  ];
3343
+ var TOOL_TEMPLATE = {
3344
+ type: 0,
3345
+ name: "resource-tool",
3346
+ processType: "automation",
3347
+ description: "",
3348
+ targetIdentifier: "resource-id",
3349
+ targetFolderKey: "folder-guid"
3350
+ };
3230
3351
  var TOOL_TEMPLATE_EXAMPLES = [
3231
3352
  {
3232
- Description: "Emit a resource tool payload template",
3353
+ Description: "Emit a resource tool payload template, with the API's camelCase field names",
3233
3354
  Command: "uip agenthub mcp-tools template resource",
3234
- Output: {
3235
- Code: OUTPUT_CODES2.Template,
3236
- Data: {
3237
- type: 0,
3238
- name: "resource-tool",
3239
- processType: "automation",
3240
- targetIdentifier: "resource-id",
3241
- targetFolderKey: "folder-guid"
3242
- }
3243
- }
3355
+ Output: { Code: OUTPUT_CODES2.Template, Data: TOOL_TEMPLATE }
3244
3356
  }
3245
3357
  ];
3246
3358
  var TOOL_CANDIDATES_EXAMPLES = [
@@ -3358,6 +3470,7 @@ var inputPayload = async (options, scalar, emptyHint, scalarExclude = []) => {
3358
3470
  return scalar;
3359
3471
  };
3360
3472
  var typeNameOf = (server) => server.type === undefined ? undefined : MCP_SERVER_TYPE_NAME_BY_VALUE[server.type];
3473
+ var platformToolNamesCommand = (service) => `uip agenthub platform-tools list --service ${shellArg(service)} --limit 1000 --output-filter "{Names: Items[].Name, Total: Total}"`;
3361
3474
  var nextCommandForParentType = (slug, actual, options) => {
3362
3475
  switch (actual) {
3363
3476
  case "coded":
@@ -3419,6 +3532,13 @@ var validateJsonStrings = (payload) => {
3419
3532
  }
3420
3533
  };
3421
3534
  var findByName = (items, name) => items.filter((item) => item.name?.toLowerCase().includes(name.toLowerCase()));
3535
+ var selectByName = (items, name, allowMultiple) => {
3536
+ const matches = findByName(items, name);
3537
+ if (allowMultiple || matches.length < 2)
3538
+ return matches;
3539
+ const exact = matches.filter((item) => item.name === name);
3540
+ return exact.length > 0 ? exact : matches;
3541
+ };
3422
3542
  var resolveToolIds = async (options, positionalIds, code) => {
3423
3543
  const listCommand = `uip agenthub mcp-tools list --mcp ${shellArg(options.mcp)} ${folderFlagFor(options)}`;
3424
3544
  if (positionalIds.length > 0 && options.name) {
@@ -3446,7 +3566,7 @@ var resolveToolIds = async (options, positionalIds, code) => {
3446
3566
  await emitError(code, error);
3447
3567
  return;
3448
3568
  }
3449
- const matches = findByName(items ?? [], options.name);
3569
+ const matches = selectByName(items ?? [], options.name, options.allowMultiple);
3450
3570
  if (matches.length === 0) {
3451
3571
  await emitError(code, new Error(`No tool name on '${options.mcp}' matched '${options.name}'.`), {
3452
3572
  ErrorCode: "not_found",
@@ -3518,7 +3638,7 @@ var registerMcpToolsCommand = (parent) => {
3518
3638
  "--mcp identifies the parent server; pass <id> (positional)",
3519
3639
  "or --name to select which tool inside that server."
3520
3640
  ].join(`
3521
- `)).requiredOption("--mcp <slug>", "Parent MCP server slug, not its display name.").argument("[id]", "Tool id.").option("--name <name>", "Lookup by name substring.").option("--allow-multiple", "Return all name matches instead of failing.")).examples(TOOL_GET_EXAMPLES).trackedAction(processContext, async (id, options) => {
3641
+ `)).requiredOption("--mcp <slug>", "Parent MCP server slug, not its display name.").argument("[id]", "Tool id.").option("--name <name>", "Lookup by name: a substring, or the exact name when several tools contain it.").option("--allow-multiple", "Return all name matches instead of failing.")).examples(TOOL_GET_EXAMPLES).trackedAction(processContext, async (id, options) => {
3522
3642
  const [apiError, api] = await catchError(createToolsApi2(options));
3523
3643
  if (apiError)
3524
3644
  return await emitError(OUTPUT_CODES2.Get, apiError);
@@ -3550,7 +3670,7 @@ var registerMcpToolsCommand = (parent) => {
3550
3670
  const [error, items] = await catchError(api.apiServersSlugToolsGet({ slug: options.mcp }));
3551
3671
  if (error)
3552
3672
  return await emitError(OUTPUT_CODES2.Get, error);
3553
- const matches = findByName(items ?? [], options.name);
3673
+ const matches = selectByName(items ?? [], options.name, options.allowMultiple);
3554
3674
  if (matches.length !== 1 && !options.allowMultiple) {
3555
3675
  const none = matches.length === 0;
3556
3676
  return await emitError(OUTPUT_CODES2.Get, new Error(`Found ${matches.length} matching tools.`), {
@@ -3713,6 +3833,9 @@ var registerMcpToolsCommand = (parent) => {
3713
3833
  ...hint && templateCommand ? { NextCommand: templateCommand } : {}
3714
3834
  });
3715
3835
  }
3836
+ const miscased = miscasedKeysError(payload, CREATE_TOOL_SCHEMA, "`uip agenthub mcp create uipath --print-schema` lists every tool field under `tools`.");
3837
+ if (miscased)
3838
+ return await emitError(OUTPUT_CODES2.Create, miscased);
3716
3839
  const [validateError] = await catchError(Promise.resolve().then(() => validateJsonStrings(payload)));
3717
3840
  if (validateError)
3718
3841
  return await emitError(OUTPUT_CODES2.Create, validateError);
@@ -3775,7 +3898,7 @@ var registerMcpToolsCommand = (parent) => {
3775
3898
  "Use `--rename <new-name>` to change the tool's name; the",
3776
3899
  "lookup `--name` flag selects the existing tool to update."
3777
3900
  ].join(`
3778
- `)).argument("[id]", "Tool id (omit when using --name).").option("--name <substr>", "Lookup by tool name substring.").option("--allow-multiple", "Apply the update to every name match.").option("--rename <name>", "Rename the tool to this value.").option("--description <text>", "Updated description.").option("--target-identifier <guid>", "Updated target identifier.").option("--target-folder-key <key>", "Orchestrator folder key (GUID) of the target's folder, when it differs from the MCP server's folder. Use --target-folder-path for the folder name or fully-qualified path.").option("--target-folder-path <path>", "Orchestrator folder display name or fully-qualified path of the target's folder (e.g. 'Shared' or 'Foo/Shared'). Resolved to the folder key via the Orchestrator SDK.").option("--input-schema <json>", "JSON input schema.").option("--output-schema <json>", "JSON output schema.").option("--metadata <json>", "JSON metadata.")).examples(TOOL_UPDATE_EXAMPLES).trackedAction(processContext, async (id, options) => {
3901
+ `)).argument("[id]", "Tool id (omit when using --name).").option("--name <substr>", "Lookup by tool name: a substring, or the exact name when several tools contain it.").option("--allow-multiple", "Apply the update to every name match.").option("--rename <name>", "Rename the tool to this value.").option("--description <text>", "Updated description.").option("--target-identifier <guid>", "Updated target identifier.").option("--target-folder-key <key>", "Orchestrator folder key (GUID) of the target's folder, when it differs from the MCP server's folder. Use --target-folder-path for the folder name or fully-qualified path.").option("--target-folder-path <path>", "Orchestrator folder display name or fully-qualified path of the target's folder (e.g. 'Shared' or 'Foo/Shared'). Resolved to the folder key via the Orchestrator SDK.").option("--input-schema <json>", "JSON input schema.").option("--output-schema <json>", "JSON output schema.").option("--metadata <json>", "JSON metadata.")).examples(TOOL_UPDATE_EXAMPLES).trackedAction(processContext, async (id, options) => {
3779
3902
  if (!await validateFolderInputsForTool(options, OUTPUT_CODES2.Update))
3780
3903
  return;
3781
3904
  if (!await requireParentType(options.mcp, "uipath", options, OUTPUT_CODES2.Update))
@@ -3808,6 +3931,9 @@ var registerMcpToolsCommand = (parent) => {
3808
3931
  }, undefined, ["name"]));
3809
3932
  if (inputError)
3810
3933
  return await emitError(inputError.code ?? OUTPUT_CODES2.Update, inputError);
3934
+ const miscased = miscasedKeysError(payload, UPDATE_TOOL_SCHEMA, "Or pass the changes as options: see `uip agenthub mcp-tools update --help`.");
3935
+ if (miscased)
3936
+ return await emitError(OUTPUT_CODES2.Update, miscased);
3811
3937
  const [validateError] = await catchError(Promise.resolve().then(() => validateJsonStrings(payload)));
3812
3938
  if (validateError)
3813
3939
  return await emitError(OUTPUT_CODES2.Update, validateError);
@@ -3851,7 +3977,7 @@ var registerMcpToolsCommand = (parent) => {
3851
3977
  Data: ids.length === 1 ? updates[0] : updates
3852
3978
  });
3853
3979
  });
3854
- addCommonOptions2(tools.command("delete").description("Delete one or more uipath MCP tools by id or --name.").requiredOption("--mcp <slug>", "Parent MCP server slug, not its display name.").argument("[ids...]", "Tool id(s) (omit when using --name).").option("--name <substr>", "Lookup by tool name substring.").option("--allow-multiple", "Delete every name match instead of failing on duplicates.").option("--dry-run", "Print the mutation plan without deleting.").option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)")).examples(TOOL_DELETE_EXAMPLES).trackedAction(processContext, async (positionalIds, options) => {
3980
+ addCommonOptions2(tools.command("delete").description("Delete one or more uipath MCP tools by id or --name.").requiredOption("--mcp <slug>", "Parent MCP server slug, not its display name.").argument("[ids...]", "Tool id(s) (omit when using --name).").option("--name <substr>", "Lookup by tool name: a substring, or the exact name when several tools contain it.").option("--allow-multiple", "Delete every name match instead of failing on duplicates.").option("--dry-run", "Print the mutation plan without deleting.").option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)")).examples(TOOL_DELETE_EXAMPLES).trackedAction(processContext, async (positionalIds, options) => {
3855
3981
  if (!requireConfirmation(options, `delete ${positionalIds.length || "matching"} MCP tool(s) on '${options.mcp}'`))
3856
3982
  return;
3857
3983
  if (!await requireParentType(options.mcp, "uipath", options, OUTPUT_CODES2.Delete))
@@ -3893,19 +4019,12 @@ var registerMcpToolsCommand = (parent) => {
3893
4019
  Data: { ids, deleted: true }
3894
4020
  });
3895
4021
  });
3896
- tools.command("template").description("Emit a tool payload template.").addArgument(new Argument("<kind>", "Template kind.").choices(["resource", "raw"]).argRequired()).examples(TOOL_TEMPLATE_EXAMPLES).trackedAction(processContext, async () => {
4022
+ tools.command("template").description("Emit a tool payload template to edit and pass with --file or --body. It keeps the API's camelCase field names, which the payload needs.").addArgument(new Argument("<kind>", "Template kind.").choices(["resource", "raw"]).argRequired()).examples(TOOL_TEMPLATE_EXAMPLES).trackedAction(processContext, async () => {
3897
4023
  OutputFormatter.success({
3898
4024
  Result: RESULTS.Success,
3899
4025
  Code: OUTPUT_CODES2.Template,
3900
- Data: {
3901
- type: 0,
3902
- name: "resource-tool",
3903
- processType: "automation",
3904
- description: "",
3905
- targetIdentifier: "resource-id",
3906
- targetFolderKey: "folder-guid"
3907
- }
3908
- });
4026
+ Data: { ...TOOL_TEMPLATE }
4027
+ }, { preserveDataKeys: true });
3909
4028
  });
3910
4029
  const candidatesCmd = tools.command("candidates").description("List normalized candidates for create-resource.").addOption(new Option("--category <category>", `Tool source category. One of: ${ALL_CANDIDATE_CATEGORIES.join(", ")}.`).choices([...ALL_CANDIDATE_CATEGORIES]).makeOptionMandatory(true));
3911
4030
  const originalOptionMissingArgument = candidatesCmd.optionMissingArgument.bind(candidatesCmd);
@@ -4012,8 +4131,8 @@ var registerMcpToolsCommand = (parent) => {
4012
4131
  if (fetchError)
4013
4132
  return await emitError(code, fetchError);
4014
4133
  const { serverApi, currentTools } = fetched;
4134
+ const folder = folderFlagFor(options);
4015
4135
  if (server.useAllTools) {
4016
- const folder = folderFlagFor(options);
4017
4136
  if (enable) {
4018
4137
  const defined = new Set(currentTools.map((tool) => tool.name));
4019
4138
  const unknown = names.filter((name) => !defined.has(name));
@@ -4050,6 +4169,38 @@ var registerMcpToolsCommand = (parent) => {
4050
4169
  return;
4051
4170
  }
4052
4171
  const selected = new Set(currentTools.map((tool) => tool.name).filter((name) => Boolean(name)));
4172
+ const unselected = enable ? [] : names.filter((name) => !selected.has(name));
4173
+ if (unselected.length > 0) {
4174
+ const service = server.arguments;
4175
+ const [definedError, defined] = await catchError((async () => {
4176
+ if (!service)
4177
+ return new Set;
4178
+ const api = await createPlatformApi(options);
4179
+ const serviceTools = await api.apiPlatformsServiceNameToolsGet({
4180
+ serviceName: service
4181
+ });
4182
+ return new Set(serviceTools.map((tool) => tool.name));
4183
+ })());
4184
+ if (definedError && await isPlatformDisabled(definedError)) {
4185
+ emitPlatformNotEnabled(code, "change");
4186
+ return;
4187
+ }
4188
+ if (definedError)
4189
+ return await emitError(code, definedError);
4190
+ const unknown = unselected.filter((name) => !defined.has(name));
4191
+ if (unknown.length > 0) {
4192
+ OutputFormatter.error({
4193
+ Result: RESULTS.Failure,
4194
+ Code: code,
4195
+ ErrorCode: "invalid_argument",
4196
+ Retry: "RetryWillNotFix",
4197
+ Message: service ? `Tools not found in the ${service} service: ${unknown.join(", ")}.` : `Tools not selected on ${options.mcp}: ${unknown.join(", ")}.`,
4198
+ Instructions: service ? `List the service's tool names with \`${platformToolNamesCommand(service)}\`.` : `List its selected tools with \`uip agenthub mcp-tools list --mcp ${shellArg(options.mcp)} ${folder}\`.`
4199
+ });
4200
+ processContext.exit(1);
4201
+ return;
4202
+ }
4203
+ }
4053
4204
  for (const name of names)
4054
4205
  enable ? selected.add(name) : selected.delete(name);
4055
4206
  const payload = {
@@ -4103,6 +4254,16 @@ var registerMcpToolsCommand = (parent) => {
4103
4254
  if (inputError)
4104
4255
  return await emitError(inputError.code ?? code, inputError);
4105
4256
  const names = Array.isArray(fromInput) ? fromInput : [fromInput].filter(Boolean);
4257
+ const invalid = names.some((name) => typeof name !== "string" || !name);
4258
+ if (names.length === 0 || invalid) {
4259
+ let message = "A tool name cannot be empty.";
4260
+ if (names.length === 0) {
4261
+ message = `Pass the tools to ${verb}.`;
4262
+ } else if (options.file || options.body) {
4263
+ message = "The payload must be a tool name or a list of tool names.";
4264
+ }
4265
+ return await emitError(code, new InstructedError(message, "Pass each tool with --name <tool>, repeated for each tool, using the names `uip agenthub platform-tools list --service <service>` lists."));
4266
+ }
4106
4267
  await platformToggle(enable, names, options);
4107
4268
  });
4108
4269
  }
@@ -4662,4 +4823,4 @@ var createStandaloneProgram = async () => {
4662
4823
 
4663
4824
  export { metadata, registerCommands, createStandaloneProgram };
4664
4825
 
4665
- //# debugId=0A20087F8553A9DC64756E2164756E21
4826
+ //# debugId=3C0F41FF7138F94B64756E2164756E21
@@ -182,6 +182,16 @@ class NodeFileSystem {
182
182
  async rename(oldPath, newPath) {
183
183
  await fs.rename(oldPath, newPath);
184
184
  }
185
+ async isSymbolicLink(filePath) {
186
+ try {
187
+ return (await fs.lstat(filePath)).isSymbolicLink();
188
+ } catch (error) {
189
+ if (this.isEnoent(error) || this.hasErrnoCode(error, "ENOTDIR")) {
190
+ return false;
191
+ }
192
+ throw error;
193
+ }
194
+ }
185
195
  async realpath(filePath) {
186
196
  try {
187
197
  return await fs.realpath(filePath);
@@ -236,4 +246,4 @@ var getFileSystemAsync = async () => fsInstance;
236
246
 
237
247
  export { NodeFileSystem, setFileSystem, getFileSystem, getFileSystemAsync };
238
248
 
239
- //# debugId=3E49815A855BD0ED64756E2164756E21
249
+ //# debugId=1DD0126610F78D8964756E2164756E21