get_market_stats
Get price statistics for a slice of the Portugal property market: how many listings match, the median price, the p25–p75 range, the median price per m² and a breakdown by typology. Use this when the user asks what something costs, whether an asking price is fair, or how two areas compare — instead of listing individual properties. Takes the same filters as search_properties and describes exactly the set that tool would return, so the two never disagree. Reports medians and quartiles rather than averages, because property prices have a long right tail and a single luxury listing moves an average. Call once per area to compare areas.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| minArea | No | Minimum floor area in m². Matches either the gross or the useful area, whichever the source published. Only matches listings that published an area. | |
| location | No | Location: district, municipality, neighbourhood, town or postal-code prefix (e.g. Lisbon, Cascais, Chiado, 2750). Not a free-text keyword search — words that are not places (e.g. 'sea view') will not match. | |
| priceMax | No | Maximum price, in the market currency. Note: listings advertised 'price on request' have no price and are excluded by either price bound. | |
| priceMin | No | Minimum price, in the market currency. | |
| typology | No | Normalised typology code (T0, T1, T2, T3…), where the number is the count of bedrooms. Used in every market, including the German and Polish ones. Matched exactly; pass an array to match several. The buckets `T0–T1` and `T4+` are also accepted. | |
| condition | No | State of repair, or an array of states. Only matches listings whose source published it. | |
| operation | No | buy = for sale, rent = to let. Defaults to buy; a listing is one or the other, so call twice to cover both. | |
| energyClass | No | Energy certificate class. Selects the whole band the class belongs to: A+/A, B/B-, C, or D-and-below. Only matches listings that carry a certificate. | |
| minBathrooms | No | Minimum number of bathrooms. Only matches listings whose source published a bathroom count. | |
| propertyType | No | Property type, or an array of types. Omit to search all types. `farm` covers rural estates (quintas); `building` is a whole apartment block. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | Yes | Listings matching the filters, with or without a published price. | |
| price | No | Price distribution, in percentiles. null when no matching listing publishes a price. There is deliberately no min or max: listings come from third-party sources and the extremes are set by data errors, not by the market. | |
| market | Yes | ||
| priced | Yes | Subset with a published price — the base of every figure below. A large gap to `count` means many listings in this slice are 'price on request'. | |
| currency | Yes | ||
| operation | Yes | ||
| byTypology | Yes | Up to 6 most represented typologies, each with its own median. | |
| pricePerM2Median | No | Median price per m² among listings that published both a price and an area. Best figure for comparing areas. |