@ainecto/cli 0.14.0-next.12 → 0.14.0-next.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/bin/ainecto.js +432 -259
- package/dist/bin/ainecto.js.map +1 -1
- package/dist/bin/mcp.js +165 -17
- package/dist/bin/mcp.js.map +1 -1
- package/package.json +2 -2
package/dist/bin/ainecto.js
CHANGED
|
@@ -5542,7 +5542,7 @@ function tokenKey(endpoint) {
|
|
|
5542
5542
|
}
|
|
5543
5543
|
|
|
5544
5544
|
// src/core/auth/oauth.ts
|
|
5545
|
-
import { createHash as
|
|
5545
|
+
import { createHash as createHash3, randomBytes } from "crypto";
|
|
5546
5546
|
import { createServer } from "http";
|
|
5547
5547
|
import { spawn } from "child_process";
|
|
5548
5548
|
import { URLSearchParams } from "url";
|
|
@@ -5686,8 +5686,8 @@ function legacyRoleInput(flag, envVars = process.env) {
|
|
|
5686
5686
|
|
|
5687
5687
|
// src/core/version.ts
|
|
5688
5688
|
var UNBUNDLED_VERSION = "dev";
|
|
5689
|
-
var CLI_VERSION = true ? "0.14.0-next.
|
|
5690
|
-
var CLI_BUILD = true ? "
|
|
5689
|
+
var CLI_VERSION = true ? "0.14.0-next.13" : UNBUNDLED_VERSION;
|
|
5690
|
+
var CLI_BUILD = true ? "3a78293" : void 0;
|
|
5691
5691
|
function cliVersionLabel(version, build, release) {
|
|
5692
5692
|
return release || build === void 0 ? version : `${version}-dev+${build}`;
|
|
5693
5693
|
}
|
|
@@ -5699,6 +5699,296 @@ function bridgePackageSpec(version = CLI_VERSION) {
|
|
|
5699
5699
|
return version === UNBUNDLED_VERSION ? PACKAGE_NAME : `${PACKAGE_NAME}@${version}`;
|
|
5700
5700
|
}
|
|
5701
5701
|
|
|
5702
|
+
// src/core/catalog/generator.ts
|
|
5703
|
+
import { createHash as createHash2 } from "crypto";
|
|
5704
|
+
var LEGACY_PREFIX = "mcp__ainecto__";
|
|
5705
|
+
function bareToolName(name) {
|
|
5706
|
+
return name.startsWith(LEGACY_PREFIX) ? name.slice(LEGACY_PREFIX.length) : name;
|
|
5707
|
+
}
|
|
5708
|
+
var DESTRUCTIVE_PREFIXES = [
|
|
5709
|
+
"delete_",
|
|
5710
|
+
"remove_",
|
|
5711
|
+
"archive_",
|
|
5712
|
+
"unarchive_",
|
|
5713
|
+
"restore_",
|
|
5714
|
+
"move_",
|
|
5715
|
+
"erd_delete_",
|
|
5716
|
+
"erd_remove_",
|
|
5717
|
+
"testcase_delete_"
|
|
5718
|
+
];
|
|
5719
|
+
function generateCatalog(tools, sourceCatalog) {
|
|
5720
|
+
return tools.map((tool) => normalizeTool(tool, sourceCatalog)).sort((a, b) => a.mcpName.localeCompare(b.mcpName));
|
|
5721
|
+
}
|
|
5722
|
+
function normalizeTool(tool, sourceCatalog) {
|
|
5723
|
+
if (!tool.name) {
|
|
5724
|
+
throw new Error("Unsupported tool name: empty.");
|
|
5725
|
+
}
|
|
5726
|
+
const stripped = bareToolName(tool.name);
|
|
5727
|
+
const group = inferGroup(stripped);
|
|
5728
|
+
const inputSchema = normalizeSchema(tool.inputSchema ?? { type: "object", properties: {} });
|
|
5729
|
+
const required = Array.isArray(inputSchema.required) ? inputSchema.required.filter((value) => typeof value === "string").sort() : [];
|
|
5730
|
+
const definition = {
|
|
5731
|
+
mcpName: tool.name,
|
|
5732
|
+
commandPath: generateCommandPath(stripped, group),
|
|
5733
|
+
group,
|
|
5734
|
+
description: tool.description ?? "",
|
|
5735
|
+
inputSchema,
|
|
5736
|
+
required,
|
|
5737
|
+
payloadMode: inferPayloadMode(stripped, inputSchema),
|
|
5738
|
+
destructive: inferDestructive(stripped, tool),
|
|
5739
|
+
sourceCatalog,
|
|
5740
|
+
schemaHash: ""
|
|
5741
|
+
};
|
|
5742
|
+
return { ...definition, schemaHash: computeSchemaHash(definition) };
|
|
5743
|
+
}
|
|
5744
|
+
function inferGroup(strippedName) {
|
|
5745
|
+
if (strippedName.startsWith("erd_")) return "erd";
|
|
5746
|
+
if (strippedName.startsWith("flow_")) return "flow";
|
|
5747
|
+
if (strippedName.startsWith("testcase_")) return "testcase";
|
|
5748
|
+
if (strippedName.startsWith("markdown_")) return "markdown";
|
|
5749
|
+
if (strippedName.includes("attachment") || strippedName.includes("upload")) return "attachment";
|
|
5750
|
+
if (strippedName.startsWith("kanban_")) return "kanban";
|
|
5751
|
+
if (strippedName.includes("workspace")) return "workspace";
|
|
5752
|
+
if (strippedName.includes("document")) return "document";
|
|
5753
|
+
return "generic";
|
|
5754
|
+
}
|
|
5755
|
+
function generateCommandPath(strippedName, group) {
|
|
5756
|
+
if (group !== "generic" && strippedName.startsWith(`${group}_`)) {
|
|
5757
|
+
return [group, snakeToKebab(strippedName.slice(group.length + 1))];
|
|
5758
|
+
}
|
|
5759
|
+
const [verb, ...rest] = strippedName.split("_");
|
|
5760
|
+
if (verb && rest.length > 0 && isVerb(verb)) {
|
|
5761
|
+
return [rest.join("-"), verb];
|
|
5762
|
+
}
|
|
5763
|
+
return ["tools", "run", snakeToKebab(strippedName)];
|
|
5764
|
+
}
|
|
5765
|
+
function inferPayloadMode(strippedName, inputSchema) {
|
|
5766
|
+
if (strippedName.includes("upload") || strippedName.includes("attachment_upload")) {
|
|
5767
|
+
return "binary-upload";
|
|
5768
|
+
}
|
|
5769
|
+
const properties = inputSchema.properties;
|
|
5770
|
+
if (!isRecord3(properties)) {
|
|
5771
|
+
return "flags";
|
|
5772
|
+
}
|
|
5773
|
+
const values = Object.values(properties);
|
|
5774
|
+
if (values.length === 0) {
|
|
5775
|
+
return "flags";
|
|
5776
|
+
}
|
|
5777
|
+
if (values.every(isScalarSchema)) {
|
|
5778
|
+
return "flags";
|
|
5779
|
+
}
|
|
5780
|
+
return "file-json";
|
|
5781
|
+
}
|
|
5782
|
+
function inferDestructive(strippedName, tool) {
|
|
5783
|
+
if (tool.annotations?.destructiveHint === true) {
|
|
5784
|
+
return true;
|
|
5785
|
+
}
|
|
5786
|
+
return DESTRUCTIVE_PREFIXES.some((prefix) => strippedName.startsWith(prefix));
|
|
5787
|
+
}
|
|
5788
|
+
function computeSchemaHash(tool) {
|
|
5789
|
+
return createHash2("sha256").update(stableStringify({
|
|
5790
|
+
name: tool.mcpName,
|
|
5791
|
+
description: tool.description,
|
|
5792
|
+
inputSchema: tool.inputSchema
|
|
5793
|
+
})).digest("hex").slice(0, 16);
|
|
5794
|
+
}
|
|
5795
|
+
function stableStringify(value) {
|
|
5796
|
+
if (Array.isArray(value)) {
|
|
5797
|
+
return `[${value.map(stableStringify).join(",")}]`;
|
|
5798
|
+
}
|
|
5799
|
+
if (isRecord3(value)) {
|
|
5800
|
+
return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${stableStringify(value[key])}`).join(",")}}`;
|
|
5801
|
+
}
|
|
5802
|
+
return JSON.stringify(value);
|
|
5803
|
+
}
|
|
5804
|
+
function normalizeSchema(schema) {
|
|
5805
|
+
return JSON.parse(stableStringify(schema));
|
|
5806
|
+
}
|
|
5807
|
+
function isScalarSchema(value) {
|
|
5808
|
+
if (!isRecord3(value)) {
|
|
5809
|
+
return false;
|
|
5810
|
+
}
|
|
5811
|
+
const type = value.type;
|
|
5812
|
+
return type === "string" || type === "number" || type === "integer" || type === "boolean";
|
|
5813
|
+
}
|
|
5814
|
+
function isVerb(value) {
|
|
5815
|
+
return [
|
|
5816
|
+
"list",
|
|
5817
|
+
"get",
|
|
5818
|
+
"create",
|
|
5819
|
+
"update",
|
|
5820
|
+
"delete",
|
|
5821
|
+
"move",
|
|
5822
|
+
"restore",
|
|
5823
|
+
"archive",
|
|
5824
|
+
"unarchive",
|
|
5825
|
+
"search"
|
|
5826
|
+
].includes(value);
|
|
5827
|
+
}
|
|
5828
|
+
function snakeToKebab(value) {
|
|
5829
|
+
return value.replaceAll("_", "-");
|
|
5830
|
+
}
|
|
5831
|
+
function isRecord3(value) {
|
|
5832
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5833
|
+
}
|
|
5834
|
+
|
|
5835
|
+
// src/core/mcp/toolPayload.ts
|
|
5836
|
+
function unwrapMcpToolPayload(value) {
|
|
5837
|
+
if (!isRecord4(value) || !Array.isArray(value.content)) {
|
|
5838
|
+
return value;
|
|
5839
|
+
}
|
|
5840
|
+
const text2 = value.content.map((item) => isRecord4(item) && typeof item.text === "string" ? item.text : "").find((itemText) => itemText.trim().startsWith("{"));
|
|
5841
|
+
if (!text2) {
|
|
5842
|
+
return value;
|
|
5843
|
+
}
|
|
5844
|
+
try {
|
|
5845
|
+
return JSON.parse(text2);
|
|
5846
|
+
} catch {
|
|
5847
|
+
return value;
|
|
5848
|
+
}
|
|
5849
|
+
}
|
|
5850
|
+
function toolErrorText(value) {
|
|
5851
|
+
if (!isRecord4(value) || !Array.isArray(value.content)) {
|
|
5852
|
+
return "The tool returned an error.";
|
|
5853
|
+
}
|
|
5854
|
+
const text2 = value.content.map((item) => isRecord4(item) && typeof item.text === "string" ? item.text : "").filter(Boolean).join("\n");
|
|
5855
|
+
return text2 || "The tool returned an error.";
|
|
5856
|
+
}
|
|
5857
|
+
function isRecord4(value) {
|
|
5858
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5859
|
+
}
|
|
5860
|
+
function extractProjects(value) {
|
|
5861
|
+
const candidates = Array.isArray(value) ? value : isRecord4(value) ? ["projects", "items", "created", "data", "hits"].flatMap((key) => {
|
|
5862
|
+
const nested = value[key];
|
|
5863
|
+
return Array.isArray(nested) ? nested : [];
|
|
5864
|
+
}) : [];
|
|
5865
|
+
const projects = [];
|
|
5866
|
+
for (const candidate of candidates) {
|
|
5867
|
+
if (isRecord4(candidate) && typeof candidate.uuid === "string") {
|
|
5868
|
+
projects.push({
|
|
5869
|
+
uuid: candidate.uuid,
|
|
5870
|
+
name: typeof candidate.name === "string" ? candidate.name : candidate.uuid
|
|
5871
|
+
});
|
|
5872
|
+
}
|
|
5873
|
+
}
|
|
5874
|
+
return projects;
|
|
5875
|
+
}
|
|
5876
|
+
|
|
5877
|
+
// src/core/mcp/operations.ts
|
|
5878
|
+
var SEARCH_TOOL = "search";
|
|
5879
|
+
var OperationError = class extends Error {
|
|
5880
|
+
constructor(message2, code, operation, details) {
|
|
5881
|
+
super(message2);
|
|
5882
|
+
this.code = code;
|
|
5883
|
+
this.operation = operation;
|
|
5884
|
+
this.details = details;
|
|
5885
|
+
this.name = "OperationError";
|
|
5886
|
+
}
|
|
5887
|
+
code;
|
|
5888
|
+
operation;
|
|
5889
|
+
details;
|
|
5890
|
+
};
|
|
5891
|
+
function searchPayload(asked, operation, result) {
|
|
5892
|
+
if (isRecord5(result) && result.isError === true) throw toolRefusal(asked, operation, result);
|
|
5893
|
+
return unwrapMcpToolPayload(result);
|
|
5894
|
+
}
|
|
5895
|
+
function parseOperationPage(result) {
|
|
5896
|
+
const payload = searchPayload("the operation list", SEARCH_TOOL, result);
|
|
5897
|
+
if (!isRecord5(payload) || !Array.isArray(payload.items)) {
|
|
5898
|
+
throw new OperationError("search did not return an items array.", "MCP_PROTOCOL_ERROR", SEARCH_TOOL);
|
|
5899
|
+
}
|
|
5900
|
+
const items = payload.items.flatMap((item) => isRecord5(item) && typeof item.operation === "string" ? [{ operation: item.operation, summary: typeof item.summary === "string" ? item.summary : "" }] : []);
|
|
5901
|
+
const nextCursor = typeof payload.nextCursor === "string" && payload.nextCursor ? payload.nextCursor : void 0;
|
|
5902
|
+
return { items, ...nextCursor ? { nextCursor } : {} };
|
|
5903
|
+
}
|
|
5904
|
+
function parseOperationDetail(operation, result) {
|
|
5905
|
+
const payload = searchPayload(`the detail of ${operation}`, operation, result);
|
|
5906
|
+
if (!isRecord5(payload) || payload.operation !== operation) {
|
|
5907
|
+
throw new OperationError(`search did not return the detail of ${operation}.`, "MCP_PROTOCOL_ERROR", operation);
|
|
5908
|
+
}
|
|
5909
|
+
const executor = payload.executor;
|
|
5910
|
+
if (typeof executor !== "string" || executor.trim() === "") {
|
|
5911
|
+
throw new OperationError(
|
|
5912
|
+
`search detail of ${operation} has no valid executor (${JSON.stringify(executor)}).`,
|
|
5913
|
+
"MCP_PROTOCOL_ERROR",
|
|
5914
|
+
operation
|
|
5915
|
+
);
|
|
5916
|
+
}
|
|
5917
|
+
const hints = isRecord5(payload.annotations) ? payload.annotations : {};
|
|
5918
|
+
return {
|
|
5919
|
+
operation,
|
|
5920
|
+
summary: typeof payload.summary === "string" ? payload.summary : "",
|
|
5921
|
+
executor,
|
|
5922
|
+
annotations: {
|
|
5923
|
+
...typeof hints.readOnlyHint === "boolean" ? { readOnlyHint: hints.readOnlyHint } : {},
|
|
5924
|
+
...typeof hints.destructiveHint === "boolean" ? { destructiveHint: hints.destructiveHint } : {},
|
|
5925
|
+
...typeof hints.idempotentHint === "boolean" ? { idempotentHint: hints.idempotentHint } : {},
|
|
5926
|
+
...typeof hints.openWorldHint === "boolean" ? { openWorldHint: hints.openWorldHint } : {}
|
|
5927
|
+
},
|
|
5928
|
+
inputSchema: isRecord5(payload.inputSchema) ? payload.inputSchema : { type: "object", properties: {} }
|
|
5929
|
+
};
|
|
5930
|
+
}
|
|
5931
|
+
var SEARCH_PAGE_MAX = 50;
|
|
5932
|
+
var MAX_PAGES = 20;
|
|
5933
|
+
function searchVocabulary(searchTool) {
|
|
5934
|
+
const props = isRecord5(searchTool) && isRecord5(searchTool.inputSchema) && isRecord5(searchTool.inputSchema.properties) ? searchTool.inputSchema.properties : {};
|
|
5935
|
+
const values = (facet) => {
|
|
5936
|
+
const prop = props[facet];
|
|
5937
|
+
const items = isRecord5(prop) && isRecord5(prop.items) ? prop.items : {};
|
|
5938
|
+
return Array.isArray(items.enum) ? items.enum.filter((value) => typeof value === "string") : [];
|
|
5939
|
+
};
|
|
5940
|
+
const vocabulary = { action: values("action"), object: values("object") };
|
|
5941
|
+
if (vocabulary.action.length === 0 || vocabulary.object.length === 0) {
|
|
5942
|
+
throw new OperationError("tools/list has no search tool with action/object vocabularies.", "MCP_PROTOCOL_ERROR", SEARCH_TOOL);
|
|
5943
|
+
}
|
|
5944
|
+
return vocabulary;
|
|
5945
|
+
}
|
|
5946
|
+
async function listAllOperations(input) {
|
|
5947
|
+
const vocabulary = searchVocabulary((await input.toolsList()).find((tool) => isRecord5(tool) && tool.name === SEARCH_TOOL));
|
|
5948
|
+
const byName = /* @__PURE__ */ new Map();
|
|
5949
|
+
let cursor;
|
|
5950
|
+
for (let page = 0; page < MAX_PAGES; page += 1) {
|
|
5951
|
+
const result = parseOperationPage(await input.callPublic(SEARCH_TOOL, { ...vocabulary, limit: SEARCH_PAGE_MAX, ...cursor ? { cursor } : {} }));
|
|
5952
|
+
for (const line of result.items) if (!byName.has(line.operation)) byName.set(line.operation, line);
|
|
5953
|
+
cursor = result.nextCursor;
|
|
5954
|
+
if (!cursor) return [...byName.values()].sort((a, b) => a.operation.localeCompare(b.operation));
|
|
5955
|
+
}
|
|
5956
|
+
throw new OperationError(`search kept returning a next page after ${MAX_PAGES} pages.`, "MCP_PROTOCOL_ERROR", SEARCH_TOOL);
|
|
5957
|
+
}
|
|
5958
|
+
var OperationCaller = class {
|
|
5959
|
+
constructor(callPublic) {
|
|
5960
|
+
this.callPublic = callPublic;
|
|
5961
|
+
}
|
|
5962
|
+
callPublic;
|
|
5963
|
+
details = /* @__PURE__ */ new Map();
|
|
5964
|
+
detail(operation) {
|
|
5965
|
+
let found = this.details.get(operation);
|
|
5966
|
+
if (!found) {
|
|
5967
|
+
found = this.callPublic(SEARCH_TOOL, { operation }).then((result) => parseOperationDetail(operation, result));
|
|
5968
|
+
found.catch(() => this.details.delete(operation));
|
|
5969
|
+
this.details.set(operation, found);
|
|
5970
|
+
}
|
|
5971
|
+
return found;
|
|
5972
|
+
}
|
|
5973
|
+
async call(operation, args) {
|
|
5974
|
+
const detail = await this.detail(operation);
|
|
5975
|
+
return this.callPublic(detail.executor, { operation, args });
|
|
5976
|
+
}
|
|
5977
|
+
};
|
|
5978
|
+
function toolRefusal(asked, operation, result) {
|
|
5979
|
+
const text2 = toolErrorText(result);
|
|
5980
|
+
let code = "MCP_TOOL_ERROR";
|
|
5981
|
+
try {
|
|
5982
|
+
const parsed = JSON.parse(text2);
|
|
5983
|
+
if (isRecord5(parsed) && typeof parsed.code === "string" && parsed.code) code = parsed.code;
|
|
5984
|
+
} catch {
|
|
5985
|
+
}
|
|
5986
|
+
return new OperationError(`search refused ${asked}: ${text2}`, code, operation, result);
|
|
5987
|
+
}
|
|
5988
|
+
function isRecord5(value) {
|
|
5989
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5990
|
+
}
|
|
5991
|
+
|
|
5702
5992
|
// src/core/mcp/rpcClient.ts
|
|
5703
5993
|
var CHANNEL_HEADER = "X-AiNecto-Channel";
|
|
5704
5994
|
var AGENT_HEADER = "X-AiNecto-Agent";
|
|
@@ -5725,11 +6015,16 @@ var McpRpcClient = class {
|
|
|
5725
6015
|
constructor(options) {
|
|
5726
6016
|
this.options = options;
|
|
5727
6017
|
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
6018
|
+
this.operations = new OperationCaller((tool, args) => this.request("tools/call", { name: tool, arguments: args }));
|
|
5728
6019
|
}
|
|
5729
6020
|
options;
|
|
5730
6021
|
fetchImpl;
|
|
5731
6022
|
nextId = 1;
|
|
5732
6023
|
agent;
|
|
6024
|
+
/** operation → 실행 도구 — 상세(executor)는 이 연결에서 한 번만 묻는다. */
|
|
6025
|
+
operations;
|
|
6026
|
+
/** 서버가 공개한 도구 이름 — 진실원은 tools/list. 연결당 한 번(실패는 기억하지 않는다). */
|
|
6027
|
+
publicTools;
|
|
5733
6028
|
/**
|
|
5734
6029
|
* 브리지 전용 — 호스트 에이전트가 보낸 {@code initialize} 의 {@code clientInfo.name}(프로그램 고정 이름).
|
|
5735
6030
|
* 이후 모든 요청의 {@code X-AiNecto-Agent} 헤더로 싣는다. 직접 명령은 부르지 않는다(누가 셸을 돌렸는지 모른다).
|
|
@@ -5746,13 +6041,41 @@ var McpRpcClient = class {
|
|
|
5746
6041
|
}
|
|
5747
6042
|
async toolsList() {
|
|
5748
6043
|
const result = await this.request("tools/list", {});
|
|
5749
|
-
if (!
|
|
6044
|
+
if (!isRecord6(result) || !Array.isArray(result.tools)) {
|
|
5750
6045
|
throw new McpRpcError("tools/list response did not include a tools array.", "MCP_PROTOCOL_ERROR", result);
|
|
5751
6046
|
}
|
|
6047
|
+
this.publicTools = Promise.resolve(toolNames(result.tools));
|
|
5752
6048
|
return result.tools;
|
|
5753
6049
|
}
|
|
6050
|
+
/** 공개 도구 이름 — 이 연결에서 아직 모르면 tools/list 를 한 번 부른다. */
|
|
6051
|
+
publicToolNames() {
|
|
6052
|
+
if (!this.publicTools) {
|
|
6053
|
+
const pending = this.toolsList().then(toolNames);
|
|
6054
|
+
pending.catch(() => {
|
|
6055
|
+
if (this.publicTools === pending) this.publicTools = void 0;
|
|
6056
|
+
});
|
|
6057
|
+
this.publicTools = pending;
|
|
6058
|
+
}
|
|
6059
|
+
return this.publicTools;
|
|
6060
|
+
}
|
|
6061
|
+
/**
|
|
6062
|
+
* ★CLI 안의 모든 도구 호출이 지나는 한 입구. 서버 tools/list 에 있는 공개 도구(search·execute_*·open_ainecto_panel)는
|
|
6063
|
+
* 자기 이름으로 한 번만, 그 밖의 이름은 operation 으로 보고 {@code <executor> {operation, args}} 로 바꿔 부른다(operations.ts)
|
|
6064
|
+
* — 서버는 옛 108개 이름을 거절한다. 공개 이름의 사본은 두지 않는다(리뷰 r1 P1-3).
|
|
6065
|
+
* 옛 {@code mcp__ainecto__} 앞머리는 뗀다. 브리지(sendRaw)는 이 길을 지나지 않는다 — 호스트가 고른 도구 그대로 간다.
|
|
6066
|
+
*/
|
|
5754
6067
|
async toolsCall(name, args) {
|
|
5755
|
-
|
|
6068
|
+
const bare = bareToolName(name);
|
|
6069
|
+
const payload = isRecord6(args) ? args : {};
|
|
6070
|
+
return (await this.publicToolNames()).has(bare) ? this.request("tools/call", { name: bare, arguments: payload }) : this.operations.call(bare, payload);
|
|
6071
|
+
}
|
|
6072
|
+
/**
|
|
6073
|
+
* {@link toolsCall} 가 이 이름을 부를 때 쓸 상세 — 공개 도구 이름이면 undefined(자기 이름으로 바로 간다).
|
|
6074
|
+
* 같은 연결의 상세라 뒤이은 toolsCall 이 똑같은 것을 쓴다(실행 전 판단과 실행이 같은 사실을 본다).
|
|
6075
|
+
*/
|
|
6076
|
+
async operationDetailFor(name) {
|
|
6077
|
+
const bare = bareToolName(name);
|
|
6078
|
+
return (await this.publicToolNames()).has(bare) ? void 0 : this.operations.detail(bare);
|
|
5756
6079
|
}
|
|
5757
6080
|
async request(method, params) {
|
|
5758
6081
|
const response = await this.sendRaw({
|
|
@@ -5839,7 +6162,7 @@ var McpRpcClient = class {
|
|
|
5839
6162
|
function rateLimitedResponse(text2, retryAfter) {
|
|
5840
6163
|
const envelope = rpcErrorEnvelope(text2);
|
|
5841
6164
|
if (envelope) {
|
|
5842
|
-
const data =
|
|
6165
|
+
const data = isRecord6(envelope.error.data) ? envelope.error.data : {};
|
|
5843
6166
|
const seconds = parseRetryAfter(retryAfter);
|
|
5844
6167
|
if (data.retryAfterSeconds === void 0 && seconds !== void 0) {
|
|
5845
6168
|
envelope.error.data = { ...data, retryAfterSeconds: seconds };
|
|
@@ -5851,7 +6174,7 @@ function rateLimitedResponse(text2, retryAfter) {
|
|
|
5851
6174
|
}
|
|
5852
6175
|
function rpcErrorEnvelope(text2) {
|
|
5853
6176
|
const parsed = parseJsonOrUndefined(text2);
|
|
5854
|
-
return isJsonRpcResponse(parsed) && "error" in parsed &&
|
|
6177
|
+
return isJsonRpcResponse(parsed) && "error" in parsed && isRecord6(parsed.error) ? parsed : void 0;
|
|
5855
6178
|
}
|
|
5856
6179
|
function parseJsonOrUndefined(text2) {
|
|
5857
6180
|
try {
|
|
@@ -5861,8 +6184,8 @@ function parseJsonOrUndefined(text2) {
|
|
|
5861
6184
|
}
|
|
5862
6185
|
}
|
|
5863
6186
|
function describeRpcError(error) {
|
|
5864
|
-
const data =
|
|
5865
|
-
const messages =
|
|
6187
|
+
const data = isRecord6(error.data) ? error.data : {};
|
|
6188
|
+
const messages = isRecord6(data.messages) ? data.messages : {};
|
|
5866
6189
|
const sentence = [error.message, data.message, messages.en, messages.ko].find((value) => typeof value === "string" && value.trim() !== "");
|
|
5867
6190
|
const code = typeof data.code === "string" && data.code.trim() ? data.code.trim() : void 0;
|
|
5868
6191
|
if (!code) {
|
|
@@ -5871,7 +6194,7 @@ function describeRpcError(error) {
|
|
|
5871
6194
|
return describeServerError({ error: code, description: sentence });
|
|
5872
6195
|
}
|
|
5873
6196
|
function isToolError(result) {
|
|
5874
|
-
return
|
|
6197
|
+
return isRecord6(result) && result.isError === true;
|
|
5875
6198
|
}
|
|
5876
6199
|
function agentHeaderValue(clientName) {
|
|
5877
6200
|
return printableHeaderValue(clientName);
|
|
@@ -5890,7 +6213,7 @@ function parseServerError(body) {
|
|
|
5890
6213
|
} catch {
|
|
5891
6214
|
return void 0;
|
|
5892
6215
|
}
|
|
5893
|
-
if (!
|
|
6216
|
+
if (!isRecord6(parsed) || typeof parsed.error !== "string" || !parsed.error.trim()) {
|
|
5894
6217
|
return void 0;
|
|
5895
6218
|
}
|
|
5896
6219
|
return {
|
|
@@ -5903,9 +6226,12 @@ function describeServerError(serverError) {
|
|
|
5903
6226
|
return line.replace(/\s+/g, " ").trim();
|
|
5904
6227
|
}
|
|
5905
6228
|
function isJsonRpcResponse(value) {
|
|
5906
|
-
return
|
|
6229
|
+
return isRecord6(value) && value.jsonrpc === "2.0" && ("result" in value || "error" in value);
|
|
5907
6230
|
}
|
|
5908
|
-
function
|
|
6231
|
+
function toolNames(tools) {
|
|
6232
|
+
return new Set(tools.flatMap((tool) => isRecord6(tool) && typeof tool.name === "string" ? [tool.name] : []));
|
|
6233
|
+
}
|
|
6234
|
+
function isRecord6(value) {
|
|
5909
6235
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5910
6236
|
}
|
|
5911
6237
|
function httpErrorDetails(status, body, envVars) {
|
|
@@ -6036,7 +6362,7 @@ var OAuthClient = class {
|
|
|
6036
6362
|
};
|
|
6037
6363
|
function generatePkcePair() {
|
|
6038
6364
|
const codeVerifier = randomBytes(32).toString("base64url");
|
|
6039
|
-
const codeChallenge =
|
|
6365
|
+
const codeChallenge = createHash3("sha256").update(codeVerifier).digest("base64url");
|
|
6040
6366
|
return { codeVerifier, codeChallenge };
|
|
6041
6367
|
}
|
|
6042
6368
|
function generateOAuthState() {
|
|
@@ -6547,11 +6873,11 @@ Retries: send a unique clientMutationId with each write; if you retry the same c
|
|
|
6547
6873
|
{ "mcpName": "unfavorite_documents", "commandPath": ["tools", "run", "unfavorite-documents"], "group": "document", "description": "Remove documents from the signed-in user's favorites (favorite_documents). Works even for a document the user can no longer open, and a document that was not a favorite is returned the same way. The documents themselves are not changed. Targets are UUIDs only; names are never matched and may repeat. Look the UUID up first, and when more than one candidate fits what the user said, ask which one. Items run in order and each one commits on its own: the first failing item ends the call with an error, items before it stay applied (the error does not list them), and later items are not tried \u2014 re-read before retrying. Returns unfavorited: [{documentUuid, favorited: false}] and count.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "uuids": { "description": "Document UUIDs to remove from favorites", "items": { "description": "Document UUID", "type": "string" }, "type": "array" } }, "required": ["uuids"], "type": "object" }, "required": ["uuids"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "prod", "schemaHash": "5464109984aa000d" },
|
|
6548
6874
|
{ "mcpName": "unsubscribe_documents", "commandPath": ["tools", "run", "unsubscribe-documents"], "group": "document", "description": "Stop the signed-in user's subscription to documents (subscribe_documents) \u2014 no more change notifications for them. Works even for a document the user can no longer open, and a document that was not subscribed is returned the same way. Notifications already received stay in the inbox. Targets are UUIDs only; names are never matched and may repeat. Look the UUID up first, and when more than one candidate fits what the user said, ask which one. Items run in order and each one commits on its own: the first failing item ends the call with an error, items before it stay applied (the error does not list them), and later items are not tried \u2014 re-read before retrying. Returns unsubscribed: [{documentUuid, subscribed: false}] and count.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "uuids": { "description": "Document UUIDs to unsubscribe from", "items": { "description": "Document UUID", "type": "string" }, "type": "array" } }, "required": ["uuids"], "type": "object" }, "required": ["uuids"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "prod", "schemaHash": "3c032d27d8adc84d" },
|
|
6549
6875
|
{ "mcpName": "update_agent_todos", "commandPath": ["agent-todos", "update"], "group": "generic", "description": "Claim, renew, complete, release, or dismiss the signed-in user's agent to-dos. Only the session holding the current leaseToken may renew, release, or complete a claimed to-do \u2014 even another session of the same connection gets CLAIMED_BY_OTHER. Results are per item: {todoId, ok: true, state, leaseToken?, claimExpiresAt?} or {todoId, ok: false, error} with error one of CLAIMED_BY_OTHER, LEASE_LOST, ALREADY_DONE, CLOSED_BY_HUMAN, SUPERSEDED, ACCESS_LOST, BUSINESS_ACTION_REQUIRED, NOT_FOUND, INVALID \u2014 on CLOSED_BY_HUMAN or SUPERSEDED stop working on it. BUSINESS_ACTION_REQUIRED: card to-dos (CARD_*) cannot be completed here; doing the card action closes them. Retrying the same complete or dismiss returns ok again. To mark the person's notifications read (only when they ask), use mark_notifications_read.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "To-dos to update; each item is applied and reported on its own.", "items": { "additionalProperties": false, "properties": { "action": { "description": "claim: take it (returns leaseToken, valid 30 minutes). renew: extend your lease. complete: done (with leaseToken if you claimed it; without one only while it is still OPEN). release: give it back. dismiss: not a to-do.", "enum": ["claim", "renew", "complete", "release", "dismiss"], "type": "string" }, "leaseToken": { "description": "Required for renew and release, and for complete or dismiss of a to-do you claimed.", "type": "string" }, "note": { "description": "For complete or dismiss: one line on what you did (at most 500 characters, no document bodies). The person sees it in the inbox.", "maxLength": 500, "type": "string" }, "todoId": { "description": "todoId from list_agent_todos.", "type": "string" } }, "required": ["todoId", "action"], "type": "object" }, "maxItems": 50, "minItems": 1, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "prod", "schemaHash": "35cde49fba4c9f5f" },
|
|
6550
|
-
{ "mcpName": "update_agents", "commandPath": ["agents", "update"], "group": "generic", "description": "Rename, archive or unarchive the signed-in user's named agents (see list_agents), or set the project an agent works in (projectUuid; display only). Each item commits on its own and a failing item does not stop the others. Results are per item: {agentUuid, ok: true, agent, note?} or {agentUuid, ok: false, error: {code, message}} with code one of AGENT_NOT_FOUND, AGENT_NAME_INVALID, AGENT_NAME_TAKEN, AGENT_HAS_OPEN_WORK (open cards or to-dos still point at the agent \u2014 reassign them first; counts are in openCards and openTodos), PROJECT_NOT_FOUND (no such project, or you cannot read it), AGENT_INVALID. After a rename, change the name in that agent's folder connection settings too, or it connects with the old name again and a new agent appears.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "Agents to change; each item is applied and reported on its own.", "items": { "additionalProperties": false, "properties": { "agentUuid": { "description": "agentUuid from list_agents.", "type": "string" }, "archived": { "description": "true archives the agent (it disappears from pickers; its history stays), false brings it back. An archived agent that connects again with its name is brought back automatically.", "type": "boolean" }, "clientMutationId": { "description": "Optional id echoed back in this item's result.", "type": "string" }, "name": { "description": "New name \u2014 lowercase letters, digits, '.', '_' and '-', starting with a letter or digit (stored in lowercase).", "maxLength": 64, "type": "string" }, "projectUuid": { "description": "The project this agent works in (projectUuid from list_projects) \u2014 shown next to the agent in list_agents and when picking an agent for a card. Display only: it does not limit what the agent can do or which cards it can get. An empty string clears it. You must be able to read the project.", "type": "string" } }, "required": ["agentUuid"], "type": "object" }, "maxItems": 50, "minItems": 1, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive":
|
|
6876
|
+
{ "mcpName": "update_agents", "commandPath": ["agents", "update"], "group": "generic", "description": "Rename, archive or unarchive the signed-in user's named agents (see list_agents), or set the project an agent works in (projectUuid; display only). Each item commits on its own and a failing item does not stop the others. Results are per item: {agentUuid, ok: true, agent, note?} or {agentUuid, ok: false, error: {code, message}} with code one of AGENT_NOT_FOUND, AGENT_NAME_INVALID, AGENT_NAME_TAKEN, AGENT_HAS_OPEN_WORK (open cards or to-dos still point at the agent \u2014 reassign them first; counts are in openCards and openTodos), PROJECT_NOT_FOUND (no such project, or you cannot read it), AGENT_INVALID. After a rename, change the name in that agent's folder connection settings too, or it connects with the old name again and a new agent appears.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "Agents to change; each item is applied and reported on its own.", "items": { "additionalProperties": false, "properties": { "agentUuid": { "description": "agentUuid from list_agents.", "type": "string" }, "archived": { "description": "true archives the agent (it disappears from pickers; its history stays), false brings it back. An archived agent that connects again with its name is brought back automatically.", "type": "boolean" }, "clientMutationId": { "description": "Optional id echoed back in this item's result.", "type": "string" }, "name": { "description": "New name \u2014 lowercase letters, digits, '.', '_' and '-', starting with a letter or digit (stored in lowercase).", "maxLength": 64, "type": "string" }, "projectUuid": { "description": "The project this agent works in (projectUuid from list_projects) \u2014 shown next to the agent in list_agents and when picking an agent for a card. Display only: it does not limit what the agent can do or which cards it can get. An empty string clears it. You must be able to read the project.", "type": "string" } }, "required": ["agentUuid"], "type": "object" }, "maxItems": 50, "minItems": 1, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "prod", "schemaHash": "04b7bb798d169034" },
|
|
6551
6877
|
{ "mcpName": "update_comments", "commandPath": ["comments", "update"], "group": "generic", "description": "Edit your own comments on a document or a kanban card (cardUuid). Only the author can edit, and only while they can still read it. A resolved question and a top-level comment that already has replies are locked. Items are applied in order and each one commits on its own; results report each item.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "cardUuid": { "description": "Kanban card UUID the comments belong to (from kanban_list_cards). Anyone who can read the card's board may comment. Give this or documentUuid, not both.", "type": "string" }, "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "documentUuid": { "description": "Document UUID the comments belong to. Give this or cardUuid, not both.", "type": "string" }, "items": { "description": "Edits, applied in order", "items": { "additionalProperties": false, "properties": { "body": { "description": "New comment text (replaces the old text).", "maxLength": 1e4, "minLength": 1, "type": "string" }, "clientMutationId": { "description": "Idempotency key (visible ASCII, at most 128 characters). Required when mentionUserIds is not empty; reuse the same value when retrying the same item so the mention email is not sent twice.", "maxLength": 128, "type": "string" }, "id": { "description": "Comment id (from mcp__ainecto__list_comments)", "minimum": 1, "type": "integer" }, "mentionUserIds": { "description": "The complete set of userIds mentioned after the edit; omit to remove all mentions. Each one's @<displayName> must appear in body. Only people who were not mentioned before get a notification email.", "items": { "type": "string" }, "maxItems": 20, "type": "array", "uniqueItems": true } }, "required": ["id", "body"], "type": "object" }, "minItems": 1, "type": "array" }, "mailLanguage": { "description": "Language of the comment notification email (mention or reply). Defaults to en.", "enum": ["en", "ko"], "type": "string" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "prod", "schemaHash": "04ef0a3cecca04ee" },
|
|
6552
6878
|
{ "mcpName": "update_documents", "commandPath": ["documents", "update"], "group": "document", "description": "Update documents: the title and/or the whole body. A body you send replaces the current body entirely \u2014 it is not a patch, so read the document first and send the full new text. The document type decides the body field (see body and typePayload): file documents can only be renamed, ERD content changes through erd_apply_changes, diagram nodes and edges through diagram_apply_changes, and board documents are refused. Every body change is kept in version history, so list_versions and restore_versions can undo it. Needs edit access. Items run in order and each one commits on its own: the first failing item ends the call with an error, items before it stay applied (the error does not list them), and later items are not tried \u2014 re-read before retrying. Returns updated (document rows) and count. Fails with 409 when the document is in the trash or its folder, project or workspace is archived. If a replacement body is tens of KB or more, prefer request_upload_token (purpose=document.update) and upload the body with curl. While you write a document, people who open it see that an AI agent is writing it (with your agent name and the time of your last write). When the document is complete, call finish_documents; otherwise the notice ends 10 minutes after your last write.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "Updates", "items": { "additionalProperties": false, "properties": { "basedOn": { "description": "Documents this one is based on (at most 50). Put only documents you actually used as a basis as TRACK; leave out sibling documents written alongside this one, or add them as REFERENCE. kind TRACK (default) records the source version and tells this document's owner when the source is updated so they can review it; REFERENCE is a plain link. If you read the source with get_document (or get_version), pass its readVersion as version \u2014 if that version was overwritten after you read it you get 409, read again. If readVersion is null (changes not yet saved as a version, or a type whose get_document does not return the whole content) read it with get_version and pass that readVersion, or omit version (always omit it when get_version's readVersion is null too). Omitting version records the latest version at save time and does not prove what you read. An existing tracking relation is confirmed to that version; an existing reference is promoted to tracking; kind REFERENCE never demotes a tracking relation (use document_relations SET_KIND). Relations not listed are left as they are.", "items": { "additionalProperties": false, "properties": { "documentUuid": { "description": "Source document UUID", "type": "string" }, "kind": { "description": "TRACK (default) or REFERENCE", "enum": ["REFERENCE", "TRACK"], "type": "string" }, "version": { "additionalProperties": false, "description": "The readVersion you got from get_document or get_version, as given", "properties": { "hash": { "description": "Version hash from readVersion", "type": "string" }, "number": { "description": "Version number from readVersion", "type": "integer" } }, "required": ["number", "hash"], "type": "object" } }, "required": ["documentUuid"], "type": "object" }, "type": "array" }, "body": { "description": "Deprecated compatibility alias for typePayload.body when document type is markdown. \uBCF8\uBB38\uC774 \uC218\uC2ED KB \uC774\uC0C1\uC73C\uB85C \uD06C\uBA74 LLM \uD1A0\uD070 \uC808\uC57D\uC744 \uC704\uD574 `request_upload_token (purpose=document.update)` \uB97C \uD638\uCD9C\uD574 uploadUrl \uC744 \uBC1B\uACE0 curl \uB85C \uC9C1\uC811 PUT \uC73C\uB85C \uBCF4\uB0BC \uAC83.", "type": "string" }, "title": { "description": "New title", "type": "string" }, "typePayload": { "additionalProperties": true, "description": "Type-specific payload for enabled document types. markdown: {body}; diagram: {sourceLanguage,edgeStyle,isModule,metadata,diagramSource} \u2014 the canvas is drawn only from nodes/edges/groups made with diagram_apply_changes; diagramSource is optional text kept beside them, never converted, and refused while the diagram has no nodes; openapi: {content}; html: {content} (a full HTML page); file: {file:{filename,contentType,sizeBytes,viewerKind}} (+content for text/CSV, first 64 KB); kanban: no body \u2014 only the title can be updated; cards are changed with kanban_apply_changes and kanban_card_action; design: no body \u2014 only the title can be updated; the canvas is changed with design_apply_changes.", "type": "object" }, "uuid": { "description": "Document UUID", "type": "string" } }, "required": ["uuid"], "type": "object" }, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "prod", "schemaHash": "ef6e145a6a639575" },
|
|
6553
6879
|
{ "mcpName": "update_folders", "commandPath": ["folders", "update"], "group": "generic", "description": "Rename folders (only the name; move_folders moves them). Names do not have to be unique. Needs edit access to the folder. Targets are UUIDs only; names are never matched and may repeat. Look the UUID up first, and when more than one candidate fits what the user said, ask which one. Items run in order and each one commits on its own: the first failing item ends the call with an error, items before it stay applied (the error does not list them), and later items are not tried \u2014 re-read before retrying. Sends no email or inbox notification. Returns updated (folder rows) and count. Fails with 404, 403, or 409 when the folder or a parent folder is archived.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "Updates", "items": { "additionalProperties": false, "properties": { "name": { "description": "New name", "type": "string" }, "uuid": { "description": "Folder UUID", "type": "string" } }, "required": ["uuid", "name"], "type": "object" }, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "prod", "schemaHash": "a83ac73386dc3339" },
|
|
6554
|
-
{ "mcpName": "update_project_members", "commandPath": ["project-members", "update"], "group": "generic", "description": 'Change the role of one person who is already invited to or added to a project (a pending invitation too), with the same rules as the AiNecto app. role is required: if the user has not said which role to give, ask them first and never assume one (a call without role is refused with reason ROLE_REQUIRED). Only an owner or admin of the project can change roles; people outside the team can only be VIEWER. Refusals are error GRANT_NOT_ALLOWED with reason, a message to pass on to the user as is (message; messages.ko/en) and nextAction. If the person has no invitation or access on this project itself, the call fails with 404: invite them with invite_project_members instead. To add someone new, use invite_project_members. Targets are UUIDs only; names are never matched and may repeat. Look the UUID up first, and when more than one candidate fits what the user said, ask which one. Example: {"projectUuid":"<uuid>","email":"kim@example.com","role":"EDITOR"} returns {"status":"ROLE_CHANGED","previousRole":"VIEWER","grant":{...,"role":"EDITOR"},...}. Returns status, projectUuid, projectUrl, grant, previousRole and nextAction.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.', "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "email": { "description": "Email address of the person. Give exactly one of email or userId.", "type": "string" }, "projectUuid": { "description": "Project UUID.", "type": "string" }, "role": { "description": "New role (required). If the user has not said which role, ask them first; never assume one. People outside the team can only be VIEWER.", "enum": ["ADMIN", "EDITOR", "VIEWER"], "type": "string" }, "userId": { "description": "User id of the person. Give exactly one of email or userId.", "type": "string" } }, "required": ["projectUuid"], "type": "object" }, "required": ["projectUuid"], "payloadMode": "flags", "destructive":
|
|
6880
|
+
{ "mcpName": "update_project_members", "commandPath": ["project-members", "update"], "group": "generic", "description": 'Change the role of one person who is already invited to or added to a project (a pending invitation too), with the same rules as the AiNecto app. role is required: if the user has not said which role to give, ask them first and never assume one (a call without role is refused with reason ROLE_REQUIRED). Only an owner or admin of the project can change roles; people outside the team can only be VIEWER. Refusals are error GRANT_NOT_ALLOWED with reason, a message to pass on to the user as is (message; messages.ko/en) and nextAction. If the person has no invitation or access on this project itself, the call fails with 404: invite them with invite_project_members instead. To add someone new, use invite_project_members. Targets are UUIDs only; names are never matched and may repeat. Look the UUID up first, and when more than one candidate fits what the user said, ask which one. Example: {"projectUuid":"<uuid>","email":"kim@example.com","role":"EDITOR"} returns {"status":"ROLE_CHANGED","previousRole":"VIEWER","grant":{...,"role":"EDITOR"},...}. Returns status, projectUuid, projectUrl, grant, previousRole and nextAction.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.', "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "email": { "description": "Email address of the person. Give exactly one of email or userId.", "type": "string" }, "projectUuid": { "description": "Project UUID.", "type": "string" }, "role": { "description": "New role (required). If the user has not said which role, ask them first; never assume one. People outside the team can only be VIEWER.", "enum": ["ADMIN", "EDITOR", "VIEWER"], "type": "string" }, "userId": { "description": "User id of the person. Give exactly one of email or userId.", "type": "string" } }, "required": ["projectUuid"], "type": "object" }, "required": ["projectUuid"], "payloadMode": "flags", "destructive": true, "sourceCatalog": "prod", "schemaHash": "75c93f622e212416" },
|
|
6555
6881
|
{ "mcpName": "update_projects", "commandPath": ["projects", "update"], "group": "generic", "description": 'Rename projects or change their description (projectKey cannot be changed here). Omitted fields stay as they are, a blank name is ignored, and description "" clears it. Names do not have to be unique. Needs admin or owner rights on the project. Targets are UUIDs only; names are never matched and may repeat. Look the UUID up first, and when more than one candidate fits what the user said, ask which one. Items run in order and each one commits on its own: the first failing item ends the call with an error, items before it stay applied (the error does not list them), and later items are not tried \u2014 re-read before retrying. Sends no email or inbox notification. Returns updated (project rows) and count. Fails with 404 for an unknown UUID and 403 without rights or when the project or its workspace is archived.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.', "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "Updates", "items": { "additionalProperties": false, "properties": { "description": { "description": "New description", "type": "string" }, "name": { "description": "New name", "type": "string" }, "uuid": { "description": "Project UUID", "type": "string" } }, "required": ["uuid"], "type": "object" }, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "prod", "schemaHash": "1e87173984d15609" },
|
|
6556
6882
|
{ "mcpName": "update_workspaces", "commandPath": ["workspaces", "update"], "group": "workspace", "description": 'Rename workspaces or change their description. Omitted fields stay as they are, a blank name is ignored, and description "" clears it. Names do not have to be unique. Needs admin or owner rights. Targets are UUIDs only; names are never matched and may repeat. Look the UUID up first, and when more than one candidate fits what the user said, ask which one. Items run in order and each one commits on its own: the first failing item ends the call with an error, items before it stay applied (the error does not list them), and later items are not tried \u2014 re-read before retrying. Sends no email or inbox notification. Returns updated (workspace rows) and count. Fails with 404 for an unknown UUID and 403 without rights or when the workspace is archived.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.', "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "Updates", "items": { "additionalProperties": false, "properties": { "description": { "description": "New description", "type": "string" }, "name": { "description": "New name", "type": "string" }, "uuid": { "description": "Workspace UUID", "type": "string" } }, "required": ["uuid"], "type": "object" }, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "prod", "schemaHash": "95349c371bc644c8" },
|
|
6557
6883
|
{ "mcpName": "upload_attachments", "commandPath": ["tools", "run", "upload-attachments"], "group": "attachment", "description": "Register files you have already uploaded as attachments of documents. Steps: (1) request_upload_token with purpose=attachment.upload and {documentUuid, filename}; (2) PUT the file bytes with curl to the returned URL; (3) call this with the storageKey from step 1 \u2014 without step 2 it fails. sizeBytes, when given, must equal the uploaded size. A storageKey registers once (409 after that). Files over the server's attachment size limit or beyond the storage quota are refused, and the server decides the stored content type. File documents cannot take attachments. Needs edit access to the document. Items run in order and each one commits on its own: the first failing item ends the call with an error, items before it stay applied (the error does not list them), and later items are not tried \u2014 re-read before retrying. Sends no email or inbox notification. Returns uploaded (attachment rows) and count.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "Attachments to register", "items": { "additionalProperties": false, "properties": { "contentType": { "description": "MIME type", "type": "string" }, "documentUuid": { "description": "Parent document UUID", "type": "string" }, "filename": { "description": "Original file name", "type": "string" }, "sizeBytes": { "description": "Size in bytes", "type": "integer" }, "storageKey": { "description": "Storage key returned by request_upload_token purpose=attachment.upload", "type": "string" } }, "required": ["documentUuid", "filename", "storageKey"], "type": "object" }, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "binary-upload", "destructive": false, "sourceCatalog": "prod", "schemaHash": "4b6b98cb4150bc28" }
|
|
@@ -6656,7 +6982,7 @@ Retries: send a unique clientMutationId with each write; if you retry the same c
|
|
|
6656
6982
|
{ "mcpName": "unfavorite_documents", "commandPath": ["tools", "run", "unfavorite-documents"], "group": "document", "description": "Remove documents from the signed-in user's favorites (favorite_documents). Works even for a document the user can no longer open, and a document that was not a favorite is returned the same way. The documents themselves are not changed. Targets are UUIDs only; names are never matched and may repeat. Look the UUID up first, and when more than one candidate fits what the user said, ask which one. Items run in order and each one commits on its own: the first failing item ends the call with an error, items before it stay applied (the error does not list them), and later items are not tried \u2014 re-read before retrying. Returns unfavorited: [{documentUuid, favorited: false}] and count.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "uuids": { "description": "Document UUIDs to remove from favorites", "items": { "description": "Document UUID", "type": "string" }, "type": "array" } }, "required": ["uuids"], "type": "object" }, "required": ["uuids"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "dev", "schemaHash": "5464109984aa000d" },
|
|
6657
6983
|
{ "mcpName": "unsubscribe_documents", "commandPath": ["tools", "run", "unsubscribe-documents"], "group": "document", "description": "Stop the signed-in user's subscription to documents (subscribe_documents) \u2014 no more change notifications for them. Works even for a document the user can no longer open, and a document that was not subscribed is returned the same way. Notifications already received stay in the inbox. Targets are UUIDs only; names are never matched and may repeat. Look the UUID up first, and when more than one candidate fits what the user said, ask which one. Items run in order and each one commits on its own: the first failing item ends the call with an error, items before it stay applied (the error does not list them), and later items are not tried \u2014 re-read before retrying. Returns unsubscribed: [{documentUuid, subscribed: false}] and count.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "uuids": { "description": "Document UUIDs to unsubscribe from", "items": { "description": "Document UUID", "type": "string" }, "type": "array" } }, "required": ["uuids"], "type": "object" }, "required": ["uuids"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "dev", "schemaHash": "3c032d27d8adc84d" },
|
|
6658
6984
|
{ "mcpName": "update_agent_todos", "commandPath": ["agent-todos", "update"], "group": "generic", "description": "Claim, renew, complete, release, or dismiss the signed-in user's agent to-dos. Only the session holding the current leaseToken may renew, release, or complete a claimed to-do \u2014 even another session of the same connection gets CLAIMED_BY_OTHER. Results are per item: {todoId, ok: true, state, leaseToken?, claimExpiresAt?} or {todoId, ok: false, error} with error one of CLAIMED_BY_OTHER, LEASE_LOST, ALREADY_DONE, CLOSED_BY_HUMAN, SUPERSEDED, ACCESS_LOST, BUSINESS_ACTION_REQUIRED, NOT_FOUND, INVALID \u2014 on CLOSED_BY_HUMAN or SUPERSEDED stop working on it. BUSINESS_ACTION_REQUIRED: card to-dos (CARD_*) cannot be completed here; doing the card action closes them. Retrying the same complete or dismiss returns ok again. To mark the person's notifications read (only when they ask), use mark_notifications_read.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "To-dos to update; each item is applied and reported on its own.", "items": { "additionalProperties": false, "properties": { "action": { "description": "claim: take it (returns leaseToken, valid 30 minutes). renew: extend your lease. complete: done (with leaseToken if you claimed it; without one only while it is still OPEN). release: give it back. dismiss: not a to-do.", "enum": ["claim", "renew", "complete", "release", "dismiss"], "type": "string" }, "leaseToken": { "description": "Required for renew and release, and for complete or dismiss of a to-do you claimed.", "type": "string" }, "note": { "description": "For complete or dismiss: one line on what you did (at most 500 characters, no document bodies). The person sees it in the inbox.", "maxLength": 500, "type": "string" }, "todoId": { "description": "todoId from list_agent_todos.", "type": "string" } }, "required": ["todoId", "action"], "type": "object" }, "maxItems": 50, "minItems": 1, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "dev", "schemaHash": "35cde49fba4c9f5f" },
|
|
6659
|
-
{ "mcpName": "update_agents", "commandPath": ["agents", "update"], "group": "generic", "description": "Rename, archive or unarchive the signed-in user's named agents (see list_agents), or set the project an agent works in (projectUuid; display only). Each item commits on its own and a failing item does not stop the others. Results are per item: {agentUuid, ok: true, agent, note?} or {agentUuid, ok: false, error: {code, message}} with code one of AGENT_NOT_FOUND, AGENT_NAME_INVALID, AGENT_NAME_TAKEN, AGENT_HAS_OPEN_WORK (open cards or to-dos still point at the agent \u2014 reassign them first; counts are in openCards and openTodos), PROJECT_NOT_FOUND (no such project, or you cannot read it), AGENT_INVALID. After a rename, change the name in that agent's folder connection settings too, or it connects with the old name again and a new agent appears.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "Agents to change; each item is applied and reported on its own.", "items": { "additionalProperties": false, "properties": { "agentUuid": { "description": "agentUuid from list_agents.", "type": "string" }, "archived": { "description": "true archives the agent (it disappears from pickers; its history stays), false brings it back. An archived agent that connects again with its name is brought back automatically.", "type": "boolean" }, "clientMutationId": { "description": "Optional id echoed back in this item's result.", "type": "string" }, "name": { "description": "New name \u2014 lowercase letters, digits, '.', '_' and '-', starting with a letter or digit (stored in lowercase).", "maxLength": 64, "type": "string" }, "projectUuid": { "description": "The project this agent works in (projectUuid from list_projects) \u2014 shown next to the agent in list_agents and when picking an agent for a card. Display only: it does not limit what the agent can do or which cards it can get. An empty string clears it. You must be able to read the project.", "type": "string" } }, "required": ["agentUuid"], "type": "object" }, "maxItems": 50, "minItems": 1, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive":
|
|
6985
|
+
{ "mcpName": "update_agents", "commandPath": ["agents", "update"], "group": "generic", "description": "Rename, archive or unarchive the signed-in user's named agents (see list_agents), or set the project an agent works in (projectUuid; display only). Each item commits on its own and a failing item does not stop the others. Results are per item: {agentUuid, ok: true, agent, note?} or {agentUuid, ok: false, error: {code, message}} with code one of AGENT_NOT_FOUND, AGENT_NAME_INVALID, AGENT_NAME_TAKEN, AGENT_HAS_OPEN_WORK (open cards or to-dos still point at the agent \u2014 reassign them first; counts are in openCards and openTodos), PROJECT_NOT_FOUND (no such project, or you cannot read it), AGENT_INVALID. After a rename, change the name in that agent's folder connection settings too, or it connects with the old name again and a new agent appears.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "Agents to change; each item is applied and reported on its own.", "items": { "additionalProperties": false, "properties": { "agentUuid": { "description": "agentUuid from list_agents.", "type": "string" }, "archived": { "description": "true archives the agent (it disappears from pickers; its history stays), false brings it back. An archived agent that connects again with its name is brought back automatically.", "type": "boolean" }, "clientMutationId": { "description": "Optional id echoed back in this item's result.", "type": "string" }, "name": { "description": "New name \u2014 lowercase letters, digits, '.', '_' and '-', starting with a letter or digit (stored in lowercase).", "maxLength": 64, "type": "string" }, "projectUuid": { "description": "The project this agent works in (projectUuid from list_projects) \u2014 shown next to the agent in list_agents and when picking an agent for a card. Display only: it does not limit what the agent can do or which cards it can get. An empty string clears it. You must be able to read the project.", "type": "string" } }, "required": ["agentUuid"], "type": "object" }, "maxItems": 50, "minItems": 1, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "dev", "schemaHash": "04b7bb798d169034" },
|
|
6660
6986
|
{ "mcpName": "update_comments", "commandPath": ["comments", "update"], "group": "generic", "description": "Edit your own comments on a document or a kanban card (cardUuid). Only the author can edit, and only while they can still read it. A resolved question and a top-level comment that already has replies are locked. Items are applied in order and each one commits on its own; results report each item.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "cardUuid": { "description": "Kanban card UUID the comments belong to (from kanban_list_cards). Anyone who can read the card's board may comment. Give this or documentUuid, not both.", "type": "string" }, "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "documentUuid": { "description": "Document UUID the comments belong to. Give this or cardUuid, not both.", "type": "string" }, "items": { "description": "Edits, applied in order", "items": { "additionalProperties": false, "properties": { "body": { "description": "New comment text (replaces the old text).", "maxLength": 1e4, "minLength": 1, "type": "string" }, "clientMutationId": { "description": "Idempotency key (visible ASCII, at most 128 characters). Required when mentionUserIds is not empty; reuse the same value when retrying the same item so the mention email is not sent twice.", "maxLength": 128, "type": "string" }, "id": { "description": "Comment id (from mcp__ainecto__list_comments)", "minimum": 1, "type": "integer" }, "mentionUserIds": { "description": "The complete set of userIds mentioned after the edit; omit to remove all mentions. Each one's @<displayName> must appear in body. Only people who were not mentioned before get a notification email.", "items": { "type": "string" }, "maxItems": 20, "type": "array", "uniqueItems": true } }, "required": ["id", "body"], "type": "object" }, "minItems": 1, "type": "array" }, "mailLanguage": { "description": "Language of the comment notification email (mention or reply). Defaults to en.", "enum": ["en", "ko"], "type": "string" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "dev", "schemaHash": "04ef0a3cecca04ee" },
|
|
6661
6987
|
{ "mcpName": "update_documents", "commandPath": ["documents", "update"], "group": "document", "description": "Update documents: the title and/or the whole body. A body you send replaces the current body entirely \u2014 it is not a patch, so read the document first and send the full new text. The document type decides the body field (see body and typePayload): file documents can only be renamed, ERD content changes through erd_apply_changes, diagram nodes and edges through diagram_apply_changes, and board documents are refused. Every body change is kept in version history, so list_versions and restore_versions can undo it. Needs edit access. Items run in order and each one commits on its own: the first failing item ends the call with an error, items before it stay applied (the error does not list them), and later items are not tried \u2014 re-read before retrying. Returns updated (document rows) and count. Fails with 409 when the document is in the trash or its folder, project or workspace is archived. If a replacement body is tens of KB or more, prefer request_upload_token (purpose=document.update) and upload the body with curl. While you write a document, people who open it see that an AI agent is writing it (with your agent name and the time of your last write). When the document is complete, call finish_documents; otherwise the notice ends 10 minutes after your last write.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "Updates", "items": { "additionalProperties": false, "properties": { "basedOn": { "description": "Documents this one is based on (at most 50). kind TRACK (default) records the source version and tells this document's owner when the source is updated so they can review it; REFERENCE is a plain link. If you read the source with get_document (or get_version), pass its readVersion as version \u2014 if that version was overwritten after you read it you get 409, read again. If readVersion is null (changes not yet saved as a version, or a type whose get_document does not return the whole content) read it with get_version and pass that readVersion, or omit version (always omit it when get_version's readVersion is null too). Omitting version records the latest version at save time and does not prove what you read. An existing tracking relation is confirmed to that version; an existing reference is promoted to tracking; kind REFERENCE never demotes a tracking relation (use document_relations SET_KIND). Relations not listed are left as they are.", "items": { "additionalProperties": false, "properties": { "documentUuid": { "description": "Source document UUID", "type": "string" }, "kind": { "description": "TRACK (default) or REFERENCE", "enum": ["REFERENCE", "TRACK"], "type": "string" }, "version": { "additionalProperties": false, "description": "The readVersion you got from get_document or get_version, as given", "properties": { "hash": { "description": "Version hash from readVersion", "type": "string" }, "number": { "description": "Version number from readVersion", "type": "integer" } }, "required": ["number", "hash"], "type": "object" } }, "required": ["documentUuid"], "type": "object" }, "type": "array" }, "body": { "description": "Deprecated compatibility alias for typePayload.body when document type is markdown. \uBCF8\uBB38\uC774 \uC218\uC2ED KB \uC774\uC0C1\uC73C\uB85C \uD06C\uBA74 LLM \uD1A0\uD070 \uC808\uC57D\uC744 \uC704\uD574 `request_upload_token (purpose=document.update)` \uB97C \uD638\uCD9C\uD574 uploadUrl \uC744 \uBC1B\uACE0 curl \uB85C \uC9C1\uC811 PUT \uC73C\uB85C \uBCF4\uB0BC \uAC83.", "type": "string" }, "title": { "description": "New title", "type": "string" }, "typePayload": { "additionalProperties": true, "description": "Type-specific payload for enabled document types. markdown: {body}; diagram: {sourceLanguage,edgeStyle,isModule,metadata,diagramSource} \u2014 the canvas is drawn only from nodes/edges/groups made with diagram_apply_changes; diagramSource is optional text kept beside them, never converted, and refused while the diagram has no nodes; openapi: {content}; html: {content} (a full HTML page); file: {file:{filename,contentType,sizeBytes,viewerKind}} (+content for text/CSV, first 64 KB); kanban: no body \u2014 only the title can be updated; cards are changed with kanban_apply_changes and kanban_card_action; design: no body \u2014 only the title can be updated; the canvas is changed with design_apply_changes.", "type": "object" }, "uuid": { "description": "Document UUID", "type": "string" } }, "required": ["uuid"], "type": "object" }, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "dev", "schemaHash": "1f2fb8cb13186980" },
|
|
6662
6988
|
{ "mcpName": "update_folders", "commandPath": ["folders", "update"], "group": "generic", "description": "Rename folders (only the name; move_folders moves them). Names do not have to be unique. Needs edit access to the folder. Targets are UUIDs only; names are never matched and may repeat. Look the UUID up first, and when more than one candidate fits what the user said, ask which one. Items run in order and each one commits on its own: the first failing item ends the call with an error, items before it stay applied (the error does not list them), and later items are not tried \u2014 re-read before retrying. Sends no email or inbox notification. Returns updated (folder rows) and count. Fails with 404, 403, or 409 when the folder or a parent folder is archived.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "Updates", "items": { "additionalProperties": false, "properties": { "name": { "description": "New name", "type": "string" }, "uuid": { "description": "Folder UUID", "type": "string" } }, "required": ["uuid", "name"], "type": "object" }, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "file-json", "destructive": true, "sourceCatalog": "dev", "schemaHash": "a83ac73386dc3339" },
|
|
@@ -6665,145 +6991,17 @@ Retries: send a unique clientMutationId with each write; if you retry the same c
|
|
|
6665
6991
|
{ "mcpName": "upload_attachments", "commandPath": ["tools", "run", "upload-attachments"], "group": "attachment", "description": "Register files you have already uploaded as attachments of documents. Steps: (1) request_upload_token with purpose=attachment.upload and {documentUuid, filename}; (2) PUT the file bytes with curl to the returned URL; (3) call this with the storageKey from step 1 \u2014 without step 2 it fails. sizeBytes, when given, must equal the uploaded size. A storageKey registers once (409 after that). Files over the server's attachment size limit or beyond the storage quota are refused, and the server decides the stored content type. File documents cannot take attachments. Needs edit access to the document. Items run in order and each one commits on its own: the first failing item ends the call with an error, items before it stay applied (the error does not list them), and later items are not tried \u2014 re-read before retrying. Sends no email or inbox notification. Returns uploaded (attachment rows) and count.\n\nRetries: send a unique clientMutationId with each write; if you retry the same call (for example after a timeout or lost response), send the same clientMutationId and the server returns the first result instead of running it again.", "inputSchema": { "additionalProperties": false, "properties": { "clientMutationId": { "description": "Idempotency key for this call (visible ASCII, at most 128 characters). Reusing it with the same arguments returns the first result (marked idempotentReplay); reusing it with different arguments is rejected with 409.", "maxLength": 128, "minLength": 1, "pattern": "^[\\x21-\\x7E]{1,128}$", "type": "string" }, "items": { "description": "Attachments to register", "items": { "additionalProperties": false, "properties": { "contentType": { "description": "MIME type", "type": "string" }, "documentUuid": { "description": "Parent document UUID", "type": "string" }, "filename": { "description": "Original file name", "type": "string" }, "sizeBytes": { "description": "Size in bytes", "type": "integer" }, "storageKey": { "description": "Storage key returned by request_upload_token purpose=attachment.upload", "type": "string" } }, "required": ["documentUuid", "filename", "storageKey"], "type": "object" }, "type": "array" } }, "required": ["items"], "type": "object" }, "required": ["items"], "payloadMode": "binary-upload", "destructive": false, "sourceCatalog": "dev", "schemaHash": "4b6b98cb4150bc28" }
|
|
6666
6992
|
];
|
|
6667
6993
|
|
|
6668
|
-
// src/core/catalog/generator.ts
|
|
6669
|
-
import { createHash as createHash3 } from "crypto";
|
|
6670
|
-
var LEGACY_PREFIX = "mcp__ainecto__";
|
|
6671
|
-
function bareToolName(name) {
|
|
6672
|
-
return name.startsWith(LEGACY_PREFIX) ? name.slice(LEGACY_PREFIX.length) : name;
|
|
6673
|
-
}
|
|
6674
|
-
var DESTRUCTIVE_PREFIXES = [
|
|
6675
|
-
"delete_",
|
|
6676
|
-
"remove_",
|
|
6677
|
-
"archive_",
|
|
6678
|
-
"unarchive_",
|
|
6679
|
-
"restore_",
|
|
6680
|
-
"move_",
|
|
6681
|
-
"erd_delete_",
|
|
6682
|
-
"erd_remove_",
|
|
6683
|
-
"testcase_delete_"
|
|
6684
|
-
];
|
|
6685
|
-
function generateCatalog(tools, sourceCatalog) {
|
|
6686
|
-
return tools.map((tool) => normalizeTool(tool, sourceCatalog)).sort((a, b) => a.mcpName.localeCompare(b.mcpName));
|
|
6687
|
-
}
|
|
6688
|
-
function normalizeTool(tool, sourceCatalog) {
|
|
6689
|
-
if (!tool.name) {
|
|
6690
|
-
throw new Error("Unsupported tool name: empty.");
|
|
6691
|
-
}
|
|
6692
|
-
const stripped = bareToolName(tool.name);
|
|
6693
|
-
const group = inferGroup(stripped);
|
|
6694
|
-
const inputSchema = normalizeSchema(tool.inputSchema ?? { type: "object", properties: {} });
|
|
6695
|
-
const required = Array.isArray(inputSchema.required) ? inputSchema.required.filter((value) => typeof value === "string").sort() : [];
|
|
6696
|
-
const definition = {
|
|
6697
|
-
mcpName: tool.name,
|
|
6698
|
-
commandPath: generateCommandPath(stripped, group),
|
|
6699
|
-
group,
|
|
6700
|
-
description: tool.description ?? "",
|
|
6701
|
-
inputSchema,
|
|
6702
|
-
required,
|
|
6703
|
-
payloadMode: inferPayloadMode(stripped, inputSchema),
|
|
6704
|
-
destructive: inferDestructive(stripped, tool),
|
|
6705
|
-
sourceCatalog,
|
|
6706
|
-
schemaHash: ""
|
|
6707
|
-
};
|
|
6708
|
-
return { ...definition, schemaHash: computeSchemaHash(definition) };
|
|
6709
|
-
}
|
|
6710
|
-
function inferGroup(strippedName) {
|
|
6711
|
-
if (strippedName.startsWith("erd_")) return "erd";
|
|
6712
|
-
if (strippedName.startsWith("flow_")) return "flow";
|
|
6713
|
-
if (strippedName.startsWith("testcase_")) return "testcase";
|
|
6714
|
-
if (strippedName.startsWith("markdown_")) return "markdown";
|
|
6715
|
-
if (strippedName.includes("attachment") || strippedName.includes("upload")) return "attachment";
|
|
6716
|
-
if (strippedName.startsWith("kanban_")) return "kanban";
|
|
6717
|
-
if (strippedName.includes("workspace")) return "workspace";
|
|
6718
|
-
if (strippedName.includes("document")) return "document";
|
|
6719
|
-
return "generic";
|
|
6720
|
-
}
|
|
6721
|
-
function generateCommandPath(strippedName, group) {
|
|
6722
|
-
if (group !== "generic" && strippedName.startsWith(`${group}_`)) {
|
|
6723
|
-
return [group, snakeToKebab(strippedName.slice(group.length + 1))];
|
|
6724
|
-
}
|
|
6725
|
-
const [verb, ...rest] = strippedName.split("_");
|
|
6726
|
-
if (verb && rest.length > 0 && isVerb(verb)) {
|
|
6727
|
-
return [rest.join("-"), verb];
|
|
6728
|
-
}
|
|
6729
|
-
return ["tools", "run", snakeToKebab(strippedName)];
|
|
6730
|
-
}
|
|
6731
|
-
function inferPayloadMode(strippedName, inputSchema) {
|
|
6732
|
-
if (strippedName.includes("upload") || strippedName.includes("attachment_upload")) {
|
|
6733
|
-
return "binary-upload";
|
|
6734
|
-
}
|
|
6735
|
-
const properties = inputSchema.properties;
|
|
6736
|
-
if (!isRecord4(properties)) {
|
|
6737
|
-
return "flags";
|
|
6738
|
-
}
|
|
6739
|
-
const values = Object.values(properties);
|
|
6740
|
-
if (values.length === 0) {
|
|
6741
|
-
return "flags";
|
|
6742
|
-
}
|
|
6743
|
-
if (values.every(isScalarSchema)) {
|
|
6744
|
-
return "flags";
|
|
6745
|
-
}
|
|
6746
|
-
return "file-json";
|
|
6747
|
-
}
|
|
6748
|
-
function inferDestructive(strippedName, tool) {
|
|
6749
|
-
if (tool.annotations?.destructiveHint === true) {
|
|
6750
|
-
return true;
|
|
6751
|
-
}
|
|
6752
|
-
return DESTRUCTIVE_PREFIXES.some((prefix) => strippedName.startsWith(prefix));
|
|
6753
|
-
}
|
|
6754
|
-
function computeSchemaHash(tool) {
|
|
6755
|
-
return createHash3("sha256").update(stableStringify({
|
|
6756
|
-
name: tool.mcpName,
|
|
6757
|
-
description: tool.description,
|
|
6758
|
-
inputSchema: tool.inputSchema
|
|
6759
|
-
})).digest("hex").slice(0, 16);
|
|
6760
|
-
}
|
|
6761
|
-
function stableStringify(value) {
|
|
6762
|
-
if (Array.isArray(value)) {
|
|
6763
|
-
return `[${value.map(stableStringify).join(",")}]`;
|
|
6764
|
-
}
|
|
6765
|
-
if (isRecord4(value)) {
|
|
6766
|
-
return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${stableStringify(value[key])}`).join(",")}}`;
|
|
6767
|
-
}
|
|
6768
|
-
return JSON.stringify(value);
|
|
6769
|
-
}
|
|
6770
|
-
function normalizeSchema(schema) {
|
|
6771
|
-
return JSON.parse(stableStringify(schema));
|
|
6772
|
-
}
|
|
6773
|
-
function isScalarSchema(value) {
|
|
6774
|
-
if (!isRecord4(value)) {
|
|
6775
|
-
return false;
|
|
6776
|
-
}
|
|
6777
|
-
const type = value.type;
|
|
6778
|
-
return type === "string" || type === "number" || type === "integer" || type === "boolean";
|
|
6779
|
-
}
|
|
6780
|
-
function isVerb(value) {
|
|
6781
|
-
return [
|
|
6782
|
-
"list",
|
|
6783
|
-
"get",
|
|
6784
|
-
"create",
|
|
6785
|
-
"update",
|
|
6786
|
-
"delete",
|
|
6787
|
-
"move",
|
|
6788
|
-
"restore",
|
|
6789
|
-
"archive",
|
|
6790
|
-
"unarchive",
|
|
6791
|
-
"search"
|
|
6792
|
-
].includes(value);
|
|
6793
|
-
}
|
|
6794
|
-
function snakeToKebab(value) {
|
|
6795
|
-
return value.replaceAll("_", "-");
|
|
6796
|
-
}
|
|
6797
|
-
function isRecord4(value) {
|
|
6798
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6799
|
-
}
|
|
6800
|
-
|
|
6801
6994
|
// src/core/catalog/index.ts
|
|
6802
6995
|
function getGeneratedTools(env) {
|
|
6803
6996
|
return env === "dev" ? generatedTools2 : generatedTools;
|
|
6804
6997
|
}
|
|
6805
6998
|
async function loadLiveTools(env, client) {
|
|
6806
|
-
|
|
6999
|
+
const lines = await listAllOperations({ toolsList: () => client.toolsList(), callPublic: (tool, args) => client.toolsCall(tool, args) });
|
|
7000
|
+
return generateCatalog(lines.map((line) => ({ name: line.operation, description: line.summary })), env);
|
|
7001
|
+
}
|
|
7002
|
+
async function loadLiveTool(env, client, operation) {
|
|
7003
|
+
const detail = await client.operations.detail(operation);
|
|
7004
|
+
return normalizeTool({ name: detail.operation, description: detail.summary, inputSchema: detail.inputSchema, annotations: detail.annotations }, env);
|
|
6807
7005
|
}
|
|
6808
7006
|
|
|
6809
7007
|
// src/core/mcp/stdioBridge.ts
|
|
@@ -6844,7 +7042,7 @@ var INVALID_REQUEST = -32600;
|
|
|
6844
7042
|
var INTERNAL_ERROR = -32603;
|
|
6845
7043
|
var RATE_LIMITED_CODE = 429;
|
|
6846
7044
|
function failure(id, code, error) {
|
|
6847
|
-
const data = error instanceof McpRpcError ? { code: error.code, ...
|
|
7045
|
+
const data = error instanceof McpRpcError ? { code: error.code, ...isRecord7(error.details) ? error.details : {} } : void 0;
|
|
6848
7046
|
return {
|
|
6849
7047
|
jsonrpc: "2.0",
|
|
6850
7048
|
id,
|
|
@@ -6860,7 +7058,7 @@ function writeLine(output, message2) {
|
|
|
6860
7058
|
}
|
|
6861
7059
|
function parseJsonRpcRequest(line) {
|
|
6862
7060
|
const parsed = JSON.parse(line);
|
|
6863
|
-
if (!
|
|
7061
|
+
if (!isRecord7(parsed) || parsed.jsonrpc !== "2.0" || typeof parsed.method !== "string") {
|
|
6864
7062
|
throw new Error("Invalid JSON-RPC request.");
|
|
6865
7063
|
}
|
|
6866
7064
|
return {
|
|
@@ -6871,9 +7069,9 @@ function parseJsonRpcRequest(line) {
|
|
|
6871
7069
|
};
|
|
6872
7070
|
}
|
|
6873
7071
|
function clientInfoName(params) {
|
|
6874
|
-
return
|
|
7072
|
+
return isRecord7(params) && isRecord7(params.clientInfo) ? params.clientInfo.name : void 0;
|
|
6875
7073
|
}
|
|
6876
|
-
function
|
|
7074
|
+
function isRecord7(value) {
|
|
6877
7075
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6878
7076
|
}
|
|
6879
7077
|
|
|
@@ -6913,7 +7111,7 @@ function renderCodexConfig(entry) {
|
|
|
6913
7111
|
`;
|
|
6914
7112
|
}
|
|
6915
7113
|
function isOurEntry(entry, endpoint) {
|
|
6916
|
-
if (
|
|
7114
|
+
if (isRecord8(entry) && typeof entry.url === "string") {
|
|
6917
7115
|
const url = normalizedServerUrl(entry.url);
|
|
6918
7116
|
return url !== void 0 && (url === endpoint || isDefaultEndpoint(url));
|
|
6919
7117
|
}
|
|
@@ -6940,10 +7138,10 @@ function buildServerEntry(input = {}) {
|
|
|
6940
7138
|
return { command: "npx", args };
|
|
6941
7139
|
}
|
|
6942
7140
|
function entryCarriesRole(entry) {
|
|
6943
|
-
return
|
|
7141
|
+
return isRecord8(entry) && Array.isArray(entry.args) && entry.args.includes("--role");
|
|
6944
7142
|
}
|
|
6945
7143
|
function pinnedBridgeVersion(entry) {
|
|
6946
|
-
if (!
|
|
7144
|
+
if (!isRecord8(entry) || !Array.isArray(entry.args)) {
|
|
6947
7145
|
return void 0;
|
|
6948
7146
|
}
|
|
6949
7147
|
const pinned = entry.args.find((arg) => typeof arg === "string" && arg.startsWith(`${PACKAGE_NAME}@`));
|
|
@@ -6956,13 +7154,13 @@ function readServerEntry(existing) {
|
|
|
6956
7154
|
try {
|
|
6957
7155
|
const parsed = JSON.parse(existing);
|
|
6958
7156
|
const servers = parsed?.mcpServers;
|
|
6959
|
-
return
|
|
7157
|
+
return isRecord8(servers) ? servers[SERVER_NAME] : void 0;
|
|
6960
7158
|
} catch {
|
|
6961
7159
|
return void 0;
|
|
6962
7160
|
}
|
|
6963
7161
|
}
|
|
6964
7162
|
function isOurBridge(entry) {
|
|
6965
|
-
if (!
|
|
7163
|
+
if (!isRecord8(entry)) {
|
|
6966
7164
|
return false;
|
|
6967
7165
|
}
|
|
6968
7166
|
const { command, args } = entry;
|
|
@@ -7006,7 +7204,7 @@ function readServers(root) {
|
|
|
7006
7204
|
if (servers === void 0) {
|
|
7007
7205
|
return {};
|
|
7008
7206
|
}
|
|
7009
|
-
if (!
|
|
7207
|
+
if (!isRecord8(servers)) {
|
|
7010
7208
|
throw new Error(
|
|
7011
7209
|
'Existing MCP config has an "mcpServers" value that is not an object, so it was left untouched. Fix it by hand and run init again.'
|
|
7012
7210
|
);
|
|
@@ -7025,7 +7223,7 @@ function parseConfigObject(existing) {
|
|
|
7025
7223
|
`Existing MCP config is not valid JSON, so it was left untouched. Fix it by hand and run init again. (${error instanceof Error ? error.message : String(error)})`
|
|
7026
7224
|
);
|
|
7027
7225
|
}
|
|
7028
|
-
if (!
|
|
7226
|
+
if (!isRecord8(parsed)) {
|
|
7029
7227
|
throw new Error("Existing MCP config must be a JSON object; it was left untouched.");
|
|
7030
7228
|
}
|
|
7031
7229
|
return parsed;
|
|
@@ -7034,7 +7232,7 @@ function stringify(value) {
|
|
|
7034
7232
|
return `${JSON.stringify(value, null, 2)}
|
|
7035
7233
|
`;
|
|
7036
7234
|
}
|
|
7037
|
-
function
|
|
7235
|
+
function isRecord8(value) {
|
|
7038
7236
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7039
7237
|
}
|
|
7040
7238
|
|
|
@@ -7089,14 +7287,16 @@ user's AiNecto permissions on the workspace, project, or document it touches \u2
|
|
|
7089
7287
|
what the user may not do. A refusal is an answer: report it to the user instead of looking for a
|
|
7090
7288
|
way around it.
|
|
7091
7289
|
|
|
7092
|
-
|
|
7093
|
-
\`
|
|
7290
|
+
AiNecto has two kinds of tools: \`search\` finds an operation and its input format, and the
|
|
7291
|
+
\`execute_*\` tools run it as \`{operation, args}\` \u2014 \`search\` with \`{"operation": "<name>"}\` says
|
|
7292
|
+
which \`execute_*\` runs it. Find the project and document for the task with the operations
|
|
7293
|
+
\`list_projects\`, \`search_documents\` and \`get_document\` \u2014 this repository is not bound to one project.
|
|
7094
7294
|
|
|
7095
|
-
## When
|
|
7295
|
+
## When an operation is missing
|
|
7096
7296
|
|
|
7097
|
-
|
|
7098
|
-
was added. Start a new session, or
|
|
7099
|
-
\`npx -y ainecto@latest tools call <
|
|
7297
|
+
Operations are listed by \`search\`, so a new one needs no new tool. If an \`execute_*\` tool is not in
|
|
7298
|
+
your tool list, this session started before it was added. Start a new session, or run the operation
|
|
7299
|
+
from the repository with \`npx -y ainecto@latest tools call <operation> '<json>'\`.
|
|
7100
7300
|
|
|
7101
7301
|
## Commands
|
|
7102
7302
|
|
|
@@ -7552,7 +7752,7 @@ var enrichments = [
|
|
|
7552
7752
|
// src/core/output/table.ts
|
|
7553
7753
|
function renderTable(data, options = {}) {
|
|
7554
7754
|
const rows = extractRows(data);
|
|
7555
|
-
if (!rows.length || !rows.every(
|
|
7755
|
+
if (!rows.length || !rows.every(isRecord9)) {
|
|
7556
7756
|
return void 0;
|
|
7557
7757
|
}
|
|
7558
7758
|
const columns = options.columns?.length ? options.columns : inferColumns(rows);
|
|
@@ -7569,7 +7769,7 @@ function extractRows(data) {
|
|
|
7569
7769
|
if (Array.isArray(data)) {
|
|
7570
7770
|
return data;
|
|
7571
7771
|
}
|
|
7572
|
-
if (
|
|
7772
|
+
if (isRecord9(data)) {
|
|
7573
7773
|
for (const key of ["items", "projects", "workspaces", "folders", "documents", "tasks", "attachments", "results", "data"]) {
|
|
7574
7774
|
const value = data[key];
|
|
7575
7775
|
if (Array.isArray(value)) {
|
|
@@ -7597,7 +7797,7 @@ function formatCell(value) {
|
|
|
7597
7797
|
}
|
|
7598
7798
|
return String(value);
|
|
7599
7799
|
}
|
|
7600
|
-
function
|
|
7800
|
+
function isRecord9(value) {
|
|
7601
7801
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7602
7802
|
}
|
|
7603
7803
|
|
|
@@ -7650,7 +7850,7 @@ function payloadToArgs(value) {
|
|
|
7650
7850
|
if (value === void 0 || value === null) {
|
|
7651
7851
|
return {};
|
|
7652
7852
|
}
|
|
7653
|
-
if (!
|
|
7853
|
+
if (!isRecord10(value)) {
|
|
7654
7854
|
throw new CliCommandError("INVALID_PAYLOAD", "Generated command payload must be a JSON object.", { value });
|
|
7655
7855
|
}
|
|
7656
7856
|
return { ...value };
|
|
@@ -7754,12 +7954,12 @@ function coerceFlagValue(value, schema, key) {
|
|
|
7754
7954
|
}
|
|
7755
7955
|
function getSchemaProperties(schema) {
|
|
7756
7956
|
const properties = schema.properties;
|
|
7757
|
-
if (!
|
|
7957
|
+
if (!isRecord10(properties)) {
|
|
7758
7958
|
return {};
|
|
7759
7959
|
}
|
|
7760
7960
|
const result = {};
|
|
7761
7961
|
for (const [key, value] of Object.entries(properties)) {
|
|
7762
|
-
if (
|
|
7962
|
+
if (isRecord10(value)) {
|
|
7763
7963
|
result[key] = value;
|
|
7764
7964
|
}
|
|
7765
7965
|
}
|
|
@@ -7774,7 +7974,7 @@ function requireValue(flag, value) {
|
|
|
7774
7974
|
}
|
|
7775
7975
|
return value;
|
|
7776
7976
|
}
|
|
7777
|
-
function
|
|
7977
|
+
function isRecord10(value) {
|
|
7778
7978
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7779
7979
|
}
|
|
7780
7980
|
|
|
@@ -7841,8 +8041,10 @@ async function executeGeneratedCommand(options) {
|
|
|
7841
8041
|
return 2;
|
|
7842
8042
|
}
|
|
7843
8043
|
const parsed = await parseGeneratedCommandArgs(route.tool, route.rest, options.io.stdin);
|
|
8044
|
+
const detail = await options.client.operationDetailFor(route.tool.mcpName);
|
|
8045
|
+
const destructive = detail && typeof detail.annotations.destructiveHint === "boolean" ? inferDestructive(bareToolName(route.tool.mcpName), { name: route.tool.mcpName, annotations: detail.annotations }) : route.tool.destructive;
|
|
7844
8046
|
await confirmDestructiveCommand({
|
|
7845
|
-
tool: route.tool,
|
|
8047
|
+
tool: { ...route.tool, destructive },
|
|
7846
8048
|
yes: parsed.yes,
|
|
7847
8049
|
json: options.json,
|
|
7848
8050
|
io: options.io
|
|
@@ -7902,50 +8104,6 @@ function findRestStart(argv, commandPath) {
|
|
|
7902
8104
|
// src/core/upload/attachmentUpload.ts
|
|
7903
8105
|
import { readFile as readFile4, stat as stat3 } from "fs/promises";
|
|
7904
8106
|
import { basename as basename2, extname } from "path";
|
|
7905
|
-
|
|
7906
|
-
// src/core/mcp/toolPayload.ts
|
|
7907
|
-
function unwrapMcpToolPayload(value) {
|
|
7908
|
-
if (!isRecord9(value) || !Array.isArray(value.content)) {
|
|
7909
|
-
return value;
|
|
7910
|
-
}
|
|
7911
|
-
const text2 = value.content.map((item) => isRecord9(item) && typeof item.text === "string" ? item.text : "").find((itemText) => itemText.trim().startsWith("{"));
|
|
7912
|
-
if (!text2) {
|
|
7913
|
-
return value;
|
|
7914
|
-
}
|
|
7915
|
-
try {
|
|
7916
|
-
return JSON.parse(text2);
|
|
7917
|
-
} catch {
|
|
7918
|
-
return value;
|
|
7919
|
-
}
|
|
7920
|
-
}
|
|
7921
|
-
function toolErrorText(value) {
|
|
7922
|
-
if (!isRecord9(value) || !Array.isArray(value.content)) {
|
|
7923
|
-
return "The tool returned an error.";
|
|
7924
|
-
}
|
|
7925
|
-
const text2 = value.content.map((item) => isRecord9(item) && typeof item.text === "string" ? item.text : "").filter(Boolean).join("\n");
|
|
7926
|
-
return text2 || "The tool returned an error.";
|
|
7927
|
-
}
|
|
7928
|
-
function isRecord9(value) {
|
|
7929
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7930
|
-
}
|
|
7931
|
-
function extractProjects(value) {
|
|
7932
|
-
const candidates = Array.isArray(value) ? value : isRecord9(value) ? ["projects", "items", "created", "data", "hits"].flatMap((key) => {
|
|
7933
|
-
const nested = value[key];
|
|
7934
|
-
return Array.isArray(nested) ? nested : [];
|
|
7935
|
-
}) : [];
|
|
7936
|
-
const projects = [];
|
|
7937
|
-
for (const candidate of candidates) {
|
|
7938
|
-
if (isRecord9(candidate) && typeof candidate.uuid === "string") {
|
|
7939
|
-
projects.push({
|
|
7940
|
-
uuid: candidate.uuid,
|
|
7941
|
-
name: typeof candidate.name === "string" ? candidate.name : candidate.uuid
|
|
7942
|
-
});
|
|
7943
|
-
}
|
|
7944
|
-
}
|
|
7945
|
-
return projects;
|
|
7946
|
-
}
|
|
7947
|
-
|
|
7948
|
-
// src/core/upload/attachmentUpload.ts
|
|
7949
8107
|
var AttachmentUploadError = class extends Error {
|
|
7950
8108
|
constructor(code, message2, details) {
|
|
7951
8109
|
super(message2);
|
|
@@ -7975,8 +8133,8 @@ async function uploadAttachments(client, input) {
|
|
|
7975
8133
|
documentUuid: input.documentUuid,
|
|
7976
8134
|
maxBytes: input.maxBytes,
|
|
7977
8135
|
ttlSeconds: input.ttlSeconds,
|
|
7978
|
-
requestToolName: input.requestToolName ?? "
|
|
7979
|
-
commitToolName: input.commitToolName ?? "
|
|
8136
|
+
requestToolName: input.requestToolName ?? "request_upload_token",
|
|
8137
|
+
commitToolName: input.commitToolName ?? "upload_attachments",
|
|
7980
8138
|
fetchImpl,
|
|
7981
8139
|
onProgress: input.onProgress,
|
|
7982
8140
|
index,
|
|
@@ -8043,7 +8201,7 @@ async function requestUploadToken(client, metadata, context) {
|
|
|
8043
8201
|
requestArgs.ttlSeconds = context.ttlSeconds;
|
|
8044
8202
|
}
|
|
8045
8203
|
const response = unwrapMcpToolPayload(await client.toolsCall(context.requestToolName, requestArgs));
|
|
8046
|
-
if (!
|
|
8204
|
+
if (!isRecord11(response)) {
|
|
8047
8205
|
throw new AttachmentUploadError("UPLOAD_TOKEN_PROTOCOL_ERROR", "request_upload_token response was not an object.");
|
|
8048
8206
|
}
|
|
8049
8207
|
const token = response.token;
|
|
@@ -8129,7 +8287,7 @@ function parsePutResponse(text2) {
|
|
|
8129
8287
|
} catch {
|
|
8130
8288
|
throw new AttachmentUploadError("ATTACHMENT_UPLOAD_PROTOCOL_ERROR", "Attachment PUT response was not valid JSON.");
|
|
8131
8289
|
}
|
|
8132
|
-
if (!
|
|
8290
|
+
if (!isRecord11(parsed)) {
|
|
8133
8291
|
throw new AttachmentUploadError("ATTACHMENT_UPLOAD_PROTOCOL_ERROR", "Attachment PUT response was not an object.");
|
|
8134
8292
|
}
|
|
8135
8293
|
if (typeof parsed.storageKey !== "string") {
|
|
@@ -8193,7 +8351,7 @@ var MIME_BY_EXTENSION = {
|
|
|
8193
8351
|
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
8194
8352
|
".zip": "application/zip"
|
|
8195
8353
|
};
|
|
8196
|
-
function
|
|
8354
|
+
function isRecord11(value) {
|
|
8197
8355
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8198
8356
|
}
|
|
8199
8357
|
|
|
@@ -8321,8 +8479,8 @@ function renderAttachmentUploadResult(result, json) {
|
|
|
8321
8479
|
import { mkdir as mkdir3, open, readFile as readFile5, rename as rename3 } from "fs/promises";
|
|
8322
8480
|
import { dirname as dirname4 } from "path";
|
|
8323
8481
|
var EXIT_NOTHING_NEW = 3;
|
|
8324
|
-
var LIST_NOTIFICATIONS = "
|
|
8325
|
-
var LIST_AGENT_TODOS = "
|
|
8482
|
+
var LIST_NOTIFICATIONS = "list_notifications";
|
|
8483
|
+
var LIST_AGENT_TODOS = "list_agent_todos";
|
|
8326
8484
|
function isInboxPollCommand(domain, action) {
|
|
8327
8485
|
return [NOTIFICATIONS_POLL_COMMAND_PATH, NOTIFICATIONS_ACK_COMMAND_PATH, AGENT_TODOS_POLL_COMMAND_PATH].some(([d, a]) => d === domain && a === action);
|
|
8328
8486
|
}
|
|
@@ -8425,7 +8583,7 @@ async function agentTodosPoll(options) {
|
|
|
8425
8583
|
let after;
|
|
8426
8584
|
for (let page = 0; page < 20; page += 1) {
|
|
8427
8585
|
const result = await callTool(options.client, LIST_AGENT_TODOS, { state: ["OPEN"], ...scope, limit: 50, ...after ? { after } : {} });
|
|
8428
|
-
const pageItems = Array.isArray(result.items) ? result.items.filter(
|
|
8586
|
+
const pageItems = Array.isArray(result.items) ? result.items.filter(isRecord12) : [];
|
|
8429
8587
|
items.push(...pageItems);
|
|
8430
8588
|
const last = pageItems[pageItems.length - 1];
|
|
8431
8589
|
if (result.hasMore !== true || !last || typeof last.todoId !== "string") break;
|
|
@@ -8450,7 +8608,7 @@ async function callTool(client, name, args) {
|
|
|
8450
8608
|
throw new CliCommandError("TOOL_ERROR", toolErrorText(raw), { tool: name });
|
|
8451
8609
|
}
|
|
8452
8610
|
const payload = unwrapMcpToolPayload(raw);
|
|
8453
|
-
if (!
|
|
8611
|
+
if (!isRecord12(payload)) {
|
|
8454
8612
|
throw new CliCommandError("MCP_PROTOCOL_ERROR", `${name} did not return an object.`, { tool: name });
|
|
8455
8613
|
}
|
|
8456
8614
|
return payload;
|
|
@@ -8525,7 +8683,7 @@ async function readCursorFile(path) {
|
|
|
8525
8683
|
if (text2 === void 0 || !text2.trim()) return void 0;
|
|
8526
8684
|
try {
|
|
8527
8685
|
const parsed = JSON.parse(text2);
|
|
8528
|
-
if (parsed?.v !== 1 || !
|
|
8686
|
+
if (parsed?.v !== 1 || !isRecord12(parsed.filter)) throw new Error("shape");
|
|
8529
8687
|
return { ...parsed, filter: normalizeSavedFilter(parsed.filter) };
|
|
8530
8688
|
} catch {
|
|
8531
8689
|
throw new CliCommandError("INVALID_CURSOR_FILE", `${path} is not a cursor file written by ainecto notifications poll.`, { cursorFile: path });
|
|
@@ -8560,7 +8718,7 @@ async function writeJsonAtomic(path, value) {
|
|
|
8560
8718
|
}
|
|
8561
8719
|
await rename3(temp, path);
|
|
8562
8720
|
}
|
|
8563
|
-
function
|
|
8721
|
+
function isRecord12(value) {
|
|
8564
8722
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8565
8723
|
}
|
|
8566
8724
|
|
|
@@ -9576,9 +9734,9 @@ async function applyPlan(root, plan, dryRun, snapshot, recordFirst = true) {
|
|
|
9576
9734
|
}
|
|
9577
9735
|
const applied = [];
|
|
9578
9736
|
try {
|
|
9579
|
-
const
|
|
9580
|
-
const recordWrites = plan.writes.filter((write) =>
|
|
9581
|
-
const recordDeletes = plan.deletes.filter((path) =>
|
|
9737
|
+
const isRecord15 = (path) => !recordFirst && path === HARNESS_RECORD_PATH;
|
|
9738
|
+
const recordWrites = plan.writes.filter((write) => isRecord15(write.path));
|
|
9739
|
+
const recordDeletes = plan.deletes.filter((path) => isRecord15(path));
|
|
9582
9740
|
const createdDirectories = [...plan.record?.createdDirectories ?? []];
|
|
9583
9741
|
const rememberDirectories = (directories) => {
|
|
9584
9742
|
for (const directory of directories) {
|
|
@@ -9620,8 +9778,8 @@ async function applyPlan(root, plan, dryRun, snapshot, recordFirst = true) {
|
|
|
9620
9778
|
};
|
|
9621
9779
|
try {
|
|
9622
9780
|
await apply(
|
|
9623
|
-
orderedWrites(plan.writes.filter((write) => !
|
|
9624
|
-
plan.deletes.filter((path) => !
|
|
9781
|
+
orderedWrites(plan.writes.filter((write) => !isRecord15(write.path)), recordFirst),
|
|
9782
|
+
plan.deletes.filter((path) => !isRecord15(path))
|
|
9625
9783
|
);
|
|
9626
9784
|
await recordDirectoriesOrExplain(false);
|
|
9627
9785
|
await apply(recordWrites, recordDeletes);
|
|
@@ -9692,7 +9850,7 @@ async function fileMode(absolutePath) {
|
|
|
9692
9850
|
try {
|
|
9693
9851
|
return (await stat4(absolutePath)).mode & 4095;
|
|
9694
9852
|
} catch (error) {
|
|
9695
|
-
if (
|
|
9853
|
+
if (isRecord13(error) && error.code === "ENOENT") {
|
|
9696
9854
|
return void 0;
|
|
9697
9855
|
}
|
|
9698
9856
|
throw error;
|
|
@@ -9735,7 +9893,7 @@ function parseInitArgs(argv) {
|
|
|
9735
9893
|
}
|
|
9736
9894
|
return args;
|
|
9737
9895
|
}
|
|
9738
|
-
function
|
|
9896
|
+
function isRecord13(value) {
|
|
9739
9897
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9740
9898
|
}
|
|
9741
9899
|
|
|
@@ -13092,7 +13250,6 @@ function clip(text2, max) {
|
|
|
13092
13250
|
|
|
13093
13251
|
// src/core/agent/tools.ts
|
|
13094
13252
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
13095
|
-
var TOOL_PREFIX = "mcp__ainecto__";
|
|
13096
13253
|
var AgentToolError = class extends Error {
|
|
13097
13254
|
constructor(message2, tool, code, retryable = false) {
|
|
13098
13255
|
super(message2);
|
|
@@ -13137,10 +13294,10 @@ function createAgentTools(input) {
|
|
|
13137
13294
|
return {
|
|
13138
13295
|
call(tool, args, options = {}) {
|
|
13139
13296
|
return logged(tool, Buffer.byteLength(JSON.stringify(args), "utf8"), async () => {
|
|
13140
|
-
const raw = await clientFor(options.as).toolsCall(
|
|
13297
|
+
const raw = await clientFor(options.as).toolsCall(tool, args);
|
|
13141
13298
|
if (isToolError(raw)) throw new AgentToolError(toolErrorText(raw), tool, codeInText(toolErrorText(raw)));
|
|
13142
13299
|
const payload = unwrapMcpToolPayload(raw);
|
|
13143
|
-
if (!
|
|
13300
|
+
if (!isRecord14(payload)) throw new AgentToolError(`${tool} did not return an object.`, tool, "MCP_PROTOCOL_ERROR");
|
|
13144
13301
|
return payload;
|
|
13145
13302
|
}, options.as);
|
|
13146
13303
|
},
|
|
@@ -13158,8 +13315,8 @@ function toolsAs(tools, identity) {
|
|
|
13158
13315
|
function toToolError(tool, error) {
|
|
13159
13316
|
if (error instanceof AgentToolError) return error;
|
|
13160
13317
|
if (error instanceof McpRpcError) {
|
|
13161
|
-
const details =
|
|
13162
|
-
const data =
|
|
13318
|
+
const details = isRecord14(error.details) ? error.details : {};
|
|
13319
|
+
const data = isRecord14(details.data) ? details.data : {};
|
|
13163
13320
|
const status = typeof details.status === "number" ? details.status : void 0;
|
|
13164
13321
|
const code = typeof data.code === "string" ? data.code : typeof details.error === "string" ? details.error : error.code;
|
|
13165
13322
|
const rpcCode = typeof details.code === "number" ? details.code : void 0;
|
|
@@ -13175,12 +13332,12 @@ function toToolError(tool, error) {
|
|
|
13175
13332
|
function codeInText(text2) {
|
|
13176
13333
|
try {
|
|
13177
13334
|
const parsed = JSON.parse(text2);
|
|
13178
|
-
return
|
|
13335
|
+
return isRecord14(parsed) && typeof parsed.code === "string" ? parsed.code : void 0;
|
|
13179
13336
|
} catch {
|
|
13180
13337
|
return void 0;
|
|
13181
13338
|
}
|
|
13182
13339
|
}
|
|
13183
|
-
function
|
|
13340
|
+
function isRecord14(value) {
|
|
13184
13341
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13185
13342
|
}
|
|
13186
13343
|
|
|
@@ -13263,8 +13420,9 @@ function answerComments(listed2, commentId) {
|
|
|
13263
13420
|
var PROMPT_HEADS = {
|
|
13264
13421
|
CARD_ASSIGNED: "[AiNecto auto-run] The person handed you this kanban card with auto-run. Do the work with the AiNecto tools.",
|
|
13265
13422
|
DECISION_ANSWERED: "[AiNecto auto-run \u2014 continue] The person answered on this card (or asked for changes). Continue the same work.",
|
|
13266
|
-
RESUME: "[AiNecto auto-run \u2014 resume] This machine stopped while you were working this card. Continue the same work: first check what is already done with report_work_progress (CHECKPOINT)."
|
|
13423
|
+
RESUME: "[AiNecto auto-run \u2014 resume] This machine stopped while you were working this card. Continue the same work: first check what is already done with operation report_work_progress (CHECKPOINT)."
|
|
13267
13424
|
};
|
|
13425
|
+
var OPERATIONS_LINE = 'AiNecto names below are operations. Run one with the execute_* tool that `search {operation: "<name>"}` names, as `{operation: "<name>", args: {\u2026}}` \u2014 a wrong execute_* is refused with the one to use.';
|
|
13268
13426
|
function todoPromptText(input) {
|
|
13269
13427
|
const { card, workId } = input;
|
|
13270
13428
|
const owner = card.ownerUserId ?? "the card's assignee";
|
|
@@ -13272,7 +13430,8 @@ function todoPromptText(input) {
|
|
|
13272
13430
|
PROMPT_HEADS[input.kind],
|
|
13273
13431
|
"",
|
|
13274
13432
|
`Card \xAB${card.title}\xBB (${card.key ? `${card.key}, ` : ""}cardUuid ${card.uuid}${card.boardUuid ? `, boardUuid ${card.boardUuid}` : ""}) \xB7 status ${card.status}${card.blocked ? " \xB7 blocked" : ""}`,
|
|
13275
|
-
`AI work: workId ${workId} \u2014 send this workId with every AiNecto call for this card and report each step with report_work_progress (read each response before going on)
|
|
13433
|
+
`AI work: workId ${workId} \u2014 send this workId with every AiNecto call for this card and report each step with operation report_work_progress (read each response before going on).`,
|
|
13434
|
+
OPERATIONS_LINE
|
|
13276
13435
|
];
|
|
13277
13436
|
if (card.description) lines.push("", "Description:", card.description);
|
|
13278
13437
|
if (card.criteria.length > 0) {
|
|
@@ -13284,18 +13443,18 @@ function todoPromptText(input) {
|
|
|
13284
13443
|
"Comments to read (oldest first):",
|
|
13285
13444
|
...input.answers.map((a) => `- #${a.id} ${a.kind}${a.questionState ? ` (${a.questionState})` : ""} by ${a.author}: ${a.body}`)
|
|
13286
13445
|
);
|
|
13287
|
-
lines.push("", `First read them: report_work_progress (it lists the comments to read \u2014 send \`read\` with its checkId), resolve_comments for the questions that are answered, and if the card is blocked, kanban_card_action {cardUuid: "${card.uuid}", action: "unblock"}. Then continue the work.`);
|
|
13446
|
+
lines.push("", `First read them: operation report_work_progress (it lists the comments to read \u2014 send \`read\` with its checkId), resolve_comments for the questions that are answered, and if the card is blocked, kanban_card_action with args {cardUuid: "${card.uuid}", action: "unblock"}. Then continue the work.`);
|
|
13288
13447
|
}
|
|
13289
13448
|
lines.push(
|
|
13290
13449
|
"",
|
|
13291
|
-
"If you need the person's decision, do not guess. Ask and stop:",
|
|
13450
|
+
"If you need the person's decision, do not guess. Ask and stop (operation, then its args):",
|
|
13292
13451
|
`1) create_comments {cardUuid: "${card.uuid}", workId: "${workId}", items: [{kind: "QUESTION", body: <your question>}]}`,
|
|
13293
13452
|
`2) kanban_card_action {cardUuid: "${card.uuid}", action: "block", reason: <one line>, responderIds: ["${owner}"]}`,
|
|
13294
13453
|
`3) report_work_progress {workId: "${workId}", stepId: <the step>, status: "BLOCKED"}`,
|
|
13295
13454
|
"Then answer with what you asked. You will be called again on this card when they answer.",
|
|
13296
13455
|
"",
|
|
13297
13456
|
"Do not request review, approve, or finish the card yourself \u2014 this PC posts your answer as the result and asks the person to review it.",
|
|
13298
|
-
"Do not
|
|
13457
|
+
"Do not run operation finish_work: the AI work stays open until the person approves the result (finishing it early blocks the hand-over).",
|
|
13299
13458
|
"Your answer (reply) is shown to the person in this card's auto-run conversation: say what you did, or what you asked."
|
|
13300
13459
|
);
|
|
13301
13460
|
return lines.join("\n");
|
|
@@ -16692,7 +16851,8 @@ async function runAinectoCli(argv, io) {
|
|
|
16692
16851
|
}
|
|
16693
16852
|
const tokenStore = new FileTokenStore();
|
|
16694
16853
|
const agentName = domain === "mcp" ? void 0 : await readAgentName(process.cwd());
|
|
16695
|
-
|
|
16854
|
+
let connection;
|
|
16855
|
+
const connect2 = () => connection ??= (() => {
|
|
16696
16856
|
const auth = new OAuthClient({
|
|
16697
16857
|
endpoint: resolved.endpoint,
|
|
16698
16858
|
tokenStore,
|
|
@@ -16710,7 +16870,7 @@ async function runAinectoCli(argv, io) {
|
|
|
16710
16870
|
});
|
|
16711
16871
|
const client2 = new McpRpcClient({ endpoint: resolved.endpoint, tokenProvider: auth, legacyRole, channel: "cli", agentName });
|
|
16712
16872
|
return { auth, client: client2 };
|
|
16713
|
-
};
|
|
16873
|
+
})();
|
|
16714
16874
|
if (domain === "mcp") {
|
|
16715
16875
|
const bridgeArgs = parseMcpArgs(parsed.positionals.slice(1));
|
|
16716
16876
|
await runConnector({
|
|
@@ -16877,9 +17037,10 @@ async function runAinectoCli(argv, io) {
|
|
|
16877
17037
|
let routeTools = getGeneratedTools(env);
|
|
16878
17038
|
let remote = isAttachmentsUploadCommand(domain, action) || isInboxPollCommand(domain, action) || domain === "tools" && (action === "list" || action === "call") || matchGeneratedCommand(routeTools, parsed.positionals) !== void 0;
|
|
16879
17039
|
if (!remote) {
|
|
16880
|
-
const live = await loadLiveTools(env, connect2().client).catch(
|
|
16881
|
-
|
|
16882
|
-
|
|
17040
|
+
const live = await loadLiveTools(env, connect2().client).catch(liveListFailure);
|
|
17041
|
+
const match = matchGeneratedCommand(live, parsed.positionals);
|
|
17042
|
+
if (match) {
|
|
17043
|
+
routeTools = [await loadLiveTool(env, connect2().client, match.tool.mcpName)];
|
|
16883
17044
|
remote = true;
|
|
16884
17045
|
}
|
|
16885
17046
|
}
|
|
@@ -16939,16 +17100,28 @@ async function printCatalog(parsed, io, endpoint, liveClient) {
|
|
|
16939
17100
|
const catalogEnv = parsed.env ?? "prod";
|
|
16940
17101
|
try {
|
|
16941
17102
|
const tools = await loadLiveTools(catalogEnv, await liveClient());
|
|
16942
|
-
io.stdout.write(renderSuccess(tools, { json: parsed.json }));
|
|
17103
|
+
io.stdout.write(renderSuccess(tools.map(catalogLine), { json: parsed.json, warnings: [CATALOG_DETAIL_HINT] }));
|
|
16943
17104
|
} catch (error) {
|
|
16944
17105
|
const reason = error instanceof Error ? error.message : String(error);
|
|
16945
|
-
io.stdout.write(renderSuccess(getGeneratedTools(catalogEnv), {
|
|
17106
|
+
io.stdout.write(renderSuccess(getGeneratedTools(catalogEnv).map(catalogLine), {
|
|
16946
17107
|
json: parsed.json,
|
|
16947
|
-
warnings: [`Could not read the live tool list from ${endpoint} (${reason}). Showing the ${catalogEnv} catalog checked in when this CLI version was built \u2014 a snapshot of that server's tools/list that may miss newer document types and tools. Run \`ainecto auth login\`, then retry.`]
|
|
17108
|
+
warnings: [CATALOG_DETAIL_HINT, `Could not read the live tool list from ${endpoint} (${reason}). Showing the ${catalogEnv} catalog checked in when this CLI version was built \u2014 a snapshot of that server's tools/list that may miss newer document types and tools. Run \`ainecto auth login\`, then retry.`]
|
|
16948
17109
|
}));
|
|
16949
17110
|
}
|
|
16950
17111
|
return 0;
|
|
16951
17112
|
}
|
|
17113
|
+
function liveListFailure(error) {
|
|
17114
|
+
const cause = error instanceof Error ? error : new Error(String(error));
|
|
17115
|
+
const failure2 = new Error(`This command is not in this CLI's catalog, and the server's operation list could not be read: ${cause.message}`);
|
|
17116
|
+
const source = cause;
|
|
17117
|
+
failure2.code = typeof source.code === "string" ? source.code : "LIVE_CATALOG_UNAVAILABLE";
|
|
17118
|
+
if (source.details !== void 0) failure2.details = source.details;
|
|
17119
|
+
throw failure2;
|
|
17120
|
+
}
|
|
17121
|
+
function catalogLine(tool) {
|
|
17122
|
+
return { operation: tool.mcpName, command: `ainecto ${tool.commandPath.join(" ")}`, description: tool.description };
|
|
17123
|
+
}
|
|
17124
|
+
var CATALOG_DETAIL_HINT = "Each line is an operation. For its input format, run `ainecto tools call search '{\"operation\":\"<operation>\"}'`; run it with its command or `ainecto tools call <operation> '<json>'`.";
|
|
16952
17125
|
async function handleTools(action, rest, parsed, client, io) {
|
|
16953
17126
|
if (action === "list") {
|
|
16954
17127
|
const tools = await client.toolsList();
|