Skip to main content
Glama
Xxx00xxX33

FinanceMCP

by Xxx00xxX33

dragon_tiger_inst

Retrieve institutional trading details from Dragon Tiger Board for specific dates. Provides buy/sell/net amounts and listing reasons to analyze major institutional transactions.

Instructions

龙虎榜机构成交明细(top_inst)。必填:交易日期;可选:股票TS代码。返回表格包含买入/卖出/净额及上榜理由等。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
trade_dateYes交易日期,格式YYYYMMDD
ts_codeNo可选,股票TS代码,如 000001.SZ

Implementation Reference

  • The core handler function 'run' that fetches dragon tiger list institutional trading details from Tushare API 'top_inst', processes data into a markdown table with totals and stock code explanations.
    async run(args: { trade_date: string; ts_code?: string }) {
      try {
        if (!args.trade_date || args.trade_date.trim().length !== 8) {
          throw new Error('trade_date 必须为YYYYMMDD');
        }
    
        if (!TUSHARE_CONFIG.API_TOKEN) {
          throw new Error('请配置TUSHARE_TOKEN环境变量');
        }
    
        const params: any = {
          api_name: 'top_inst',
          token: TUSHARE_CONFIG.API_TOKEN,
          params: {
            trade_date: args.trade_date
          }
        };
        if (args.ts_code) params.params.ts_code = args.ts_code;
    
        const controller = new AbortController();
        const timeoutId = setTimeout(() => controller.abort(), TUSHARE_CONFIG.TIMEOUT);
        try {
          const resp = await fetch(TUSHARE_CONFIG.API_URL, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify(params),
            signal: controller.signal
          });
          if (!resp.ok) throw new Error(`Tushare API请求失败: ${resp.status}`);
          const data = await resp.json();
          if (data.code !== 0) throw new Error(`Tushare API错误: ${data.msg}`);
    
          const fields: string[] = data.data?.fields ?? [];
          const items: any[] = data.data?.items ?? [];
          if (items.length === 0) {
            return {
              content: [
                { type: 'text', text: `# 龙虎榜机构明细 ${args.trade_date}${args.ts_code ? ` - ${args.ts_code}` : ''}\n\n暂无数据` }
              ]
            };
          }
    
          // 字段顺序按需求固定(移除 trade_date 列)
          const desired = ['ts_code','exalter','buy','buy_rate','sell','sell_rate','net_buy','reason'];
          const headers = desired.filter(h => fields.includes(h));
    
          let table = `| ${headers.join(' | ')} |\n`;
          table += `|${headers.map(() => '--------').join('|')}|\n`;
          let totalBuy = 0;
          let totalSell = 0;
          let totalNet = 0;
          for (const row of items) {
            const obj: Record<string, any> = {};
            fields.forEach((f: string, idx: number) => obj[f] = row[idx]);
            const line = headers.map(h => {
              const v = obj[h];
              return (v === null || v === undefined || v === '') ? 'N/A' : String(v);
            });
            table += `| ${line.join(' | ')} |\n`;
            const buyVal = Number(obj.buy);
            const sellVal = Number(obj.sell);
            const netVal = Number(obj.net_buy);
            if (!isNaN(buyVal)) totalBuy += buyVal;
            if (!isNaN(sellVal)) totalSell += sellVal;
            if (!isNaN(netVal)) totalNet += netVal;
          }
    
          const title = `# 龙虎榜机构明细 ${args.trade_date}${args.ts_code ? ` - ${args.ts_code}` : ''}`;
          const fmt = (n: number) => n.toLocaleString('zh-CN', { maximumFractionDigits: 2 });
          const summary = `\n\n## 当日资金统计\n- 买入额合计: ${fmt(totalBuy)} 元\n- 卖出额合计: ${fmt(totalSell)} 元\n- 净流入: ${fmt(totalNet)} 元`;
          
          // 收集所有股票代码并生成说明
          const stockCodes: string[] = [];
          for (const row of items) {
            const obj: Record<string, any> = {};
            fields.forEach((f: string, idx: number) => obj[f] = row[idx]);
            if (obj.ts_code) {
              stockCodes.push(String(obj.ts_code));
            }
          }
          const stockExplanation = await resolveStockCodes(stockCodes);
          
          return { content: [ { type: 'text', text: `${title}\n\n${table}${summary}${stockExplanation}` } ] };
        } finally {
          clearTimeout(timeoutId);
        }
      } catch (error) {
        return {
          content: [ { type: 'text', text: `❌ 查询失败: ${error instanceof Error ? error.message : String(error)}` } ],
          isError: true
        };
      }
    }
  • Input schema definition for the dragon_tiger_inst tool, specifying trade_date as required and ts_code as optional.
    parameters: {
      type: 'object',
      properties: {
        trade_date: {
          type: 'string',
          description: '交易日期,格式YYYYMMDD'
        },
        ts_code: {
          type: 'string',
          description: '可选,股票TS代码,如 000001.SZ'
        }
      },
      required: ['trade_date']
    },
  • src/index.ts:252-255 (registration)
    Tool registration in the main tools list for MCP stdio server.
      name: dragonTigerInst.name,
      description: dragonTigerInst.description,
      inputSchema: dragonTigerInst.parameters
    }
  • src/index.ts:395-398 (registration)
    Dispatch case in the main request handler for executing dragon_tiger_inst tool.
    case "dragon_tiger_inst": {
      const trade_date = String(request.params.arguments?.trade_date);
      const ts_code = request.params.arguments?.ts_code ? String(request.params.arguments.ts_code) : undefined;
      return normalizeResult(await dragonTigerInst.run({ trade_date, ts_code }));
  • Tool registration in the toolList array for HTTP server.
    { name: dragonTigerInst.name, description: dragonTigerInst.description, inputSchema: dragonTigerInst.parameters },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the return format ('返回表格包含' - returns a table containing) but lacks details on pagination, rate limits, authentication needs, error handling, or data freshness. For a data retrieval tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves beyond basic input-output.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, stating the purpose and key parameters in a single sentence. Every element (purpose, required/optional parameters, return content) earns its place without redundancy. However, the lack of structural formatting (e.g., bullet points) and slightly dense phrasing in Chinese might reduce immediate clarity for non-native readers.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and parameters but lacks details on output structure (beyond mentioning table content), error cases, or usage scenarios. Without annotations or output schema, more context on behavioral aspects would improve completeness for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for both parameters in the input schema. The description adds minimal value beyond the schema by reiterating that 'trade_date' is required and 'ts_code' is optional, but doesn't provide additional context like example usage patterns or implications of omitting the optional parameter. Baseline score of 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves '龙虎榜机构成交明细(top_inst)' (dragon-tiger list institutional transaction details), specifying it returns a table with buy/sell/net amounts and listing reasons. It uses specific verbs ('返回表格包含' - returns a table containing) and identifies the resource, but doesn't explicitly differentiate from sibling tools like 'block_trade' or 'money_flow' which might have overlapping financial data domains.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying required parameters ('必填:交易日期' - required: trade date) and optional ones ('可选:股票TS代码' - optional: stock TS code), which provides basic context for when to provide inputs. However, it doesn't offer explicit guidance on when to use this tool versus alternatives like 'stock_data' or 'money_flow', nor does it mention any exclusions or prerequisites beyond parameter requirements.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Xxx00xxX33/FinanceMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server