# MCP tool: sources

API

## Description (verbatim)

Wszystkie źródła udostępniane przez API, z licencją, wskazaniem pochodzenia, as_of, aktualnością i zakresem danych.

## Cost and binding

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

REST binding: [GET /v1/sources](../operations/sources.md).

## Inputs

| Field | Required | Schema / constraints | Description |
| --- | --- | --- | --- |
| `after` | no | `{"$anchor": "b", "type": "string"}` | not specified in the source contract |
| `gmina` | no | `{"$anchor": "C", "pattern": "^[0-9]{6}[123]$", "type": "string"}` | not specified in the source contract |
| `limit` | no | `{"$anchor": "t", "maximum": 100, "minimum": 1, "type": "integer"}` | not specified in the source contract |
| `voivodeship` | no | `{"$anchor": "b", "pattern": "^(0[2468]\|1[02468]\|2[02468]\|3[02])$", "type": "string"}` | not specified in the source contract |

```json
{
  "inputSchema": {
    "$ref": "#a",
    "additionalProperties": false,
    "properties": {
      "after": {
        "$ref": "#b"
      },
      "gmina": {
        "$ref": "#C"
      },
      "limit": {
        "$ref": "#t",
        "maximum": 100
      },
      "voivodeship": {
        "$ref": "#/$defs/az"
      }
    }
  }
}
```

## 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": "#a",
  "allOf": [
    {
      "$ref": "#a",
      "allOf": [
        {
          "$ref": "#/$defs/af"
        }
      ],
      "properties": {
        "coverage_gminas": {
          "$ref": "#a",
          "additionalProperties": false,
          "minProperties": 4,
          "properties": {
            "generated_at": {
              "$ref": "#o"
            },
            "items": {
              "$ref": "#c",
              "items": {
                "$ref": "#a",
                "additionalProperties": false,
                "minProperties": 4,
                "properties": {
                  "gmina_teryt": {
                    "$ref": "#C"
                  },
                  "layers": {
                    "$ref": "#a",
                    "additionalProperties": false,
                    "minProperties": 15,
                    "patternProperties": {
                      "^(ad(dress|min)|buildings|flood|landslide|mpzp|p(arcel|ermits|lanning|og|rices|rotected)|road_access|soil|wz)$(?!\\s)": {
                        "$ref": "#a",
                        "additionalProperties": false,
                        "if": {
                          "$ref": "#aac"
                        },
                        "minProperties": 3,
                        "patternProperties": {
                          "^(new|old)est_as_of$(?!\\s)": {
                            "$ref": "#g"
                          }
                        },
                        "properties": {
                          "coverage": {
                            "$ref": "#J"
                          }
                        },
                        "then": {
                          "patternProperties": {
                            "^(new|old)est_as_of$(?!\\s)": {
                              "type": "null"
                            }
                          }
                        }
                      }
                    }
                  },
                  "name": {
                    "$ref": "#e",
                    "minLength": 1
                  },
                  "voivodeship": {
                    "$ref": "#/$defs/az"
                  }
                }
              },
              "maxItems": 100
            },
            "next_cursor": {
              "$ref": "#e",
              "pattern": "^(?:c[0-9]+\\.[0-9]+\\.[01]\\.)?[0-9]{6}[123]$"
            },
            "note": {
              "$ref": "#d"
            }
          }
        },
        "coverage_summary": {
          "$ref": "#a",
          "additionalProperties": false,
          "minProperties": 9,
          "patternProperties": {
            "^(lin|not)e$(?!\\s)": {
              "$ref": "#d"
            },
            "^(new|old)est_as_of$(?!\\s)": {
              "$ref": "#g"
            }
          },
          "properties": {
            "generated_at": {
              "$ref": "#o"
            },
            "gminas": {
              "$ref": "#k"
            },
            "layers": {
              "$ref": "#a",
              "additionalProperties": false,
              "minProperties": 8,
              "patternProperties": {
                "^(buildings|flood|landslide|mpzp|parcel|pog|protected|wz)$(?!\\s)": {
                  "$ref": "#a",
                  "additionalProperties": false,
                  "minProperties": 4,
                  "patternProperties": {
                    "^(new|old)est_as_of$(?!\\s)": {
                      "$ref": "#g"
                    }
                  },
                  "properties": {
                    "gminas": {
                      "$ref": "#k"
                    },
                    "voivodeships": {
                      "$ref": "#k",
                      "maximum": 16
                    }
                  }
                }
              }
            },
            "unmeasured_layers": {
              "$ref": "#j",
              "items": {
                "$ref": "#B"
              }
            },
            "voivodeships": {
              "$ref": "#k",
              "maximum": 16
            }
          }
        },
        "trial": false
      },
      "unevaluatedProperties": false
    }
  ],
  "properties": {
    "meta": {
      "properties": {
        "operation": {
          "const": "sources"
        }
      }
    }
  }
}
```

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 GET "https://api.landfeed.pl/v1/sources" --get \
  -H "X-Api-Key: ${LANDFEED_API_KEY}" \
  --data-urlencode 'id=141803_2.0001.12/3'
```

MCP transport invocation: not specified in the source contract.
