Skip to main content
Glama

search_real_estate_data

Search Swiss open data for real estate and housing datasets including property prices, rents, construction data, and vacancy rates to support market analysis and research.

Instructions

Search opendata.swiss for Swiss real estate and housing datasets. Finds datasets about property prices, rents, housing construction, vacancy rates, and more. Returns dataset names, descriptions, and resource download URLs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch terms in German, French, or English (e.g. "Immobilien", "Miete", "rent", "logement", "Wohnungspreise", "Leerwohnungen").
limitNoMax results to return (1–20, default 10).

Implementation Reference

  • The function handleSearchRealEstateData executes the tool logic, including searching the opendata.swiss CKAN API with relevant keywords for real estate datasets and formatting the output.
    async function handleSearchRealEstateData(
      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: "groups:territoire-et-environnement OR groups:construction-et-logement OR tags:immobilien OR tags:wohnen OR tags:miete OR tags:logement",
      });
    
      const data = await fetchJSON<CkanSearchResult>(url, {
        headers: { "User-Agent": "mcp-swiss" },
      });
    
      if (!data.success) throw new Error("opendata.swiss search failed");
    
      // Also do a fallback search without group filter if we get 0 results
      let results = data.result.results;
      let totalCount = data.result.count;
    
      if (results.length === 0) {
        const url2 = buildUrl(`${CKAN_BASE}/package_search`, { q: query, rows: limit });
        const data2 = await fetchJSON<CkanSearchResult>(url2, {
          headers: { "User-Agent": "mcp-swiss" },
        });
        if (data2.success) {
          results = data2.result.results;
          totalCount = data2.result.count;
        }
      }
    
      const mapped = results.map((pkg) => {
        const resources = (pkg.resources ?? []).slice(0, 5).map((r) => ({
          name: resolveText(r.name) || r.format,
          format: r.format,
          url: r.url,
        }));
    
        return {
          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) ?? "",
          organization: resolveText(pkg.organization?.title),
          resources,
          dataset_url: `https://opendata.swiss/en/dataset/${pkg.name}`,
        };
      });
    
      return JSON.stringify({
        query,
        total_matches: totalCount,
        returned: mapped.length,
        results: mapped,
        source: "opendata.swiss CKAN",
        source_url: `https://opendata.swiss/en/dataset?q=${encodeURIComponent(query)}`,
      });
    }
  • Tool registration for search_real_estate_data, including its name, description, and input schema.
    name: "search_real_estate_data",
    description:
      "Search opendata.swiss for Swiss real estate and housing datasets. " +
      "Finds datasets about property prices, rents, housing construction, vacancy rates, and more. " +
      "Returns dataset names, descriptions, and resource download URLs.",
    inputSchema: {
      type: "object",
      required: ["query"],
      properties: {
        query: {
          type: "string",
          description:
            'Search terms in German, French, or English (e.g. "Immobilien", "Miete", ' +
            '"rent", "logement", "Wohnungspreise", "Leerwohnungen").',
        },
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 states what the tool returns ('dataset names, descriptions, and resource download URLs') which is helpful, but doesn't mention important behavioral aspects like whether this is a read-only operation, potential rate limits, authentication requirements, error conditions, or pagination behavior for results beyond the limit parameter.

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 perfectly structured with three concise sentences that each earn their place: first establishes the action and scope, second elaborates on the data domain, third specifies the return format. No wasted words, front-loaded with the core purpose.

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 and no output schema, the description provides adequate but incomplete context. It covers the purpose, data domain, and return format, but lacks behavioral details (especially important with no annotations) and doesn't explain how results are structured or formatted. The absence of output schema means the description should ideally provide more detail about the return values.

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?

With 100% schema description coverage, the input schema already fully documents both parameters (query and limit). The description adds no additional parameter semantics 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.

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 opendata.swiss'), resource ('Swiss real estate and housing datasets'), and scope ('Finds datasets about property prices, rents, housing construction, vacancy rates, and more'). It effectively distinguishes this tool from its many siblings by focusing exclusively on real estate data from a specific Swiss open data portal.

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

Usage Guidelines3/5

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

The description implies usage context by specifying the data domain (real estate/housing) and source (opendata.swiss), but provides no explicit guidance on when to use this tool versus alternatives. With many sibling tools available (like get_property_price_index, get_rent_index, search_statistics), there's no indication of how this search tool complements or differs from those specific real estate tools.

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