/** * 列出东方财富妙想 MCP 暴露的所有工具 * 用法: npm run data:discover * 输出: tool 名称 + 描述 + 输入 schema */ require('dotenv').config() async function main() { if (!process.env.EM_API_KEY) { console.error('缺少 EM_API_KEY (在 .env 配)') process.exit(1) } const { listAvailableTools } = await import('./fetchers/eastmoney-mcp.fetcher.js') console.log('[Discover] 调妙想 MCP tools/list...') const tools = await listAvailableTools() console.log(`[Discover] 找到 ${tools.length} 个工具\n`) for (const t of tools) { console.log(`── ${t.name} ${'─'.repeat(Math.max(0, 60 - t.name.length))}`) if (t.description) console.log(` ${t.description}`) if (t.inputSchema) { console.log(' inputSchema:') const s = JSON.stringify(t.inputSchema, null, 2) s.split('\n').forEach((line) => console.log(' ' + line)) } console.log('') } } main().catch((e) => { console.error('[Discover] 失败:', e.message) process.exit(1) })