Skip to main content
Glama
Xxx00xxX33

FinanceMCP

by Xxx00xxX33

finance_news

Search financial news from mainstream media using keywords to track market developments and company updates.

Instructions

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

Input Schema

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

Implementation Reference

  • The main finance_news tool object, defining name, description, input parameters schema, and the async run handler function that orchestrates news search via internal helpers.
    export const financeNews = {
      name: "finance_news",
      description: "通过真正的搜索API获取主流财经媒体的新闻内容,支持单个或多个关键词智能搜索",
      parameters: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "搜索关键词,支持单个关键词如'药明康德'、'腾讯',或多个关键词用空格分开如'美联储 加息'、'比特币 监管'等。系统会智能搜索相关历史新闻"
          }
        },
        required: ["query"]
      },
      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 : '未知错误'}`
              }
            ]
          };
        }
      }
    };
  • TypeScript interface defining the structure of a NewsItem used in the finance_news tool response.
    export interface NewsItem {
      title: string;
      summary: string;
      url: string;
      source: string;
      publishTime: string;
      keywords: string[];
    }
  • Helper function that performs the actual news search using Baidu News and deduplicates 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:274-277 (registration)
    Registration and dispatch handler in the stdio MCP server for calling the finance_news tool.
    case "finance_news": {
      const query = String(request.params.arguments?.query);
      return normalizeResult(await financeNews.run({ query }));
    }
  • Registration and dispatch handler in the HTTP MCP server for calling the finance_news tool.
    case 'finance_news':
      return await financeNews.run({
        query: String(args?.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. It mentions '通过真正的搜索API' (via a real search API) and '智能搜索' (intelligent search), which hints at external data retrieval but doesn't cover critical aspects like rate limits, authentication needs, response format, or error handling. For a tool that likely makes external API calls, this is a significant gap in transparency.

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 a single, efficient sentence in Chinese that conveys the core functionality without unnecessary details. It is appropriately sized and front-loaded with the main purpose, though it could be slightly more structured to separate purpose from usage hints.

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 complexity of a news search tool with no annotations and no output schema, the description is incomplete. It lacks information on what the tool returns (e.g., article titles, dates, sources), how results are formatted, pagination, or error cases. This makes it inadequate for an agent to use the tool effectively without guesswork.

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 schema description coverage is 100%, with the 'query' parameter fully documented in the schema. The description adds minimal value beyond the schema by reiterating support for single or multiple keywords with examples like '药明康德' and '美联储 加息'. However, it doesn't provide additional semantics such as search logic nuances or result limitations, so it meets the baseline for high schema coverage.

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), though it doesn't explicitly distinguish from sibling tools like 'hot_news_7x24' which might have similar functions.

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 like 'hot_news_7x24' or 'macro_econ'. It mentions support for single or multiple keywords but doesn't specify use cases, prerequisites, or exclusions. The lack of sibling tool differentiation leaves the agent without clear selection criteria.

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