Skip to main content
Glama
fatwang2

Search1API MCP Server

news

Search news articles across multiple engines (Google, Bing, DuckDuckGo, Yahoo, HackerNews) with customizable filters for sites, time range, and optional full-page crawling.

Instructions

News search tool

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query, be simple and concise
max_resultsNoMaximum number of results to return
search_serviceNoSpecify the news engine to use. Choose based on your specific needsbing
crawl_resultsNoNumber of results to crawl for full webpage content, useful when search result summaries are insufficient for complex queries
include_sitesNoList of sites to include in search. Only use when you need special results from sites not available in search_service
exclude_sitesNoList of sites to exclude from search. Only use when you need to explicitly filter out specific domains from results
time_rangeNoTime range for search results, only use when specific time constraints are required

Implementation Reference

  • The main handler function for the 'news' tool. Validates args via isValidNewsArgs, calls the /news API endpoint via makeRequest, and returns the results as JSON content or an error message.
    export async function handleNews(args: unknown, apiKey?: string) {
      if (!isValidNewsArgs(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Invalid news search arguments"
        );
      }
    
      log("Processing news search with query:", (args as NewsArgs).query);
    
      try {
        const response = await makeRequest<NewsResponse>(
          API_CONFIG.ENDPOINTS.NEWS,
          args,
          apiKey
        );
        
        return {
          content: [{
            type: "text",
            mimeType: "application/json",
            text: JSON.stringify(response.results, null, 2)
          }]
        };
      } catch (error) {
        log("News search error:", error);
        return {
          content: [{
            type: "text",
            mimeType: "text/plain",
            text: `News API error: ${formatError(error)}`
          }],
          isError: true
        };
      }
    }
  • Tool registration/definition for the 'news' tool. Defines name ('news'), description, and inputSchema with properties: query (required string), max_results, search_service (enum of search engines), crawl_results, include_sites, exclude_sites, and time_range.
    export const NEWS_TOOL: Tool = {
      name: "news",
      description: "News search tool",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Search query, be simple and concise"
          },
          max_results: {
            type: "number",
            description: "Maximum number of results to return",
            default: 10
          },
          search_service: {
            type: "string",
            description: "Specify the news engine to use. Choose based on your specific needs",
            default: "bing",
            enum: ["google", "bing", "duckduckgo", "yahoo", "hackernews"]
          },
          crawl_results: {
            type: "number",
            description: "Number of results to crawl for full webpage content, useful when search result summaries are insufficient for complex queries",
            default: 0
          },
          include_sites: {
            type: "array",
            items: {
              type: "string"
            },
            description: "List of sites to include in search. Only use when you need special results from sites not available in search_service",
            default: []
          },
          exclude_sites: {
            type: "array",
            items: {
              type: "string"
            },
            description: "List of sites to exclude from search. Only use when you need to explicitly filter out specific domains from results",
            default: []
          },
          time_range: {
            type: "string",
            description: "Time range for search results, only use when specific time constraints are required",
            enum: ["day", "month", "year"]
          }
        },
        required: ["query"]
      }
    };
  • Registration of the 'news' tool in the dispatch switch statement. When toolName matches NEWS_TOOL.name ('news'), it calls handleNews(args, apiKey).
    case NEWS_TOOL.name:
      return await handleNews(args, apiKey);
  • Type definitions for the news tool: NewsArgs interface (query, max_results, search_service, crawl_results, include_sites, exclude_sites, time_range), NewsResult interface, NewsResponse interface, and the isValidNewsArgs type guard function that validates all fields.
    export interface NewsArgs {
      query: string;
      max_results?: number;
      search_service?: NewsService;
      crawl_results?: number;
      include_sites?: string[];
      exclude_sites?: string[];
      time_range?: TimeRange;
    }
    
    export function isValidNewsArgs(args: unknown): args is NewsArgs {
      if (typeof args !== 'object' || args === null) {
        return false;
      }
    
      const { 
        query, 
        max_results, 
        search_service, 
        crawl_results,
        include_sites,
        exclude_sites,
        time_range
      } = args as NewsArgs;
    
      if (typeof query !== 'string' || query.trim().length === 0) {
        return false;
      }
    
      if (max_results !== undefined && (typeof max_results !== 'number' || max_results < 1 || max_results > 50)) {
        return false;
      }
    
      if (search_service !== undefined) {
        const validServices = Object.values(NewsService);
        if (!validServices.includes(search_service)) {
          return false;
        }
      }
    
      if (crawl_results !== undefined && (typeof crawl_results !== 'number' || crawl_results < 0)) {
        return false;
      }
    
      if (include_sites !== undefined && (!Array.isArray(include_sites) || !include_sites.every(site => typeof site === 'string'))) {
        return false;
      }
    
      if (exclude_sites !== undefined && (!Array.isArray(exclude_sites) || !exclude_sites.every(site => typeof site === 'string'))) {
        return false;
      }
    
      if (time_range !== undefined) {
        const validTimeRanges = Object.values(TimeRange);
        if (!validTimeRanges.includes(time_range)) {
          return false;
        }
      }
    
      return true;
  • API configuration including the BASE_URL, DEFAULT_QUERY ('latest news in the world'), and the NEWS endpoint path ('/news') used by the news handler to make API requests.
    BASE_URL: 'https://api.search1api.com',
    DEFAULT_QUERY: 'latest news in the world',
    ENDPOINTS: {
      SEARCH: '/search',
      CRAWL: '/crawl',
      SITEMAP: '/sitemap',
      NEWS: '/news',
      REASONING: '/v1/chat/completions',
      TRENDING: '/trending'
    }
Behavior1/5

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

No annotations provided, and the description contains no information about behavioral traits such as what the tool returns, whether it mutates data, or any side effects. The description adds no value beyond the already sparse name.

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

Conciseness2/5

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

The description is overly brief (3 words) and lacks a front-loaded, informative summary. While concise, it sacrifices essential detail, making it inadequately sized for proper tool comprehension.

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

Completeness1/5

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

Despite 7 parameters and no output schema or annotations, the description offers no context about return values, pagination, or intended use. It leaves significant gaps in understanding the tool's purpose and behavior.

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%, so the input schema adequately documents all parameters. The description adds no additional meaning, but the baseline score of 3 is appropriate given the schema richness.

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

Purpose1/5

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

The description 'News search tool' is a tautology that merely restates the tool's name. It does not specify a verb, resource, or scope, nor does it differentiate the tool from sibling tools like 'search' or 'trending'.

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

Usage Guidelines1/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 does not mention any prerequisites, exclusions, or contexts where this tool is preferred over siblings.

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/fatwang2/search1api-mcp'

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