search_teblig
Search Turkish communiqués by keyword in titles and content on mevzuat.gov.tr. Supports Boolean operators and exact phrase matching for precise results.
Instructions
Search for Turkish communiqués (Tebliğ) in both titles and content on mevzuat.gov.tr.
IMPORTANT: Search is keyword-based, NOT by number. Use descriptive Turkish terms. Communiqués are regulatory documents issued by various government institutions.
Query Syntax: Simple keyword, AND, OR, NOT, +required, (grouping), "exact phrase"
Example queries:
"katma değer vergisi" - Find VAT-related communiqués
"muafiyet OR istisna" - Communiqués about exemptions
"gümrük" - Customs-related communiqués
"ithalat" or "ihracat" - Import/export communiqués
Returns: Communiqué number, title, publication date, Official Gazette info.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| aranacak_ifade | Yes | Search query with optional Boolean operators: simple word (vergi), AND (vergi AND muafiyet), OR (muafiyet OR istisna), NOT (vergi NOT gelir), + for required (+term), grouping with (), exact phrase with quotes ("katma değer vergisi") | |
| tam_cumle | No | Exact phrase match (true) or any word match (false, default). Set to true when searching for exact phrases. | |
| baslangic_tarihi | No | Start year for filtering results (format: YYYY, e.g., '2020') | |
| bitis_tarihi | No | End year for filtering results (format: YYYY, e.g., '2024') | |
| page_number | No | Page number for pagination (starts at 1) | |
| aranacak_yer | No | Where to search: 1=Title only, 2=Content only, 3=Both title and content (default) | |
| page_size | No | Number of results per page (1-100) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| documents | Yes | ||
| total_results | Yes | ||
| current_page | Yes | ||
| page_size | Yes | ||
| total_pages | Yes | ||
| query_used | Yes | ||
| error_message | No |
Implementation Reference
- mevzuat_mcp_server.py:421-456 (registration)Registration of the 'search_teblig' tool as a FastMCP tool using @app.tool() decorator
@app.tool() async def search_teblig( aranacak_ifade: str = Field( ..., description='Search query with optional Boolean operators: simple word (vergi), AND (vergi AND muafiyet), OR (muafiyet OR istisna), NOT (vergi NOT gelir), + for required (+term), grouping with (), exact phrase with quotes ("katma değer vergisi")' ), tam_cumle: bool = Field( False, description="Exact phrase match (true) or any word match (false, default). Set to true when searching for exact phrases." ), baslangic_tarihi: Optional[str] = Field( None, description="Start year for filtering results (format: YYYY, e.g., '2020')" ), bitis_tarihi: Optional[str] = Field( None, description="End year for filtering results (format: YYYY, e.g., '2024')" ), page_number: int = Field( 1, ge=1, description="Page number for pagination (starts at 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)" ) ) -> MevzuatSearchResultNew: - mevzuat_mcp_server.py:422-506 (handler)Handler function 'search_teblig' - searches Turkish communiqués (Tebliğ) on mevzuat.gov.tr. Uses keyword-based search with Boolean operators (AND/OR/NOT), date filtering, and pagination. Creates a MevzuatSearchRequestNew with mevzuat_tur='Tebliğ' and delegates to mevzuat_client.search_documents().
async def search_teblig( aranacak_ifade: str = Field( ..., description='Search query with optional Boolean operators: simple word (vergi), AND (vergi AND muafiyet), OR (muafiyet OR istisna), NOT (vergi NOT gelir), + for required (+term), grouping with (), exact phrase with quotes ("katma değer vergisi")' ), tam_cumle: bool = Field( False, description="Exact phrase match (true) or any word match (false, default). Set to true when searching for exact phrases." ), baslangic_tarihi: Optional[str] = Field( None, description="Start year for filtering results (format: YYYY, e.g., '2020')" ), bitis_tarihi: Optional[str] = Field( None, description="End year for filtering results (format: YYYY, e.g., '2024')" ), page_number: int = Field( 1, ge=1, description="Page number for pagination (starts at 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)" ) ) -> MevzuatSearchResultNew: """ Search for Turkish communiqués (Tebliğ) in both titles and content on mevzuat.gov.tr. IMPORTANT: Search is keyword-based, NOT by number. Use descriptive Turkish terms. Communiqués are regulatory documents issued by various government institutions. Query Syntax: Simple keyword, AND, OR, NOT, +required, (grouping), "exact phrase" Example queries: - "katma değer vergisi" - Find VAT-related communiqués - "muafiyet OR istisna" - Communiqués about exemptions - "gümrük" - Customs-related communiqués - "ithalat" or "ihracat" - Import/export communiqués Returns: Communiqué number, title, publication date, Official Gazette info. """ search_req = MevzuatSearchRequestNew( mevzuat_tur="Tebliğ", aranacak_ifade=aranacak_ifade, 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 ) log_params = search_req.model_dump(exclude_defaults=True) logger.info(f"Tool 'search_teblig' called with parameters: {log_params}") try: result = await mevzuat_client.search_documents(search_req) if not result.documents and not result.error_message: result.error_message = "No communiqués found matching the specified criteria." return result except Exception as e: logger.exception("Error in tool 'search_teblig'") return MevzuatSearchResultNew( documents=[], total_results=0, current_page=page_number, page_size=page_size, total_pages=0, query_used=log_params, error_message=f"An unexpected error occurred: {str(e)}" ) - mevzuat_models.py:32-125 (schema)Input schema - MevzuatSearchRequestNew model defines the search parameters used by search_teblig
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" ) class MevzuatDocumentNew(BaseModel): """Model for a single legislation document from mevzuat.gov.tr""" mevzuat_no: str = Field(..., description="Legislation number") mev_adi: str = Field(..., description="Legislation title/name") kabul_tarih: Optional[str] = Field(None, description="Acceptance date") resmi_gazete_tarihi: Optional[str] = Field(None, description="Official Gazette publication date") resmi_gazete_sayisi: Optional[str] = Field(None, description="Official Gazette issue number") mevzuat_tertip: str = Field(..., description="Legislation series/order") mevzuat_tur: int = Field(..., description="Legislation type code") url: str = Field(..., description="Relative URL to view the legislation") def get_pdf_url(self) -> str: """Generate PDF download URL for this legislation (only works for Kanun).""" return f"https://www.mevzuat.gov.tr/MevzuatMetin/{self.mevzuat_tur}.{self.mevzuat_tertip}.{self.mevzuat_no}.pdf" def get_web_url(self) -> str: """Generate web page URL for this legislation.""" return f"https://www.mevzuat.gov.tr/{self.url}" 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 class MevzuatArticleContent(BaseModel): """Model for the content of legislation (reused from old models).""" madde_id: str mevzuat_id: str markdown_content: str error_message: Optional[str] = None - mevzuat_models.py:107-117 (schema)Output schema - MevzuatSearchResultNew model defines the return type of search_teblig
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 - mevzuat_client.py:449-451 (helper)MevzuatApiClientNew.search_documents() - the underlying API client method called by search_teblig to actually perform the HTTP request to mevzuat.gov.tr
) async def search_documents(self, request: MevzuatSearchRequestNew) -> MevzuatSearchResultNew: