Skip to main content
Glama

search_swiss_news

Search Swiss news headlines from SRF by keyword to find relevant articles across all categories.

Instructions

Search Swiss news headlines from SRF by keyword. Searches across all available news categories and returns matching articles.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch keyword or phrase to find in news articles
limitNoMaximum number of results to return (default: 5, max: 20)

Implementation Reference

  • The implementation of the `handleSearchSwissNews` function which fetches RSS feeds and filters articles by keyword.
    export async function handleSearchSwissNews(args: {
      query: string;
      limit?: number;
    }): Promise<string> {
      const query = args.query.toLowerCase().trim();
      const limit = Math.min(args.limit ?? 5, 20);
    
      if (!query) {
        throw new Error("query parameter is required and cannot be empty");
      }
    
      // Search across all available feeds
      const allArticles: (NewsArticle & { category: string })[] = [];
    
      await Promise.all(
        Object.entries(FEED_IDS).map(async ([cat, feedId]) => {
          try {
            const xml = await fetchFeed(feedId);
            const items = parseRssItems(xml);
            for (const item of items) {
              allArticles.push({ ...item, category: cat });
            }
          } catch {
            // Skip unavailable feeds silently
          }
        })
      );
    
      // Filter by query (title or description)
      const matched = allArticles.filter(
        (a) =>
          a.title.toLowerCase().includes(query) ||
          a.description.toLowerCase().includes(query)
      );
    
      // Deduplicate by link
      const seen = new Set<string>();
      const unique = matched.filter((a) => {
        if (seen.has(a.link)) return false;
        seen.add(a.link);
        return true;
      });
    
      const results = unique.slice(0, limit);
    
      const result = {
        query: args.query,
        count: results.length,
        articles: results,
        source: "srf.ch",
      };
    
      return JSON.stringify(result, null, 2);
    }
  • The registration of the `search_swiss_news` tool within the MCP server using zod for schema validation.
    server.tool(
      "search_swiss_news",
      "Search Swiss news headlines from SRF by keyword. Searches across all available news categories and returns matching articles.",
      {
        query: z.string().min(1).describe("Search keyword or phrase to find in news articles"),
        limit: z
          .number()
          .int()
          .min(1)
          .max(20)
          .optional()
          .describe("Maximum number of results to return (default: 5, max: 20)"),
      },
      async (args) => {
        const text = await handleSearchSwissNews(args);
        return { content: [{ type: "text", text }] };
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool searches and returns matching articles but lacks critical details: authentication requirements, rate limits, error conditions, pagination behavior, or what fields are returned. For a search tool with no annotation coverage, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise—two sentences that directly state the tool's function and scope. It's front-loaded with the core purpose and avoids unnecessary elaboration. However, it could be slightly more structured by explicitly separating scope from behavior.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (search with two parameters), no annotations, and no output schema, the description is minimally adequate. It covers what the tool does but lacks details about return format, error handling, and operational constraints. For a search tool without output schema, more information about result structure would be beneficial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the input schema already fully documents both parameters (query and limit). The description adds minimal value beyond the schema—it mentions 'keyword or phrase' which aligns with the schema's description, but doesn't provide additional context about search syntax, language support, or result ordering. The baseline of 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool searches Swiss news headlines from SRF by keyword, specifying both the action (search) and resource (Swiss news headlines). It distinguishes itself from the sibling 'get_swiss_news' by focusing on keyword-based search rather than general retrieval. However, it doesn't explicitly contrast with other search tools like 'search_cantonal_affairs' or 'search_parliament_business'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal usage guidance. It mentions searching across all available news categories but doesn't specify when to use this tool versus alternatives like 'get_swiss_news' (which appears to retrieve news without search) or other search tools for different data types. No exclusions, prerequisites, or comparative context is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/vikramgorla/mcp-swiss'

If you have feedback or need assistance with the MCP directory API, please join our Discord server