Skip to main content
Glama

search_statistics

Search Swiss Federal Statistical Office datasets on opendata.swiss to find official statistics on topics like unemployment, GDP, housing prices, and birth rates.

Instructions

Search Swiss Federal Statistical Office (BFS/OFS/UST) datasets on opendata.swiss. Returns matching dataset titles, IDs, and descriptions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (e.g. 'unemployment', 'GDP', 'housing prices', 'birth rate')
limitNoMax results to return (1–20, default 10)

Implementation Reference

  • The implementation of the `search_statistics` tool handler, which searches opendata.swiss for datasets from the BFS/OFS organization.
    async function handleSearchStatistics(args: Record<string, unknown>): Promise<string> {
      const query = typeof args.query === "string" ? args.query.trim() : "";
      if (!query) throw new Error("query is required");
    
      const limit = Math.min(20, Math.max(1, typeof args.limit === "number" ? args.limit : 10));
    
      const url = buildUrl(`${CKAN_BASE}/package_search`, {
        q: query,
        rows: limit,
        fq: `organization:${BFS_ORG}`,
      });
    
      const data = await fetchJSON<CkanSearchResult>(url);
    
      if (!data.success) throw new Error("opendata.swiss search failed");
    
      const results = data.result.results.map((pkg) => ({
        id: pkg.name,
        title: resolveText(pkg.title),
        description: truncate(resolveText(pkg.notes || pkg.description), 200),
        keywords: pkg.keywords?.en ?? pkg.keywords?.de ?? [],
        modified: pkg.metadata_modified?.slice(0, 10) ?? "",
      }));
    
      return JSON.stringify({
        query,
        total_matches: data.result.count,
        returned: results.length,
        results,
        source: "opendata.swiss — Federal Statistical Office (BFS/OFS)",
        source_url: `https://opendata.swiss/en/organization/bundesamt-fur-statistik-bfs`,
      });
    }
  • The schema definition for the `search_statistics` tool.
    {
      name: "search_statistics",
      description:
        "Search Swiss Federal Statistical Office (BFS/OFS/UST) datasets on opendata.swiss. " +
        "Returns matching dataset titles, IDs, and descriptions.",
      inputSchema: {
        type: "object",
        required: ["query"],
        properties: {
          query: {
            type: "string",
            description: "Search query (e.g. 'unemployment', 'GDP', 'housing prices', 'birth rate')",
          },
          limit: {
            type: "number",
            description: "Max results to return (1–20, default 10)",
          },
        },
      },
    },
  • Registration/dispatch logic for the `search_statistics` tool within the statistics module.
    case "search_statistics":
      return handleSearchStatistics(args);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the return format (titles, IDs, descriptions) which is helpful, but doesn't cover important behavioral aspects like rate limits, authentication requirements, error conditions, pagination behavior, or whether this is a read-only operation. For a search tool with zero annotation coverage, this leaves significant gaps.

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 communicates the core purpose and return format. It's appropriately sized for a search tool and front-loads the essential information. There's no wasted verbiage, though it could potentially benefit from additional context about when to use it.

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?

For a search tool with 2 parameters, 100% schema coverage, and no output schema, the description provides basic but incomplete context. It covers what the tool does and what it returns, but lacks behavioral details (especially important with no annotations) and usage guidance. The absence of an output schema means the description should ideally provide more detail about return values, though it does mention the key fields returned.

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 (query and limit). The description doesn't add any parameter-specific information beyond what's in the schema. The baseline score of 3 is appropriate when the schema does all the parameter documentation work.

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 Federal Statistical Office datasets on opendata.swiss and returns matching dataset titles, IDs, and descriptions. It specifies the verb 'search' and resource 'datasets', but doesn't explicitly differentiate from sibling tools like 'search_cantonal_affairs' or 'search_companies' that also search different data sources.

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. It doesn't mention when this tool is appropriate compared to other search tools on the server (like search_companies or search_swiss_news) or when not to use it. The only implied usage is for statistical data, but this isn't explicit.

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