Skip to main content
Glama

search_uyusmazlik_decisions

Search jurisdictional dispute court decisions to resolve conflicts between civil and administrative courts using keywords, case details, or decision parameters.

Instructions

Use this when searching jurisdictional dispute court (Uyuşmazlık Mahkemesi) decisions. Resolves conflicts between civil and administrative courts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
icerikNoKeyword or content for main text search.
bolumNoSelect the department (Bölüm). Use 'ALL' for all departments.ALL
uyusmazlik_turuNoSelect the type of dispute. Use 'ALL' for all types.ALL
karar_sonuclariNoList of desired 'Karar Sonucu' types.
esas_yilNoCase year ('Esas Yılı').
esas_sayisiNoCase number ('Esas Sayısı').
karar_yilNoDecision year ('Karar Yılı').
karar_sayisiNoDecision number ('Karar Sayısı').
kanun_noNoRelevant Law Number.
karar_date_beginNoDecision start date (DD.MM.YYYY).
karar_date_endNoDecision end date (DD.MM.YYYY).
resmi_gazete_sayiNoOfficial Gazette number.
resmi_gazete_dateNoOfficial Gazette date (DD.MM.YYYY).
tumceNoExact phrase search.
wild_cardNoSearch for phrase and its inflections.
hepsiNoSearch for texts containing all specified words.
herhangi_birisiNoSearch for texts containing any of the specified words.
not_hepsiNoExclude texts containing these specified words.

