chain-insights 0.49.0 → 0.50.0

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.
@@ -213,8 +213,8 @@ const KNOWN_PUBLIC_TOOL_DESCRIPTIONS = {
213
213
  meta_subscription_status: "Return the caller's CIA subscription window end, daily allowance, consumption, and tier.",
214
214
  meta_help: "Show a short guide to Chain Insights tools and workflow.",
215
215
  wallet_balance: "Show the local Chain Insights payment wallet address, payment network, token, and amount.",
216
- graph_query: `Run a read-only GQL/Cypher query through the Chain Insights graph endpoint. ${GRAPH_LAYERS_TEXT} ${ROUTING_NOT_SERVED} Preserve full addresses exactly.`,
217
- graph_query_batch: "Run multiple read-only GQL/Cypher queries through the Chain Insights graph endpoint in one paid batch. Prefer this for related topology/facts reads."
216
+ graph_query: `Run a read-only GQL/Cypher query through the Chain Insights graph endpoint. ${GRAPH_LAYERS_TEXT} ${ROUTING_NOT_SERVED} Preserve full addresses exactly, and write every address in full, all 42 characters, in your answer: never shorten one with ... or ….`,
217
+ graph_query_batch: "Run multiple read-only GQL/Cypher queries through the Chain Insights graph endpoint in one paid batch. Prefer this for related topology/facts reads. For a time series across days, send one USE facts total per day with the query id set to the day, \"YYYY-MM-DD\": the view joins them into one series. Write every address in full in your answer, all 42 characters."
218
218
  };
