Skip to main content
Glama
saidsurucu

Yargı MCP

by saidsurucu

get_uyusmazlik_document_markdown_from_url

Read-onlyIdempotent

Extract and convert Turkish Uyuşmazlık Mahkemesi court decisions from URLs into clean Markdown format for legal analysis and documentation.

Instructions

Use this when retrieving full text of an Uyuşmazlık Mahkemesi decision. Returns clean Markdown format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_urlYesFull URL to the Uyuşmazlık Mahkemesi decision document from search results

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that takes a document URL, fetches the HTML content using httpx, converts it to Markdown using the internal _convert_html_to_markdown_uyusmazlik method, and returns a UyusmazlikDocumentMarkdown object. This implements the logic for 'get_uyusmazlik_document_markdown_from_url'.
    async def get_decision_document_as_markdown(self, document_url: str) -> UyusmazlikDocumentMarkdown:
        """
        Retrieves a specific Uyuşmazlık decision from its full URL and returns content as Markdown.
        """
        logger.info(f"UyusmazlikApiClient (httpx for docs): Fetching Uyuşmazlık document for Markdown from URL: {document_url}")
        try:
            # Using a new httpx.AsyncClient instance for this GET request for simplicity
            async with httpx.AsyncClient(verify=False, timeout=self.request_timeout) as doc_fetch_client:
                 get_response = await doc_fetch_client.get(document_url, headers={"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"})
            get_response.raise_for_status()
            html_content_from_api = get_response.text
    
            if not isinstance(html_content_from_api, str) or not html_content_from_api.strip():
                logger.warning(f"UyusmazlikApiClient: Received empty or non-string HTML from URL {document_url}.")
                return UyusmazlikDocumentMarkdown(source_url=document_url, markdown_content=None)
    
            markdown_content = self._convert_html_to_markdown_uyusmazlik(html_content_from_api)
            return UyusmazlikDocumentMarkdown(source_url=document_url, markdown_content=markdown_content)
        except httpx.RequestError as e:
            logger.error(f"UyusmazlikApiClient (httpx for docs): HTTP error fetching Uyuşmazlık document from {document_url}: {e}")
            raise
        except Exception as e:
            logger.error(f"UyusmazlikApiClient (httpx for docs): General error processing Uyuşmazlık document from {document_url}: {e}")
            raise
  • Pydantic schema/model for the output of the tool, defining source_url (HttpUrl) and markdown_content (Optional[str]). Likely used for input/output validation in the MCP tool.
    class UyusmazlikDocumentMarkdown(BaseModel):
        """Model for an Uyuşmazlık decision document, containing only Markdown content."""
        source_url: HttpUrl # The URL from which the content was fetched
        markdown_content: Optional[str] = Field(None, description="The decision content converted to Markdown.")
  • Helper function within the client class that performs the HTML to Markdown conversion using MarkItDown library, handling encoding and streaming.
    def _convert_html_to_markdown_uyusmazlik(self, full_decision_html_content: str) -> Optional[str]:
        """Converts direct HTML content (from an Uyuşmazlık decision page) to Markdown."""
        if not full_decision_html_content: 
            return None
        
        processed_html = html.unescape(full_decision_html_content)
        # As per user request, pass the full (unescaped) HTML to MarkItDown
        html_input_for_markdown = processed_html
    
        markdown_text = None
        try:
            # Convert HTML string to bytes and create BytesIO stream
            html_bytes = html_input_for_markdown.encode('utf-8')
            html_stream = io.BytesIO(html_bytes)
            
            # Pass BytesIO stream to MarkItDown to avoid temp file creation
            md_converter = MarkItDown()
            conversion_result = md_converter.convert(html_stream)
            markdown_text = conversion_result.text_content
            logger.info("UyusmazlikApiClient: HTML to Markdown conversion successful.")
        except Exception as e:
            logger.error(f"UyusmazlikApiClient: Error during MarkItDown HTML to Markdown conversion: {e}")
        return markdown_text
Behavior3/5

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

Annotations already declare readOnlyHint=true and idempotentHint=true, so the agent knows this is a safe, repeatable read operation. The description adds value by specifying the output format ('clean Markdown format'), which isn't covered by annotations. However, it doesn't provide additional behavioral context like rate limits, authentication needs, or error conditions.

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 with just two sentences that are front-loaded and waste-free. Every word contributes essential information about purpose and output format without any redundancy or 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 tool has annotations covering safety (readOnlyHint, idempotentHint), 100% schema coverage, and an output schema exists, the description provides adequate context. It specifies the court type and output format, which complements the structured data well. However, it could be more complete by mentioning it's specifically for documents from search results (as hinted in the schema) to better integrate with sibling tools.

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 the single parameter 'document_url' well-described in the schema. The description doesn't add any parameter-specific information beyond what's in the schema, so it meets the baseline of 3 where the schema does the heavy lifting.

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 verb ('retrieving') and resource ('full text of an Uyuşmazlık Mahkemesi decision'), and specifies the output format ('clean Markdown format'). It distinguishes from some siblings by focusing on this specific court, but doesn't explicitly differentiate from other document retrieval tools like 'get_anayasa_document_unified' or 'get_bddk_document_markdown' beyond the court name.

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

Usage Guidelines3/5

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

The description provides some usage context with 'Use this when retrieving full text of an Uyuşmazlık Mahkemesi decision,' which implies this tool is for decisions from that specific court. However, it doesn't explicitly state when NOT to use it or mention alternatives among the many sibling search and retrieval tools, leaving some ambiguity about tool selection.

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