Skip to main content
Glama
saidsurucu

Yargı MCP

by saidsurucu

search_emsal_detailed_decisions

Read-onlyIdempotent

Search Turkish lower court precedent decisions and case law from UYAP using keywords, court selections, case numbers, dates, and sorting options.

Instructions

Use this when searching UYAP precedent decisions (Emsal). For lower court decisions and case law.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordNoKeyword to search.
selected_bam_civil_courtNoSelected BAM Civil Court.
selected_civil_courtNoSelected Civil Court.
selected_regional_civil_chambersNoSelected Regional Civil Chambers.
case_year_esasNoCase year for 'Esas No'.
case_start_seq_esasNoStarting sequence for 'Esas No'.
case_end_seq_esasNoEnding sequence for 'Esas No'.
decision_year_kararNoDecision year for 'Karar No'.
decision_start_seq_kararNoStarting sequence for 'Karar No'.
decision_end_seq_kararNoEnding sequence for 'Karar No'.
start_dateNoStart date for decision (DD.MM.YYYY).
end_dateNoEnd date for decision (DD.MM.YYYY).
sort_criteriaNoSorting criteria (e.g., 1: Esas No).1
sort_directionNoSorting direction ('asc' or 'desc').desc
page_numberNoPage number (accepts int).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler logic for searching detailed Emsal decisions. Maps user-friendly input params to API payload, cleans it, and executes the API POST request.
    async def search_detailed_decisions(
        self,
        params: EmsalSearchRequest
    ) -> EmsalApiResponse:
        """Performs a detailed search for Emsal decisions."""
        
        data_for_api_payload = EmsalDetailedSearchRequestData(
            arananKelime=params.keyword or "",
            Bam_Hukuk_Mahkemeleri=params.selected_bam_civil_court, # Uses alias "Bam Hukuk Mahkemeleri"
            Hukuk_Mahkemeleri=params.selected_civil_court,         # Uses alias "Hukuk Mahkemeleri"
            birimHukukMah="+".join(params.selected_regional_civil_chambers) if params.selected_regional_civil_chambers else "",
            esasYil=params.case_year_esas or "",
            esasIlkSiraNo=params.case_start_seq_esas or "",
            esasSonSiraNo=params.case_end_seq_esas or "",
            kararYil=params.decision_year_karar or "",
            kararIlkSiraNo=params.decision_start_seq_karar or "",
            kararSonSiraNo=params.decision_end_seq_karar or "",
            baslangicTarihi=params.start_date or "",
            bitisTarihi=params.end_date or "",
            siralama=params.sort_criteria,
            siralamaDirection=params.sort_direction,
            pageSize=params.page_size,
            pageNumber=params.page_number
        )
        
        # Create request dict and remove empty string fields to avoid API issues
        payload_dict = data_for_api_payload.model_dump(by_alias=True, exclude_none=True)
        # Remove empty string fields that might cause API issues
        cleaned_payload = {k: v for k, v in payload_dict.items() if v != ""}
        final_payload = {"data": cleaned_payload} 
        
        logger.info(f"EmsalApiClient: Performing DETAILED search with payload: {final_payload}")
        return await self._execute_api_search(self.DETAILED_SEARCH_ENDPOINT, final_payload)
  • Pydantic input schema for the tool, defining all parameters for detailed Emsal decision search with descriptions and defaults.
    class EmsalSearchRequest(BaseModel): # This is the model the MCP tool will accept
        """Model for Emsal detailed search request, with user-friendly field names."""
        keyword: str = Field("", description="Keyword")
        
        selected_bam_civil_court: str = Field("", description="BAM Civil Court")
        selected_civil_court: str = Field("", description="Civil Court")
        selected_regional_civil_chambers: List[str] = Field(default_factory=list, description="Regional chambers")
    
        case_year_esas: str = Field("", description="Case year")
        case_start_seq_esas: str = Field("", description="Start case no")
        case_end_seq_esas: str = Field("", description="End case no")
        
        decision_year_karar: str = Field("", description="Decision year")
        decision_start_seq_karar: str = Field("", description="Start decision no")
        decision_end_seq_karar: str = Field("", description="End decision no")
        
        start_date: str = Field("", description="Start date (DD.MM.YYYY)")
        end_date: str = Field("", description="End date (DD.MM.YYYY)")
        
        sort_criteria: str = Field("1", description="Sort by")
        sort_direction: str = Field("desc", description="Direction")
        
        page_number: int = Field(default=1, ge=1)
        page_size: int = Field(default=10, ge=1, le=10)
  • Helper function that executes the HTTP POST to the Emsal API, parses response into EmsalApiResponse, adds document URLs to results.
    async def _execute_api_search(self, endpoint: str, payload: Dict) -> EmsalApiResponse:
        """Helper method to execute search POST request and process response for Emsal."""
        try:
            response = await self.http_client.post(endpoint, json=payload)
            response.raise_for_status()
            response_json_data = response.json()
            logger.debug(f"EmsalApiClient: Raw API response from {endpoint}: {response_json_data}")
            
            api_response_parsed = EmsalApiResponse(**response_json_data)
    
            if api_response_parsed.data and api_response_parsed.data.data:
                for decision_item in api_response_parsed.data.data:
                    if decision_item.id:
                        decision_item.document_url = f"{self.BASE_URL}{self.DOCUMENT_ENDPOINT}?id={decision_item.id}"
            
            return api_response_parsed
        except httpx.RequestError as e:
            logger.error(f"EmsalApiClient: HTTP request error during Emsal search to {endpoint}: {e}")
            raise
        except Exception as e:
            logger.error(f"EmsalApiClient: Error processing or validating Emsal search response from {endpoint}: {e}")
            raise
  • Output/response schema models for the API response, including decision entries with added document_url.
    """Model for the complete search response from the Emsal API."""
    data: Optional[EmsalApiResponseInnerData] = None
    metadata: Optional[Dict[str, Any]] = Field(None, description="Optional metadata (Meta Veri) from API, if any.")
