Skip to main content
Glama

get_vote_details

Retrieve detailed Swiss popular vote results with per-district breakdowns for Basel-Stadt, including overseas voters, by specifying vote title and date.

Instructions

Get detailed breakdown of a specific Swiss popular vote, including per-district results for Basel-Stadt (Basel city, Riehen, Bettingen, and overseas voters).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vote_titleNoPartial or full vote title to look up (e.g. 'CO2-Gesetz', 'AHV')
dateNoVote date in YYYY-MM-DD format (e.g. '2024-11-24')

Implementation Reference

  • The handler function `handleGetVoteDetails` executes the tool logic by fetching data from the voting API.
    export async function handleGetVoteDetails(params: {
      vote_title?: string;
      date?: string;
    }): Promise<string> {
      if (!params.vote_title && !params.date) {
        return JSON.stringify({
          error: "Provide at least vote_title or date",
        });
      }
    
      const conditions: string[] = [
        `wahllok_name like "%Total%"`,
        `result_art="Schlussresultat"`,
      ];
    
      if (params.vote_title) {
        conditions.push(`abst_titel like "%${params.vote_title.trim()}%"`);
      }
      if (params.date) {
        conditions.push(`abst_datum_text="${params.date.trim()}"`);
      }
    
      const where = conditions.join(" AND ");
      const url = buildUrl(BS_BASE, {
        limit: 100,
        where,
        select:
          "abst_datum_text,abst_id,abst_titel,abst_art,gemein_name,wahllok_name,stimmr_anz,ja_anz,nein_anz,anteil_ja_stimmen",
        order_by: "abst_datum_text desc,abst_id asc",
      });
    
      const rows = await fetchJSON<BsVotingRecord[]>(url, {
        headers: { "User-Agent": USER_AGENT },
      });
    
      if (!rows || rows.length === 0) {
        return JSON.stringify({
          error: "No vote found matching the given parameters",
          hint: "Try partial title (e.g. 'CO2' instead of 'CO2-Gesetz') or check the date format (YYYY-MM-DD)",
        });
      }
    
      // Group by (date, abst_id) — take the first match if multiple votes match
      const firstDate = rows[0].abst_datum_text;
      const firstId = rows[0].abst_id;
      const voteRows = rows.filter(
        (r) => r.abst_datum_text === firstDate && r.abst_id === firstId,
      );
  • The tool definition including its input schema.
    {
      name: "get_vote_details",
      description:
        "Get detailed breakdown of a specific Swiss popular vote, including per-district results for Basel-Stadt (Basel city, Riehen, Bettingen, and overseas voters).",
      inputSchema: {
        type: "object",
        properties: {
          vote_title: {
            type: "string",
            description: "Partial or full vote title to look up (e.g. 'CO2-Gesetz', 'AHV')",
          },
          date: {
            type: "string",
            description: "Vote date in YYYY-MM-DD format (e.g. '2024-11-24')",
          },
        },
  • The tool registration switch-case which routes the request to the `handleGetVoteDetails` function.
    case "get_vote_details":
      return handleGetVoteDetails(args as { vote_title?: string; date?: string });
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 indicates the tool retrieves data ('Get detailed breakdown'), suggesting a read-only operation, but does not specify permissions, rate limits, error handling, or the format of the returned breakdown. This leaves significant gaps for a tool with no annotation coverage.

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 a single, efficient sentence that front-loads the core purpose. It avoids unnecessary words, though it could be slightly more structured by separating scope details. Overall, it earns its place without waste.

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 (retrieving detailed vote data), no annotations, and no output schema, the description is minimally adequate. It specifies the resource and scope but lacks details on behavioral traits, output format, or usage context, leaving room for improvement in completeness.

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 input schema has 100% description coverage, clearly documenting both parameters ('vote_title' and 'date'). The description adds no additional semantic information about these parameters beyond what the schema provides, such as examples or constraints, so it meets the baseline score of 3.

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 with a specific verb ('Get detailed breakdown') and resource ('a specific Swiss popular vote'), including the scope of data returned ('per-district results for Basel-Stadt'). However, it does not explicitly differentiate from the sibling tool 'get_voting_results' or 'search_votes', which might offer similar or overlapping 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 no guidance on when to use this tool versus alternatives like 'get_voting_results' or 'search_votes', nor does it mention any prerequisites or exclusions. It implies usage for retrieving detailed vote data but lacks explicit contextual boundaries.

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