Skip to main content
Glama
TaylorChen

Multi-MCPs

by TaylorChen

get_top_headlines

Retrieve top news headlines by country and category through the Multi-MCPs server, which aggregates multiple third-party APIs for unified access to web services.

Instructions

Get top headlines by country and category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countryNo
categoryNo

Implementation Reference

  • Tool registration for 'get_top_headlines' including name, description, and input schema.
    {
      name: "get_top_headlines",
      description: "Get top headlines by country and category",
      inputSchema: {
        type: "object",
        properties: {
          country: { type: "string" },
          category: { type: "string" },
        },
      },
    },
  • Handler implementation for the 'get_top_headlines' tool, which validates the API key and delegates to the NewsApiClient's topHeadlines method.
    async get_top_headlines(args: Record<string, unknown>) {
      if (!cfg.newsApiKey) throw new Error("NEWS_API_KEY is not configured");
      const country = args.country ? String(args.country) : undefined;
      const category = args.category ? String(args.category) : undefined;
      return client.topHeadlines(country, category);
    },
  • Helper method in NewsApiClient class that performs the actual API request to retrieve top headlines.
    topHeadlines(country?: string, category?: string) {
      return this.request("/v2/top-headlines", {
        headers: { Authorization: `Bearer ${this.apiKey}` },
        query: { country, category },
      });
    }
  • Input schema definition for the 'get_top_headlines' tool, specifying optional country and category parameters.
    inputSchema: {
      type: "object",
      properties: {
        country: { type: "string" },
        category: { type: "string" },
      },
    },

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/TaylorChen/muti-mcps'

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