Skip to main content
Glama

get_publisher_year_acts

Retrieve all legal acts published by a specific publisher in a given year to browse complete annual collections of Polish legislation.

Instructions

Get all legal acts published by a specific publisher in a given year. Useful for browsing complete annual collections.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
publisherYesPublisher code (DU for Dziennik Ustaw, MP for Monitor Polski)
yearYesPublication year (e.g., 2020, 2023)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • app.py:421-464 (handler)
    The handler function `get_year_acts` that executes the tool logic: logs the call, makes a GET request to the Sejm API endpoint `https://api.sejm.gov.pl/eli/acts/{publisher}/{year}`, parses JSON response, logs success with count, returns data; on error returns empty structure.
    def get_year_acts(
        publisher: Annotated[str, "Publisher code (DU for Dziennik Ustaw, MP for Monitor Polski)"],
        year: Annotated[Union[int, str], "Publication year (e.g., 2020, 2023)"]
    ) -> dict:
        """Fetches a list of all legal acts for a specific publisher and year.
    
        Retrieves the complete collection of legal acts published in a specific year
        by a given publisher. This is useful for annual reviews, statistical analysis,
        and browsing complete yearly publications.
    
        Args:
            publisher: Publisher code (e.g., 'DU' for Dziennik Ustaw, 'MP' for Monitor Polski).
            year: Publication year as integer or string (e.g., 2020, 2023).
    
        Returns:
            dict: Object containing totalCount, items array with act details, and searchQuery info.
                  Returns dict with zero counts and empty items array if year not found or error.
    
        Examples:
            User asks: "Show me all acts from DU in 2020":
                Parameters: publisher = 'DU', year = 2020
                Returns: {'totalCount': 2463, 'items': [{'ELI': 'DU/2020/1', 'title': '...'}], 'count': 2463}
            User asks: "What acts were published in Monitor Polski in 2023?":
                Parameters: publisher = 'MP', year = 2023
            User asks: "List all legal acts from Dziennik Ustaw for 2019":
                Parameters: publisher = 'DU', year = 2019
            User asks: "How many acts were there in DU for 2022?":
                Parameters: publisher = 'DU', year = 2022
            User asks: "Browse acts from MP published in 2024":
                Parameters: publisher = 'MP', year = 2024
        """
        logger.debug(f"get_year_acts called with publisher: {publisher}, year: {year}")
        try:
            url = f"https://api.sejm.gov.pl/eli/acts/{publisher}/{year}"
            response = requests.get(url, headers={"Accept": "application/json"})
            response.raise_for_status()
    
            data = response.json()
            logger.info(f"get_year_acts retrieved {data.get('totalCount', 0)} acts for {publisher}/{year}")
            return data
        except Exception as e:
            logger.error(f"Error: {e}")
            return {"totalCount": 0, "items": [], "count": 0}
  • app.py:416-420 (registration)
    Registers the tool with FastMCP/FastAPI using @app.tool decorator, specifying name, description, and tags.
    @app.tool(
        name="get_publisher_year_acts",
        description="Get all legal acts published by a specific publisher in a given year. Useful for browsing complete annual collections.",
        tags={"search", "acts", "yearly", "browsing"}
    )
  • Input schema defined via Annotated types for publisher (str) and year (Union[int, str]), output dict. Detailed descriptions in docstring.
    def get_year_acts(
        publisher: Annotated[str, "Publisher code (DU for Dziennik Ustaw, MP for Monitor Polski)"],
        year: Annotated[Union[int, str], "Publication year (e.g., 2020, 2023)"]
    ) -> dict:

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