Skip to main content
Glama

get_sources

Retrieve news sources by category and country through the Multi-MCPs server's unified API aggregation platform.

Instructions

List news sources

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNo
countryNo

Implementation Reference

  • The main handler function for the 'get_sources' tool. It validates the API key, extracts optional category and country parameters from input args, and delegates to the NewsApiClient's sources method to fetch the list of news sources.
    async get_sources(args: Record<string, unknown>) { if (!cfg.newsApiKey) throw new Error("NEWS_API_KEY is not configured"); const category = args.category ? String(args.category) : undefined; const country = args.country ? String(args.country) : undefined; return client.sources(category, country); },
  • The registration of the 'get_sources' tool within the registerNewsApi() function's tools array, including its name, description, and input schema.
    { name: "get_sources", description: "List news sources", inputSchema: { type: "object", properties: { category: { type: "string" }, country: { type: "string" }, }, }, },
  • The input schema for the 'get_sources' tool, defining optional string parameters for category and country.
    inputSchema: { type: "object", properties: { category: { type: "string" }, country: { type: "string" }, }, },
  • The supporting 'sources' method in NewsApiClient class that makes the actual API request to NewsAPI's /v2/top-headlines/sources endpoint.
    sources(category?: string, country?: string) { return this.request("/v2/top-headlines/sources", { headers: { Authorization: `Bearer ${this.apiKey}` }, query: { category, country }, }); }

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