219
219
  const KNOWN_PUBLIC_TOOL_TITLES = {
220
220
  graph_query: "Graph Query",
@@ -225,12 +225,20 @@ const NETWORK_SCHEMA = zod.string().min(1).describe("Network to query: robinhood
225
225
  const EMPTY_INPUT_SCHEMA = zod.strictObject({});
226
226
  const REMOTE_GRAPH_TOOL_REQUEST_TIMEOUT_MS = 9e5;
227
227
  const PICTURE_RULES = [
228
- "Pictures: hosts that draw views, such as Claude Desktop, draw a graph_query answer from its column names. No other tool is needed.",
229
- "- Rows with from_address and to_address columns draw a graph of at most 60 addresses. Optional columns: amount_usd_sum, tx_count, first_seen_timestamp, last_seen_timestamp, link_kind, from_labels, to_labels. Example: USE topology MATCH (a:Address {address: $addr})-[f:FLOWS_TO]->(b:Address) WHERE NOT a:Pool RETURN a.address AS from_address, b.address AS to_address, f.amount_usd_sum AS amount_usd_sum, f.tx_count AS tx_count, f.last_seen_timestamp AS last_seen_timestamp ORDER BY f.last_seen_timestamp DESC LIMIT 25",
230
- "- Rows with a day, date or *_timestamp column and number columns draw a chart. Example, the transfers of a known pair on one day: USE facts MATCH (a:Address {address: $from})-[t:TRANSFER]->(b:Address {address: $to}) WHERE t.block_date = \"YYYY-MM-DD\" RETURN t.block_timestamp AS block_timestamp, t.amount_usd AS amount_usd LIMIT 200",
228
+ "Pictures: hosts that draw views, such as Claude Desktop and the Codex app, draw a graph_query answer from its column names. No other tool is needed. Choose the picture by the question: who sent to whom, flows and routes are a graph; how something changed over time is a time series; a list, a lookup or the details of one thing is a table.",
229
+ "- Rows with from_address and to_address columns draw a graph of at most 5,000 addresses. Optional columns: amount_usd_sum, tx_count, first_seen_timestamp, last_seen_timestamp, link_kind, from_labels, to_labels. Example: USE topology MATCH (a:Address {address: $addr})-[f:FLOWS_TO]->(b:Address) WHERE NOT a:Pool RETURN a.address AS from_address, b.address AS to_address, f.amount_usd_sum AS amount_usd_sum, f.tx_count AS tx_count, f.last_seen_timestamp AS last_seen_timestamp ORDER BY f.last_seen_timestamp DESC LIMIT 25",
230
+ "- Rows with a day, date, hour, week, month or *_timestamp column, number columns, no address in any value and at least 3 distinct times draw a time series. Within one day, the transfers of a known pair: USE facts MATCH (a:Address {address: $from})-[t:TRANSFER]->(b:Address {address: $to}) WHERE t.block_date = \"YYYY-MM-DD\" RETURN t.block_timestamp AS block_timestamp, t.amount_usd AS amount_usd LIMIT 200",
231
+ "- Across days: facts reads one day at a time, so send graph_query_batch with one query per day (3 to 20 days), each query id the day as \"YYYY-MM-DD\", each returning one total row: USE facts MATCH (a:Address {address: $from})-[t:TRANSFER]->(b:Address {address: $to}) WHERE t.block_date = \"YYYY-MM-DD\" RETURN count(t) AS tx_count, sum(t.amount_usd) AS amount_usd_sum. The view joins the days into one time series. Do not group by day or name several days in one read: both are refused.",
231
232
  "- Any other rows draw a table."
232
233
  ].join("\n");
233
- const PICTURE_HELP_LINE = "In hosts that draw views, a graph_query answer with from_address and to_address columns draws a graph, a day or time column with numbers draws a chart, and any other rows draw a table.";
234
+ const PICTURE_HELP_LINE = "In hosts that draw views, a graph_query answer with from_address and to_address columns draws a graph, a day or time column with numbers draws a time series (across days: a graph_query_batch of one-day totals, each query id the day), and any other rows draw a table.";
235
+ const ANSWER_RULES = [
236
+ "Answer rules, for every reply to the user:",
237
+ "1. Write every address in full: 0x plus 40 hex characters, 42 in all, in sentences, lists, tables and summaries. Never shorten one with ... or …. The drawn picture may shorten its labels; your text never does.",
238
+ "2. Do not print the query, its USE line, its LIMIT, the epoch numbers you computed, or a Ref: line, unless the user asks how a number was found.",
239
+ "3. Tokens are not dollars: a transfer moves tokens worth an amount at the day price. Say \"tokens worth about 183 USD on 2026-10-06\", never \"sent 183 USD\".",
240
+ "4. Never draw a graph or a chart in text, ASCII or Mermaid: the host draws the picture from the columns. Write a short answer beside it."
241
+ ].join("\n");
234
242
  const CHAIN_INSIGHTS_WORKFLOW = [
235
243
  "Workflow:",
236
244
  "1. Do not call investigation tools until required arguments are known. Network is required; use meta_network_capabilities to check supported networks and available tools, or ask the user if missing.",
@@ -273,6 +281,7 @@ const GRAPH_SCHEMA_HINTS = [
273
281
  const ROUTING_HEAD = routingHead();
274
282
  const SERVER_INSTRUCTIONS = [
275
283
  "Chain Insights is an AML and graph-analysis MCP server for AI agents.",
284
+ ANSWER_RULES,
276
285
  CHAIN_INSIGHTS_WORKFLOW,
277
286
  ROUTING_HEAD,
278
287
  PICTURE_RULES,
@@ -281,6 +290,7 @@ const SERVER_INSTRUCTIONS = [
281
290
  ].join("\n\n");
282
291
  const STATELESS_SERVER_INSTRUCTIONS = [
283
292
  "Chain Insights is running as a stateless AML proxy for a host application.",
293
+ ANSWER_RULES,
284
294
  "Call graph_query or graph_query_batch with network=robinhood. meta_network_capabilities takes no arguments (send {}); call it only to check which tools and layers are live.",
285
295
  ROUTING_HEAD,
286
296
  PICTURE_RULES,
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-proxy.d.cts","names":[],"sources":["../src/mcp/proxy.ts"],"mappings":";;qBAgEa;qBACA;;;;;wBAqBG;YAkBJ;wBAEI,oBAAoB,MAAK,OAAO,aAA2B;KAgCtE,iBAAiB,eAAe,EAAE;wBAgGvB,2BAA2B,mBAAmB;;;;;;;;wBA+lBxC,eAAe"}
1
+ {"version":3,"file":"mcp-proxy.d.cts","names":[],"sources":["../src/mcp/proxy.ts"],"mappings":";;qBAgEa;qBACA;;;;;wBAqBG;YAkBJ;wBAEI,oBAAoB,MAAK,OAAO,aAA2B;KAgCtE,iBAAiB,eAAe,EAAE;wBA6GvB,2BAA2B,mBAAmB;;;;;;;;wBA+lBxC,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-proxy.d.mts","names":[],"sources":["../src/mcp/proxy.ts"],"mappings":";;qBAgEa;qBACA;;;;;wBAqBG;YAkBJ;wBAEI,oBAAoB,MAAK,OAAO,aAA2B;KAgCtE,iBAAiB,eAAe,EAAE;wBAgGvB,2BAA2B,mBAAmB;;;;;;;;wBA+lBxC,eAAe"}
1
+ {"version":3,"file":"mcp-proxy.d.mts","names":[],"sources":["../src/mcp/proxy.ts"],"mappings":";;qBAgEa;qBACA;;;;;wBAqBG;YAkBJ;wBAEI,oBAAoB,MAAK,OAAO,aAA2B;KAgCtE,iBAAiB,eAAe,EAAE;wBA6GvB,2BAA2B,mBAAmB;;;;;;;;wBA+lBxC,eAAe"}
@@ -209,8 +209,8 @@ const KNOWN_PUBLIC_TOOL_DESCRIPTIONS = {
209
209
  meta_subscription_status: "Return the caller's CIA subscription window end, daily allowance, consumption, and tier.",
210
210
  meta_help: "Show a short guide to Chain Insights tools and workflow.",
211
211
  wallet_balance: "Show the local Chain Insights payment wallet address, payment network, token, and amount.",
212
- graph_query: `Run a read-only GQL/Cypher query through the Chain Insights graph endpoint. ${GRAPH_LAYERS_TEXT} ${ROUTING_NOT_SERVED} Preserve full addresses exactly.`,
213
- graph_query_batch: "Run multiple read-only GQL/Cypher queries through the Chain Insights graph endpoint in one paid batch. Prefer this for related topology/facts reads."
212
+ graph_query: `Run a read-only GQL/Cypher query through the Chain Insights graph endpoint. ${GRAPH_LAYERS_TEXT} ${ROUTING_NOT_SERVED} Preserve full addresses exactly, and write every address in full, all 42 characters, in your answer: never shorten one with ... or ….`,
213
+ graph_query_batch: "Run multiple read-only GQL/Cypher queries through the Chain Insights graph endpoint in one paid batch. Prefer this for related topology/facts reads. For a time series across days, send one USE facts total per day with the query id set to the day, \"YYYY-MM-DD\": the view joins them into one series. Write every address in full in your answer, all 42 characters."
214
214
  };
215
215
  const KNOWN_PUBLIC_TOOL_TITLES = {
216
216
  graph_query: "Graph Query",
@@ -221,12 +221,20 @@ const NETWORK_SCHEMA = z.string().min(1).describe("Network to query: robinhood,
221
221
  const EMPTY_INPUT_SCHEMA = z.strictObject({});
222
222
  const REMOTE_GRAPH_TOOL_REQUEST_TIMEOUT_MS = 9e5;
223
223
  const PICTURE_RULES = [
224
- "Pictures: hosts that draw views, such as Claude Desktop, draw a graph_query answer from its column names. No other tool is needed.",
225
- "- Rows with from_address and to_address columns draw a graph of at most 60 addresses. Optional columns: amount_usd_sum, tx_count, first_seen_timestamp, last_seen_timestamp, link_kind, from_labels, to_labels. Example: USE topology MATCH (a:Address {address: $addr})-[f:FLOWS_TO]->(b:Address) WHERE NOT a:Pool RETURN a.address AS from_address, b.address AS to_address, f.amount_usd_sum AS amount_usd_sum, f.tx_count AS tx_count, f.last_seen_timestamp AS last_seen_timestamp ORDER BY f.last_seen_timestamp DESC LIMIT 25",
226
- "- Rows with a day, date or *_timestamp column and number columns draw a chart. Example, the transfers of a known pair on one day: USE facts MATCH (a:Address {address: $from})-[t:TRANSFER]->(b:Address {address: $to}) WHERE t.block_date = \"YYYY-MM-DD\" RETURN t.block_timestamp AS block_timestamp, t.amount_usd AS amount_usd LIMIT 200",
224
+ "Pictures: hosts that draw views, such as Claude Desktop and the Codex app, draw a graph_query answer from its column names. No other tool is needed. Choose the picture by the question: who sent to whom, flows and routes are a graph; how something changed over time is a time series; a list, a lookup or the details of one thing is a table.",
225
+ "- Rows with from_address and to_address columns draw a graph of at most 5,000 addresses. Optional columns: amount_usd_sum, tx_count, first_seen_timestamp, last_seen_timestamp, link_kind, from_labels, to_labels. Example: USE topology MATCH (a:Address {address: $addr})-[f:FLOWS_TO]->(b:Address) WHERE NOT a:Pool RETURN a.address AS from_address, b.address AS to_address, f.amount_usd_sum AS amount_usd_sum, f.tx_count AS tx_count, f.last_seen_timestamp AS last_seen_timestamp ORDER BY f.last_seen_timestamp DESC LIMIT 25",
226
+ "- Rows with a day, date, hour, week, month or *_timestamp column, number columns, no address in any value and at least 3 distinct times draw a time series. Within one day, the transfers of a known pair: USE facts MATCH (a:Address {address: $from})-[t:TRANSFER]->(b:Address {address: $to}) WHERE t.block_date = \"YYYY-MM-DD\" RETURN t.block_timestamp AS block_timestamp, t.amount_usd AS amount_usd LIMIT 200",
227
+ "- Across days: facts reads one day at a time, so send graph_query_batch with one query per day (3 to 20 days), each query id the day as \"YYYY-MM-DD\", each returning one total row: USE facts MATCH (a:Address {address: $from})-[t:TRANSFER]->(b:Address {address: $to}) WHERE t.block_date = \"YYYY-MM-DD\" RETURN count(t) AS tx_count, sum(t.amount_usd) AS amount_usd_sum. The view joins the days into one time series. Do not group by day or name several days in one read: both are refused.",
227
228
  "- Any other rows draw a table."
228
229
  ].join("\n");
229
- const PICTURE_HELP_LINE = "In hosts that draw views, a graph_query answer with from_address and to_address columns draws a graph, a day or time column with numbers draws a chart, and any other rows draw a table.";
230
+ const PICTURE_HELP_LINE = "In hosts that draw views, a graph_query answer with from_address and to_address columns draws a graph, a day or time column with numbers draws a time series (across days: a graph_query_batch of one-day totals, each query id the day), and any other rows draw a table.";
231
+ const ANSWER_RULES = [
232
+ "Answer rules, for every reply to the user:",
233
+ "1. Write every address in full: 0x plus 40 hex characters, 42 in all, in sentences, lists, tables and summaries. Never shorten one with ... or …. The drawn picture may shorten its labels; your text never does.",
234
+ "2. Do not print the query, its USE line, its LIMIT, the epoch numbers you computed, or a Ref: line, unless the user asks how a number was found.",
235
+ "3. Tokens are not dollars: a transfer moves tokens worth an amount at the day price. Say \"tokens worth about 183 USD on 2026-10-06\", never \"sent 183 USD\".",
236
+ "4. Never draw a graph or a chart in text, ASCII or Mermaid: the host draws the picture from the columns. Write a short answer beside it."
237
+ ].join("\n");
230
238
  const CHAIN_INSIGHTS_WORKFLOW = [
231
239
  "Workflow:",
232
240
  "1. Do not call investigation tools until required arguments are known. Network is required; use meta_network_capabilities to check supported networks and available tools, or ask the user if missing.",
@@ -269,6 +277,7 @@ const GRAPH_SCHEMA_HINTS = [
269
277
  const ROUTING_HEAD = routingHead();
270
278
  const SERVER_INSTRUCTIONS = [
271
279
  "Chain Insights is an AML and graph-analysis MCP server for AI agents.",
280
+ ANSWER_RULES,
272
281
  CHAIN_INSIGHTS_WORKFLOW,
273
282
  ROUTING_HEAD,
274
283
  PICTURE_RULES,
@@ -277,6 +286,7 @@ const SERVER_INSTRUCTIONS = [
277
286
  ].join("\n\n");
278
287
  const STATELESS_SERVER_INSTRUCTIONS = [
279
288
  "Chain Insights is running as a stateless AML proxy for a host application.",
289
+ ANSWER_RULES,
280
290
  "Call graph_query or graph_query_batch with network=robinhood. meta_network_capabilities takes no arguments (send {}); call it only to check which tools and layers are live.",
281
291
  ROUTING_HEAD,
282
292
  PICTURE_RULES,