Skip to main content
Glama

get_act_table_of_contents

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

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
numYesAct number/position within the year
publisherYesPublisher code (DU for Dziennik Ustaw, MP for Monitor Polski)
yearYesPublication year

Implementation Reference

  • app.py:586-630 (handler)
    The handler function `get_act_structure` implements the core logic of the 'get_act_table_of_contents' tool. It makes an API request to fetch the hierarchical structure (table of contents) of a Polish legal act from the Sejm API and returns it as a 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: """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)
    The @app.tool decorator registers the `get_act_structure` function as the MCP tool named 'get_act_table_of_contents' with its 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"} )
  • The function signature defines the input schema using Annotated types for publisher (str), year (int), num (Union[int,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