get_legal_keywords
Retrieve available keywords for categorizing Polish legal acts to understand document topics and enable precise legal searches.
Instructions
Retrieve all available keywords for categorizing Polish legal acts. Essential for understanding document topics and enabling precise searches.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- app.py:171-208 (handler)The handler function get_keywords_list() that implements the core logic of fetching keywords from the Sejm API. It makes a GET request to https://api.sejm.gov.pl/eli/keywords, parses the JSON response, and returns the list of keywords or an empty list on error.def get_keywords_list() -> list[str]: """Retrieves a list of all available keywords for law acts from the Sejm API. Keywords are used to categorize and filter legal acts by topic, subject matter, and legal domain. This function provides the complete vocabulary for advanced legal document searches and classification. Returns: list[str]: List of keywords used to categorize law acts, or empty list if request fails. Examples: User asks: "What keywords are available for searching law acts?": Returns: ['sąd', 'podatek', 'prawo', ...] User asks: "Show me all possible keywords for legal documents": Returns: ['administracja', 'zdrowie', 'edukacja', ...] User asks: "What topics can I search for in law acts?": Returns: ['gospodarka', 'środowisko', 'transport', ...] User asks: "Give me the complete list of keywords": Returns: ['prawo pracy', 'podatki', 'ochrony zdrowia', ...] User asks: "What categories exist for Polish legal acts?": Returns: ['sądownictwo', 'administracja publiczna', 'prawo karne', ...] User asks: "I need keywords for environmental law acts": Returns: ['środowisko', 'ochrona przyrody', 'gospodarka odpadami', ...] User asks: "Show me keywords related to education": Returns: ['szkolnictwo', 'edukacja', 'nauka', 'uczelnie', ...] """ logger.debug("get_keywords_list called") try: url = "https://api.sejm.gov.pl/eli/keywords" logger.debug(f"Making GET request to: {url}") response = requests.get(url, headers={"Accept": "application/json"}) response.raise_for_status() # Raise exception for bad status codes data = response.json() logger.info(f"get_keywords_list retrieved {len(data)} keywords") return data except Exception as e: logger.error(f"Error: {e}") return []
- app.py:166-170 (registration)The @app.tool decorator that registers the get_keywords_list function as the MCP tool named 'get_legal_keywords' with description and tags.@app.tool( name="get_legal_keywords", description="Retrieve all available keywords for categorizing Polish legal acts. Essential for understanding document topics and enabling precise searches.", tags={"metadata", "keywords", "reference", "search-filters"} )