Skip to main content
Glama
saidsurucu

Yargı MCP

by saidsurucu

search_uyusmazlik_decisions

Read-onlyIdempotent

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.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

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
Behavior3/5

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

Annotations already declare readOnlyHint=true, openWorldHint=true, and idempotentHint=true, so the agent knows this is a safe, non-destructive, cacheable search operation. The description adds no behavioral context beyond what annotations provide—no mention of rate limits, authentication needs, result formats, or pagination. However, it doesn't contradict the annotations, so it meets the baseline for tools with good annotation coverage.

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 extremely concise—just two sentences that directly state the tool's purpose and context. Every word serves a clear function with zero redundancy. It's appropriately sized and front-loaded with essential information.

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 complexity (18 parameters), rich annotations, and the presence of an output schema, the description is reasonably complete. It identifies the specific legal domain and court function, which is valuable context. However, it could better address usage scenarios or result interpretation to fully compensate for the tool's complexity.

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%, with all 18 parameters well-documented in the schema itself. The description adds no parameter-specific information beyond what's in the schema. According to the rules, when schema coverage is high (>80%), the baseline score is 3 even without parameter details in the description.

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 jurisdictional dispute court (Uyuşmazlık Mahkemesi) decisions' and explains the court's function ('Resolves conflicts between civil and administrative courts'). This specifies both the verb ('searching') and resource ('decisions'), but it doesn't explicitly differentiate from sibling tools like 'search_anayasa_unified' or 'search_bddk_decisions' that search different legal domains.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools, specify use cases, or indicate prerequisites. The phrase 'Use this when searching...' is directive but doesn't offer contextual differentiation from other search tools in the server.

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

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