get_recent_tenders
Retrieve recently published public tenders from Turkey's EKAP portal, filtered by date range, tender types, and result limits for procurement monitoring.
Instructions
Get recent tenders from last N days. Convenience function for recent tender activity.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | Number of days back to search (1-30) | |
| limit | No | Maximum number of results (1-100) | |
| tender_types | No | Filter by tender types |
Implementation Reference
- ihale_mcp.py:245-294 (handler)The handler function for the 'get_recent_tenders' tool, decorated with @mcp.tool for registration. It fetches recent tenders from EKAP by calculating the date range for the past N days and invoking the underlying search_tenders method, then formats the response with additional metadata.@mcp.tool async def get_recent_tenders( days: Annotated[int, "Number of days back to search (1-30)"] = 7, tender_types: Annotated[List[Literal[1, 2, 3, 4]], "Filter by tender types"] = None, limit: Annotated[int, "Maximum number of results (1-100)"] = 20 ) -> Dict[str, Any]: """ Get recent tenders from last N days. Convenience function for recent tender activity. """ if days > 30: days = 30 elif days < 1: days = 1 # Calculate date range end_date = datetime.now() start_date = end_date - timedelta(days=days) start_date_str = start_date.strftime("%Y-%m-%d") end_date_str = end_date.strftime("%Y-%m-%d") # Use the client to search for recent tenders result = await ekap_client.search_tenders( search_text="", tender_types=tender_types, announcement_date_start=start_date_str, announcement_date_end=end_date_str, order_by="ihaleTarihi", sort_order="desc", limit=limit ) if result.get("error"): return result return { "recent_tenders": result.get("tenders", []), "total_count": result.get("total_count", 0), "date_range": { "start": start_date_str, "end": end_date_str, "days_back": days }, "filters_applied": { "tender_types": tender_types, "limit": limit } }
- ihale_mcp.py:245-245 (registration)The @mcp.tool decorator registers the get_recent_tenders function as an MCP tool.@mcp.tool
- ihale_mcp.py:246-250 (schema)Input schema defined via Annotated type hints in the function signature, providing parameter descriptions and types for the tool.async def get_recent_tenders( days: Annotated[int, "Number of days back to search (1-30)"] = 7, tender_types: Annotated[List[Literal[1, 2, 3, 4]], "Filter by tender types"] = None, limit: Annotated[int, "Maximum number of results (1-100)"] = 20 ) -> Dict[str, Any]: