get_act_relationships
Analyze legal relationships and references for Polish acts to identify which acts they amend, reference, or are referenced by using publisher, year, and number parameters.
Instructions
Analyze legal relationships and references for an act. Shows which acts it amends, references, or is referenced by.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| num | Yes | Act number/position within the year | |
| publisher | Yes | Publisher code (DU for Dziennik Ustaw, MP for Monitor Polski) | |
| year | Yes | Publication year |
Implementation Reference
- app.py:637-682 (handler)The main handler function that implements the tool logic. It makes an API request to the Sejm API to fetch relationships and references for the specified legal act, organized by reference types.def get_act_references( 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"] ) -> dict: """Fetches references to/from a specific legal act (acts that reference this act or are referenced by this act). Analyzes the legal relationships and dependencies of a specific act, showing which acts it amends, references, or is referenced by. This helps understand the legal context and impact of the document within the broader legal framework. 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: dict: Dictionary organized by reference types (e.g., 'Akty zmienione', 'Akty uchylone') with arrays of referenced acts and their relationship details. Returns empty dict if no references found or error occurs. Examples: User asks: "What acts reference DU/2020/1?": Parameters: publisher = 'DU', year = 2020, num = 1 Returns: {'Akty zmienione': [{'act': {'ELI': 'DU/2016/1498', ...}, 'date': '2020-01-17'}], ...} User asks: "Show me references for act MP/2023/25": Parameters: publisher = 'MP', year = 2023, num = 25 User asks: "What laws does DU/2019/50 reference?": Parameters: publisher = 'DU', year = 2019, num = 50 User asks: "Find acts that amended DU/2022/100": Parameters: publisher = 'DU', year = 2022, num = 100 User asks: "What is the legal basis for act DU/2021/75?": Parameters: publisher = 'DU', year = 2021, num = 75 """ logger.debug(f"get_act_references called with: publisher={publisher}, year={year}, num={num}") try: url = f"https://api.sejm.gov.pl/eli/acts/{publisher}/{year}/{num}/references" response = requests.get(url, headers={"Accept": "application/json"}) response.raise_for_status() data = response.json() logger.info(f"get_act_references retrieved references for act: {publisher}/{year}/{num}") return data except Exception as e: logger.error(f"Error: {e}") return {}
- app.py:632-636 (registration)The @app.tool decorator that registers the 'get_act_relationships' tool with the FastMCP server, including its description and tags.@app.tool( name="get_act_relationships", description="Analyze legal relationships and references for an act. Shows which acts it amends, references, or is referenced by.", tags={"analysis", "references", "relationships", "legal-network"} )
- app.py:638-640 (schema)The function parameters with Annotated types that define the input schema for the tool.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"]