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
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | ||
| country | No |
Implementation Reference
- src/apis/news/newsapi.ts:91-96 (handler)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); },
- src/apis/news/newsapi.ts:64-74 (registration)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" }, }, }, },
- src/apis/news/newsapi.ts:67-73 (schema)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" }, }, },
- src/apis/news/newsapi.ts:26-31 (helper)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 }, }); }