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:
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a read-only operation ('Get all') and hints at batch retrieval ('complete annual collections'), but doesn't specify pagination, rate limits, authentication needs, or error handling. It adds some context about the tool's scope but lacks detailed behavioral traits.

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 two sentences with zero waste: the first states the tool's purpose, and the second adds usage context. It's front-loaded with the core functionality and appropriately sized, earning its place efficiently.

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

Completeness4/5

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

Given the tool's moderate complexity (2 required parameters), 100% schema coverage, and the presence of an output schema, the description is mostly complete. It covers purpose and usage context well, but since there are no annotations, it could benefit from more behavioral details like pagination or error handling to reach a 5.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters (publisher and year). The description adds no additional parameter semantics beyond what's in the schema, such as format examples or constraints. Baseline 3 is appropriate when the schema does all the work.

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 description clearly states the specific action ('Get all legal acts'), resource ('published by a specific publisher in a given year'), and scope ('complete annual collections'), distinguishing it from siblings like get_legal_publishers (list publishers) or search_legal_acts (search across criteria). It uses precise verbs and identifies the exact data being retrieved.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('Useful for browsing complete annual collections'), implying it's for retrieving a publisher's yearly output rather than searching or getting details. However, it doesn't explicitly mention when not to use it or name alternatives like search_legal_acts for filtered queries, which would elevate it to a 5.

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

Install Server

Other Tools

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