Skip to main content
Glama
saidsurucu

İhale MCP

by saidsurucu

search_authorities

Find Turkish government authorities, ministries, municipalities, and universities for tender filtering by searching with Turkish terms to identify relevant institutions.

Instructions

Search Turkish government authorities/institutions.

Find ministries, municipalities, universities for tender filtering. Search in Turkish for best results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of results to return (1-500)
search_termNoSearch term to find matching authorities/institutions by name

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for search_authorities. Defines input schema via Annotated types, decorated with @mcp.tool for registration, and delegates to EKAPClient helper.
    @mcp.tool
    async def search_authorities(
        search_term: Annotated[str, "Search term to find matching authorities/institutions by name"] = "",
        limit: Annotated[int, "Maximum number of results to return (1-500)"] = 50
    ) -> Dict[str, Any]:
        """
        Search Turkish government authorities/institutions.
        
        Find ministries, municipalities, universities for tender filtering.
        Search in Turkish for best results.
        """
        
        # Use the client to search authorities
        return await ekap_client.search_authorities(
            search_term=search_term,
            limit=limit
        )
  • Core helper method in EKAPClient class that implements the authority search by constructing API parameters and calling the EKAP v2 authority endpoint (/b_idare/api/DetsisKurumBirim/DetsisAgaci).
    async def search_authorities(
        self,
        search_term: str = "",
        limit: int = 50
    ) -> Dict[str, Any]:
        """Search Turkish government authorities/institutions"""
        
        # Validate limit
        if limit > 500:
            limit = 500
        elif limit < 1:
            limit = 1
        
        # Build API request payload for authority search
        authority_params = {
            "loadOptions": {
                "filter": {
                    "sort": [],
                    "group": [],
                    "filter": [],
                    "totalSummary": [],
                    "groupSummary": [],
                    "select": [],
                    "preSelect": [],
                    "primaryKey": []
                }
            }
        }
        
        # Add search filters if provided
        filters = []
        
        if search_term:
            # Search in authority names (correct field name is 'ad')
            filters.append(["ad", "contains", search_term])
        
        if filters:
            authority_params["loadOptions"]["filter"]["filter"] = filters
        
        # Set take limit for API
        authority_params["loadOptions"]["take"] = limit
        
        try:
            # Make API request to authority endpoint
            response_data = await self._make_request(self.authority_endpoint, authority_params)
            
            # Parse and format the response
            authority_items = response_data.get("loadResult", {}).get("data", [])
            
            # Format each authority for better readability
            results = []
            for item in authority_items:
                results.append({
                    "id": item.get("id"),
                    "name": item.get("ad"),
                    "parent_id": item.get("parentIdareKimlikKodu"),
                    "level": item.get("seviye"),
                    "has_children": item.get("hasItems", False),
                    "child_count": 0,  # Not available in response
                    "detsis_no": item.get("detsisNo"),
                    "idare_id": item.get("idareId")
                })
            
            return {
                "authorities": results,
                "total_found": len(results),
                "search_params": {
                    "search_term": search_term,
                    "limit": limit
                }
            }
            
        except httpx.HTTPStatusError as e:
            return {
                "error": f"API request failed with status {e.response.status_code}",
                "message": str(e)
            }
        except Exception as e:
            return {
                "error": "Request failed - authority search",
                "message": str(e)
            }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that searching in Turkish yields 'best results,' which is useful context about language preferences. However, it lacks critical behavioral details such as whether this is a read-only operation, potential rate limits, authentication requirements, or what happens with empty search terms. For a search tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise and front-loaded, consisting of three brief sentences that efficiently convey the tool's purpose, use case, and a key recommendation. Every sentence adds value without redundancy, making it easy for an AI agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, search functionality), the description is reasonably complete. It covers the purpose, context (tender filtering), and a language tip. Since an output schema exists, the description doesn't need to explain return values. However, the lack of annotations means it could benefit from more behavioral details to fully guide usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema already fully documents the two parameters (limit and search_term) with their types, defaults, and descriptions. The description adds no additional parameter semantics beyond what's in the schema, such as examples of search terms or clarification on how the search operates (e.g., partial matches). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: searching for Turkish government authorities/institutions (ministries, municipalities, universities) for tender filtering. It specifies the resource (authorities/institutions) and verb (search), but doesn't explicitly differentiate from sibling tools like 'search_direct_procurement_authorities' or 'search_direct_procurement_parent_authorities' which may have overlapping domains.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides some usage context by mentioning 'for tender filtering' and recommending 'Search in Turkish for best results,' which implies this tool is part of a tender-related workflow. However, it doesn't explicitly state when to use this tool versus alternatives like the sibling 'search_direct_procurement_authorities' or other search tools, leaving room for ambiguity in tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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