Skip to main content
Glama
saidsurucu

Mevzuat MCP

by saidsurucu

search_khk

Search Turkish Decree Laws (KHKs) by keyword with Boolean operators, wildcards, and date filters. Retrieve KHK number, title, and official gazette information.

Instructions

Search for Turkish Decree Laws (Kanun Hükmünde Kararname / KHK) in titles and content.

IMPORTANT: Search is keyword-based, NOT by KHK number. Use descriptive Turkish terms. KHKs were abolished after the 2017 constitutional referendum (last issued 2018). Previously enacted KHKs remain in force unless repealed.

Query Syntax: Simple keyword, AND, OR, NOT, +required, (grouping), "exact phrase"

Example queries:

  • "sağlık AND düzenleme" - Health-related KHKs

  • "anayasa" - Constitutional KHKs

  • Leave empty with dates (e.g., 2010-2018) to list all KHKs from a period

Returns: KHK number, title, dates, Official Gazette info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aranacak_ifadeNoSearch query with Boolean operators and wildcards. Examples: "değişiklik" (simple), "sağlık AND düzenleme" (AND), "bakanlık OR kurum" (OR), "kanun NOT yürürlük" (NOT), "değişiklik*" (wildcard), "güvenlik sistemi" (exact phrase with quotes). Leave empty to list all KHKs in date range.
tam_cumleNoIf True, searches for exact phrase match. If False (default), searches for any word match with Boolean operators.
baslangic_tarihiNoStart year for filtering results (format: YYYY, e.g., '2010'). Use with bitis_tarihi to define a date range.
bitis_tarihiNoEnd year for filtering results (format: YYYY, e.g., '2018'). Use with baslangic_tarihi to define a date range.
page_numberNoPage number of results to retrieve (starts from 1)
aranacak_yerNoWhere to search: 1=Title only, 2=Content only, 3=Both title and content (default)
page_sizeNoNumber of results per page (1-100, default: 25)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentsYes
total_resultsYes
current_pageYes
page_sizeYes
total_pagesYes
query_usedYes
error_messageNo

