# MCP tool: valuation

Szacunek ceny

## Description (verbatim)

Oblicz szacunek ceny działki z opisem metody, próbą porównawczą i PDF.

## Cost and binding

`x-request-cost`: 20 requests per call.

REST binding: [POST /v1/valuation](../operations/valuation.md).

## Inputs

Dokładnie jeden z parametrów q, id, point (lat i lng razem liczą się jako point). Wszystkie punkty odczytu API i wszystkie narzędzia obsługują te trzy warianty.

| Field | Required | Schema / constraints | Description |
| --- | --- | --- | --- |
| `id` | yes | `{"$anchor": "s", "maxLength": 100, "pattern": "^\\s*[0-9]{6}[._][0-9]\\.[0-9]{1,4}\\.[0-9A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u024F_./ -]{0,63}[0-9A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u024F_./-]\\s*$", "type": "string"}` | not specified in the source contract |
| `plot_type` | no | `{"enum": ["building", "agricultural", "forest", "recreational", "other"]}` | not specified in the source contract |
| `road_access` | no | `{"enum": ["public", "internal", "none", "unknown"]}` | not specified in the source contract |
| `utilities` | no | `{"$anchor": "c", "items": {"enum": ["electricity", "water", "sewer", "gas"]}, "maxItems": 4, "type": "array"}` | not specified in the source contract |

```json
{
  "inputSchema": {
    "$ref": "#a",
    "additionalProperties": false,
    "properties": {
      "id": {
        "$ref": "#s"
      },
      "plot_type": {
        "enum": [
          "building",
          "agricultural",
          "forest",
          "recreational",
          "other"
        ]
      },
      "road_access": {
        "enum": [
          "public",
          "internal",
          "none",
          "unknown"
        ]
      },
      "utilities": {
        "$ref": "#c",
        "items": {
          "enum": [
            "electricity",
            "water",
            "sewer",
            "gas"
          ]
        },
        "maxItems": 4
      }
    },
    "required": [
      "id"
    ]
  }
}
```

## Structured results

Tools return `structuredContent (JSON)` using canonical definitions in `envelope.json`.

MCP tools share the published REST operations, evidence and billing contracts. Catalog-local definitions describe their structured input and output.

```json
{
  "$ref": "#m",
  "properties": {
    "meta": {
      "properties": {
        "operation": {
          "const": "valuation"
        }
      }
    },
    "result": {
      "anyOf": [
        {
          "$ref": "#a",
          "additionalProperties": false,
          "patternProperties": {
            "^(comparables_reference|method)$(?!\\s)": {
              "$ref": "#f"
            },
            "^(per_m2|total)_pln$(?!\\s)": {
              "$ref": "#a",
              "additionalProperties": false,
              "minProperties": 2,
              "patternProperties": {
                "^(high|low)$(?!\\s)": {
                  "$ref": "#n"
                }
              }
            }
          },
          "properties": {
            "computed_at": {
              "$ref": "#o"
            },
            "confidence": {
              "enum": [
                "low",
                "medium",
                "high"
              ]
            },
            "disclaimer": {
              "const": "Szacunek ceny na podstawie cen transakcyjnych z Rejestru Cen Nieruchomości. Nie jest operatem szacunkowym w rozumieniu ustawy o gospodarce nieruchomościami."
            },
            "label": {
              "const": "szacunek"
            },
            "point_pln": {
              "$ref": "#l"
            },
            "reference": {
              "$ref": "#b",
              "format": "uuid"
            },
            "sample_size": {
              "$ref": "#t"
            },
            "used_rows_period": {
              "$ref": "#S",
              "additionalProperties": false,
              "minProperties": 2,
              "patternProperties": {
                "^(from|to)$(?!\\s)": {
                  "$ref": "#p"
                }
              }
            }
          },
          "required": [
            "label",
            "total_pln",
            "per_m2_pln",
            "confidence",
            "method",
            "sample_size",
            "comparables_reference",
            "disclaimer",
            "reference",
            "used_rows_period",
            "computed_at"
          ]
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
```

Shared catalog-local `$defs` are published once in [MCP catalogue](../mcp.md). See [Envelope](../envelope.md) and the bound operation for responses.

## Server instructions (verbatim)

Podawaj źródło, datę i zakres danych. Nie zapewniaj o bezpieczeństwie, braku zagrożeń przy brakujących danych ani o prawie do zabudowy. Rozróżniaj plan ogólny i MPZP oraz ich stan prawny. Kandydatów wybiera użytkownik. Bez danych tożsamości i KW. Wiersze RCN: konto płatne, poza okresem próbnym i testowym, LANDFEED_RCN_ROWS=on.

## Annotations

```json
{
  "readOnlyHint": true
}
```

## Coverage states

Cztery stany zakresu danych dla jednej kategorii w danym miejscu. covered: źródło obejmuje to miejsce i zawiera rekord; value zawiera ten rekord. covered_no_data: źródło obejmuje to miejsce, lecz nie zawiera rekordu; value ma określoną dla danej kategorii pustą wartość (false, 0, [], none), nigdy null; jest to potwierdzony brak rekordu, za który naliczana jest opłata. not_covered: źródło nie obejmuje miejsca albo państwo nie publikuje tych danych w postaci do odczytu maszynowego; value=null, agent nie może wyciągać wniosków, a opłata jest zwracana, gdy zapytanie dotyczy tych danych. not_computed: posiadamy źródło, lecz nie obliczyliśmy jeszcze wyniku dla tego miejsca, np. trwa ładowanie zbioru; value=null, opłata jest zwracana. Każdy stan zawiera uwagę napisaną prostym językiem.

States: `covered` | `covered_no_data` | `not_covered` | `not_computed`.

`LayerAnswer` required fields: `layer`, `coverage`, `value`, `note`, `source`, `as_of`, `layer_version`.

## Billing rule

Koszt żądania. charged: liczba naliczonych wywołań po zwrotach. refunded: liczba wywołań naliczonych, a następnie zwróconych. rule: zastosowana reguła. Płatne są odpowiedzi, potwierdzone braki rekordów (covered_no_data) i niejednoznaczne listy kandydatów. Bezpłatne są błędne dane wejściowe (400), brak uwierzytelnienia (401), odpowiedzi bez zmiany danych (304) i operacje bezpłatne. Zwrot obejmuje pozostałe 4xx, każde 5xx, status not_covered oraz odpowiedź dotyczącą jednej kategorii ze stanem not_covered lub not_computed. W operacjach zbiorczych liczby dotyczą poszczególnych elementów.

Rule values: `charged` | `free_operation` | `free_invalid_input` | `free_unauthorized` | `free_not_modified` | `free_idempotency_replay` | `refunded_client_error` | `refunded_server_error` | `refunded_not_covered` | `refunded_not_computed` | `batch_mixed` | `free_record_reuse`.

## curl example of the REST binding

```sh
curl --silent --show-error --request POST "https://api.landfeed.pl/v1/valuation" \
  -H "X-Api-Key: ${LANDFEED_API_KEY}" \
  -H 'Idempotency-Key: docs-example-001' \
  -H 'Content-Type: application/json' \
  --data '{"id": "146501_1.0101.12/3"}'
```

MCP transport invocation: not specified in the source contract.
