Skip to main content
Glama

get_act_table_of_contents

Extract the hierarchical table of contents for Polish legal acts, showing chapters, articles, and sections to understand document structure.

Instructions

Get the hierarchical structure and table of contents of a legal act. Shows chapters, articles, sections, and their organization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
publisherYesPublisher code (DU for Dziennik Ustaw, MP for Monitor Polski)
yearYesPublication year
numYesAct number/position within the year

Implementation Reference

  • app.py:581-630 (handler)
    The @app.tool decorator registers the 'get_act_table_of_contents' tool, and the immediately following 'get_act_structure' function serves as the handler. It fetches the hierarchical structure (table of contents) of a legal act from the Sejm API using the provided publisher, year, and number parameters.
    @app.tool( name="get_act_table_of_contents", description="Get the hierarchical structure and table of contents of a legal act. Shows chapters, articles, sections, and their organization.", tags={"analysis", "structure", "navigation", "toc"} ) def get_act_structure( 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"] ) -> list: """Fetches the structure/table of contents of a specific legal act. Retrieves the hierarchical organization of a legal act, including parts, chapters, articles, sections, and other structural elements. This helps understand the document's organization and navigate to specific sections. 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. Returns: list: List of structure elements with hierarchical organization, each containing id, title, type, and children arrays. Returns empty list if structure not found. Examples: User asks: "Show me the structure of DU/2020/1": Parameters: publisher = 'DU', year = 2020, num = 1 Returns: [{'id': 'part_1', 'title': 'Treść rozporządzenia', 'type': 'part', 'children': [...]}] User asks: "What is the table of contents for act MP/2023/50?": Parameters: publisher = 'MP', year = 2023, num = 50 User asks: "Display the structure of DU/2019/100": Parameters: publisher = 'DU', year = 2019, num = 100 User asks: "How is act DU/2022/75 organized?": Parameters: publisher = 'DU', year = 2022, num = 75 User asks: "Give me the outline of legal act DU/2021/30": Parameters: publisher = 'DU', year = 2021, num = 30 """ logger.debug(f"get_act_structure called with: publisher={publisher}, year={year}, num={num}") try: url = f"https://api.sejm.gov.pl/eli/acts/{publisher}/{year}/{num}/struct" response = requests.get(url, headers={"Accept": "application/json"}) response.raise_for_status() data = response.json() logger.info(f"get_act_structure retrieved structure for act: {publisher}/{year}/{num}") return data except Exception as e: logger.error(f"Error: {e}") return []
  • app.py:581-585 (registration)
    Tool registration via FastMCP @app.tool decorator, specifying the tool name, description, and tags.
    @app.tool( name="get_act_table_of_contents", description="Get the hierarchical structure and table of contents of a legal act. Shows chapters, articles, sections, and their organization.", tags={"analysis", "structure", "navigation", "toc"} )
  • Input schema defined by function parameters with Annotated types for publisher (str), year (int), num (int or str), and output as list.
    def get_act_structure( 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"] ) -> list:

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