Implementation Reference

  • The main handler function that executes the tool logic: maps user-friendly enums to API IDs, constructs form data, performs POST request to Uyusmazlik Mahkemesi search endpoint, parses HTML response with BeautifulSoup, and returns structured decision entries.
    async def search_decisions( self, params: UyusmazlikSearchRequest ) -> UyusmazlikSearchResponse: bolum_id_for_api = BOLUM_ENUM_TO_ID_MAP.get(params.bolum, "") uyusmazlik_id_for_api = UYUSMAZLIK_TURU_ENUM_TO_ID_MAP.get(params.uyusmazlik_turu, "") form_data_list: List[Tuple[str, str]] = [] def add_to_form_data(key: str, value: Optional[str]): # API expects empty strings for omitted optional fields based on user payload example form_data_list.append((key, value or "")) add_to_form_data("BolumId", bolum_id_for_api) add_to_form_data("UyusmazlikId", uyusmazlik_id_for_api) if params.karar_sonuclari: for enum_member in params.karar_sonuclari: api_id = KARAR_SONUCU_ENUM_TO_ID_MAP.get(enum_member) if api_id: # Only add if a valid ID is found form_data_list.append(('KararSonucuList', api_id)) add_to_form_data("EsasYil", params.esas_yil) add_to_form_data("EsasSayisi", params.esas_sayisi) add_to_form_data("KararYil", params.karar_yil) add_to_form_data("KararSayisi", params.karar_sayisi) add_to_form_data("KanunNo", params.kanun_no) add_to_form_data("KararDateBegin", params.karar_date_begin) add_to_form_data("KararDateEnd", params.karar_date_end) add_to_form_data("ResmiGazeteSayi", params.resmi_gazete_sayi) add_to_form_data("ResmiGazeteDate", params.resmi_gazete_date) add_to_form_data("Icerik", params.icerik) add_to_form_data("Tumce", params.tumce) add_to_form_data("WildCard", params.wild_card) add_to_form_data("Hepsi", params.hepsi) add_to_form_data("Herhangibirisi", params.herhangi_birisi) add_to_form_data("NotHepsi", params.not_hepsi) # Convert form data to dict for httpx form_data_dict = {} for key, value in form_data_list: if key in form_data_dict: # Handle multiple values (like KararSonucuList) if not isinstance(form_data_dict[key], list): form_data_dict[key] = [form_data_dict[key]] form_data_dict[key].append(value) else: form_data_dict[key] = value logger.info(f"UyusmazlikApiClient (httpx): Performing search to {self.SEARCH_ENDPOINT} with form_data: {form_data_dict}") try: # Use shared httpx client response = await self.http_client.post( self.SEARCH_ENDPOINT, data=form_data_dict, headers={"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"} ) response.raise_for_status() html_content = response.text logger.debug("UyusmazlikApiClient (httpx): Received HTML response for search.") except httpx.HTTPError as e: logger.error(f"UyusmazlikApiClient (httpx): HTTP client error during search: {e}") raise # Re-raise to be handled by the MCP tool except Exception as e: logger.error(f"UyusmazlikApiClient (httpx): Error processing search request: {e}") raise # --- HTML Parsing (remains the same as previous version) --- soup = BeautifulSoup(html_content, 'html.parser') total_records_text_div = soup.find("div", class_="pull-right label label-important") total_records = None if total_records_text_div: match_records = re.search(r'(\d+)\s*adet kayıt bulundu', total_records_text_div.get_text(strip=True)) if match_records: total_records = int(match_records.group(1)) result_table = soup.find("table", class_="table-hover") processed_decisions: List[UyusmazlikApiDecisionEntry] = [] if result_table: rows = result_table.find_all("tr") if len(rows) > 1: # Skip header row for row in rows[1:]: cols = row.find_all('td') if len(cols) >= 5: try: popover_div = cols[0].find("div", attrs={"data-rel": "popover"}) popover_content_raw = popover_div["data-content"] if popover_div and popover_div.has_attr("data-content") else None link_tag = cols[0].find('a') doc_relative_url = link_tag['href'] if link_tag and link_tag.has_attr('href') else None if not doc_relative_url: continue document_url_str = urljoin(self.BASE_URL, doc_relative_url) pdf_link_tag = cols[5].find('a', href=re.compile(r'\.pdf$', re.IGNORECASE)) if len(cols) > 5 else None pdf_url_str = urljoin(self.BASE_URL, pdf_link_tag['href']) if pdf_link_tag and pdf_link_tag.has_attr('href') else None decision_data_parsed = { "karar_sayisi": cols[0].get_text(strip=True), "esas_sayisi": cols[1].get_text(strip=True), "bolum": cols[2].get_text(strip=True), "uyusmazlik_konusu": cols[3].get_text(strip=True), "karar_sonucu": cols[4].get_text(strip=True), "popover_content": html.unescape(popover_content_raw) if popover_content_raw else None, "document_url": document_url_str, "pdf_url": pdf_url_str } decision_model = UyusmazlikApiDecisionEntry(**decision_data_parsed) processed_decisions.append(decision_model) except Exception as e: logger.warning(f"UyusmazlikApiClient: Could not parse decision row. Row content: {row.get_text(strip=True, separator=' | ')}, Error: {e}") return UyusmazlikSearchResponse( decisions=processed_decisions, total_records_found=total_records )
  • Pydantic input schema for the MCP tool, defining user-friendly fields and enums for searching Uyusmazlik decisions.
    class UyusmazlikSearchRequest(BaseModel): # This is the model the MCP tool will accept """Model for Uyuşmazlık Mahkemesi search request using user-friendly terms.""" icerik: Optional[str] = Field("", description="Search text") bolum: Optional[UyusmazlikBolumEnum] = Field( UyusmazlikBolumEnum.TUMU, description="Department" ) uyusmazlik_turu: Optional[UyusmazlikTuruEnum] = Field( UyusmazlikTuruEnum.TUMU, description="Dispute type" ) # User provides a list of user-friendly names for Karar Sonucu karar_sonuclari: Optional[List[UyusmazlikKararSonucuEnum]] = Field( # Changed to list of Enums default_factory=list, description="Decision types" ) esas_yil: Optional[str] = Field("", description="Case year") esas_sayisi: Optional[str] = Field("", description="Case no") karar_yil: Optional[str] = Field("", description="Decision year") karar_sayisi: Optional[str] = Field("", description="Decision no") kanun_no: Optional[str] = Field("", description="Law no") karar_date_begin: Optional[str] = Field("", description="Start date (DD.MM.YYYY)") karar_date_end: Optional[str] = Field("", description="End date (DD.MM.YYYY)") resmi_gazete_sayi: Optional[str] = Field("", description="Gazette no") resmi_gazete_date: Optional[str] = Field("", description="Gazette date (DD.MM.YYYY)") # Detailed text search fields from the "icerikDetail" section of the form tumce: Optional[str] = Field("", description="Exact phrase") wild_card: Optional[str] = Field("", description="Wildcard search") hepsi: Optional[str] = Field("", description="All words") herhangi_birisi: Optional[str] = Field("", description="Any word") not_hepsi: Optional[str] = Field("", description="Exclude words")
  • Pydantic output schema returned by the MCP tool, containing list of decision entries and total count.
    class UyusmazlikSearchResponse(BaseModel): # This is what the MCP tool will return """Response model for Uyuşmazlık Mahkemesi search results for the MCP tool.""" decisions: List[UyusmazlikApiDecisionEntry] total_records_found: Optional[int] = Field(None, description="Total number of records found for the query, if available.")
  • Helper mappings that convert user-friendly enum values from the input schema to internal API GUID IDs required by the Uyusmazlik Mahkemesi search endpoint.
    BOLUM_ENUM_TO_ID_MAP = { UyusmazlikBolumEnum.CEZA_BOLUMU: "f6b74320-f2d7-4209-ad6e-c6df180d4e7c", UyusmazlikBolumEnum.GENEL_KURUL_KARARLARI: "e4ca658d-a75a-4719-b866-b2d2f1c3b1d9", UyusmazlikBolumEnum.HUKUK_BOLUMU: "96b26fc4-ef8e-4a4f-a9cc-a3de89952aa1", UyusmazlikBolumEnum.TUMU: "", # Represents "...Seçiniz..." or all - empty string for API "ALL": "" # Also map the new "ALL" literal to empty string for backward compatibility } UYUSMAZLIK_TURU_ENUM_TO_ID_MAP = { UyusmazlikTuruEnum.GOREV_UYUSMAZLIGI: "7b1e2cd3-8f09-418a-921c-bbe501e1740c", UyusmazlikTuruEnum.HUKUM_UYUSMAZLIGI: "19b88402-172b-4c1d-8339-595c942a89f5", UyusmazlikTuruEnum.TUMU: "", # Represents "...Seçiniz..." or all - empty string for API "ALL": "" # Also map the new "ALL" literal to empty string for backward compatibility } KARAR_SONUCU_ENUM_TO_ID_MAP = { # These IDs are from the form HTML provided by the user UyusmazlikKararSonucuEnum.HUKUM_UYUSMAZLIGI_OLMADIGINA_DAIR: "6f47d87f-dcb5-412e-9878-000385dba1d9", UyusmazlikKararSonucuEnum.HUKUM_UYUSMAZLIGI_OLDUGUNA_DAIR: "5a01742a-c440-4c4a-ba1f-da20837cffed", # Add all other 'Karar Sonucu' enum members and their corresponding GUIDs # by inspecting the 'KararSonucuList' checkboxes in the provided form HTML. } # --- End Mappings ---
  • User-friendly enum definitions used in the input schema for department, dispute type, and decision result selections.
    class UyusmazlikBolumEnum(str, Enum): """User-friendly names for 'BolumId'.""" TUMU = "ALL" # Represents "...Seçiniz..." or all CEZA_BOLUMU = "Ceza Bölümü" GENEL_KURUL_KARARLARI = "Genel Kurul Kararları" HUKUK_BOLUMU = "Hukuk Bölümü" class UyusmazlikTuruEnum(str, Enum): """User-friendly names for 'UyusmazlikId'.""" TUMU = "ALL" # Represents "...Seçiniz..." or all GOREV_UYUSMAZLIGI = "Görev Uyuşmazlığı" HUKUM_UYUSMAZLIGI = "Hüküm Uyuşmazlığı" class UyusmazlikKararSonucuEnum(str, Enum): # Based on checkbox text in the form """User-friendly names for 'KararSonucuList' items.""" HUKUM_UYUSMAZLIGI_OLMADIGINA_DAIR = "Hüküm Uyuşmazlığı Olmadığına Dair" HUKUM_UYUSMAZLIGI_OLDUGUNA_DAIR = "Hüküm Uyuşmazlığı Olduğuna Dair" # Add other "Karar Sonucu" options from the form's checkboxes as Enum members # Example: GOREVLI_YARGI_YERI_ADLI = "Görevli Yargı Yeri Belirlenmesine Dair (Adli Yargı)" # The client will map these enum values (which are strings) to their respective IDs. class UyusmazlikSearchRequest(BaseModel): # This is the model the MCP tool will accept

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

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