chain-insights 0.40.0 → 0.42.2

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.
Files changed (52) hide show
  1. package/README.md +6 -0
  2. package/dist/{call-args-ysbB_xdA.mjs → call-args-DPWeqIla.mjs} +3 -1
  3. package/dist/call-args-DPWeqIla.mjs.map +1 -0
  4. package/dist/{call-args-DAiQSDmD.cjs → call-args-Db8KXsQx.cjs} +2 -0
  5. package/dist/{capabilities-BbAQ4Tfa.cjs → capabilities-A8fsfP24.cjs} +4 -1
  6. package/dist/{capabilities-BOOUnAeV.mjs → capabilities-DfWL6n_g.mjs} +5 -2
  7. package/dist/capabilities-DfWL6n_g.mjs.map +1 -0
  8. package/dist/cli.cjs +77 -128
  9. package/dist/cli.mjs +74 -125
  10. package/dist/cli.mjs.map +1 -1
  11. package/dist/{config-Br6VEK0O.mjs → config-9MabJh5R.mjs} +34 -2
  12. package/dist/config-9MabJh5R.mjs.map +1 -0
  13. package/dist/{config-CPUhkz0Z.cjs → config-BxtMoo9c.cjs} +32 -0
  14. package/dist/flows-9XJmeF_M.mjs +363 -0
  15. package/dist/flows-9XJmeF_M.mjs.map +1 -0
  16. package/dist/flows-CJSNSXkH.cjs +413 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.cts.map +1 -1
  19. package/dist/index.d.mts.map +1 -1
  20. package/dist/index.mjs +1 -1
  21. package/dist/mcp-proxy.cjs +83 -335
  22. package/dist/mcp-proxy.d.cts.map +1 -1
  23. package/dist/mcp-proxy.d.mts.map +1 -1
  24. package/dist/mcp-proxy.mjs +68 -320
  25. package/dist/mcp-proxy.mjs.map +1 -1
  26. package/dist/print-result-BEA_PyNz.cjs +178 -0
  27. package/dist/print-result-k9kXVR2c.mjs +151 -0
  28. package/dist/print-result-k9kXVR2c.mjs.map +1 -0
  29. package/dist/public-tools-CZyeptJQ.mjs.map +1 -1
  30. package/dist/{tool-visibility-IB5nHCZ_.mjs → tool-visibility-BdncNrVB.mjs} +11 -2
  31. package/dist/tool-visibility-BdncNrVB.mjs.map +1 -0
  32. package/dist/{tool-visibility-Boxtlbtr.cjs → tool-visibility-CfMxSzf8.cjs} +12 -2
  33. package/dist/{transport-error-DmC9WLTW.cjs → transport-error-CenkuT7T.cjs} +5 -2
  34. package/dist/{transport-error-CSEb6sPr.mjs → transport-error-S0za4TCe.mjs} +6 -3
  35. package/dist/transport-error-S0za4TCe.mjs.map +1 -0
  36. package/dist/{update-MsoEFbhn.mjs → update-7TewxG_2.mjs} +2 -2
  37. package/dist/{update-MsoEFbhn.mjs.map → update-7TewxG_2.mjs.map} +1 -1
  38. package/dist/{update-RKd0UW90.cjs → update-Rn1RSqrb.cjs} +7 -7
  39. package/docs/graph-query-compatibility.md +23 -16
  40. package/docs/graph-tools.md +123 -25
  41. package/package.json +7 -7
  42. package/skills/chain-insights-cypher/SKILL.md +222 -43
  43. package/skills/chain-insights-cypher/agents/openai.yaml +1 -1
  44. package/skills/chain-insights-schema-evm/SKILL.md +61 -29
  45. package/dist/call-args-ysbB_xdA.mjs.map +0 -1
  46. package/dist/capabilities-BOOUnAeV.mjs.map +0 -1
  47. package/dist/config-Br6VEK0O.mjs.map +0 -1
  48. package/dist/tool-visibility-IB5nHCZ_.mjs.map +0 -1
  49. package/dist/transport-error-CSEb6sPr.mjs.map +0 -1
  50. package/dist/version-BA3J8hu4.mjs +0 -8
  51. package/dist/version-BA3J8hu4.mjs.map +0 -1
  52. package/dist/version-CO9Or_YV.cjs +0 -17
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as PACKAGE_VERSION, t as PACKAGE_INFO } from "./version-BA3J8hu4.mjs";
1
+ import { a as PACKAGE_VERSION, i as PACKAGE_INFO, r as printMcpTextContent } from "./print-result-k9kXVR2c.mjs";
2
2
  import { Command, Option } from "commander";
