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
| Name | Required | Description | Default |
|---|---|---|---|
| country | No | ||
| category | No |
Implementation Reference
- src/apis/news/newsapi.ts:40-50 (registration)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" }, }, }, },
- src/apis/news/newsapi.ts:77-82 (handler)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); },
- src/apis/news/newsapi.ts:12-17 (helper)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 }, }); }
- src/apis/news/newsapi.ts:43-49 (schema)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" }, }, },