{"version":3,"file":"tool-visibility-9-rvB91K.mjs","names":[],"sources":["../src/mcp/tool-visibility.ts"],"sourcesContent":["export const HIDDEN_REMOTE_TOOL_NAMES = new Set([\n  'topup',\n  'address_risk',\n  'trace_victim_funds',\n  'trace_suspect_funds',\n  'trace_deposit_sources',\n  'trace_funds',\n  'track_funds',\n  'network_capabilities',\n  'usage_status',\n  'balance',\n  'help',\n  'money_flows_between_exchanges',\n  'address_connection_risk',\n])\n\nexport const PUBLIC_MCP_TOOL_REQUIRED_ARGS: Record<string, string[]> = {\n  aml_address_risk: ['address', 'network'],\n  aml_trace_victim_funds: ['victim_addresses', 'network'],\n  aml_trace_suspect_funds: ['suspect_addresses', 'network'],\n  aml_trace_deposit_sources: ['deposit_addresses', 'network'],\n  graph_query: ['query', 'network'],\n  graph_query_batch: ['network', 'queries'],\n}\n\nexport const PUBLIC_MCP_TOOL_ALLOWED_ARGS: Record<string, string[]> = {\n  aml_address_risk: ['address', 'network', 'compare_address', 'include_attachments', 'topology_scope'],\n  aml_trace_victim_funds: ['victim_addresses', 'network', 'known_suspect_addresses', 'incident_timestamp_ms', 'max_hops', 'include_attachments', 'topology_scope'],\n  aml_trace_suspect_funds: ['suspect_addresses', 'network', 'incident_timestamp_ms', 'max_hops', 'include_attachments', 'topology_scope'],\n  aml_trace_deposit_sources: ['deposit_addresses', 'network', 'max_hops', 'include_attachments', 'topology_scope'],\n  graph_query: ['query', 'network'],\n  graph_query_batch: ['network', 'queries', 'per_query_timeout_seconds'],\n}\n\nexport function isHiddenRemoteToolName(name: string): boolean {\n  return HIDDEN_REMOTE_TOOL_NAMES.has(name)\n}\n\nexport function visibleRemoteTools<T extends { name: string }>(tools: T[]): T[] {\n  return tools.filter((tool) => !isHiddenRemoteToolName(tool.name))\n}\n\nexport function assertPublicMcpToolName(name: string): void {\n  if (!isHiddenRemoteToolName(name)) return\n  const replacement = name === 'trace_funds'\n    ? ' Use aml_trace_victim_funds, aml_trace_suspect_funds, or aml_trace_deposit_sources instead.'\n    : name === 'trace_victim_funds'\n      ? ' Use aml_trace_victim_funds instead.'\n      : name === 'trace_suspect_funds'\n        ? ' Use aml_trace_suspect_funds instead.'\n        : name === 'trace_deposit_sources'\n          ? ' Use aml_trace_deposit_sources instead.'\n    : name === 'track_funds'\n      ? ' Use aml_trace_victim_funds instead.'\n      : name === 'address_risk'\n        ? ' Use aml_address_risk instead.'\n      : name === 'network_capabilities'\n        ? ' Use meta_network_capabilities instead.'\n      : name === 'usage_status'\n        ? ' Use meta_usage_status instead.'\n      : name === 'balance'\n        ? ' Use wallet_balance instead.'\n      : name === 'help'\n        ? ' Use meta_help instead.'\n      : ''\n  throw new Error(`MCP tool '${name}' is not exposed by Chain Insights.${replacement}`)\n}\n\nconst TOPOLOGY_SCOPE_VALUES = ['live_topology', 'archive_topology']\n\nexport function validatePublicMcpToolArguments(name: string, args: Record<string, unknown>): void {\n  const allowedArgs = PUBLIC_MCP_TOOL_ALLOWED_ARGS[name]\n  if (!allowedArgs) return\n\n  const unsupportedArgs = Object.keys(args).filter((argName) => !allowedArgs.includes(argName))\n  if (unsupportedArgs.length === 0) {\n    if ('topology_scope' in args && !TOPOLOGY_SCOPE_VALUES.includes(String(args['topology_scope']))) {\n      throw new Error(`Invalid topology_scope for ${name}: ${String(args['topology_scope'])}. Allowed values: ${TOPOLOGY_SCOPE_VALUES.join(', ')}.`)\n    }\n    return\n  }\n\n  throw new Error([\n    `Unsupported argument${unsupportedArgs.length === 1 ? '' : 's'} for ${name}: ${unsupportedArgs.join(', ')}.`,\n    `Allowed arguments: ${allowedArgs.join(', ')}.`,\n  ].join(' '))\n}\n"],"mappings":";;;;;;;;;;;AAAA,MAAa,2CAA2B,IAAI,IAAI;CAC9C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,gCAA0D;CACrE,kBAAkB,CAAC,WAAW,SAAS;CACvC,wBAAwB,CAAC,oBAAoB,SAAS;CACtD,yBAAyB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