search_taxlaw_interpretations
Search Korean tax law interpretations and official rulings from the National Tax Service database. Filter by document type, date range, and tax law code.
Instructions
하위호환용: 세법해석례/질의회신 검색. 내부적으로 search_taxlaw_documents를 사용.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | ||
| docType | No | reply | |
| display | No | ||
| page | No | ||
| sort | No | date_desc | |
| fromDate | No | ||
| toDate | No | ||
| taxLawCode | No |
Implementation Reference
- src/index.ts:547-565 (registration)Tool registration in the 'tools' array with inputSchema and description stating it's a backward-compatibility wrapper.
{ name: "search_taxlaw_interpretations", description: "하위호환용: 세법해석례/질의회신 검색. 내부적으로 search_taxlaw_documents를 사용.", inputSchema: { type: "object", properties: { query: { type: "string" }, docType: { type: "string", enum: ["all", "interpretations", "advance", "reply", "tax_standard", "written", "01", "02", "03", "04"], default: "reply" }, display: { type: "number", minimum: 1, maximum: 50, default: 20 }, page: { type: "number", minimum: 1, default: 1 }, sort: { type: "string", enum: ["date_desc", "date_asc", "reg_desc", "reg_asc"], default: "date_desc" }, fromDate: { type: "string", pattern: "^\\d{8}$" }, toDate: { type: "string", pattern: "^\\d{8}$" }, taxLawCode: { type: "string" }, }, required: [], additionalProperties: false, }, }, - src/index.ts:1904-1906 (handler)Handler dispatch: delegates to searchTaxlawDocuments with fallback docType 'reply'.
if (name === "search_taxlaw_interpretations") { return await searchTaxlawDocuments(input as DocumentSearchArgs, "reply") } - src/index.ts:1251-1307 (helper)Actual implementation that search_taxlaw_interpretations delegates to. Handles document search with type codes, deduplication, and pagination.
async function searchTaxlawDocuments(args: DocumentSearchArgs, fallbackDocType = "reply"): Promise<ToolResponse> { validateDateRange(args.fromDate, args.toDate) const codes = documentCodes(args.docType, fallbackDocType) const groups = splitDocumentCodes(codes) if (groups.length === 0) { throw new TaxlawMcpError("No supported document type selected.", ErrorCodes.INVALID_PARAM) } const settled = await Promise.allSettled(groups.map((group) => searchDocumentGroup(group, args))) const results = settled .filter((s): s is PromiseFulfilledResult<{ group: "question" | "precedent"; codes: string[]; result: TaxlawSearchData["ASIPDI002PR01"] }> => s.status === "fulfilled") .map((s) => s.value) const failedGroups = settled .map((s, idx) => ({ status: s.status, group: groups[idx], reason: s.status === "rejected" ? s.reason : undefined })) .filter((entry) => entry.status === "rejected") if (results.length === 0) { throw failedGroups[0]?.reason ?? new TaxlawMcpError("Taxlaw document search failed.", ErrorCodes.API_ERROR) } const total = results.reduce((sum, entry) => sum + totalCount(entry.result, entry.codes), 0) const rawItems = results .flatMap((entry) => (entry.result.body || []).map((row) => row.dcm).filter((d): d is TaxlawDcm => !!d)) .sort((a, b) => documentDateValue(b) - documentDateValue(a)) const { items: uniqueItems, duplicatesRemoved } = uniqueDocuments(rawItems) const items = uniqueItems.slice(0, asPositiveInt(args.display, 20, 50)) if (total === 0 || items.length === 0) { const label = codes.map((code) => docLabel(code)).join(", ") return notFoundResponse(`국세법령정보시스템 '${args.query || "(전체)"}' ${label} 검색 결과가 없습니다.`, [ "docType을 all 또는 interpretations/disputes로 넓혀 재검색하세요.", "통합검색이 필요하면 search_taxlaw_all을 사용하세요.", "본 도구는 코드 01–10(세법해석례·과세전적부심사·이의·심사·심판·판례·헌재)만 직접 지원합니다. 법제처 해석례(actionId=ASIBGE004MR03), 감사원 심사청구(ASIPDM001MR01), 납세자보호위원회 심의사례(ASIPRC019MR02), 평가심의사례(ASIBGH004MR01)는 list_taxlaw_site_menus + call_taxlaw_action으로 조회하세요.", "korean-law-mcp의 search_decisions(domain=precedent/interpretation/tax_tribunal/constitutional)도 병행 시도하세요. NTS와 법제처는 인덱싱 범위·본문 검색 강도가 달라 한쪽에만 회수되는 사건이 흔합니다(특히 최신 조세심판원 결정례는 NTS, 일부 대법원·헌재 판결은 법제처가 강세).", ]) } const title = codes.length === 1 ? docLabel(codes[0]) : codes.map((code) => docLabel(code)).join(", ") const lines = [ `국세법령정보시스템 문서 검색 결과: ${title}`, `출처: ${TAXLAW_BASE}/action.do (ASIPDI002PR01)`, `검색어: ${args.query || "(전체)"} / 총 ${total.toLocaleString()}건 / page=${asPositiveInt(args.page, 1)}`, "주의: 아래 결과는 국세법령정보시스템 응답에 존재한 항목만 표시합니다.", "", ] if (duplicatesRemoved > 0) { lines.push(`중복 제거: 같은 문서번호/회신번호/제목으로 보이는 ${duplicatesRemoved.toLocaleString()}건은 표시에서 제외했습니다.`, "") } if (failedGroups.length > 0) { const labels = failedGroups.map((entry) => entry.group.kind === "question" ? "세법해석례/질의회신" : "판례·결정례").join(", ") const reasons = failedGroups.map((entry) => entry.reason instanceof Error ? entry.reason.message : String(entry.reason)).join("; ") lines.push(`⚠️ 일부 그룹 조회 실패(표시되지 않음): ${labels} — ${reasons}`, "") } items.forEach((item) => lines.push(formatDocumentSearchItem(item, args.query), "")) return textResponse(truncate(lines.join("\n"), 50000)) }