Skip to main content
Glama
leehanchung

Bing Search MCP Server

by leehanchung

bing_news_search

Search for current news articles by specifying a query, result count, market, and freshness period using the Bing News Search API.

Instructions

Searches for news articles using Bing News Search API for current events and timely information.

Args:
    query: News search query (required)
    count: Number of results (1-50, default 10)
    market: Market code like en-US, en-GB, etc.
    freshness: Time period of news (Day, Week, Month)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNo
freshnessNoDay
marketNoen-US
queryYes

Implementation Reference

  • The primary handler for the 'bing_news_search' tool. Decorated with @server.tool() for registration in FastMCP. Implements the core logic: API key check, rate limiting, HTTP request to Bing News Search endpoint, parses JSON response, formats results with title, URL, description, date, and provider.
    @server.tool()
    async def bing_news_search(
        query: str, count: int = 10, market: str = "en-US", freshness: str = "Day"
    ) -> str:
        """Searches for news articles using Bing News Search API for current
        events and timely information.
    
        Args:
            query: News search query (required)
            count: Number of results (1-50, default 10)
            market: Market code like en-US, en-GB, etc.
            freshness: Time period of news (Day, Week, Month)
        """
        # Get API key from environment
        api_key = os.environ.get("BING_API_KEY", "")
    
        if not api_key:
            return (
                "Error: Bing API key is not configured. Please set the "
                "BING_API_KEY environment variable."
            )
    
        try:
            check_rate_limit()
    
            # News search has a different endpoint
            news_url = f"{BING_API_URL}v7.0/news/search"
    
            headers = {
                "User-Agent": USER_AGENT,
                "Ocp-Apim-Subscription-Key": api_key,
                "Accept": "application/json",
            }
    
            params = {
                "q": query,
                "count": min(count, 50),
                "mkt": market,
                "freshness": freshness,
            }
    
            async with httpx.AsyncClient() as client:
                response = await client.get(
                    news_url, headers=headers, params=params, timeout=10.0
                )
    
                response.raise_for_status()
                data = response.json()
    
                if "value" not in data:
                    return "No news results found."
    
                results = []
                for result in data["value"]:
                    published_date = result.get("datePublished", "Unknown date")
                    provider_info = result.get("provider", [{"name": "Unknown"}])
                    # Handle potential empty provider list
                    provider_name = (
                        provider_info[0]["name"] if provider_info else "Unknown"
                    )
                    results.append(
                        f"Title: {result['name']}\n"
                        f"URL: {result['url']}\n"
                        f"Description: {result['description']}\n"
                        f"Published: {published_date}\n"
                        f"Provider: {provider_name}"
                    )
    
                return "\n\n".join(results)
    
        except httpx.HTTPError as e:
            return f"Error communicating with Bing API: {str(e)}"
        except Exception as e:
            return f"Unexpected error: {str(e)}"
  • Input schema and documentation for bing_news_search tool, defining parameters query (str required), count (int default 10, 1-50), market (str default en-US), freshness (str default Day), returning formatted string of news results.
    async def bing_news_search(
        query: str, count: int = 10, market: str = "en-US", freshness: str = "Day"
    ) -> str:
        """Searches for news articles using Bing News Search API for current
        events and timely information.
    
        Args:
            query: News search query (required)
            count: Number of results (1-50, default 10)
            market: Market code like en-US, en-GB, etc.
            freshness: Time period of news (Day, Week, Month)
        """
  • Shared helper function check_rate_limit() used by bing_news_search (and other tools) to enforce rate limits (1/sec, 15k/month). Called before API requests.
    def check_rate_limit():
        """Check if we're within rate limits"""
        now = time.time()
        if now - request_count["last_reset"] > 1:
            request_count["second"] = 0
            request_count["last_reset"] = now
    
        if (
            request_count["second"] >= RATE_LIMIT["per_second"]
            or request_count["month"] >= RATE_LIMIT["per_month"]
        ):
            raise Exception("Rate limit exceeded")
    
        request_count["second"] += 1
        request_count["month"] += 1
  • The @server.tool() decorator registers the bing_news_search function as an MCP tool in the FastMCP server.
    @server.tool()
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 the API source (Bing News Search API) and context (current events), but lacks critical details such as authentication requirements, rate limits, error handling, or what the output looks like (e.g., format of results). For a search tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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 sized and front-loaded, starting with the core purpose followed by parameter details in a structured format. Every sentence adds value, with no wasted words, though the parameter explanations could be slightly more concise (e.g., by integrating defaults and ranges more fluidly).

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 (4 parameters, no output schema, no annotations), the description is partially complete. It excels in parameter semantics but lacks output information, behavioral context (e.g., rate limits), and sibling differentiation. Without annotations or output schema, the description should do more to cover these gaps for a search tool, making it adequate but with clear room for improvement.

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

Parameters5/5

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

The description adds substantial meaning beyond the input schema, which has 0% description coverage. It explains each parameter's purpose: 'query' as the news search query (required), 'count' as number of results with range and default, 'market' as market code with examples, and 'freshness' as time period with options. This fully compensates for the schema's lack of descriptions, providing clear semantics for all parameters.

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 as searching for news articles using Bing News Search API, specifying the resource (news articles) and context (current events and timely information). However, it doesn't explicitly differentiate from sibling tools like bing_image_search or bing_web_search, which would require mentioning it's specifically for news content rather than images or general web results.

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 bing_image_search or bing_web_search. It mentions the context of 'current events and timely information,' which implies usage but doesn't offer explicit when-to-use or when-not-to-use criteria, leaving the agent to infer based on the tool name alone.

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/leehanchung/bing-search-mcp'

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