get_taxlaw_interpretation_text
Retrieve detailed text of Korean tax law interpretations and official rulings using a unique ID. Includes the full content of questions and answers.
Instructions
하위호환용: 세법해석례/질의회신 상세 조회. 내부적으로 get_taxlaw_document_text를 사용.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| full | No |
Implementation Reference
- src/index.ts:566-578 (registration)Tool definition registration for 'get_taxlaw_interpretation_text' in the tools array with inputSchema (name, description, inputSchema for id and full).
{ name: "get_taxlaw_interpretation_text", description: "하위호환용: 세법해석례/질의회신 상세 조회. 내부적으로 get_taxlaw_document_text를 사용.", inputSchema: { type: "object", properties: { id: { type: "string" }, full: { type: "boolean", default: false }, }, required: ["id"], additionalProperties: false, }, }, - src/index.ts:1907-1909 (handler)Handler in handleToolCall that delegates to getTaxlawDocumentText with docType defaulting to 'reply'.
if (name === "get_taxlaw_interpretation_text") { return await getTaxlawDocumentText({ ...input, docType: input.docType || "reply" } as DocumentDetailArgs) } - src/index.ts:1309-1344 (helper)The actual implementation function getTaxlawDocumentText which fetches document detail via postTaxlawAction and formats the result.
async function getTaxlawDocumentText(args: DocumentDetailArgs): Promise<ToolResponse> { const rawId = requireString("id", args.id) const id = normalizeDetailId(rawId) const knownCode = docCodeFromType(args.docType) const attempts = knownCode ? [refererForDoc(knownCode, id)] : [`/qt/USEQTA002P.do?ntstDcmId=${encodeURIComponent(id)}`, `/pd/USEPDA002P.do?ntstDcmId=${encodeURIComponent(id)}`] let lastError: unknown for (const referer of attempts) { try { const data = await postTaxlawAction<TaxlawDetailData>( "ASIQTB002PR01", { dcmDVO: { ntstDcmId: id } }, referer, ) const detail = data.ASIQTB002PR01 const dcm = detail.dcmDVO if (!dcm) continue return textResponse(formatDocumentDetail(id, dcm, detail, args.full === true, referer)) } catch (error) { lastError = error } } if (lastError instanceof TaxlawMcpError) { if (attempts.length === 1) throw lastError if (lastError.code !== ErrorCodes.NOT_FOUND && lastError.code !== ErrorCodes.PARSE_ERROR) { throw lastError } } return notFoundResponse(`국세법령정보시스템 문서 상세를 찾을 수 없습니다: ${rawId}`, [ "search_taxlaw_documents로 DOC_ID를 다시 확인하세요.", "docType을 알고 있으면 함께 입력하세요.", ]) } - src/index.ts:1346-1391 (helper)formatDocumentDetail helper that formats the detailed document output with metadata, body text, and related precedents.
function formatDocumentDetail(id: string, dcm: TaxlawDcm, detail: TaxlawDetailData["ASIQTB002PR01"], full: boolean, referer: string): string { const relatedLaws = (detail.dcmRltnStttList || []) .map((item) => cleanText(item.ntstTextNm)) .filter(Boolean) .join(", ") const referencePrecedents = (detail.dcmRfrnPrtsList || []) .map((item) => [cleanText(item.ntstDcmDscmCntn), cleanText(item.ntstDcmTtl)].filter(Boolean).join(" ")) .filter(Boolean) const quotedPrecedents = (detail.dcmQutPrtsList || []) .map((item) => [cleanText(item.ntstDcmDscmCntn), cleanText(item.ntstDcmTtl)].filter(Boolean).join(" ")) .filter(Boolean) const bodyText = detailTextFromHtmlList(detail.dcmHwpEditorDVOList) const code = dcm.ntstDcmClCd || dcm.NTST_DCM_CL_CD const type = dcm.ntstDcmClNm || dcm.NTST_DCM_CL_NM || docLabel(code) const title = cleanText(dcm.ntstDcmTtl || dcm.TTL) const lines = [ `=== ${title || "(제목 없음)"} ===`, "", "기본 정보:", ` ID: ${dcm.ntstDcmId || id}`, ` 구분: ${type}`, ` 세목코드: ${dcm.ntstTlawClCd || "N/A"}`, ` 문서번호: ${cleanText(dcm.ntstDcmDscmCntn || dcm.NTST_DCM_DSCM_CNTN) || "N/A"}`, ` 회신번호: ${cleanText(dcm.ntstDcmRplyCntn || dcm.NTST_DCM_RPLY_CNTN) || "N/A"}`, ` 결정: ${cleanText(dcm.ntstDcmDcsClNm || dcm.NTST_DCM_DCS_CL_NM) || "N/A"}`, ` 생산일자: ${normalizeDate(dcm.ntstDcmRgtDt || dcm.DCM_RGT_DTM)} / 등록일자: ${normalizeDate(dcm.frsRgtDtm || dcm.FRS_RGT_DTM)}`, ` 출처: ${TAXLAW_BASE}${referer}`, ] if (relatedLaws) lines.push(` 관련법령: ${relatedLaws}`) lines.push("") const gist = cleanText(dcm.ntstDcmGistCntn || dcm.GIST_CNTN) const answer = cleanText(dcm.ntstDcmCntn || dcm.CNTN) if (gist) lines.push("요지:", gist, "") if (answer) lines.push("본문/회신/결정내용:", answer, "") if (bodyText) lines.push(full ? "원문 변환 텍스트:" : "원문 요약 텍스트:", compactBodyText(bodyText, full), "") if (referencePrecedents.length > 0) { lines.push("참조 판례:", ...referencePrecedents.slice(0, 20).map((item) => ` - ${item}`), "") } if (quotedPrecedents.length > 0) { lines.push("인용 판례:", ...quotedPrecedents.slice(0, 20).map((item) => ` - ${item}`), "") } return truncate(lines.join("\n"), full ? 50000 : 30000) } - src/index.ts:755-759 (helper)normalizeDetailId helper used to normalize the document ID (strip '001_' prefix).
function normalizeDetailId(id: string): string { const trimmed = id.trim() const prefixed = trimmed.match(/^001_(\d+)$/) return prefixed ? prefixed[1] : trimmed }