Skip to main content
Glama

get_act_content

Retrieve full text content of Polish legal acts from Dziennik Ustaw or Monitor Polski in PDF or HTML format for comprehensive legal document analysis.

Instructions

Retrieve the actual text content of a legal act in PDF or HTML format. Use for reading the full document content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
publisherYesPublisher code (DU for Dziennik Ustaw, MP for Monitor Polski)
yearYesPublication year
numYesAct number/position within the year
format_typeNoContent format: 'pdf' or 'html' (default: pdf)pdf

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • app.py:521-580 (handler)
    The complete handler for the 'get_act_content' tool, including registration decorator, type-annotated parameters (schema), docstring description, and execution logic that retrieves PDF URL or HTML text from the Sejm API.
    @app.tool(
        name="get_act_content",
        description="Retrieve the actual text content of a legal act in PDF or HTML format. Use for reading the full document content.",
        tags={"analysis", "content", "text", "reading"}
    )
    def get_act_text(
        publisher: Annotated[str, "Publisher code (DU for Dziennik Ustaw, MP for Monitor Polski)"],
        year: Annotated[int, "Publication year"],
        num: Annotated[Union[int, str], "Act number/position within the year"],
        format_type: Annotated[str, "Content format: 'pdf' or 'html' (default: pdf)"] = "pdf"
    ) -> str:
        """Fetches the text content of a specific legal act in PDF or HTML format.
    
        Retrieves the actual textual content of a legal act for reading and analysis.
        For PDF format, returns a download URL. For HTML format, returns the full
        HTML content of the document.
    
        Args:
            publisher: Publication code (e.g., 'DU' for Dziennik Ustaw, 'MP' for Monitor Polski).
            year: Year of publication as integer.
            num: Act number/position within the year as integer or string.
            format_type: Content format - 'pdf' or 'html'. Defaults to 'pdf'.
    
        Returns:
            str: For PDF format, returns download URL string. For HTML format, returns
                 the full HTML content. Returns empty string if content not found or error.
    
        Examples:
            User asks: "Get the PDF text of DU/2020/1280":
                Parameters: publisher = 'DU', year = 2020, num = 1280, format_type = 'pdf'
                Returns: "PDF content available at: https://api.sejm.gov.pl/eli/acts/DU/2020/1280/text.pdf"
            User asks: "Get the HTML text of DU/2020/1":
                Parameters: publisher = 'DU', year = 2020, num = 1, format_type = 'html'
            User asks: "Download PDF of act MP/2023/100":
                Parameters: publisher = 'MP', year = 2023, num = 100, format_type = 'pdf'
            User asks: "Show me the HTML content of DU/2019/50":
                Parameters: publisher = 'DU', year = 2019, num = 50, format_type = 'html'
            User asks: "I need the text of act DU/2022/200 in PDF":
                Parameters: publisher = 'DU', year = 2022, num = 200, format_type = 'pdf'
        """
        logger.debug(f"get_act_text called with: publisher={publisher}, year={year}, num={num}, format_type={format_type}")
        try:
            url = f"https://api.sejm.gov.pl/eli/acts/{publisher}/{year}/{num}/text.{format_type}"
            logger.debug(f"Making GET request to: {url}")
            response = requests.get(url)
            response.raise_for_status()
    
            if format_type == "pdf":
                # For PDF, return download URL since binary content can't be displayed directly
                result = f"PDF content available at: {url}"
                logger.info(f"get_act_text retrieved PDF for act: {publisher}/{year}/{num}")
                return result
            else:
                # For HTML, return the actual content
                logger.info(f"get_act_text retrieved HTML content for act: {publisher}/{year}/{num}")
                return response.text
        except Exception as e:
            logger.error(f"Error: {e}")
            return ""
  • app.py:521-525 (registration)
    The @app.tool decorator registers the get_act_text function as the 'get_act_content' MCP tool with description and tags.
    @app.tool(
        name="get_act_content",
        description="Retrieve the actual text content of a legal act in PDF or HTML format. Use for reading the full document content.",
        tags={"analysis", "content", "text", "reading"}
    )
  • Input schema defined via type hints and Annotated metadata for publisher (str), year (int), num (Union[int,str]), format_type (str, default 'pdf'), output str.
    def get_act_text(
        publisher: Annotated[str, "Publisher code (DU for Dziennik Ustaw, MP for Monitor Polski)"],
        year: Annotated[int, "Publication year"],
        num: Annotated[Union[int, str], "Act number/position within the year"],
        format_type: Annotated[str, "Content format: 'pdf' or 'html' (default: pdf)"] = "pdf"
    ) -> str:
Behavior2/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 mentions the tool retrieves content in specific formats but doesn't cover critical aspects like authentication requirements, rate limits, error handling, or whether it's a read-only operation (though implied by 'retrieve'). For a tool with no annotation coverage, this leaves significant gaps in understanding its 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 extremely concise (two short sentences) and front-loaded with the core purpose. Every word earns its place—no redundancy or fluff. It efficiently communicates the tool's function and primary use case without unnecessary elaboration.

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

Completeness3/5

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

Given the tool has an output schema (which likely describes the returned content), the description doesn't need to explain return values. However, for a tool with no annotations and 4 parameters, it should provide more behavioral context (e.g., read-only nature, error cases). The description is minimally adequate but leaves gaps in understanding operational constraints.

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 fully documents all parameters (publisher, year, num, format_type). The description adds no additional parameter semantics beyond what's in the schema, such as explaining format implications or parameter interactions. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('retrieve') and resource ('actual text content of a legal act'), specifying the output formats (PDF or HTML). It distinguishes from siblings like get_act_table_of_contents by focusing on full document content rather than metadata or structure, though it doesn't explicitly name alternatives.

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

Usage Guidelines3/5

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

The description provides implied usage context ('use for reading the full document content'), suggesting this tool is for accessing complete text rather than summaries or metadata. However, it lacks explicit guidance on when to choose this over siblings like get_act_comprehensive_details or get_act_relationships, and doesn't mention prerequisites or exclusions.

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