detail_subjektu
Retrieve complete details for Slovak legal entities by IČO number, including statutory representatives, shareholders, business activities, legal form, and address. Optionally access historical records like former executives and previous addresses.
Instructions
Vráti kompletný detail právnickej osoby z RPO podľa IČO. Obsahuje štatutárov, spoločníkov, predmety činnosti, právnu formu a adresu. Ak historia=True, vráti aj historické záznamy (bývalí konatelia, staré adresy atď.).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ico | Yes | ||
| historia | No |
Implementation Reference
- server.py:120-241 (handler)Handler for the 'detail_subjektu' MCP tool. It fetches details from the RPO API based on the provided IČO.
async def detail_subjektu(ico: str, historia: bool = False) -> dict: """ Vráti kompletný detail právnickej osoby z RPO podľa IČO. Obsahuje štatutárov, spoločníkov, predmety činnosti, právnu formu a adresu. Ak historia=True, vráti aj historické záznamy (bývalí konatelia, staré adresy atď.). """ async with httpx.AsyncClient(timeout=15) as client: # Krok 1: Vyhľadaj RPO ID podľa IČO r = await client.get(f"{RPO_BASE}/search", params={"identifier": ico}) r.raise_for_status() search_data = r.json() results = search_data.get("results", []) if not results: return {"chyba": f"Subjekt s IČO {ico} nebol nájdený v RPO"} rpo_id = results[0]["id"] # Krok 2: Načítaj kompletný detail podľa RPO ID params = {} if historia: params["showHistoricalData"] = "true" r = await client.get(f"{RPO_BASE}/entity/{rpo_id}", params=params) r.raise_for_status() data = r.json() # IČO identifiers = data.get("identifiers", []) current_id = current_only(identifiers) ico_val = current_id[0]["value"] if current_id else (identifiers[0]["value"] if identifiers else None) # Názov names = data.get("fullNames", []) current_name = current_only(names) nazov_val = current_name[0]["value"] if current_name else (names[-1]["value"] if names else None) # Právna forma legal_forms = data.get("legalForms", []) current_lf = current_only(legal_forms) lf = current_lf[0] if current_lf else (legal_forms[0] if legal_forms else {}) pravna_forma = lf.get("value", {}).get("value", None) if lf else None # Adresa addresses = data.get("addresses", []) current_addr = current_only(addresses) addr = current_addr[0] if current_addr else (addresses[0] if addresses else {}) # Štatutárne orgány (konatelia, predseda predstavenstva, atď.) statutory = data.get("statutoryBodies", []) if not historia: statutory = current_only(statutory) statutari = [] for s in statutory: person = s.get("personName", {}) company = s.get("companyName", {}) name = person.get("formatedName") or company.get("value") or "neznámy" stype = s.get("stakeholderType", {}).get("value", "") statutari.append({ "meno": name, "funkcia": stype, "od": s.get("validFrom"), "do": s.get("validTo"), "adresa": format_address(s["address"]) if s.get("address") else None, }) # Spoločníci / akcionári stakeholders = data.get("stakeholders", []) if not historia: stakeholders = current_only(stakeholders) spolocnici = [] for s in stakeholders: person = s.get("personName", {}) name = ( person.get("formatedName") or s.get("fullName") or s.get("companyName", {}).get("value") or "neznámy" ) stype = s.get("stakeholderType", {}).get("value", "") spolocnici.append({ "nazov": name, "typ": stype, "ico": s.get("identifier") if s.get("identifier") != "Neuvedené" else None, "od": s.get("validFrom"), "do": s.get("validTo"), "adresa": format_address(s["address"]) if s.get("address") else None, }) # Predmety činnosti activities = data.get("activities", []) if not historia: activities = current_only(activities) cinnosti = [a.get("economicActivityDescription") for a in activities if a.get("economicActivityDescription")] # Zdrojový register source = data.get("sourceRegister", {}) source_name = source.get("value", {}).get("value", "") if isinstance(source.get("value"), dict) else "" reg_offices = source.get("registrationOffices", []) reg_numbers = source.get("registrationNumbers", []) current_office = current_only(reg_offices) current_regnum = current_only(reg_numbers) return { "rpo_id": data.get("id"), "ico": ico_val, "nazov": nazov_val, "pravna_forma": pravna_forma, "adresa": format_address(addr) if addr else None, "datum_vzniku": data.get("establishment"), "datum_zaniku": data.get("termination"), "zdrojovy_register": source_name, "registrovy_sud": current_office[0].get("value") if current_office else None, "spisova_znacka": current_regnum[0].get("value") if current_regnum else None, "statutari": statutari, "spolocnici": spolocnici, "cinnosti": cinnosti, "pravne_poradenstvo": PRAVNE_PORADENSTVO, }