get_constitutional_decision_text
Retrieve full text of Korean constitutional court decisions, including case name, case number, summary, and holdings, to track constitutional grounds for PIPA interpretation.
Instructions
헌재 결정문 전문 (법제처 lawService · target=detc). 사건명·사건번호·결정요지·판시사항·전문 추출. PIPA 해석의 헌법적 근거(자기결정권 등) 추적. 긴 전문은 자동 축약. 다음: search_constitutional_decisions로 유사 사건, intelligent_law_search로 인용 조문 검색.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | 헌재결정례일련번호 (search_constitutional_decisions 결과의 [id=N]) |
Implementation Reference
- The handler function that fetches and returns the full text of a Korean Constitutional Court decision. It calls the lawService API, parses the JSON response, extracts fields like 사건명, 사건번호, 판시사항, 결정요지, 전문, and formats them into a text response with suggestions.
async handler(args, client) { try { const jsonText = await client.fetchApi({ endpoint: "lawService.do", target: "detc", type: "JSON", extraParams: { ID: args.id }, }); let parsed: { DetcService?: ConstitutionalDecisionData; Law?: string }; try { parsed = JSON.parse(jsonText); } catch { return notFoundResponse(`헌재 결정문 응답 파싱 실패 (id=${args.id})`, [ `search_constitutional_decisions(query="...") — 유효한 id 확인`, ]); } if (typeof parsed.Law === "string") { return notFoundResponse(`헌재 결정문 없음: ${parsed.Law}`, [ `search_constitutional_decisions(query="...") — 유효한 id 확인`, ]); } const decision = parsed.DetcService; if (!decision) { return notFoundResponse(`헌재 결정문 데이터 없음 (id=${args.id})`, [ `search_constitutional_decisions(query="...") — 유효한 id 확인`, ]); } const title = decision.사건명 ?? "(사건명 없음)"; let text = `=== ${title} ===\n`; if (decision.사건번호) text += `사건번호: ${decision.사건번호}\n`; if (decision.사건종류명) text += `사건종류: ${decision.사건종류명}\n`; if (decision.종국일자) text += `종국일자: ${decision.종국일자}\n`; if (decision.헌재결정례일련번호) text += `결정례ID: ${decision.헌재결정례일련번호}\n`; // 핵심 본문 — 우선순위 (판시사항 → 결정요지 → 전문) text += formatField("판시사항", decision.판시사항); text += formatField("결정요지", decision.결정요지); text += formatField("심판대상조문", decision.심판대상조문); text += formatField("참조조문", decision.참조조문); text += formatField("참조판례", decision.참조판례); text += formatField("전문", decision.전문); text = appendSuggestions(text, [ { tool: "search_constitutional_decisions", args: { query: title.slice(0, 20) }, reason: "유사 헌재 결정 검색", }, ]); text += `\n📎 출처: 헌법재판소 결정례 (id=${args.id}) — ${constitutionalDecisionUrl(args.id)}`; return { content: [{ type: "text", text }] }; } catch (err) { return formatToolError(err, "get_constitutional_decision_text"); } }, }; - Input schema for the tool: requires an 'id' string (헌재결정례일련번호) from search_constitutional_decisions results.
const inputSchema = z.object({ id: z .string() .min(1) .describe( "헌재결정례일련번호 (search_constitutional_decisions 결과의 [id=N])" ), }); - src/tools/registry.ts:20-65 (registration)Import of getConstitutionalDecisionText from its primitive module, and its inclusion in the ALL_TOOLS array (line 65) for registration.
import { getConstitutionalDecisionText } from "./primitives/get-constitutional-decision-text.js"; import { getAdminAppealText } from "./primitives/get-admin-appeal-text.js"; import { getInterpretationText } from "./primitives/get-interpretation-text.js"; import { getEnglishLawText } from "./primitives/get-english-law-text.js"; import { compareAdminRuleOldNew } from "./primitives/compare-admin-rule-old-new.js"; import { getLawHistory } from "./primitives/get-law-history.js"; import { getHistoricalLaw } from "./primitives/get-historical-law.js"; import { compareOldNew } from "./primitives/compare-old-new.js"; import { getThreeTier } from "./primitives/get-three-tier.js"; import { getArticleChangeHistory } from "./primitives/get-article-change-history.js"; import { getDelegatedLaws } from "./primitives/get-delegated-laws.js"; import { getLawSystemTree } from "./primitives/get-law-system-tree.js"; import { getIntelligentRelatedLaws } from "./primitives/get-intelligent-related-laws.js"; import { compareArticles } from "./primitives/compare-articles.js"; import { getLegalTerm } from "./primitives/get-legal-term.js"; import { getTermArticles } from "./primitives/get-term-articles.js"; import { getLawAbbreviations } from "./primitives/get-law-abbreviations.js"; import { getLawTree } from "./primitives/get-law-tree.js"; // W3 — Layer C corpus import { searchPrivacyCorpus } from "./corpus/search-privacy-corpus.js"; import { searchPrivacyCases } from "./corpus/search-privacy-cases.js"; import { searchPrivacyGuides } from "./corpus/search-privacy-guides.js"; // W3 — Layer B+ hints (PIPC 공식 출처 인덱스화) import { getSectoralRelatedLaws } from "./hints/get-sectoral-related-laws.js"; import { getPipcCuratedCorpus } from "./hints/get-pipc-curated-corpus.js"; // W4 — Validator (4계층 환각 검증) import { verifyPipaCitation } from "./validator/verify-pipa-citation.js"; export const ALL_TOOLS: Tool[] = [ // W1.5 searchLaw, getLawText, intelligentLawSearch, getRelatedLaws, getAnnexes, // W2 — search primitives (admin rule + decisions + interpretations + english) searchAdminRule, searchPipcDecisions, searchConstitutionalDecisions, searchAdminAppeals, searchInterpretations, searchEnglishLaw, // W2 — get text primitives getAdminRuleText, getPipcDecisionText, getConstitutionalDecisionText, - formatField helper function used to format each field section with HTML stripping and optional compaction for long text.
function formatField(label: string, value: string | undefined): string { if (!value) return ""; const cleaned = stripHtmlTags(value); if (!cleaned) return ""; const compacted = cleaned.length > FIELD_COMPACT_THRESHOLD ? compactBody(cleaned, { headLimit: 1500, tailLimit: 800, minLength: FIELD_COMPACT_THRESHOLD, }) : cleaned; return `\n[${label}]\n${compacted}\n`; } - ConstitutionalDecisionData interface defining the shape of the API response fields.
interface ConstitutionalDecisionData { 헌재결정례일련번호?: string; 사건명?: string; 사건번호?: string; 사건종류명?: string; 사건종류코드?: string; 종국일자?: string; 재판부구분코드?: string; 판시사항?: string; 결정요지?: string; 심판대상조문?: string; 참조조문?: string; 참조판례?: string; 전문?: string; }