Skip to main content
Glama

search_bddk_decisions

Search for BDDK banking regulation decisions in Turkish using specified keywords. Access detailed results page by page to navigate regulatory information efficiently.

Instructions

Search BDDK banking regulation decisions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordsYesSearch keywords in Turkish
pageNoPage number

Implementation Reference

  • Main handler function for the MCP tool 'search_bddk_decisions'. It creates a BddkSearchRequest from input parameters, calls the BddkApiClient.search_decisions method, and formats the response as a dictionary.
    async def search_bddk_decisions( keywords: str = Field(..., description="Search keywords in Turkish"), page: int = Field(1, ge=1, description="Page number") # pageSize: int = Field(10, ge=1, le=50, description="Results per page") ) -> dict: """Search BDDK banking regulation and supervision decisions.""" logger.info(f"BDDK search tool called with keywords: {keywords}, page: {page}") pageSize = 10 # Default value try: search_request = BddkSearchRequest( keywords=keywords, page=page, pageSize=pageSize ) result = await bddk_client_instance.search_decisions(search_request) logger.info(f"BDDK search completed. Found {len(result.decisions)} decisions on page {page}") return { "decisions": [ { "title": dec.title, "document_id": dec.document_id, "content": dec.content } for dec in result.decisions ], "total_results": result.total_results, "page": result.page, "pageSize": result.pageSize } except Exception as e: logger.exception(f"Error searching BDDK decisions: {e}") return { "decisions": [], "total_results": 0, "page": page, "pageSize": pageSize, "error": str(e) }
  • Pydantic model defining the input schema for the BDDK search tool, including keywords, page, and pageSize parameters.
    class BddkSearchRequest(BaseModel): """ Request model for searching BDDK decisions via Tavily API. BDDK (Bankacılık Düzenleme ve Denetleme Kurumu) is Turkey's Banking Regulation and Supervision Agency responsible for banking licenses, electronic money institutions, and financial regulations. """ keywords: str = Field(..., description="Search keywords in Turkish") page: int = Field(1, ge=1, description="Page number (1-indexed)") pageSize: int = Field(10, ge=1, le=50, description="Results per page (1-50)")
  • Core helper method in BddkApiClient that performs the actual search using Tavily API, extracts BDDK document IDs from search results, and returns structured BddkSearchResult.
    async def search_decisions( self, request: BddkSearchRequest ) -> BddkSearchResult: """ Search for BDDK decisions using Tavily API. Args: request: Search request parameters Returns: BddkSearchResult with matching decisions """ try: headers = { "Content-Type": "application/json", "Authorization": f"Bearer {self.tavily_api_key}" } # Tavily API request - enhanced for BDDK decision documents query = f"{request.keywords} \"Karar Sayısı\"" payload = { "query": query, "country": "turkey", "include_domains": ["https://www.bddk.org.tr/Mevzuat/DokumanGetir"], "max_results": request.pageSize, "search_depth": "advanced" } # Calculate offset for pagination if request.page > 1: # Tavily doesn't have direct pagination, so we'll need to handle this # For now, we'll just return empty for pages > 1 logger.warning(f"Tavily API doesn't support pagination. Page {request.page} requested.") response = await self.http_client.post( self.TAVILY_API_URL, json=payload, headers=headers ) response.raise_for_status() data = response.json() # Log raw Tavily response for debugging logger.info(f"Tavily returned {len(data.get('results', []))} results") # Convert Tavily results to our format decisions = [] for result in data.get("results", []): # Extract document ID from URL url = result.get("url", "") logger.debug(f"Processing URL: {url}") doc_id = self._extract_document_id(url) if doc_id: decision = BddkDecisionSummary( title=result.get("title", "").replace("[PDF] ", "").strip(), document_id=doc_id, content=result.get("content", "")[:500] # Limit content length ) decisions.append(decision) logger.debug(f"Added decision: {decision.title} (ID: {doc_id})") else: logger.warning(f"Could not extract document ID from URL: {url}") return BddkSearchResult( decisions=decisions, total_results=len(data.get("results", [])), page=request.page, pageSize=request.pageSize ) except httpx.HTTPStatusError as e: logger.error(f"HTTP error searching BDDK decisions: {e}") if e.response.status_code == 401: raise Exception("Tavily API authentication failed. Check API key.") raise Exception(f"Failed to search BDDK decisions: {str(e)}") except Exception as e: logger.error(f"Error searching BDDK decisions: {e}") raise Exception(f"Failed to search BDDK decisions: {str(e)}")
  • Pydantic model for the output schema of BDDK search results, containing list of decisions, pagination info.
    class BddkSearchResult(BaseModel): """Response model for BDDK decision search results.""" decisions: List[BddkDecisionSummary] = Field( default_factory=list, description="List of matching BDDK decisions" ) total_results: int = Field(0, description="Total number of results") page: int = Field(1, description="Current page number") pageSize: int = Field(10, description="Results per page")
  • Registration of the MCP tool using FastMCP @app.tool decorator with description and annotations.
    @app.tool( description="Search BDDK banking regulation decisions", annotations={ "readOnlyHint": True, "openWorldHint": True, "idempotentHint": True } )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/saidsurucu/yargi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server