get_swiss_news
Retrieve Swiss news headlines from SRF across categories like domestic, international, and economy. Returns articles with titles, descriptions, links, and publication dates.
Instructions
Get the latest Swiss news headlines from SRF (Schweizer Radio und Fernsehen). Returns top news articles with title, description, link, and publication date.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | News category. "switzerland" = domestic Swiss news (default), "international" = world news, "economy" = business & economy. | |
| limit | No | Number of articles to return (default: 10, max: 50) |
Implementation Reference
- src/modules/news.ts:88-115 (handler)The main handler function for the get_swiss_news tool, which fetches and processes RSS news feeds from SRF.
export async function handleGetSwissNews(args: { category?: string; limit?: number; }): Promise<string> { const category = args.category ?? "switzerland"; const limit = Math.min(args.limit ?? 10, 50); const feedId = FEED_IDS[category]; if (!feedId) { const valid = Object.keys(FEED_IDS).join(", "); throw new Error(`Unknown category "${category}". Valid categories: ${valid}`); } const xml = await fetchFeed(feedId); const allItems = parseRssItems(xml); const items = allItems.slice(0, limit); const result = { category, count: items.length, total_available: allItems.length, articles: items, source: "srf.ch", }; const json = JSON.stringify(result, null, 2); if (json.length > 49000) { // Truncate descriptions if needed - src/modules/news.ts:230-244 (registration)Tool definition and registration block for get_swiss_news, including its description and input schema.
{ name: "get_swiss_news", description: "Get the latest Swiss news headlines from SRF (Schweizer Radio und Fernsehen). Returns top news articles with title, description, link, and publication date.", inputSchema: { type: "object" as const, properties: { category: { type: "string", enum: ["switzerland", "international", "economy"], description: 'News category. "switzerland" = domestic Swiss news (default), "international" = world news, "economy" = business & economy.', }, limit: { type: "number", - src/modules/news.ts:276-277 (handler)Switch case handling the invocation of get_swiss_news.
case "get_swiss_news": return handleGetSwissNews(args as { category?: "switzerland" | "international" | "economy"; limit?: number });