3
3
  import { execFileSync } from "node:child_process";
4
4
  import { fileURLToPath } from "node:url";
@@ -45,99 +45,6 @@ function formatCiaWorkflows(workflows) {
45
45
  ].join("\n");
46
46
  }
47
47
  //#endregion
48
- //#region src/mcp/print-result.ts
49
- function isRecord(value) {
50
- return !!value && typeof value === "object" && !Array.isArray(value);
51
- }
52
- function displayValue(value) {
53
- if (value === null || value === void 0) return "";
54
- if (typeof value === "string") return value;
55
- if (typeof value === "number" || typeof value === "boolean") return String(value);
56
- try {
57
- return JSON.stringify(value);
58
- } catch {
59
- return String(value);
60
- }
61
- }
62
- function formatTable(rows) {
63
- if (rows.length === 0) return [];
64
- const columns = [...new Set(rows.flatMap((row) => Object.keys(row)))];
65
- const values = rows.map((row) => columns.map((column) => displayValue(row[column])));
66
- const widths = columns.map((column, index) => Math.max(column.length, ...values.map((row) => row[index]?.length ?? 0)));
67
- const line = (row) => row.map((value, index) => index === row.length - 1 ? value : value.padEnd(widths[index] ?? 0)).join(" | ");
68
- return [
69
- line(columns),
70
- widths.map((width) => "-".repeat(width)).join("-+-"),
71
- ...values.map(line)
72
- ];
73
- }
74
- function formatGraphResult(value, fallbackTool) {
75
- const facts = isRecord(value.facts) ? value.facts : void 0;
76
- const query = facts && isRecord(facts.query) ? facts.query : void 0;
77
- const queries = facts && Array.isArray(facts.queries) ? facts.queries : void 0;
78
- if (!query && !queries) return null;
79
- const lines = [`Tool: ${displayValue(value.tool) || fallbackTool || "MCP result"}`];
80
- const subject = isRecord(value.subject) ? value.subject : facts && isRecord(facts.subject) ? facts.subject : void 0;
81
- if (subject?.network !== void 0) lines.push(`Network: ${displayValue(subject.network)}`);
82
- if (query) {
83
- const results = Array.isArray(query.results) ? query.results.filter(isRecord) : [];
84
- if (query.count !== void 0) lines.push(`Rows: ${displayValue(query.count)}`);
85
- else lines.push(`Rows: ${results.length}`);
86
- if (query.billable_units !== void 0) lines.push(`Billed units: ${displayValue(query.billable_units)}`);
87
- if (query.elapsed_ms !== void 0) lines.push(`Elapsed: ${displayValue(query.elapsed_ms)} ms`);
88
- if (query.truncated !== void 0) lines.push(`Truncated: ${displayValue(query.truncated)}`);
89
- if (query.error !== void 0) lines.push(`Error: ${displayValue(query.error)}`);
90
- if (results.length > 0) lines.push("", "Results:", ...formatTable(results));
91
- else lines.push("", "Results: none");
92
- }
93
- if (queries) {
94
- lines.push(`Queries: ${queries.length}`);
95
- for (const entry of queries) {
96
- if (!isRecord(entry)) continue;
97
- const id = displayValue(entry.id) || "query";
98
- const results = Array.isArray(entry.results) ? entry.results.filter(isRecord) : [];
99
- lines.push("", `[${id}]`);
100
- if (entry.error !== void 0) lines.push(`Error: ${displayValue(entry.error)}`);
101
- lines.push(`Rows: ${displayValue(entry.count ?? results.length)}`);
102
- if (results.length > 0) lines.push(...formatTable(results));
103
- else lines.push("Results: none");
104
- }
105
- }
106
- return lines.join("\n");
107
- }
108
- /**
109
- * Formats one MCP text block for terminal output. JSON is indented when the
110
- * caller requests `--json`; graph query envelopes are rendered as a compact
111
- * result summary and table by default.
112
- */
113
- function formatMcpTextContent(text, tool, options = {}) {
114
- let parsed;
115
- try {
116
- parsed = JSON.parse(text);
117
- } catch {
118
- return text;
119
- }
120
- if (options.json) try {
121
- return JSON.stringify(parsed, null, 2);
122
- } catch {
123
- return text;
124
- }
125
- if (isRecord(parsed)) return formatGraphResult(parsed, tool) ?? JSON.stringify(parsed, null, 2);
126
- return displayValue(parsed);
127
- }
128
- /**
129
- * Prints the text blocks of an MCP tool result to stdout. When the result is
130
- * flagged `isError`, throws with the tool's error text instead — MCP `callTool`
131
- * returns tool errors as ordinary results (it does not reject), so callers must
132
- * surface them as failures (non-zero exit) rather than printing to stdout and
133
- * exiting 0.
134
- */
135
- function printMcpTextContent(result, options = {}) {
136
- const texts = (result.content ?? []).filter((item) => item.type === "text").map((item) => item.text ?? "");
137
- if (result.isError) throw new Error(texts.join("\n").trim() || "MCP tool returned an error");
138
- for (const text of texts) console.log(formatMcpTextContent(text, options.tool, options));
139
- }
140
- //#endregion
141
48
  //#region src/cli.ts
