Skip to main content
Glama

search_votes

Search Swiss popular votes by keyword to find referendum results with yes/no outcomes. Use keywords in German, French, or Italian to locate specific votes and their results.

Instructions

Search Swiss popular votes by keyword in the vote title (e.g. 'Initiative', 'Klimaschutz', 'CO2', 'AHV'). Returns matching votes with yes/no results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch keyword to find in vote titles (German/French/Italian)
limitNoMaximum number of results (default: 5, max: 20).

Implementation Reference

  • The handler function `handleSearchVotes` executes the search logic by querying the database and aggregating results.
    export async function handleSearchVotes(params: {
      query: string;
      limit?: number;
    }): Promise<string> {
      if (!params.query?.trim()) {
        return JSON.stringify({ error: "query parameter is required" });
      }
    
      const limit = Math.min(params.limit ?? 5, 20);
      const keyword = params.query.trim();
    
      const extraWhere = `abst_titel like "%${keyword}%"`;
      const rows = await fetchVoteRows(extraWhere, limit);
      const votes = aggregateVotes(rows).slice(0, limit);
    
      if (votes.length === 0) {
        return JSON.stringify({
          query: keyword,
          count: 0,
          votes: [],
          hint: "Try shorter keywords. Vote titles are in German, French, or Italian.",
        });
      }
    
      return JSON.stringify({
        query: keyword,
        count: votes.length,
        votes,
        source: "Basel-Stadt open data",
        data_url: "https://data.bs.ch/explore/dataset/100345/",
      });
  • The registration of the `search_votes` tool definition, including its description and input schema.
    name: "search_votes",
    description:
      "Search Swiss popular votes by keyword in the vote title (e.g. 'Initiative', 'Klimaschutz', 'CO2', 'AHV'). Returns matching votes with yes/no results.",
    inputSchema: {
      type: "object",
      required: ["query"],
      properties: {
        query: {
          type: "string",
          description: "Search keyword to find in vote titles (German/French/Italian)",
        },
        limit: {
          type: "number",
          description: "Maximum number of results (default: 5, max: 20).",
  • The entry point in the tool router that invokes `handleSearchVotes` when `search_votes` is called.
    case "search_votes":
      return handleSearchVotes(args as { query: string; limit?: number });
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 mentions the search scope (vote titles) and return format (matching votes with yes/no results), but lacks critical behavioral details such as language support (though implied by German/French/Italian examples), result ordering, pagination, error handling, or whether this is a read-only operation. The description provides basic functionality but misses important operational context.

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 - a single sentence that efficiently communicates the core functionality. It's front-loaded with the main purpose and includes helpful examples. There's no wasted text, though it could potentially benefit from slightly more structure for complex aspects.

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 functionality with 2 parameters), no annotations, and no output schema, the description provides adequate but incomplete coverage. It explains what the tool does and what it returns, but lacks details about behavioral characteristics, error conditions, and how results are structured. For a search tool without output schema, more detail about return format 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?

Schema description coverage is 100%, so the schema already fully documents both parameters. The description adds marginal value by providing keyword examples ('Initiative', 'Klimaschutz', 'CO2', 'AHV') that illustrate potential query values, but doesn't add significant semantic context beyond what's in the schema descriptions. This meets the baseline for high schema coverage.

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's purpose: searching Swiss popular votes by keyword in vote titles and returning matching votes with yes/no results. It specifies the resource (Swiss popular votes) and action (search by keyword), but doesn't explicitly differentiate from sibling tools like 'get_vote_details' or 'get_voting_results' beyond the search functionality.

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 by keyword with examples ('Initiative', 'Klimaschutz'), but offers no explicit guidance on when to use this tool versus alternatives like 'get_vote_details' or 'get_voting_results'. There's no mention of prerequisites, limitations, or comparative use cases.

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