Skip to main content
Glama

get_property_price_index

Retrieve Swiss Residential Property Price Index data from BFS to track quarterly property price trends since 2009. Filter by property type and date range for analysis.

Instructions

Get the Swiss Residential Property Price Index (SWRPI) — official BFS data. Baseline Q4 2019 = 100. Returns quarterly index values tracking Swiss property prices since 2009. Covers all properties, single-family houses, and apartments separately.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNoProperty type to filter by: "all" (combined index), "houses" (single-family), "apartments" (condominiums/flats). Defaults to "all".
fromNoStart period (inclusive). Format: "2020Q1", "2020-Q1", or just "2020". Defaults to earliest available (2009-Q4).
toNoEnd period (inclusive). Format: "2024Q4", "2024-Q4", or just "2024". Defaults to latest available.

Implementation Reference

  • Handler function for the get_property_price_index tool.
    async function handleGetPropertyPriceIndex(
      args: Record<string, unknown>
    ): Promise<string> {
      const rawType = typeof args.type === "string" ? args.type.trim().toLowerCase() : "all";
      const rawFrom = typeof args.from === "string" ? args.from.trim() : undefined;
      const rawTo = typeof args.to === "string" ? args.to.trim() : undefined;
    
      const validTypes = ["all", "houses", "apartments"];
      if (!validTypes.includes(rawType)) {
        throw new Error(`Invalid type "${rawType}". Must be one of: all, houses, apartments`);
      }
    
      // Filter by from/to
      let data = [...SWRPI_ALL_DATA];
    
      if (rawFrom) {
        const parsed = parseQuarter(rawFrom);
        if (!parsed) throw new Error(`Invalid from value: "${rawFrom}". Use format like "2020Q1" or "2020"`);
        data = data.filter(
          (d) => d.year > parsed.year || (d.year === parsed.year && d.quarter >= parsed.quarter)
        );
      }
    
      if (rawTo) {
        const parsed = parseQuarter(rawTo);
        if (!parsed) throw new Error(`Invalid to value: "${rawTo}". Use format like "2024Q4" or "2024"`);
        data = data.filter(
          (d) => d.year < parsed.year || (d.year === parsed.year && d.quarter <= parsed.quarter)
        );
      }
    
      if (data.length === 0) {
        throw new Error("No data available for the specified period range");
      }
    
      // Build series based on type
      const series = data.map((d) => {
        const entry: Record<string, unknown> = { period: d.period };
        if (rawType === "all") entry.index = d.index_all;
        else if (rawType === "houses") entry.index = d.index_houses;
        else entry.index = d.index_apartments;
        return entry;
      });
    
      // Trend: compare latest to previous year same quarter
      const latest = data[data.length - 1];
      const prevYear = data.find(
        (d) => d.year === latest.year - 1 && d.quarter === latest.quarter
      );
    
      let latestIndex: number;
      let prevIndex: number | undefined;
      if (rawType === "all") {
        latestIndex = latest.index_all;
        prevIndex = prevYear?.index_all;
      } else if (rawType === "houses") {
        latestIndex = latest.index_houses;
        prevIndex = prevYear?.index_houses;
      } else {
        latestIndex = latest.index_apartments;
        prevIndex = prevYear?.index_apartments;
      }
    
      const trend =
        prevIndex !== undefined
          ? {
              change_yoy: parseFloat((((latestIndex - prevIndex) / prevIndex) * 100).toFixed(2)),
              change_yoy_label: `${latest.period} vs ${quarterToLabel(latest.year - 1, latest.quarter)}`,
            }
          : null;
    
      // Reference: fetch dataset metadata from CKAN for the source URL
      const datasetUrl = `https://opendata.swiss/en/dataset/${SWRPI_DATASET_ID}`;
    
      return JSON.stringify({
        type: rawType,
        baseline: "Q4 2019 = 100",
        from: data[0].period,
        to: data[data.length - 1].period,
        latest_index: latestIndex,
        latest_period: latest.period,
        data_points: series.length,
        series,
        trend,
        note: "Swiss Residential Property Price Index (SWRPI). Baseline Q4 2019 = 100.",
        source: "Federal Statistical Office (BFS) — Swiss Residential Property Price Index (SWRPI)",
        source_url: datasetUrl,
        dataset_id: SWRPI_DATASET_ID,
      });
    }
  • Schema definition for the get_property_price_index tool.
    {
      name: "get_property_price_index",
      description:
        "Get the Swiss Residential Property Price Index (SWRPI) — official BFS data. " +
        "Baseline Q4 2019 = 100. Returns quarterly index values tracking Swiss property prices " +
        "since 2009. Covers all properties, single-family houses, and apartments separately.",
      inputSchema: {
        type: "object",
        properties: {
          type: {
            type: "string",
            description:
              'Property type to filter by: "all" (combined index), "houses" (single-family), ' +
              '"apartments" (condominiums/flats). Defaults to "all".',
          },
          from: {
            type: "string",
            description:
              'Start period (inclusive). Format: "2020Q1", "2020-Q1", or just "2020". ' +
              "Defaults to earliest available (2009-Q4).",
          },
          to: {
            type: "string",
            description:
              'End period (inclusive). Format: "2024Q4", "2024-Q4", or just "2024". ' +
              "Defaults to latest available.",
          },
        },
      },
    },
  • Dispatcher for the real estate tools, including registration of get_property_price_index.
    export async function handleRealEstate(
      name: string,
      args: Record<string, unknown>
    ): Promise<string> {
      switch (name) {
        case "get_property_price_index":
          return handleGetPropertyPriceIndex(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 discloses the data source ('official BFS data'), baseline ('Q4 2019 = 100'), temporal coverage ('since 2009'), and breakdowns ('all properties, single-family houses, and apartments'), but lacks details on rate limits, error handling, or response format, which are important for a data-fetching tool.

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 front-loaded with the core purpose and efficiently uses three sentences to cover data source, baseline, temporal scope, and breakdowns without any redundant or vague language. Every sentence adds essential information.

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 data-retrieval tool with no annotations and no output schema, the description adequately covers what the tool does and the data's nature. However, it lacks details on output format (e.g., JSON structure, units) and error cases, which are important for an agent to handle responses correctly, leaving some gaps in completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the schema fully documents all three parameters. The description adds value by explaining the index's baseline and breakdowns, which contextualizes the 'type' parameter options, but does not provide additional syntax or format details beyond the schema. The baseline score of 3 is raised due to this contextual enhancement.

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 tool's purpose with specific verbs ('Get') and resources ('Swiss Residential Property Price Index'), including the data source ('official BFS data'). It distinguishes itself from siblings by focusing on property price indices, unlike other tools for weather, traffic, or parliamentary data.

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 does not mention any prerequisites, exclusions, or compare it to similar tools (e.g., 'get_rent_index' or 'search_real_estate_data'), leaving the agent without context for tool selection.

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