Both sites were rebuilt and their old endpoints now 404:
- AYM moved to a single-page app backed by a JSON API
(POST /api/core/public/search, kararTipi NormDenetimi/BireyselBasvuru;
full text via {id, size:1} -> "icerik" HTML). Old /Ara, /ND/, /BB/ gone.
- Uyuşmazlık moved to ASP.NET WebForms (viewstate postback to /, GridView
results, decisions served as /Uploads/{EsasNo}.pdf). Old /Arama/Search gone.
Changes:
- New anayasa_mcp_module/api_client.py: shared KBB JSON client, base64url
document-id codec, HTML->Markdown + HTML text stripping helpers.
- Rewrite anayasa client/bireysel_client/unified_client over the new API,
preserving public method names and response models.
- Rewrite uyusmazlik client for the postback flow + GridView parse + PDF
document conversion; simplify request model to text + scope + paging.
- Trim search_anayasa_unified and search_uyusmazlik_decisions tool signatures
to parameters the new APIs actually support; drop dead enums.
Verified live via FastMCP client: search + document retrieval work for AYM
norm/bireysel and Uyuşmazlık.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
42 lines
2.0 KiB
Python
42 lines
2.0 KiB
Python
# uyusmazlik_mcp_module/models.py
|
||
|
||
from pydantic import BaseModel, Field, HttpUrl
|
||
from typing import List, Optional, Literal
|
||
|
||
# The Uyuşmazlık Mahkemesi search site was rebuilt as an ASP.NET WebForms app.
|
||
# It now offers only a single free-text search with a scope selector; the old
|
||
# Bölüm / Uyuşmazlık Türü / Karar Sonucu / Esas-Karar year filters no longer exist.
|
||
|
||
UyusmazlikSearchScope = Literal["All", "EsasNo", "KararNo"]
|
||
|
||
|
||
class UyusmazlikSearchRequest(BaseModel):
|
||
"""Model for the Uyuşmazlık Mahkemesi search request."""
|
||
icerik: str = Field("", description="Search text (txtSearch).")
|
||
search_scope: UyusmazlikSearchScope = Field(
|
||
"All",
|
||
description="Search scope: 'All' (full text), 'EsasNo' (by case number), 'KararNo' (by decision number).",
|
||
)
|
||
case_sensitive: bool = Field(False, description="Whether the search is case sensitive (chkCaseSensitive).")
|
||
page_number: int = Field(1, ge=1, description="Result page number (GridView pager).")
|
||
|
||
|
||
class UyusmazlikApiDecisionEntry(BaseModel):
|
||
"""A single decision row parsed from the Uyuşmazlık GridView results."""
|
||
esas_sayisi: Optional[str] = Field(None, description="Case number (Esas No).")
|
||
karar_sayisi: Optional[str] = Field(None, description="Decision number (Karar No).")
|
||
karar_tarihi: Optional[str] = Field(None, description="Decision date (DD/MM/YYYY).")
|
||
document_url: HttpUrl = Field(..., description="Full URL to the decision PDF document.")
|
||
|
||
|
||
class UyusmazlikSearchResponse(BaseModel):
|
||
"""Response model for Uyuşmazlık Mahkemesi search results."""
|
||
decisions: List[UyusmazlikApiDecisionEntry]
|
||
total_records_found: Optional[int] = Field(None, description="Total number of records found, if reported.")
|
||
|
||
|
||
class UyusmazlikDocumentMarkdown(BaseModel):
|
||
"""Model for an Uyuşmazlık decision document, containing Markdown content."""
|
||
source_url: HttpUrl
|
||
markdown_content: Optional[str] = Field(None, description="The decision PDF content converted to Markdown.")
|