Behavior4/5

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

Annotations provide readOnlyHint=true, openWorldHint=true, and idempotentHint=true, indicating safe, non-destructive, and repeatable operations. The description doesn't contradict these and adds context by specifying 'UYAP precedent decisions (Emsal)' and 'lower court decisions and case law', which helps clarify the domain. However, it lacks details on rate limits, authentication needs, or pagination behavior (implied by page_number parameter), though annotations cover core safety.

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 two short sentences with zero waste: 'Use this when searching UYAP precedent decisions (Emsal). For lower court decisions and case law.' It's front-loaded with the main purpose and efficiently conveys key context. Every word serves a purpose, making it highly concise and well-structured.

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 (15 parameters, search functionality) and rich annotations (readOnly, openWorld, idempotent) plus an output schema (implied by context signals), the description is reasonably complete. It specifies the domain (UYAP precedent decisions) and scope (lower court decisions, case law), which adds value beyond structured fields. However, it could better differentiate from siblings or explain result formats, though the output schema mitigates this.

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 15 parameters well-documented in the input schema (e.g., keyword, dates, sorting). The description adds no parameter-specific information beyond what's in the schema, such as examples or usage tips. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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

Purpose3/5

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

The description states the tool is for 'searching UYAP precedent decisions (Emsal)' and mentions 'lower court decisions and case law', which provides a general purpose. However, it lacks specificity about what 'detailed decisions' means compared to other search tools (e.g., search_anayasa_unified, search_bddk_decisions), and doesn't clearly distinguish it from sibling tools like 'search' or 'search_emsal_document_markdown' (implied sibling). The verb 'search' is clear but the resource scope is vague.

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 includes 'Use this when searching UYAP precedent decisions (Emsal). For lower court decisions and case law.', which gives some context but is minimal. It doesn't explicitly state when to use this tool versus alternatives (e.g., search_anayasa_unified for constitutional decisions), nor does it provide exclusions or prerequisites. The guidance is implied but insufficient for clear decision-making among many sibling tools.

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