Skip to main content
Glama
scvcoder

korean-privacy-law-mcp

by scvcoder

intelligent_law_search

Search Korean privacy law provisions by semantic meaning, not just titles. Enter natural language keywords to find relevant articles and appendices across statutes and administrative rules.

Instructions

지능형 법령 검색 (법제처 lawSearch · target=aiSearch). 법령명이 아니라 조문 본문·내용에서 의미 기반 검색. search_law는 법령명만 매칭하지만 이 도구는 조문 텍스트까지 검색 — 처리행위·키워드로 조문 발견. search 파라미터로 도메인 선택 (법령 조문/별표, 행정규칙 조문/별표). 다음: get_law_text(mst)로 해당 법령 전체 본문 조회.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes자연어 검색 키워드. 법령명이 아니라 조문 본문·내용에서 검색. 예: '동의 없이 처리'
searchNo검색 도메인: 0=법령 조문 (기본), 1=법령 별표·서식, 2=행정규칙 조문, 3=행정규칙 별표·서식0
displayNo결과 개수 (기본 20)
pageNo페이지 번호 (기본 1)

Implementation Reference

  • Main handler function that calls lawSearch.do with aiSearch target, parses XML results, formats output with article details, and appends follow-up suggestions.
      async handler(args, client) {
        try {
          const itemTag = ITEM_TAG_BY_SEARCH[args.search] ?? "법령조문";
          const xml = await client.fetchApi({
            endpoint: "lawSearch.do",
            target: "aiSearch",
            extraParams: {
              query: args.query,
              search: args.search,
              display: String(args.display),
              page: String(args.page),
            },
          });
    
          const result = parseSearchXML<AiSearchItem>(
            xml,
            "aiSearch",
            itemTag,
            (itemXml) => ({
              법령ID: extractTag(itemXml, "법령ID"),
              법령명: extractTag(itemXml, "법령명"),
              법령종류명: extractTag(itemXml, "법령종류명"),
              소관부처명: extractTag(itemXml, "소관부처명"),
              조문번호: extractTag(itemXml, "조문번호"),
              조문가지번호: extractTag(itemXml, "조문가지번호"),
              조문제목: extractTag(itemXml, "조문제목"),
              조문내용: extractTag(itemXml, "조문내용"),
              시행일자: extractTag(itemXml, "시행일자"),
            }),
            // aiSearch endpoint quirk — totalCnt 대신 검색결과개수 사용
            { totalCntTag: "검색결과개수" }
          );
    
          if (result.totalCnt === 0) {
            return notFoundResponse(
              `의미 검색 결과 없음: "${args.query}" (search=${args.search})`,
              [
                `search_law(query="${args.query}") — 법령명 직접 검색`,
                `intelligent_law_search(query="${args.query}", search="2") — 행정규칙 조문 영역도 시도`,
              ]
            );
          }
    
          let text = `의미 검색 결과 — "${args.query}" (도메인: ${itemTag})\n`;
          text += `총 ${result.totalCnt}건 중 ${result.items.length}건 표시 (페이지 ${result.page})\n\n`;
    
          for (const item of result.items) {
            const lawName = item.법령명 ?? "(법령명 없음)";
            const articleNum = item.조문번호
              ? `제${item.조문번호}조${item.조문가지번호 ? `의${item.조문가지번호}` : ""}`
              : "";
            text += `[${item.법령ID ?? "-"}] ${lawName} ${articleNum}`;
            if (item.조문제목) text += ` — ${item.조문제목}`;
            text += "\n";
            if (item.법령종류명) text += `  종류: ${item.법령종류명}\n`;
            if (item.소관부처명) text += `  소관: ${item.소관부처명}\n`;
            if (item.시행일자) text += `  시행: ${item.시행일자}\n`;
            if (item.조문내용) {
              const snippet = item.조문내용.trim().slice(0, 200);
              text += `  내용: ${snippet}${item.조문내용.length > 200 ? "..." : ""}\n`;
            }
            text += "\n";
          }
    
          const firstItem = result.items[0];
          if (firstItem?.법령ID) {
            text = appendSuggestions(text, [
              {
                tool: "get_law_text",
                args: { lawId: firstItem.법령ID },
                reason: `${firstItem.법령명 ?? ""} 전체 본문 조회`,
              },
            ]);
          }
          if (firstItem?.법령명) {
            text += `\n${formatLawAttribution(firstItem.법령명)}`;
          }
    
          return { content: [{ type: "text", text }] };
        } catch (err) {
          return formatToolError(err, "intelligent_law_search");
        }
      },
    };
  • Zod input schema defining query (string, min 1), search (enum '0'-'3' default '0'), display (1-100, default 20), page (int, default 1).
    const inputSchema = z.object({
      query: z
        .string()
        .min(1)
        .describe(
          "자연어 검색 키워드. 법령명이 아니라 조문 본문·내용에서 검색. 예: '동의 없이 처리'"
        ),
      search: z
        .enum(["0", "1", "2", "3"])
        .default("0")
        .describe(
          "검색 도메인: 0=법령 조문 (기본), 1=법령 별표·서식, 2=행정규칙 조문, 3=행정규칙 별표·서식"
        ),
      display: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(20)
        .describe("결과 개수 (기본 20)"),
      page: z.number().int().min(1).default(1).describe("페이지 번호 (기본 1)"),
    });
  • Tool definition object with name 'intelligent_law_search', description, inputSchema, and handler.
    export const intelligentLawSearch: Tool<typeof inputSchema> = {
      name: "intelligent_law_search",
      description:
        "지능형 법령 검색 (법제처 lawSearch · target=aiSearch). 법령명이 아니라 조문 본문·내용에서 의미 기반 검색. " +
        "search_law는 법령명만 매칭하지만 이 도구는 조문 텍스트까지 검색 — 처리행위·키워드로 조문 발견. " +
        "search 파라미터로 도메인 선택 (법령 조문/별표, 행정규칙 조문/별표). " +
        "다음: get_law_text(mst)로 해당 법령 전체 본문 조회.",
      inputSchema,
  • Import of intelligentLawSearch from primitives module.
    import { intelligentLawSearch } from "./primitives/intelligent-law-search.js";
    import { getRelatedLaws } from "./primitives/get-related-laws.js";
    import { getAnnexes } from "./primitives/get-annexes.js";
    import { searchAdminRule } from "./primitives/search-admin-rule.js";
    import { searchPipcDecisions } from "./primitives/search-pipc-decisions.js";
    import { searchConstitutionalDecisions } from "./primitives/search-constitutional-decisions.js";
    import { searchAdminAppeals } from "./primitives/search-admin-appeals.js";
    import { searchInterpretations } from "./primitives/search-interpretations.js";
    import { searchEnglishLaw } from "./primitives/search-english-law.js";
    import { getAdminRuleText } from "./primitives/get-admin-rule-text.js";
    import { getPipcDecisionText } from "./primitives/get-pipc-decision-text.js";
    import { getConstitutionalDecisionText } from "./primitives/get-constitutional-decision-text.js";
    import { getAdminAppealText } from "./primitives/get-admin-appeal-text.js";
    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,
  • Registration of intelligentLawSearch in the ALL_TOOLS array so it is exposed to the MCP server.
    intelligentLawSearch,
Behavior4/5

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

Describes the search domain parameter and semantic nature, but no annotations exist. Could mention limitations or pagination behavior, but current description is adequate for a search tool.

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?

Concise, front-loaded with purpose and differentiation. No unnecessary words, each sentence adds value.

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?

Completeness covers purpose, usage, parameter meaning, and next steps. No output schema, but return values are implied. Slightly more could be said about result format, but sufficient.

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?

Schema coverage is 100%, but description adds semantic context: explains query is natural language, interprets enum values for search parameter, and notes defaults for display and page.

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?

Description explicitly states it searches semantically in article text, not law names, and distinguishes from search_law which only matches law names. Example provided for clarity.

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?

Clearly indicates when to use (when searching by article content) and when not to use (use search_law for law names). Also suggests next step tool get_law_text for viewing full text.

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