Update mcp_server_main.py

This commit is contained in:
saidsurucu
2025-07-15 14:11:24 +03:00
parent 2a24ce03ad
commit 17f9b109a2
+9 -5
View File
@@ -1063,6 +1063,7 @@ KARAR_TURU_ADI_TO_GUID_ENUM_MAP = {
} }
# --- MCP Tools for Yargitay --- # --- MCP Tools for Yargitay ---
"""
@app.tool( @app.tool(
description="Search Yargıtay decisions with 52 chamber filtering and advanced operators", description="Search Yargıtay decisions with 52 chamber filtering and advanced operators",
annotations={ annotations={
@@ -1085,7 +1086,7 @@ async def search_yargitay_detailed(
pageSize: int = Field(10, ge=1, le=10, description="Number of results per page."), pageSize: int = Field(10, ge=1, le=10, description="Number of results per page."),
pageNumber: int = Field(1, ge=1, description="Page number to retrieve.") pageNumber: int = Field(1, ge=1, description="Page number to retrieve.")
) -> CompactYargitaySearchResult: ) -> CompactYargitaySearchResult:
"""Search Yargıtay decisions using primary API with 52 chamber filtering and advanced operators.""" # Search Yargıtay decisions using primary API with 52 chamber filtering and advanced operators.
# Convert "ALL" to empty string for API compatibility # Convert "ALL" to empty string for API compatibility
if birimYrgKurulDaire == "ALL": if birimYrgKurulDaire == "ALL":
@@ -1143,7 +1144,7 @@ async def search_yargitay_detailed(
} }
) )
async def get_yargitay_document_markdown(id: str) -> YargitayDocumentMarkdown: async def get_yargitay_document_markdown(id: str) -> YargitayDocumentMarkdown:
"""Get Yargıtay decision text as Markdown. Use ID from search results.""" # Get Yargıtay decision text as Markdown. Use ID from search results.
logger.info(f"Tool 'get_yargitay_document_markdown' called for ID: {id}") logger.info(f"Tool 'get_yargitay_document_markdown' called for ID: {id}")
if not id or not id.strip(): raise ValueError("Document ID must be a non-empty string.") if not id or not id.strip(): raise ValueError("Document ID must be a non-empty string.")
try: try:
@@ -1151,8 +1152,10 @@ async def get_yargitay_document_markdown(id: str) -> YargitayDocumentMarkdown:
except Exception as e: except Exception as e:
logger.exception(f"Error in tool 'get_yargitay_document_markdown'.") logger.exception(f"Error in tool 'get_yargitay_document_markdown'.")
raise raise
"""
# --- MCP Tools for Danistay --- # --- MCP Tools for Danistay ---
"""
@app.tool( @app.tool(
description="Search Danıştay decisions with keyword logic (AND/OR/NOT operators)", description="Search Danıştay decisions with keyword logic (AND/OR/NOT operators)",
annotations={ annotations={
@@ -1169,7 +1172,7 @@ async def search_danistay_by_keyword(
pageNumber: int = Field(1, ge=1, description="Page number."), pageNumber: int = Field(1, ge=1, description="Page number."),
pageSize: int = Field(10, ge=1, le=10, description="Results per page.") pageSize: int = Field(10, ge=1, le=10, description="Results per page.")
) -> CompactDanistaySearchResult: ) -> CompactDanistaySearchResult:
"""Search Danıştay decisions with keyword logic.""" # Search Danıştay decisions with keyword logic.
search_query = DanistayKeywordSearchRequest( search_query = DanistayKeywordSearchRequest(
andKelimeler=andKelimeler, andKelimeler=andKelimeler,
@@ -1219,7 +1222,7 @@ async def search_danistay_detailed(
pageNumber: int = Field(1, ge=1, description="Page number."), pageNumber: int = Field(1, ge=1, description="Page number."),
pageSize: int = Field(10, ge=1, le=10, description="Results per page.") pageSize: int = Field(10, ge=1, le=10, description="Results per page.")
) -> CompactDanistaySearchResult: ) -> CompactDanistaySearchResult:
"""Search Danıştay decisions with detailed filtering.""" # Search Danıştay decisions with detailed filtering.
search_query = DanistayDetailedSearchRequest( search_query = DanistayDetailedSearchRequest(
daire=daire, daire=daire,
@@ -1263,7 +1266,7 @@ async def search_danistay_detailed(
} }
) )
async def get_danistay_document_markdown(id: str) -> DanistayDocumentMarkdown: async def get_danistay_document_markdown(id: str) -> DanistayDocumentMarkdown:
"""Get Danıştay decision text as Markdown. Use ID from search results.""" # Get Danıştay decision text as Markdown. Use ID from search results.
logger.info(f"Tool 'get_danistay_document_markdown' called for ID: {id}") logger.info(f"Tool 'get_danistay_document_markdown' called for ID: {id}")
if not id or not id.strip(): raise ValueError("Document ID must be a non-empty string for Danıştay.") if not id or not id.strip(): raise ValueError("Document ID must be a non-empty string for Danıştay.")
try: try:
@@ -1271,6 +1274,7 @@ async def get_danistay_document_markdown(id: str) -> DanistayDocumentMarkdown:
except Exception as e: except Exception as e:
logger.exception(f"Error in tool 'get_danistay_document_markdown'.") logger.exception(f"Error in tool 'get_danistay_document_markdown'.")
raise raise
"""
# --- MCP Tools for Emsal --- # --- MCP Tools for Emsal ---
@app.tool( @app.tool(