get_legal_types
Retrieve all document types used in the Polish legal system, including laws, regulations, and ordinances, for legal research and analysis.
Instructions
Retrieve all document types (laws, regulations, ordinances, etc.) used in Polish legal system.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- app.py:730-764 (handler)The handler function `get_types_list` that implements the core logic of the `get_legal_types` tool. It fetches the list of legal document types from the Sejm API endpoint `https://api.sejm.gov.pl/eli/types` and returns it as a list of strings, handling errors gracefully.def get_types_list() -> list[str]: """Fetches a list of all possible legal act document types. Retrieves the complete classification of legal document types used in the Polish legal system, including laws, regulations, ordinances, announcements, and other legal instruments. This vocabulary is essential for filtering and categorizing documents. Returns: list[str]: List of document type strings in Polish, representing all possible legal act types. Returns empty list if request fails. Examples: User asks: "What types of legal acts exist?": Returns: ['Ustawa', 'Rozporządzenie', 'Obwieszczenie', 'Zarządzenie', ...] User asks: "Show me all document types available": Returns: ['ustawa', 'rozporządzenie', 'obwieszczenie', 'zarządzenie', ...] User asks: "What kinds of legal documents are there?": Returns: ['akt normatywny', 'akt indywidualny', 'akt prawa miejscowego', ...] User asks: "List all types of Polish legal acts": Returns: ['konstytucja', 'ustawa', 'rozporządzenie', 'uchwała', ...] User asks: "What categories of laws exist in Poland?": Returns: ['akty normatywne', 'akty indywidualne', 'akty prawa wewnętrznego', ...] """ logger.debug("get_types_list called") try: url = "https://api.sejm.gov.pl/eli/types" response = requests.get(url, headers={"Accept": "application/json"}) response.raise_for_status() data = response.json() logger.info(f"get_types_list retrieved {len(data)} types") return data except Exception as e: logger.error(f"Error: {e}") return []
- app.py:725-729 (registration)The registration of the `get_legal_types` tool using the `@app.tool` decorator, specifying the name, description, and tags.@app.tool( name="get_legal_types", description="Retrieve all document types (laws, regulations, ordinances, etc.) used in Polish legal system.", tags={"metadata", "types", "reference", "legal-analysis"} )