get_sources
Retrieve news sources by specifying category and country parameters, enabling targeted access to relevant content within the Multi-MCPs server.
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)Handler function for the 'get_sources' MCP tool. Extracts category and country from input args, checks for API key configuration, and calls the client's sources method to fetch available 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)Registration entry for the 'get_sources' tool in the News API toolset, defining its name, description, and input schema (optional category and country parameters).{ name: "get_sources", description: "List news sources", inputSchema: { type: "object", properties: { category: { type: "string" }, country: { type: "string" }, }, }, },
- src/apis/news/newsapi.ts:26-31 (helper)Supporting method in NewsApiClient class that makes the API request to retrieve news sources filtered by optional category and country.sources(category?: string, country?: string) { return this.request("/v2/top-headlines/sources", { headers: { Authorization: `Bearer ${this.apiKey}` }, query: { category, country }, }); }