Skip to main content
Glama

get_uyusmazlik_document_markdown_from_url

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

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

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