Skip to main content
Glama

search_legal_acts

Search Polish legal acts using filters like date, type, keywords, or title to find specific documents from Dziennik Ustaw and Monitor Polski.

Instructions

Advanced search for Polish legal acts with multiple filters. Use this for finding specific documents by criteria like date, type, keywords, or title. Note: When using multiple keywords, ALL keywords must be present in the act (AND logic).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
act_typeNoDocument type (e.g., 'Rozporządzenie', 'Ustawa')
date_fromNoStart date for effectiveness period (YYYY-MM-DD)
date_toNoEnd date for effectiveness period (YYYY-MM-DD)
in_forceNoOnly return currently active acts. Type 'true' for active, 'false' for inactive
keywordsNoList of keywords to search in act content. ALL keywords must be present (AND logic)
limitNoMaximum number of results (default: all matching)
offsetNoSkip first N results for pagination
pub_date_fromNoStart date for publication period (YYYY-MM-DD)
pub_date_toNoEnd date for publication period (YYYY-MM-DD)
titleNoText fragment to search in act titles
yearNoPublication year (e.g., 2020, 2023)

Implementation Reference

  • app.py:214-218 (registration)
    Registers the search_legal_acts tool using FastMCP's @app.tool decorator, specifying name, description, and tags.
    @app.tool( name="search_legal_acts", description="Advanced search for Polish legal acts with multiple filters. Use this for finding specific documents by criteria like date, type, keywords, or title. Note: When using multiple keywords, ALL keywords must be present in the act (AND logic).", tags={"search", "acts", "filtering", "legal-research"} )
  • Defines the input schema and parameters for the search_legal_acts tool using Python's Annotated types with descriptions.
    def get_acts_list( year: Annotated[Union[int, str, None], "Publication year (e.g., 2020, 2023)"] = None, keywords: Annotated[list[str] | None, "List of keywords to search in act content. ALL keywords must be present in the act (AND logic)"] = None, date_from: Annotated[str | None, "Start date for effectiveness period (YYYY-MM-DD)"] = None, date_to: Annotated[str | None, "End date for effectiveness period (YYYY-MM-DD)"] = None, title: Annotated[str | None, "Text fragment to search in act titles"] = None, act_type: Annotated[str | None, "Document type (e.g., 'Rozporządzenie', 'Ustawa')"] = None, pub_date_from: Annotated[str | None, "Start date for publication period (YYYY-MM-DD)"] = None, pub_date_to: Annotated[str | None, "End date for publication period (YYYY-MM-DD)"] = None, in_force: Annotated[Union[bool, str], "Only return currently active acts. Type 'true' for active, 'false' for inactive"] = None, limit: Annotated[Union[int, str, None], "Maximum number of results (default: all matching)"] = None, offset: Annotated[Union[int, str, None], "Skip first N results for pagination"] = None ) -> list:
  • app.py:279-325 (handler)
    Implements the core execution logic of the search_legal_acts tool: builds query parameters from inputs, makes HTTP GET request to Sejm API search endpoint, processes response, and returns list of matching legal acts.
    logger.debug(f"get_acts_list called with filters: year={year}, keywords={keywords}, date_from={date_from}, date_to={date_to}, title={title}, act_type={act_type}, pub_date_from={pub_date_from}, pub_date_to={pub_date_to}, in_force={in_force}, limit={limit}, offset={offset}") try: # Build API request parameters from function arguments params = { "publisher": "DU", # Default to Dziennik Ustaw (primary legal gazette) } if year: params["year"] = int(year) if isinstance(year, str) else year if keywords: params["keyword"] = ",".join(keywords) if date_from: params["dateEffectFrom"] = date_from if date_to: params["dateEffectTo"] = date_to if title: params["title"] = title if act_type: params["type"] = act_type if pub_date_from: params["dateFrom"] = pub_date_from if pub_date_to: params["dateTo"] = pub_date_to if in_force is not None: params["inForce"] = bool(in_force) if limit: params["limit"] = int(limit) if isinstance(limit, str) else limit if offset: params["offset"] = int(offset) if isinstance(offset, str) else offset url = "https://api.sejm.gov.pl/eli/acts/search" # Make API request with constructed parameters response = requests.get(url, params=params, headers={"Accept": "application/json"}) response.raise_for_status() data = response.json().get("items", []) if not data: logger.info("get_acts_list returned no results") return [] logger.info(f"get_acts_list returned {len(data)} acts") return data except Exception as e: logger.error(f"Error: {e}") return []

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/numikel/law-scrapper-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server