search_taxlaw_forms
Search and retrieve tax law forms from the National Tax Service database by keyword, form kind, law ID, and pagination options.
Instructions
국세법령정보시스템 별표/서식 검색. 전체 서식, 별표, 법령서식, 훈령서식, 자주찾는서식을 탐색.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | 별표/서식명 검색어 | |
| kind | No | all | |
| lawId | No | 특정 법령 ID(ntstBscId). 미입력 시 전체 | |
| display | No | ||
| page | No |
Implementation Reference
- src/index.ts:85-91 (schema)Input schema type for search_taxlaw_forms tool.
interface FormsSearchArgs { query?: string kind?: string lawId?: string display?: number page?: number } - src/index.ts:235-263 (schema)Type definition for form items returned by the search.
interface FormItem { ntstBscId?: string ntstBrkdId?: string ntstNm?: string ntstSysClCd?: string ntstPmgDt?: string ntstAtFrmlSn?: number | string ntstAtFrmlClCd?: string ntstAtFrmlAtNo?: string ntstAtFrmlNo?: string ntstAtFrmlNm?: string ntstClNm?: string ntar?: string ntarBscId?: string ntarBrkdId?: string ntarClCd?: string ntarNm?: string ntarPmgNo?: string ntarPmgDt?: string ntarFrmlSn?: string ntarFrmlNo?: string ntarFrmlNm?: string frmlNm?: string ntstBkmrFrmlClCd?: string ntstBkmrFrmlDetailClNm?: string ntstSjtClNm?: string stttInfpClCd?: string fleId?: string } - src/index.ts:607-622 (registration)Tool registration/definition with name and input schema. Listed in the tools array.
{ name: "search_taxlaw_forms", description: "국세법령정보시스템 별표/서식 검색. 전체 서식, 별표, 법령서식, 훈령서식, 자주찾는서식을 탐색.", inputSchema: { type: "object", properties: { query: { type: "string", description: "별표/서식명 검색어" }, kind: { type: "string", enum: ["all", "all_forms", "annex", "form", "legal_form", "instruction_form", "favorite_form"], default: "all" }, lawId: { type: "string", description: "특정 법령 ID(ntstBscId). 미입력 시 전체" }, display: { type: "number", minimum: 1, maximum: 50, default: 20 }, page: { type: "number", minimum: 1, default: 1 }, }, required: [], additionalProperties: false, }, }, - src/index.ts:1762-1787 (handler)Main handler function for search_taxlaw_forms. Resolves kinds, searches each form kind via the NTS API, and formats results.
async function searchTaxlawForms(args: FormsSearchArgs): Promise<ToolResponse> { const kinds = formKinds(args.kind) const results = await Promise.all(kinds.map((entry) => searchFormsKind(entry, args))) const total = results.reduce((sum, entry) => sum + Number(entry.result.recordCount || 0), 0) if (total === 0) { return notFoundResponse(`국세법령정보시스템 별표/서식 '${args.query || "(전체)"}' 검색 결과가 없습니다.`) } const lines = [ "국세법령정보시스템 별표/서식 검색 결과", `출처: ${results.map((entry) => `${TAXLAW_BASE}${SITE_MENU_ACTIONS.find((menu) => menu.highLevelTool?.includes(`kind=${entry.kind}`))?.path || ""}`).filter(Boolean).join(", ") || `${TAXLAW_BASE}/af`}`, `검색어: ${args.query || "(전체)"} / 종류: ${kinds.map(formKindLabel).join(", ")} / 총 ${total.toLocaleString()}건`, "", ] for (const entry of results) { const list = formResultList(entry.kind, entry.result) lines.push(`## ${formKindLabel(entry.kind)}: ${Number(entry.result.recordCount || 0).toLocaleString()}건`) if (list.length === 0) { lines.push("[NOT_FOUND] 표시 가능한 결과가 없습니다.", "") continue } list.forEach((item) => lines.push(formatFormItem(entry.kind, item), "")) } return textResponse(truncate(lines.join("\n"), 50000)) } - src/index.ts:1661-1709 (helper)Helper function that calls the NTS action.do API for a specific form kind.
async function searchFormsKind(kind: FormKind, args: FormsSearchArgs): Promise<{ kind: FormKind; result: FormSearchResult }> { const pageIndex = asPositiveInt(args.page, 1) const recordCountPerPage = asPositiveInt(args.display, 20, 50) let actionId = "" let referer = "" let params: AnyRecord = {} if (kind === "all_forms") { actionId = "ASIAFE001MR01" referer = "/af/USEAFE001M.do" params = { searchFrmlNm: args.query || "", pageIndex, recordCountPerPage } } else if (kind === "annex" || kind === "legal_form") { actionId = kind === "annex" ? "ASIAFA001MR01" : "ASIAFB001MR01" referer = kind === "annex" ? "/af/USEAFA001M.do" : "/af/USEAFB001M.do" params = { searchFrmlNm: args.query || "", searchNtstBscId: args.lawId || "stttAll", pageIndex, recordCountPerPage, srtFeld: "btn_sortPmgDt", srtMthd: "desc", } } else if (kind === "instruction_form") { actionId = "ASIAFC001MR01" referer = "/af/USEAFC001M.do" params = { searchNtarTlawClCd: "all", searchFrmlNm: args.query || "", pageIndex, recordCountPerPage, srtFeld: "btn_sortPmgDt", srtMthd: "desc", } } else { actionId = "ASIAFD001MR01" referer = "/af/USEAFD001M.do" params = { searchBkmrTlawClCd: "all", searchFrmlNm: args.query || "", ntstBkmrFrmlClCd: "10", pageIndex, recordCountPerPage, } } const data = await postTaxlawAction<FormsData>(actionId, params, referer) const result = data[actionId as keyof FormsData] as FormSearchResult | undefined return { kind, result: result || {} } }