get_publisher_details
Retrieve detailed information about Polish legal publishers including act counts and publication timelines to support legal research and document analysis.
Instructions
Get detailed information about a specific legal publisher including act counts and publication timeline.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| publisher | Yes | Publisher code (DU for Dziennik Ustaw, MP for Monitor Polski) |
Implementation Reference
- app.py:373-415 (handler)The core handler function `get_publisher_info` that implements the tool logic. It takes a publisher code (e.g., 'DU', 'MP'), constructs the Sejm API URL, fetches the JSON data with a GET request, and returns the publisher details including code, name, actsCount, and available years. Includes error handling returning empty dict on failure.def get_publisher_info( publisher: Annotated[str, "Publisher code (DU for Dziennik Ustaw, MP for Monitor Polski)"] ) -> dict: """Fetches detailed information about a specific legal act publisher. Provides comprehensive metadata about a legal publisher including publication statistics, available years, and document counts. This information is useful for understanding the scope and coverage of different legal gazettes. Args: publisher: Publisher code (e.g., 'DU' for Dziennik Ustaw, 'MP' for Monitor Polski). Returns: dict: Detailed information about the publisher containing code, name, shortName, actsCount, and years array. Returns empty dict if publisher not found or error. Examples: User asks: "Tell me about DU publisher": Parameters: publisher = 'DU' Returns: {'code': 'DU', 'name': 'Dziennik Ustaw', 'shortName': 'Dz.U.', 'actsCount': 96086, 'years': [1918, 1919, ...]} User asks: "What is the Dziennik Ustaw?": Parameters: publisher = 'DU' User asks: "Give me details about Monitor Polski": Parameters: publisher = 'MP' User asks: "How many acts are in DU?": Parameters: publisher = 'DU' User asks: "What years are covered by MP?": Parameters: publisher = 'MP' """ logger.debug(f"get_publisher_info called with publisher: {publisher}") try: url = f"https://api.sejm.gov.pl/eli/acts/{publisher}" logger.debug(f"Making GET request to: {url}") response = requests.get(url, headers={"Accept": "application/json"}) response.raise_for_status() data = response.json() logger.info(f"get_publisher_info retrieved details for publisher: {publisher}") return data except Exception as e: logger.error(f"Error: {e}") return {}
- app.py:368-372 (registration)The `@app.tool` decorator registration for the 'get_publisher_details' tool, specifying its name, description, and tags for MCP server integration.@app.tool( name="get_publisher_details", description="Get detailed information about a specific legal publisher including act counts and publication timeline.", tags={"metadata", "publishers", "reference", "sources"} )
- app.py:374-374 (schema)Input schema definition using Annotated type hint for the required 'publisher' parameter (string, e.g., 'DU' or 'MP').publisher: Annotated[str, "Publisher code (DU for Dziennik Ustaw, MP for Monitor Polski)"]