142
49
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
143
50
  const installerPath = path.resolve(__dirname, "..", "bin", "install.cjs");
@@ -182,10 +89,10 @@ function runInstaller(flag) {
182
89
  }
183
90
  }
184
91
  async function withGraphMcpClient(name, fn) {
185
- const { loadConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
92
+ const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
186
93
  const config = await loadConfig();
187
94
  const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import("./client-gsLi528K.mjs").then((n) => n.r);
188
- const { toGraphMcpEndpointError } = await import("./transport-error-CSEb6sPr.mjs");
95
+ const { toGraphMcpEndpointError } = await import("./transport-error-S0za4TCe.mjs");
189
96
  const endpoint = resolveGraphMcpEndpoint(config);
190
97
  const paymentFetch = await createConfiguredGraphMcpFetch(config);
191
98
  const { Client } = await import("@modelcontextprotocol/sdk/client/index.js");
@@ -210,22 +117,22 @@ async function withGraphMcpClient(name, fn) {
210
117
  }
211
118
  }
212
119
  async function printNetworkCapabilities(opts) {
213
- const { loadConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
214
- const { fetchNetworkCapabilities, formatNetworkCapabilities } = await import("./capabilities-BOOUnAeV.mjs").then((n) => n.t);
120
+ const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
121
+ const { fetchNetworkCapabilities, formatNetworkCapabilities } = await import("./capabilities-DfWL6n_g.mjs").then((n) => n.t);
215
122
  const document = await fetchNetworkCapabilities(await loadConfig());
216
123
  if (opts.json) console.log(JSON.stringify(document, null, 2));
217
124
  else console.log(formatNetworkCapabilities(document));
218
125
  }
219
126
  async function printNetworkOverview(opts) {
220
- const { loadConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
221
- const { fetchNetworkCapabilities, formatNetworkOverview } = await import("./capabilities-BOOUnAeV.mjs").then((n) => n.t);
127
+ const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
128
+ const { fetchNetworkCapabilities, formatNetworkOverview } = await import("./capabilities-DfWL6n_g.mjs").then((n) => n.t);
222
129
  const document = await fetchNetworkCapabilities(await loadConfig());
223
130
  if (opts.json) console.log(JSON.stringify(document, null, 2));
224
131
  else console.log(formatNetworkOverview(document));
225
132
  }
226
133
  async function printNetworkCapability(name, opts) {
227
- const { loadConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
228
- const { fetchNetworkCapabilities, findNetworkCapability, formatNetworkCapability } = await import("./capabilities-BOOUnAeV.mjs").then((n) => n.t);
134
+ const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
135
+ const { fetchNetworkCapabilities, findNetworkCapability, formatNetworkCapability } = await import("./capabilities-DfWL6n_g.mjs").then((n) => n.t);
229
136
  const document = await fetchNetworkCapabilities(await loadConfig());
230
137
  const network = findNetworkCapability(document, name);
231
138
  if (!network) {
@@ -342,7 +249,7 @@ program.command("workflows").description("List CIA workflow tools").option("--js
342
249
  });
343
250
  addAmlAddressRiskCommand(program.command("workflow").description("Run a high-level CIA workflow"), "cia networks");
344
251
  program.command("status").description("Show toolkit status and configuration").action(async () => {
345
- const { loadConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
252
+ const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
346
253
  const config = await loadConfig();
347
254
  const graphMcpStatus = config.graphMcpMode === "debug" && config.graphMcpAuthToken?.trim() ? "bearer access mode" : `${config.graphMcpMode} mode`;
348
255
  console.log("Config: ", config.dataDir);
@@ -351,7 +258,7 @@ program.command("status").description("Show toolkit status and configuration").a
351
258
  });
352
259
  program.command("update").description("Check npmjs for a newer Chain Insights release and update this CLI").option("--check", "Only check for a newer release").option("--dry-run", "Print the update command without running it").action(async (opts) => {
353
260
  try {
354
- const { checkForUpdate, runPackageUpdate } = await import("./update-MsoEFbhn.mjs");
261
+ const { checkForUpdate, runPackageUpdate } = await import("./update-7TewxG_2.mjs");
355
262
  const result = await checkForUpdate();
356
263
  if (result.error) throw new Error(`Could not check npmjs for updates: ${result.error}`);
357
264
  if (!result.updateAvailable || !result.latestVersion) {
@@ -376,7 +283,7 @@ program.command("update").description("Check npmjs for a newer Chain Insights re
376
283
  });
377
284
  program.command("debug").description("Configure Chain Insights Graph debug mode").addCommand(createCliCommand("on").description("Enable Chain Insights Graph debug mode without x402 payments").requiredOption("--token <token>", "Debug bearer token").option("--endpoint <url>", "Chain Insights Graph endpoint").action(async (opts) => {
378
285
  try {
379
- const { saveConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
286
+ const { saveConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
380
287
  await saveConfig({
381
288
  graphMcpMode: "debug",
382
289
  graphMcpAuthToken: opts.token,
@@ -391,7 +298,7 @@ program.command("debug").description("Configure Chain Insights Graph debug mode"
391
298
  }
392
299
  })).addCommand(createCliCommand("off").description("Disable Chain Insights Graph debug mode and use paid x402 calls").action(async () => {
393
300
  try {
394
- const { saveConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
301
+ const { saveConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
395
302
  await saveConfig({
396
303
  graphMcpMode: "paid",
397
304
  graphMcpAuthToken: ""
@@ -404,7 +311,7 @@ program.command("debug").description("Configure Chain Insights Graph debug mode"
404
311
  }
405
312
  })).addCommand(createCliCommand("status").description("Show Chain Insights Graph payment/debug mode").action(async () => {
406
313
  try {
407
- const { loadConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
314
+ const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
408
315
  const config = await loadConfig();
409
316
  console.log(`Chain Insights Graph mode: ${config.graphMcpMode}`);
410
317
  console.log(`Graph endpoint: ${config.graphMcpEndpoint}`);
@@ -419,7 +326,7 @@ program.command("access-key").description("Configure Chain Insights Graph test a
419
326
  try {
420
327
  const normalizedKey = key.trim();
421
328
  if (!normalizedKey) throw new Error("Test access key is required");
422
- const { saveConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
329
+ const { saveConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
423
330
  await saveConfig({
424
331
  graphMcpMode: "debug",
425
332
  graphMcpAuthToken: normalizedKey,
@@ -434,7 +341,7 @@ program.command("access-key").description("Configure Chain Insights Graph test a
434
341
  }
435
342
  })).addCommand(createCliCommand("clear").description("Remove the Chain Insights Graph test access key and use paid x402 calls").action(async () => {
436
343
  try {
437
- const { saveConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
344
+ const { saveConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
438
345
  await saveConfig({
439
346
  graphMcpMode: "paid",
440
347
  graphMcpAuthToken: ""
@@ -447,7 +354,7 @@ program.command("access-key").description("Configure Chain Insights Graph test a
447
354
  }
448
355
  })).addCommand(createCliCommand("status").description("Show Chain Insights Graph test access key status").action(async () => {
449
356
  try {
450
- const { loadConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
357
+ const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
451
358
  const config = await loadConfig();
452
359
  console.log(`Graph endpoint: ${config.graphMcpEndpoint}`);
453
360
  console.log(`Access key: ${config.graphMcpAuthToken?.trim() ? "configured" : "not configured"}`);
@@ -467,7 +374,7 @@ program.command("setup").description("Configure external MCP clients").addComman
467
374
  runInstaller("--hermes");
468
375
  }));
469
376
  program.command("config").description("Read or write configuration values").addCommand(createCliCommand("get").description("Read one Chain Insights configuration value").argument("<key>", "Config key to read").action(async (key) => {
470
- const { loadConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
377
+ const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
471
378
  const { CONFIG_KEYS } = await import("./schema-KjZqCHbu.mjs").then((n) => n.r);
472
379
  if (!CONFIG_KEYS.includes(key)) {
473
380
  console.error(`Unknown config key: ${key}`);
@@ -475,6 +382,21 @@ program.command("config").description("Read or write configuration values").addC
475
382
  }
476
383
  const value = (await loadConfig())[key];
477
384
  console.log(value ?? "");
385
+ })).addCommand(createCliCommand("reset").description("Put every setting back to its default (production endpoint, paid mode, no test key); the wallet stays").action(async () => {
386
+ try {
387
+ const { resetConfig, loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
388
+ const { backupPath } = await resetConfig();
389
+ const config = await loadConfig();
390
+ if (backupPath) console.log(`Previous settings saved to ${backupPath}`);
391
+ console.log("Settings reset to defaults.");
392
+ console.log(`Graph endpoint: ${config.graphMcpEndpoint}`);
393
+ console.log(`Mode: ${config.graphMcpMode}`);
394
+ console.log("Test access: off");
395
+ console.log("Wallet: unchanged (~/.chain-insights/wallet.json)");
396
+ } catch (err) {
397
+ console.error(err.message);
398
+ process.exit(1);
399
+ }
478
400
  })).addCommand(createCliCommand("set").description("Write one Chain Insights configuration value").argument("<key>", "Config key to write").argument("<value>", "Value to set").action(async (key, value) => {
479
401
  if (key === "walletPrivateKey") {
480
402
  try {
@@ -488,7 +410,7 @@ program.command("config").description("Read or write configuration values").addC
488
410
  }
489
411
  return;
490
412
  }
491
- const { loadConfig, saveConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
413
+ const { loadConfig, saveConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
492
414
  const { CONFIG_KEYS, DEFAULT_CONFIG } = await import("./schema-KjZqCHbu.mjs").then((n) => n.r);
493
415
  const current = await loadConfig();
494
416
  if (!CONFIG_KEYS.includes(key)) {
@@ -624,12 +546,12 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
624
546
  console.error(err.message);
625
547
  process.exit(1);
626
548
  }
627
- })).addCommand(createCliCommand("tools").description("List remote GraphRAG MCP tools only (cached for 24 hours)").option("--refresh", "Force refresh schema cache").action(async (opts) => {
549
+ })).addCommand(createCliCommand("tools").description("List the remote GraphRAG MCP tools (cached for 24 hours) and the local money_flows tool").option("--refresh", "Force refresh schema cache").action(async (opts) => {
628
550
  try {
629
551
  const { loadSchema, saveSchema } = await import("./schema-cache-DJdU4MIP.mjs");
630
552
  const { formatToolsTable } = await import("./format-DB2IH2U5.mjs");
631
- const { visibleRemoteTools } = await import("./tool-visibility-IB5nHCZ_.mjs").then((n) => n.a);
632
- const { loadConfig } = await import("./config-Br6VEK0O.mjs").then((n) => n.t);
553
+ const { visibleRemoteTools } = await import("./tool-visibility-BdncNrVB.mjs").then((n) => n.a);
554
+ const { loadConfig } = await import("./config-9MabJh5R.mjs").then((n) => n.t);
633
555
  const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import("./client-gsLi528K.mjs").then((n) => n.r);
634
556
  const config = await loadConfig();
635
557
  const graphMcpEndpoint = resolveGraphMcpEndpoint(config);
@@ -650,15 +572,20 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
650
572
  await client.close();
651
573
  }
652
574
  }
653
- console.log(formatToolsTable(visibleRemoteTools(tools)));
575
+ const { MONEY_FLOWS_TOOL, MONEY_FLOWS_DESCRIPTION } = await import("./flows-9XJmeF_M.mjs").then((n) => n.s);
576
+ const listed = visibleRemoteTools(tools).filter((t) => t.name !== MONEY_FLOWS_TOOL);
577
+ console.log(formatToolsTable([...listed, {
578
+ name: MONEY_FLOWS_TOOL,
579
+ description: MONEY_FLOWS_DESCRIPTION
580
+ }]));
654
581
  } catch (err) {
655
582
  console.error(err.message);
656
583
  process.exit(1);
657
584
  }
658
585
  })).addCommand(createCliCommand("call").description("Call a low-level MCP tool directly (advanced)").option("--json", "Print machine-readable JSON output").argument("<tool>", "Tool name to call").argument("[args...]", "Key=value arguments (e.g. address=0x1234... network=robinhood)").action(async (tool, rawArgs, opts) => {
659
586
  try {
660
- const { parseMcpCallArgs } = await import("./call-args-ysbB_xdA.mjs");
661
- const { assertPublicMcpToolName, validatePublicMcpToolArguments } = await import("./tool-visibility-IB5nHCZ_.mjs").then((n) => n.a);
587
+ const { parseMcpCallArgs } = await import("./call-args-DPWeqIla.mjs");
588
+ const { assertPublicMcpToolName, validatePublicMcpToolArguments } = await import("./tool-visibility-BdncNrVB.mjs").then((n) => n.a);
662
589
  const args = parseMcpCallArgs(rawArgs);
663
590
  assertPublicMcpToolName(tool);
664
591
  if (tool === "aml_address_risk") throw new Error("aml_address_risk is a CIA workflow. Run `cia workflow aml-address-risk` instead.");
@@ -672,6 +599,25 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
672
599
  await printNetworkCapabilities({ json: opts.json });
673
600
  return;
674
601
  }
602
+ if (tool === "graph_expand") throw new Error("graph_expand is used only by the money-flow view in Claude. Run `cia mcp call money_flows` instead.");
603
+ if (tool === "money_flows") {
604
+ await withGraphMcpClient("chain-insights-cli-call", async (client) => {
605
+ const { handleMoneyFlows } = await import("./flows-9XJmeF_M.mjs").then((n) => n.s);
606
+ const { graphToolRequestOptions } = await import("./request-timeout-lBBe0mGf.mjs");
607
+ const result = await handleMoneyFlows(args, {
608
+ graphQuery: async (queryArgs) => await client.callTool({
609
+ name: "graph_query",
610
+ arguments: queryArgs
611
+ }, void 0, graphToolRequestOptions("graph_query")),
612
+ describeFailure: (err) => err instanceof Error ? err.message : String(err)
613
+ });
614
+ printMcpTextContent(result, {
615
+ tool,
616
+ json: opts.json
617
+ });
618
+ });
619
+ return;
620
+ }
675
621
  if (tool === "meta_help") {
676
622
  console.log("Chain Insights workflow tools: aml_address_risk. Low-level GraphRAG tools: graph_query and graph_query_batch. Metadata and payment tools: meta_* and wallet_balance.");
677
623
  return;
@@ -679,10 +625,11 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
679
625
  await withGraphMcpClient("chain-insights-cli-call", async (client, config) => {
680
626
  if (tool === "meta_usage_status") {
681
627
  try {
682
- printMcpTextContent(await client.callTool({
628
+ const result = await client.callTool({
683
629
  name: "usage_status",
684
630
  arguments: {}
685
- }), {
631
+ });
632
+ printMcpTextContent(result, {
686
633
  tool,
687
634
  json: opts.json
688
635
  });
@@ -698,10 +645,11 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
698
645
  try {
699
646
  const { getWalletAccount } = await import("./tools-BnThuvE2.mjs").then((n) => n.p);
700
647
  const account = await getWalletAccount();
701
- printMcpTextContent(await client.callTool({
648
+ const result = await client.callTool({
702
649
  name: "subscription_status",
703
650
  arguments: { wallet: account.address }
704
- }), {
651
+ });
652
+ printMcpTextContent(result, {
705
653
  tool,
706
654
  json: opts.json
707
655
  });
@@ -715,19 +663,20 @@ program.command("mcp").description("Low-level access to the Chain Insights MCP e
715
663
  }
716
664
  const { graphToolRequestOptions } = await import("./request-timeout-lBBe0mGf.mjs");
717
665
  const requestOptions = graphToolRequestOptions(tool);
718
- printMcpTextContent(requestOptions ? await client.callTool({
666
+ const result = requestOptions ? await client.callTool({
719
667
  name: tool,
720
668
  arguments: args
721
669
  }, void 0, requestOptions) : await client.callTool({
722
670
  name: tool,
723
671
  arguments: args
724
- }), {
672
+ });
673
+ printMcpTextContent(result, {
725
674
  tool,
726
675
  json: opts.json
727
676
  });
728
677
  });
729
678
  } catch (err) {
730
- const { formatMcpCallError } = await import("./tool-visibility-IB5nHCZ_.mjs").then((n) => n.a);
679
+ const { formatMcpCallError } = await import("./tool-visibility-BdncNrVB.mjs").then((n) => n.a);
731
680
  console.error(formatMcpCallError(tool, err));
732
681
  process.exit(1);
733
682
  }