Skip to main content
Glama

get_taxlaw_document_text

Retrieve full text of Korean tax law documents using a document ID. Optionally specify document type and include extended content.

Instructions

국세법령정보시스템 문서 상세 조회. search_taxlaw_documents/search_taxlaw_all 결과의 DOC_ID/id를 사용.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes검색 결과의 DOC_ID 또는 DOCID. 예: 001_200000000000019482 또는 200000000000019482
docTypeNo알고 있는 경우 문서유형. 미입력 시 질의/판례 상세를 순차 시도
fullNotrue면 HTML 원문 변환 텍스트를 더 길게 포함

Implementation Reference

  • The main handler function `getTaxlawDocumentText` that executes the tool logic. It takes a `DocumentDetailArgs` (id, docType, full), normalizes the ID, attempts to fetch document detail via `postTaxlawAction('ASIQTB002PR01', ...)`, and formats the response.
    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:481-494 (registration)
    Tool registration in the `tools` array. Defines name 'get_taxlaw_document_text', description, and inputSchema with parameters: id (required), docType, full.
    {
      name: "get_taxlaw_document_text",
      description: "국세법령정보시스템 문서 상세 조회. search_taxlaw_documents/search_taxlaw_all 결과의 DOC_ID/id를 사용.",
      inputSchema: {
        type: "object",
        properties: {
          id: { type: "string", description: "검색 결과의 DOC_ID 또는 DOCID. 예: 001_200000000000019482 또는 200000000000019482" },
          docType: { type: "string", enum: ["advance", "reply", "tax_standard", "written", "tax_pre_review", "objection", "review", "tribunal", "precedent", "constitutional", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10"], description: "알고 있는 경우 문서유형. 미입력 시 질의/판례 상세를 순차 시도" },
          full: { type: "boolean", default: false, description: "true면 HTML 원문 변환 텍스트를 더 길게 포함" },
        },
        required: ["id"],
        additionalProperties: false,
      },
    },
  • The `formatDocumentDetail` helper function that formats the document detail response into human-readable text, including ID, type, date, related laws, gist, body text, and 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)
    }
  • The `DocumentDetailArgs` interface defining the input schema for get_taxlaw_document_text: id (string), docType (string), full (boolean).
    interface DocumentDetailArgs {
      id?: string
      docType?: string
      full?: boolean
    }
  • src/index.ts:1889-1891 (registration)
    Dispatch in `handleToolCall` routing the 'get_taxlaw_document_text' name to `getTaxlawDocumentText`.
    if (name === "get_taxlaw_document_text") {
      return await getTaxlawDocumentText(input as DocumentDetailArgs)
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states the basic operation. It does not disclose any behavioral traits like error handling, rate limits, or authentication needs that might be relevant for an AI agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief and to the point, with a single sentence and a clarifying note. It is efficient but could be slightly more structured with explicit headings or bullet points.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has three parameters and no output schema or annotations, the description provides sufficient context about input (using search result IDs) and basic behavior. It does not explain return values but that is acceptable without an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the parameters are fully described in the schema. The description adds no additional meaning beyond what the schema already provides, meeting the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves detailed document text from the tax law information system using an ID from search results, distinguishing it from sibling tools that are specific to document types.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly instructs to use DOC_ID/id from search_taxlaw_documents or search_taxlaw_all, providing clear context for when to invoke this tool. However, it does not explicitly mention when not to use it or contrast with specialized get_* tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kim-go-chon/taxlaw-nts-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server