Skip to main content
Glama

search_municipality_energy

Find Swiss municipality IDs (BFS numbers) to look up electricity tariffs. Use these IDs with get_electricity_tariff and compare_electricity_tariffs tools.

Instructions

Search for Swiss municipality IDs needed for electricity tariff lookup. Returns BFS municipality numbers for use with get_electricity_tariff and compare_electricity_tariffs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesMunicipality name to search (e.g. 'Zürich', 'Bern', 'Basel', 'Lausanne', 'Luzern').

Implementation Reference

  • The handler implementation for 'search_municipality_energy' which performs a GraphQL query to fetch municipality IDs.
    case "search_municipality_energy": {
      const nameQuery = args.name as string;
    
      if (!nameQuery?.trim()) {
        throw new Error("name is required");
      }
    
      const query = `
        query Municipalities($locale: String!, $query: String) {
          municipalities: searchMunicipalities(locale: $locale, query: $query) {
            id
            name
          }
        }
      `;
    
      const data = await gql<{ municipalities: MunicipalityResult[] }>(query, {
        locale: "de",
        query: nameQuery,
      });
    
      const municipalities = data.municipalities ?? [];
    
      if (!municipalities.length) {
        return JSON.stringify({
          results: [],
          message: `No municipalities found matching "${nameQuery}". Try a shorter or alternate spelling.`,
        }, null, 2);
      }
    
      return JSON.stringify({
        results: municipalities.map((m) => ({
          id: m.id,
          name: m.name,
          usage: `Use id "${m.id}" with get_electricity_tariff or compare_electricity_tariffs`,
        })),
        count: municipalities.length,
        note: "Use the 'id' field as the 'municipality' parameter in tariff queries.",
        source: "https://www.strompreis.elcom.admin.ch",
      }, null, 2);
    }
  • The registration and input schema definition for 'search_municipality_energy'.
    {
      name: "search_municipality_energy",
      description:
        "Search for Swiss municipality IDs needed for electricity tariff lookup. Returns BFS municipality numbers for use with get_electricity_tariff and compare_electricity_tariffs.",
      inputSchema: {
        type: "object",
        required: ["name"],
        properties: {
          name: {
            type: "string",
            description: "Municipality name to search (e.g. 'Zürich', 'Bern', 'Basel', 'Lausanne', 'Luzern').",
          },
        },
      },
    },
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the tool's purpose and output format (BFS municipality numbers), but lacks details on behavioral traits like error handling, rate limits, or authentication requirements. It doesn't contradict any annotations, but could be more informative about operational constraints.

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

Conciseness5/5

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

The description is two sentences with zero waste—each sentence adds critical information (purpose and usage context). It's front-loaded with the main action and efficiently structured to convey essential details without redundancy.

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

Completeness4/5

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

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is mostly complete. It covers purpose, usage, and output format, but lacks details on behavioral aspects like performance or errors. For a simple search tool, this is adequate but not fully comprehensive.

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 documents the single parameter ('name') with examples. The description doesn't add any parameter-specific details beyond what the schema provides, such as search behavior or result limits. With high schema coverage, the baseline score of 3 is appropriate.

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

Purpose5/5

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

The description clearly states the specific action ('Search for Swiss municipality IDs') and resource ('Swiss municipality'), distinguishing it from siblings like 'get_municipality' by specifying its purpose for electricity tariff lookup. It uses precise verbs and identifies the exact output (BFS municipality numbers).

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool ('needed for electricity tariff lookup') and names specific alternatives ('for use with get_electricity_tariff and compare_electricity_tariffs'), providing clear guidance on its role in the workflow and distinguishing it from other search tools in the sibling list.

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