Skip to main content
Glama
guangxiangdebizi

FinanceMCP

finance_news

Access real-time financial news from major media sources using keyword searches. Retrieve relevant articles efficiently with single or multiple keywords for market insights.

Instructions

通过真正的搜索API获取主流财经媒体的新闻内容,支持单个或多个关键词智能搜索

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes搜索关键词,支持单个关键词如'药明康德'、'腾讯',或多个关键词用空格分开如'美联储 加息'、'比特币 监管'等。系统会智能搜索相关历史新闻

Implementation Reference

  • The main handler function `run` that executes the finance_news tool logic: validates input, searches news via helper, formats and returns results or error.
    async run(args: { 
      query: string;
    }) {
      try {
        if (!args.query || args.query.trim().length === 0) {
          throw new Error("搜索关键词不能为空");
        }
        
        const query = args.query.trim();
        
        console.log(`开始搜索财经新闻,关键词: ${query},使用有效的新闻接口`);
        
        const newsResults = await searchFinanceNews(query);
      
        if (newsResults.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: `# ${query} 财经新闻搜索结果\n\n未找到相关财经新闻`
              }
            ]
          };
        }
      
        console.log(`搜索完成,共找到 ${newsResults.length} 条新闻`);
        
        // 简化返回格式,参考stock_data的格式
        const formattedNews = newsResults.map((news) => {
          return `${news.title}\n来源: ${news.source}  时间: ${news.publishTime}\n摘要: ${news.summary}${news.url ? `\n链接: ${news.url}` : ''}\n`;
        }).join('\n---\n\n');
        
        return {
          content: [
            {
              type: "text",
              text: `# ${query} 财经新闻搜索结果\n\n${formattedNews}`
            }
          ]
        };
      } catch (error) {
        console.error('搜索财经新闻时发生错误:', error);
        return {
          content: [
            {
              type: "text",
              text: `# ${args.query || '财经新闻'} 搜索失败\n\n错误信息: ${error instanceof Error ? error.message : '未知错误'}`
            }
          ]
        };
      }
    }
  • Input schema defining the required 'query' parameter for the finance_news tool.
    parameters: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "搜索关键词,支持单个关键词如'药明康德'、'腾讯',或多个关键词用空格分开如'美联储 加息'、'比特币 监管'等。系统会智能搜索相关历史新闻"
        }
      },
      required: ["query"]
    },
  • Helper function that performs the actual news search using BaiduNews, handles concurrency, deduplication, and limits to 20 results.
    async function searchFinanceNews(query: string): Promise<NewsItem[]> {
      const news: NewsItem[] = [];
      const keywords = query.split(' ').filter(k => k.trim().length > 0);
      
      // 并发搜索多个有效的媒体源(当前仅百度)
      const searchPromises = [
        searchBaiduNews(keywords)
      ];
    
      try {
        const results = await Promise.allSettled(searchPromises);
        
        results.forEach((result, index) => {
          const sourceNames = ['百度新闻'];
          if (result.status === 'fulfilled') {
            news.push(...result.value);
            console.log(`${sourceNames[index]} 搜索成功,获得 ${result.value.length} 条新闻`);
          } else {
            console.error(`${sourceNames[index]} 搜索失败:`, result.reason);
          }
        });
    
        // 去重
        const uniqueNews = removeDuplicates(news);
        return uniqueNews.slice(0, 20); // 最多返回20条
        
      } catch (error) {
        console.error('并发搜索时发生错误:', error);
        return [];
      }
    }
  • src/index.ts:133-137 (registration)
    Registration of the finance_news tool in the ListToolsRequestSchema handler, exposing name, description, and input schema.
    {
      name: financeNews.name,
      description: financeNews.description,
      inputSchema: financeNews.parameters
    },
  • src/index.ts:233-236 (registration)
    Handler dispatch/registration in the CallToolRequestSchema switch case, extracting query and calling financeNews.run.
    case "finance_news": {
      const query = String(request.params.arguments?.query);
      return await financeNews.run({ query });
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While it mentions '通过真正的搜索API' (through a real search API) and '智能搜索' (intelligent search), it doesn't disclose important behavioral traits like whether this is a read-only operation, potential rate limits, authentication requirements, what '主流财经媒体' (mainstream financial media) specifically includes, or how results are returned. The description is insufficient for a tool with no annotation coverage.

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 appropriately concise with a single sentence that efficiently communicates the core functionality. It's front-loaded with the main purpose and doesn't contain unnecessary information, though it could be slightly more structured by separating the purpose from the parameter guidance.

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

Completeness2/5

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

Given the tool has no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (news articles, headlines, summaries?), the format of results, potential limitations, or error conditions. For a search tool that presumably returns complex news data, this level of description is inadequate.

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?

The input schema has 100% description coverage, with the query parameter fully documented in the schema itself. The description adds minimal value beyond the schema, only repeating that it supports '单个或多个关键词智能搜索' (single or multiple keyword intelligent search) without providing additional semantic context about how the search works or what '智能' (intelligent) specifically means.

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's purpose: '获取主流财经媒体的新闻内容' (get financial news content from mainstream media) and '支持单个或多个关键词智能搜索' (supports single or multiple keyword intelligent search). It specifies the verb (获取/get) and resource (新闻内容/news content), but doesn't explicitly differentiate from sibling tools like 'macro_econ' or 'stock_data' which might also provide financial information.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when this tool is appropriate compared to sibling tools like 'company_performance', 'macro_econ', or 'stock_data', nor does it provide any context about when not to use it or what prerequisites might be needed.

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

Related 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/guangxiangdebizi/FinanceMCP'

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