Skip to main content
Glama

get_statistic

Retrieve dataset details and resource links from Swiss open data using an opendata.swiss identifier. First use search_statistics to find dataset IDs.

Instructions

Fetch details and resource links for a specific BFS/OFS dataset by its opendata.swiss identifier. Use search_statistics first to find dataset IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataset_idYesDataset identifier from opendata.swiss (e.g. 'bevolkerungsstatistik-einwohner')

Implementation Reference

  • The handler function 'handleGetStatistic' that implements the 'get_statistic' tool logic by fetching dataset details from the CKAN API.
    async function handleGetStatistic(args: Record<string, unknown>): Promise<string> {
      const datasetId = typeof args.dataset_id === "string" ? args.dataset_id.trim() : "";
      if (!datasetId) throw new Error("dataset_id is required");
    
      const url = buildUrl(`${CKAN_BASE}/package_show`, { id: datasetId });
      const data = await fetchJSON<CkanPackageResult>(url);
    
      if (!data.success) throw new Error(`Dataset not found: ${datasetId}`);
    
      const pkg = data.result;
    
      const resources = (pkg.resources ?? []).slice(0, 10).map((r) => ({
        name: resolveText(r.name),
        format: r.format,
        url: r.url,
      }));
    
      const contact = pkg.contact_points?.[0];
      const org = resolveText(pkg.organization?.title);
    
      return JSON.stringify({
        id: pkg.name,
        title: resolveText(pkg.title),
        description: truncate(resolveText(pkg.notes || pkg.description), 500),
        keywords: pkg.keywords?.en ?? pkg.keywords?.de ?? [],
        issued: pkg.issued?.slice(0, 10) ?? "",
        modified: pkg.metadata_modified?.slice(0, 10) ?? "",
        organization: org,
        contact: contact ? { name: contact.name, email: contact.email } : undefined,
        resources,
        source: "opendata.swiss",
        source_url: `https://opendata.swiss/en/dataset/${pkg.name}`,
      });
    }
  • The tool definition and input schema for 'get_statistic'.
      name: "get_statistic",
      description:
        "Fetch details and resource links for a specific BFS/OFS dataset by its opendata.swiss identifier. " +
        "Use search_statistics first to find dataset IDs.",
      inputSchema: {
        type: "object",
        required: ["dataset_id"],
        properties: {
          dataset_id: {
            type: "string",
            description: "Dataset identifier from opendata.swiss (e.g. 'bevolkerungsstatistik-einwohner')",
          },
        },
      },
    },
  • The registration/dispatch logic for 'get_statistic' within the 'handleStatistics' function.
    case "get_statistic":
      return handleGetStatistic(args);
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 mentions fetching 'details and resource links,' which gives some behavioral insight, but lacks information on permissions, rate limits, error handling, or response format. The description adds basic context but misses key operational details.

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 concise sentences with zero waste. The first sentence states the purpose, and the second provides usage guidance, making it front-loaded and efficiently structured.

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 nested objects, no output schema) and lack of annotations, the description is reasonably complete. It covers purpose, usage, and distinguishes from siblings, but could improve by adding more behavioral details like response format or error cases.

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%, with the parameter 'dataset_id' fully described in the schema. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. Baseline 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.

Purpose5/5

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

The description clearly states the action ('Fetch details and resource links') and the resource ('a specific BFS/OFS dataset by its opendata.swiss identifier'). It distinguishes from sibling 'search_statistics' by specifying this tool is for fetching details of a known dataset ID, while search_statistics is for finding IDs.

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 provides when to use this tool ('by its opendata.swiss identifier') and when to use an alternative ('Use search_statistics first to find dataset IDs'). This gives clear guidance on the workflow and distinguishes it from the sibling tool.

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