Skip to main content
Glama
saidsurucu

İhale MCP

by saidsurucu

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
NameRequiredDescriptionDefault
daysNoNumber of days back to search (1-30)
limitNoMaximum number of results (1-100)
tender_typesNoFilter by tender types

Implementation Reference

  • 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
  • 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]:

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/ihale-mcp'

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