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

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:

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