diff --git a/src/phoenix_technologies/smd/server.py b/src/phoenix_technologies/smd/server.py index f1db6c4..fa89fc0 100644 --- a/src/phoenix_technologies/smd/server.py +++ b/src/phoenix_technologies/smd/server.py @@ -24,7 +24,6 @@ logger = logging.getLogger(__name__) # Initialize FastMCP server mcp = FastMCP("SMD Researcher", host="0.0.0.0", port=8000, timeout_keep_alive=720) -@mcp.tool() async def smd_detail_article(article_id: str) -> dict: """ Get the Details of an article found by the tool smd_research based on the article_id. @@ -85,7 +84,7 @@ async def smd_research(search_query: str = "Bundesrat", date_from: str = "2024-0 ], "exact": False, "pagination": { - "pageSize": 10, + "pageSize": 25, "currentPage": 1 }, "onlyResults": False @@ -98,12 +97,30 @@ async def smd_research(search_query: str = "Bundesrat", date_from: str = "2024-0 } response = requests.post(url, headers=headers, json=query) if response.status_code == 200: - return response.json() + result = response.json() + + # Artikel-Liste aus der `data`-Struktur der Antwort + articles = result.get("data", []) + + # Verschachtelte JSON-Resultate von `smd_detail_article` sammeln + detailed_articles = [] + for article in articles: + article_id = article.get("id") + if article_id: + detailed_result = smd_detail_article(article_id) + detailed_articles.append(detailed_result) + + # Gesamtantwort mit kombinierter JSON-Struktur + return { + "search_result": result, + "detailed_articles": detailed_articles + } else: return { "message": response.text } + def run_server(): """Run the MCP server using FastMCP's built-in event loop handling."""