Skip to main content
Glama

Filtrowanie wyników wyszukiwania

filter_results
Read-onlyIdempotent

Refine a saved set of Polish legal acts from an earlier search by applying regex patterns, type, status, year, publication date range, and sort options.

Instructions

Filtruj i zawężaj wyniki wcześniejszego wyszukiwania aktów prawnych.

Działa jak grep/filtr na wynikach z search_legal_acts, browse_acts lub track_legal_changes. Wymaga result_set_id zwróconego przez te narzędzia. Przefiltrowane wyniki zapisywane są jako nowy zestaw (nowe result_set_id), który można filtrować dalej.

Limit rozmiaru wejścia: pojedyncze wywołanie przetwarza maksymalnie 100 rekordów (wartość domyślna, konfigurowalna przez operatora). Większy zestaw kończy się błędem, a nie wynikiem częściowym — dzięki temu brak dopasowania zawsze oznacza przeszukanie całego zestawu. Zawęź wyszukiwanie przed filtrowaniem.

Kiedy użyć: Po search_legal_acts/browse_acts/track_legal_changes aby zawęzić wyniki. Kiedy NIE używać: Gdy potrzebujesz nowych wyników z API → użyj search_legal_acts. Kiedy NIE używać: Do dowodzenia, że akt nie istnieje, dopóki pole source_scope odpowiedzi ma wartość 'page' — filtrowane jest wtedy okno, a nie cały zbiór, więc pusty wynik nie rozstrzyga. Odpowiedź sygnalizuje to polem no_match_is_inconclusive.

