Skip to main content
Glama
scvcoder

korean-privacy-law-mcp

by scvcoder

get_interpretation_text

Retrieve the full text of a Korean legal interpretation consultation, including the query, official answer, and detailed reasoning, to verify how PIPA provisions are applied.

Instructions

법령해석례 본문 (법제처 lawService · target=expc). 안건명·질의요지·회답·이유 + 질의/해석기관 추출. PIPA 조문 적용 의문 시 법제처·부처가 회신한 공식 해석 직접 확인. 긴 이유는 자동 축약. 다음: search_interpretations로 유사 해석례, get_law_text로 인용 조문 확인.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes법령해석례 일련번호 (search_interpretations 결과의 [id=N])

Implementation Reference

  • The async handler that executes the tool logic: fetches interpretation text from lawService.do (target=expc) using the provided ID, parses JSON, formats fields (title, agency, date, question, answer, reasoning), appends suggestions, and returns formatted text with source URL.
      async handler(args, client) {
        try {
          const jsonText = await client.fetchApi({
            endpoint: "lawService.do",
            target: "expc",
            type: "JSON",
            extraParams: { ID: args.id },
          });
    
          let parsed: { ExpcService?: InterpretationData; Law?: string };
          try {
            parsed = JSON.parse(jsonText);
          } catch {
            return notFoundResponse(`법령해석례 응답 파싱 실패 (id=${args.id})`, [
              `search_interpretations(query="...") — 유효한 id 확인`,
            ]);
          }
    
          if (typeof parsed.Law === "string") {
            return notFoundResponse(`법령해석례 없음: ${parsed.Law}`, [
              `search_interpretations(query="...") — 유효한 id 확인`,
            ]);
          }
    
          const interp = parsed.ExpcService;
          if (!interp) {
            return notFoundResponse(`법령해석례 데이터 없음 (id=${args.id})`, [
              `search_interpretations(query="...") — 유효한 id 확인`,
            ]);
          }
    
          const title = interp.안건명 ?? "(안건명 없음)";
    
          let text = `=== ${title} ===\n`;
          if (interp.안건번호) text += `안건번호: ${interp.안건번호}\n`;
          if (interp.질의기관명) text += `질의기관: ${interp.질의기관명}\n`;
          if (interp.해석기관명) text += `회신기관: ${interp.해석기관명}\n`;
          if (interp.해석일자) text += `회신일: ${interp.해석일자}\n`;
          if (interp.법령해석례일련번호)
            text += `해석례ID: ${interp.법령해석례일련번호}\n`;
    
          // 핵심 본문 — 질의요지 → 회답 → 이유 순
          text += formatField("질의요지", interp.질의요지);
          text += formatField("회답", interp.회답);
          text += formatField("이유", interp.이유);
    
          text = appendSuggestions(text, [
            {
              tool: "search_interpretations",
              args: { query: title.slice(0, 20) },
              reason: "유사 법령해석례 검색",
            },
          ]);
          text += `\n📎 출처: 법령해석례 (id=${args.id}) — ${interpretationUrl(args.id)}`;
    
          return { content: [{ type: "text", text }] };
        } catch (err) {
          return formatToolError(err, "get_interpretation_text");
        }
      },
    };
  • Zod input schema: requires a non-empty string 'id' (the interpretation serial number from search_interpretations).
    const inputSchema = z.object({
      id: z
        .string()
        .min(1)
        .describe("법령해석례 일련번호 (search_interpretations 결과의 [id=N])"),
    });
  • Import and registration of getInterpretationText in the ALL_TOOLS array (line 22 import, line 67 in the array).
    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,
      getAdminAppealText,
      getInterpretationText,
  • formatField helper: strips HTML tags, optionally compacts long text (over 2500 chars), and formats with label.
    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`;
    }
  • InterpretationData interface: defines the shape of the parsed API response fields.
    interface InterpretationData {
      법령해석례일련번호?: string;
      안건명?: string;
      안건번호?: string;
      질의기관명?: string;
      질의기관코드?: string;
      해석기관명?: string;
      해석기관코드?: string;
      해석일자?: string;
      등록일시?: string;
      질의요지?: string;
      회답?: string;
      이유?: string;
    }
Behavior3/5

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

With no annotations, the description carries the full burden. It discloses that long reasons are automatically summarized ('긴 이유는 자동 축약'), but does not mention error handling, authentication, or rate limits. This is acceptable for a retrieval tool but leaves some gaps.

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

Conciseness5/5

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

The description is concise with four sentences, each serving a purpose: definition, use case, behavioral note, and cross-reference. Information is front-loaded and there is no redundant text.

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

Completeness5/5

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

Given the tool's simplicity (single required parameter, no output schema), the description is complete. It covers what the tool returns, when to use it, and how to find related data. No additional information is necessary.

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

Parameters4/5

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

The single required parameter 'id' is clearly described in the schema as the serial number from search_interpretations results. The description adds context by linking it to the search tool, which enhances understanding beyond the schema's minimal description.

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 identifies the tool as retrieving the full text of statutory interpretation cases (법령해석례), specifying the data source (법제처 lawService, target=expc) and components. It distinguishes itself from sibling tools by referencing search_interpretations and get_law_text.

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

Usage Guidelines5/5

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

The description explicitly states when to use the tool (for official interpretations when PIPA article application is uncertain) and provides alternatives: search_interpretations for similar cases and get_law_text for cited provisions.

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/scvcoder/korean-privacy-law-mcp'

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