Implementation Reference

  • The main handler function for the 'search_khk' tool. It searches for Turkish Decree Laws (Kanun Hükmünde Kararname / KHK) by constructing a MevzuatSearchRequestNew with mevzuat_tur='KHK' and delegating to mevzuat_client.search_documents(). Registered via @app.tool() decorator.
    @app.tool()
    async def search_khk(
        aranacak_ifade: Optional[str] = Field(
            None,
            description='Search query with Boolean operators and wildcards. Examples: "değişiklik" (simple), "sağlık AND düzenleme" (AND), "bakanlık OR kurum" (OR), "kanun NOT yürürlük" (NOT), "değişiklik*" (wildcard), "güvenlik sistemi" (exact phrase with quotes). Leave empty to list all KHKs in date range.'
        ),
        tam_cumle: bool = Field(
            False,
            description="If True, searches for exact phrase match. If False (default), searches for any word match with Boolean operators."
        ),
        baslangic_tarihi: Optional[str] = Field(
            None,
            description="Start year for filtering results (format: YYYY, e.g., '2010'). Use with bitis_tarihi to define a date range."
        ),
        bitis_tarihi: Optional[str] = Field(
            None,
            description="End year for filtering results (format: YYYY, e.g., '2018'). Use with baslangic_tarihi to define a date range."
        ),
        page_number: int = Field(
            1,
            ge=1,
            description="Page number of results to retrieve (starts from 1)"
        ),
        aranacak_yer: int = Field(
            3,
            ge=1,
            le=3,
            description="Where to search: 1=Title only, 2=Content only, 3=Both title and content (default)"
        ),
        page_size: int = Field(
            25,
            ge=1,
            le=100,
            description="Number of results per page (1-100, default: 25)"
        )
    ) -> MevzuatSearchResultNew:
        """
        Search for Turkish Decree Laws (Kanun Hükmünde Kararname / KHK) in titles and content.
    
        IMPORTANT: Search is keyword-based, NOT by KHK number. Use descriptive Turkish terms.
        KHKs were abolished after the 2017 constitutional referendum (last issued 2018).
        Previously enacted KHKs remain in force unless repealed.
    
        Query Syntax: Simple keyword, AND, OR, NOT, +required, (grouping), "exact phrase"
    
        Example queries:
        - "sağlık AND düzenleme" - Health-related KHKs
        - "anayasa" - Constitutional KHKs
        - Leave empty with dates (e.g., 2010-2018) to list all KHKs from a period
    
        Returns: KHK number, title, dates, Official Gazette info.
        """
        logger.info(f"Tool 'search_khk' called: '{aranacak_ifade}', dates: {baslangic_tarihi}-{bitis_tarihi}")
    
        try:
            search_req = MevzuatSearchRequestNew(
                mevzuat_tur="KHK",
                aranacak_ifade=aranacak_ifade or "",
                aranacak_yer=aranacak_yer,
                tam_cumle=tam_cumle,
                mevzuat_no=None,
                baslangic_tarihi=baslangic_tarihi,
                bitis_tarihi=bitis_tarihi,
                page_number=page_number,
                page_size=page_size
            )
    
            result = await mevzuat_client.search_documents(search_req)
            logger.info(f"Found {result.total_results} KHKs")
            return result
    
        except Exception as e:
            logger.exception("Error in tool 'search_khk'")
            return MevzuatSearchResultNew(
                documents=[],
                total_results=0,
                current_page=page_number,
                page_size=page_size,
                total_pages=0,
                query_used={"error": str(e)},
                error_message=f"An unexpected error occurred: {str(e)}"
            )
  • Registration of the 'search_khk' tool via the FastMCP @app.tool() decorator on the async function below.
    @app.tool()
  • Input schema used by search_khk. MevzuatSearchRequestNew defines the request parameters including mevzuat_tur (set to 'KHK'), aranacak_ifade, tam_cumle, date filters, pagination, and search location.
    class MevzuatSearchRequestNew(BaseModel):
        """Request model for searching legislation on mevzuat.gov.tr"""
    
        mevzuat_tur: MevzuatTurLiteral = Field(
            "Kanun",
            description="Type of legislation. Currently only 'Kanun' (laws) are fully supported for content extraction."
        )
    
        aranacak_ifade: Optional[str] = Field(
            None,
            description="Search term or phrase to look for in legislation"
        )
    
        aranacak_yer: int = Field(
            3,
            ge=1,
            le=3,
            description="Where to search: 1=Title only, 2=Article titles, 3=Full text (default)"
        )
    
        tam_cumle: bool = Field(
            False,
            description="Exact phrase match (true) or any word match (false, default)"
        )
    
        mevzuat_no: Optional[str] = Field(
            None,
            description="Specific legislation number to search for"
        )
    
        baslangic_tarihi: Optional[str] = Field(
            None,
            description="Start date for filtering (format: DD.MM.YYYY)"
        )
    
        bitis_tarihi: Optional[str] = Field(
            None,
            description="End date for filtering (format: DD.MM.YYYY)"
        )
    
        page_number: int = Field(
            1,
            ge=1,
            description="Page number of results"
        )
    
        page_size: int = Field(
            10,
            ge=1,
            le=100,
            description="Number of results per page"
        )
  • Output schema returned by search_khk. Contains the list of matching documents, pagination info, and optional error message.
    class MevzuatSearchResultNew(BaseModel):
        """Model for search results from mevzuat.gov.tr"""
    
        documents: List[MevzuatDocumentNew]
        total_results: int
        current_page: int
        page_size: int
        total_pages: int
        query_used: Dict[str, Any]
        error_message: Optional[str] = None
Behavior4/5

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

With no annotations, the description discloses important behavioral traits: KHKs were abolished after 2017 but remain in force, and returns include KHK number, title, dates, and Official Gazette info. It does not cover pagination or error handling, but the core behavior is transparent.

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 well-structured with a brief intro, important notes, query syntax, examples, and return info. Every sentence serves a purpose; no fluff.

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 lack of output schema, the description mentions return fields. Parameter descriptions in schema cover pagination. The description could elaborate more on pagination behavior, but it is adequate for a search tool.

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

Parameters5/5

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

All 7 parameters have descriptions in the schema (100% coverage). The description adds value by providing query syntax examples, explaining the tam_cumle and aranacak_yer parameters, and showing how to use date range parameters with examples.

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

Purpose5/5

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

The description clearly states it searches Turkish Decree Laws (KHK) in titles and content, distinguishing it from sibling tools for other legal documents. It specifies keyword-based search and provides context on KHK abolition.

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

Usage Guidelines4/5

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

The description explicitly says 'Search is keyword-based, NOT by KHK number' and advises using descriptive Turkish terms. It includes example queries and mentions leaving the query empty to list all KHKs, but does not explicitly state when to avoid this tool.

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

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