Przykłady:

  • filter_results(result_set_id="rs_1", type_equals="Rozporządzenie") - Tylko rozporządzenia

  • filter_results(result_set_id="rs_1", pattern="zdrow|apteka|lekar") - Akty związane ze zdrowiem

  • filter_results(result_set_id="rs_1", pattern="podatek|VAT", type_equals="Ustawa") - Ustawy podatkowe

  • filter_results(result_set_id="rs_1", date_field="promulgation_date", date_from="2024-01-01", date_to="2024-06-30") - Ogłoszone w I połowie 2024

  • filter_results(result_set_id="rs_1", sort_by="promulgation_date", sort_desc=True, limit=10) - 10 najnowszych na pierwszej stronie

  • filter_results(result_set_id="rs_1", pattern="\p{L}+ o ochronie") - Wzorzec z klasą unikodową

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldNoPole do przeszukania wzorcem RE2. Dostępne: 'title' (domyślne), 'eli', 'status', 'type', 'publisher'.title
limitNoMaksymalna liczba wyników na stronie odpowiedzi (domyślnie 20, maks. 100).
offsetNoNieujemne przesunięcie strony wyników.
date_toNoKoniec zakresu dat (YYYY-MM-DD). Wymaga ustawienia date_field.
patternNoWzorzec wyszukiwania w składni RE2. Wielkość liter jest ignorowana. Obsługiwany podzbiór składni: alternatywa (a|b), klasy znaków ([a-z], \d, \p{L}, [[:alpha:]]), kwantyfikatory (*, +, ?, {n,m}; maksymalnie 4 zmienne zakresy), kotwice (^, $), grupy nieprzechwytujące. Lookaround ((?=...), (?<=...), (?!...)) oraz backreferencje (\1) nie są obsługiwane. Przykłady: 'zdrow|Minister Zdrowia|apteka|lekar', 'budżet.*państw', 'transport|drogow', '\p{L}+ o ochronie'
sort_byNoPole do sortowania: 'title', 'year', 'pos', 'promulgation_date', 'effective_date', 'type', 'status'.
date_fromNoPoczątek zakresu dat (YYYY-MM-DD). Wymaga ustawienia date_field.
sort_descNoSortuj malejąco (True) lub rosnąco (False, domyślnie).
date_fieldNoPole daty do filtrowania zakresem: 'promulgation_date' (data ogłoszenia) lub 'effective_date' (data wejścia w życie).
type_equalsNoFiltruj po typie dokumentu (dokładne dopasowanie). Wartości: 'Ustawa', 'Rozporządzenie', 'Obwieszczenie', 'Komunikat', 'Uchwała', 'Zarządzenie', 'Wyrok', 'Postanowienie', 'Oświadczenie rządowe'
year_equalsNoFiltruj po roku publikacji (dokładne dopasowanie). Np. 2024.
result_set_idYesIdentyfikator zestawu wyników z poprzedniego wyszukiwania (np. 'rs_1'). Zwracany przez search_legal_acts, browse_acts lub track_legal_changes w polu result_set_id.
status_equalsNoFiltruj po statusie aktu (dokładne dopasowanie). Wartości: 'akt obowiązujący', 'akt uchylony', 'akt jednorazowy', 'obowiązujący', 'uchylony', 'uznany za uchylony', 'nieobowiązujący'

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesThe actual response data
hintsNoSuggested next steps

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv4.4.0
    • removedOutput schema / properties / metadata
      Removed value: -{
      -  "additionalProperties": true,
      -  "description": "Additional metadata",
      -  "title": "Metadata",
      -  "type": "object"
      -}
  2. Changed7 schema fields changedv4.2.0
    • addedOutput schema / $defs / ActSummaryOutput / properties / effective_date / description
      Added value: +"Data wejścia w życie (entryIntoForce)."
    • addedOutput schema / $defs / FilterOutput / properties / no_match_is_inconclusive
      Added value: +{
      +  "default": false,
      +  "description": "True, gdy filtrowano okno i nic nie dopasowano. Wynik NIE rozstrzyga, czy akt istnieje w zbiorze — przeszukano tylko okno. Poszerz zestaw albo zawęź kryteria wyszukiwania przed wyciągnięciem wniosku.",
      +  "title": "No Match Is Inconclusive",
      +  "type": "boolean"
      +}
    • addedOutput schema / $defs / FilterOutput / properties / result_set_scope
      Added value: +{
      +  "anyOf": [
      +    {
      +      "$ref": "#/$defs/ResultSetScope"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Zasięg zestawu powstałego z filtrowania. None, gdy nic nie dopasowano."
      +}
    • addedOutput schema / $defs / FilterOutput / properties / source_scope
      Added value: +{
      +  "$ref": "#/$defs/ResultSetScope",
      +  "description": "Zasięg zestawu, który filtrowano — decyduje, czego dowodzi pusty wynik."
      +}
    • changedOutput schema / $defs / FilterOutput / required
      Previous value: -[
      -  "source_result_set_id",
      -  "results",
      -  "original_count",
      -  "filtered_count",
      -  "page_info"
      -]New value: +[
      +  "source_result_set_id",
      +  "results",
      +  "original_count",
      +  "filtered_count",
      +  "source_scope",
      +  "page_info"
      +]
    • addedOutput schema / $defs / ResultSetScope
      Added value: +{
      +  "description": "Zasięg zestawu wyników względem korpusu, z którego pochodzi.",
      +  "properties": {
      +    "corpus_count": {
      +      "anyOf": [
      +        {
      +          "type": "integer"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "Rozmiar korpusu, z którego pochodzi zestaw. None, gdy nieznany — tak jest dla zestawu powstałego z filtrowania okna: wiadomo, ile rekordów trafiło w oknie, nie wiadomo, ile rekordów korpusu pasowałoby do tych samych kryteriów.",
      +      "title": "Corpus Count"
      +    },
      +    "scope": {
      +      "$ref": "#/$defs/SetScope",
      +      "description": "'complete' — zestaw zawiera każdy rekord pasujący do zapytania w chwili wywołania. 'page' — zestaw jest oknem wyciętym z większego korpusu, więc brak dopasowania w filter_results NIE dowodzi, że akt nie istnieje w zbiorze."
      +    },
      +    "stored_count": {
      +      "description": "Liczba rekordów w tym zestawie.",
      +      "title": "Stored Count",
      +      "type": "integer"
      +    },
      +    "window_offset": {
      +      "description": "Pozycja początku okna w korpusie. Zero dla zestawu kompletnego.",
      +      "title": "Window Offset",
      +      "type": "integer"
      +    }
      +  },
      +  "required": [
      +    "scope",
      +    "stored_count",
      +    "window_offset"
      +  ],
      +  "title": "ResultSetScope",
      +  "type": "object"
      +}
    • addedOutput schema / $defs / SetScope
      Added value: +{
      +  "description": "Whether a stored result set is the whole answer or a window into it.",
      +  "enum": [
      +    "complete",
      +    "page"
      +  ],
      +  "title": "SetScope",
      +  "type": "string"
      +}
  3. Changed26 schema fields changedv3.1.0
    • addedInput schema / properties / date_field / title
      Added value: +"Date Field"
    • addedInput schema / properties / date_from / title
      Added value: +"Date From"
    • addedInput schema / properties / date_to / title
      Added value: +"Date To"
    • changedInput schema / properties / field / description
      Previous value: -"Pole do przeszukania wzorcem regex. Dostępne: 'title' (domyślne), 'eli', 'status', 'type', 'publisher'."New value: +"Pole do przeszukania wzorcem RE2. Dostępne: 'title' (domyślne), 'eli', 'status', 'type', 'publisher'."
    • addedInput schema / properties / field / title
      Added value: +"Field"
    • changedInput schema / properties / limit / default
      Previous value: -nullNew value: +20
    • changedInput schema / properties / limit / description
      Previous value: -"Maksymalna liczba wyników do zwrócenia."New value: +"Maksymalna liczba wyników na stronie odpowiedzi (domyślnie 20, maks. 100)."
    • addedInput schema / properties / limit / title
      Added value: +"Limit"
    • addedInput schema / properties / offset
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": 0,
      +  "description": "Nieujemne przesunięcie strony wyników.",
      +  "title": "Offset"
      +}
    • changedInput schema / properties / pattern / description
      Previous value: -"Wzorzec regex do przeszukania pola (obsługuje OR: 'podatek|VAT|akcyza'). Wielkość liter jest ignorowana. Przykłady: 'zdrow|Minister Zdrowia|apteka|lekar', 'budżet.*państw', 'transport|drogow'"New value: +"Wzorzec wyszukiwania w składni RE2. Wielkość liter jest ignorowana. Obsługiwany podzbiór składni: alternatywa (a|b), klasy znaków ([a-z], \\d, \\p{L}, [[:alpha:]]), kwantyfikatory (*, +, ?, {n,m}; maksymalnie 4 zmienne zakresy), kotwice (^, $), grupy nieprzechwytujące. Lookaround ((?=...), (?<=...), (?!...)) oraz backreferencje (\\1) nie są obsługiwane. Przykłady: 'zdrow|Minister Zdrowia|apteka|lekar', 'budżet.*państw', 'transport|drogow', '\\p{L}+ o ochronie'"
    • addedInput schema / properties / pattern / title
      Added value: +"Pattern"
    • addedInput schema / properties / result_set_id / title
      Added value: +"Result Set Id"
    • addedInput schema / properties / sort_by / title
      Added value: +"Sort By"
    • addedInput schema / properties / sort_desc / title
      Added value: +"Sort Desc"
    • addedInput schema / properties / status_equals / title
      Added value: +"Status Equals"
    • addedInput schema / properties / type_equals / title
      Added value: +"Type Equals"
    • addedInput schema / properties / year_equals / title
      Added value: +"Year Equals"
    • addedInput schema / title
      Added value: +"filter_resultsArguments"
    • addedOutput schema / $defs
      Added value: +{
      +  "ActSummaryOutput": {
      +    "description": "Formatted output for act summary.",
      +    "properties": {
      +      "effective_date": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "title": "Effective Date"
      +      },
      +      "eli": {
      +        "title": "Eli",
      +        "type": "string"
      +      },
      +      "in_force": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "title": "In Force"
      +      },
      +      "pos": {
      +        "title": "Pos",
      +        "type": "integer"
      +      },
      +      "promulgation_date": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "title": "Promulgation Date"
      +      },
      +      "publisher": {
      +        "title": "Publisher",
      +        "type": "string"
      +      },
      +      "status": {
      +        "title": "Status",
      +        "type": "string"
      +      },
      +      "title": {
      +        "title": "Title",
      +        "type": "string"
      +      },
      +      "type": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "title": "Type"
      +      },
      +      "year": {
      +        "title": "Year",
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "eli",
      +      "publisher",
      +      "year",
      +      "pos",
      +      "title",
      +      "status"
      +    ],
      +    "title": "ActSummaryOutput",
      +    "type": "object"
      +  },
      +  "FilterOutput": {
      +    "description": "Output for filtered results.",
      +    "properties": {
      +      "filtered_count": {
      +        "title": "Filtered Count",
      +        "type": "integer"
      +      },
      +      "filters_applied": {
      +        "additionalProperties": true,
      +        "default": {},
      +        "title": "Filters Applied",
      +        "type": "object"
      +      },
      +      "original_count": {
      +        "title": "Original Count",
      +        "type": "integer"
      +      },
      +      "page_info": {
      +        "$ref": "#/$defs/PageInfo"
      +      },
      +      "result_set_id": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "title": "Result Set Id"
      +      },
      +      "results": {
      +        "items": {
      +          "$ref": "#/$defs/ActSummaryOutput"
      +        },
      +        "title": "Results",
      +        "type": "array"
      +      },
      +      "source_result_set_id": {
      +        "title": "Source Result Set Id",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "source_result_set_id",
      +      "results",
      +      "original_count",
      +      "filtered_count",
      +      "page_info"
      +    ],
      +    "title": "FilterOutput",
      +    "type": "object"
      +  },
      +  "Hint": {
      +    "description": "Hint for next actions or related tools.",
      +    "properties": {
      +      "message": {
      +        "description": "Hint message",
      +        "title": "Message",
      +        "type": "string"
      +      },
      +      "parameters": {
      +        "anyOf": [
      +          {
      +            "additionalProperties": true,
      +            "type": "object"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "description": "Suggested parameters",
      +        "title": "Parameters"
      +      },
      +      "tool": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "description": "Related tool name",
      +        "title": "Tool"
      +      }
      +    },
      +    "required": [
      +      "message"
      +    ],
      +    "title": "Hint",
      +    "type": "object"
      +  },
      +  "PageInfo": {
      +    "description": "Metadata describing one bounded response page.",
      +    "properties": {
      +      "limit": {
      +        "minimum": 0,
      +        "title": "Limit",
      +        "type": "integer"
      +      },
      +      "next_offset": {
      +        "anyOf": [
      +          {
      +            "minimum": 0,
      +            "type": "integer"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "title": "Next Offset"
      +      },
      +      "offset": {
      +        "minimum": 0,
      +        "title": "Offset",
      +        "type": "integer"
      +      },
      +      "returned_count": {
      +        "minimum": 0,
      +        "title": "Returned Count",
      +        "type": "integer"
      +      },
      +      "total_count": {
      +        "minimum": 0,
      +        "title": "Total Count",
      +        "type": "integer"
      +      },
      +      "unit": {
      +        "$ref": "#/$defs/PageUnit"
      +      },
      +      "was_truncated": {
      +        "title": "Was Truncated",
      +        "type": "boolean"
      +      }
      +    },
      +    "required": [
      +      "limit",
      +      "offset",
      +      "returned_count",
      +      "total_count",
      +      "was_truncated",
      +      "unit"
      +    ],
      +    "title": "PageInfo",
      +    "type": "object"
      +  },
      +  "PageUnit": {
      +    "description": "Unit represented by a page.",
      +    "enum": [
      +      "items",
      +      "characters"
      +    ],
      +    "title": "PageUnit",
      +    "type": "string"
      +  }
      +}
    • addedOutput schema / properties / data
      Added value: +{
      +  "$ref": "#/$defs/FilterOutput",
      +  "description": "The actual response data"
      +}
    • addedOutput schema / properties / hints
      Added value: +{
      +  "description": "Suggested next steps",
      +  "items": {
      +    "$ref": "#/$defs/Hint"
      +  },
      +  "title": "Hints",
      +  "type": "array"
      +}
    • addedOutput schema / properties / metadata
      Added value: +{
      +  "additionalProperties": true,
      +  "description": "Additional metadata",
      +  "title": "Metadata",
      +  "type": "object"
      +}
    • removedOutput schema / properties / result
      Removed value: -{
      -  "type": "string"
      -}
    • changedOutput schema / required
      Previous value: -[
      -  "result"
      -]New value: +[
      +  "data"
      +]
    • addedOutput schema / title
      Added value: +"EnrichedResponse[FilterOutput]"
    • removedOutput schema / x-fastmcp-wrap-result
      Removed value: -true
  4. Addedv1.0.2

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations (read-only, idempotent, non-destructive), it discloses the 100-record input limit, that oversized sets error rather than return partial results, and that each filtering round creates a new result_set_id. It also explains the no_match_is_inconclusive signal tied to source_scope, giving agents a clear model of edge-case behavior.

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 organized with a short lead, an operation/input section, an input-limit warning, explicit usage/non-usage guidance, and a compact example list. Every block carries distinct information and no sentence is filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter filter tool with an output schema and full annotation coverage, the description covers prerequisites, chaining behavior, limit semantics, failure modes, and the key epistemic limitation that empty results may be inconclusive. The examples cover all major filter dimensions, leaving no significant gap for correct invocation.

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?

Schema coverage is 100% and the schema already documents each parameter thoroughly, so the baseline is 3; the description earns a 4 by adding worked examples that show meaningful parameter combinations (pattern alternation, date ranges with date_field, sort/limit pagination) and by reinforcing that result_set_id comes from the three named sibling tools. It does not deeply redefine parameters, but the examples add practical selection value.

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 first sentence states a specific verb and resource: filter and narrow results from an earlier legal-acts search. It further distinguishes itself by naming the predecessor tools (search_legal_acts, browse_acts, track_legal_changes) and describing the tool as a grep/filter over their result sets. This clearly separates it from sibling search and browse tools.

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

Usage Guidelines5/5

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

The description has explicit 'Kiedy użyć' and two 'Kiedy NIE używać' sections, including the alternative to use search_legal_acts when new results are needed and the caveat about source_scope='page' making empty results inconclusive. This is direct, decision-relevant guidance that prevents misinvocation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.