Skip to main content
Glama
scvcoder

korean-privacy-law-mcp

by scvcoder

get_intelligent_related_laws

Retrieve AI-recommended legal clauses semantically related to your keyword. Get a list of clause titles for broader meaning matching.

Instructions

AI 연관법령 조문 (법제처 lawSearch · target=aiRltLs). 키워드와 의미적으로 연관된 조문 list를 AI가 추천. intelligent_law_search보다 폭넓은 의미 매칭 (본문 직접 매칭 X, AI가 추천한 조문 제목 list). 다음: get_law_text(lawId)로 추천 조문의 전체 본문 조회.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes키워드. AI가 의미적으로 연관된 법령 조문 추천 (intelligent_law_search보다 폭넓은 의미 매칭).
searchNo검색범위: 0=법령조문 (기본), 1=행정규칙조문0
displayNo결과 개수 (기본 20)

Implementation Reference

  • The async handler that executes the tool logic: calls lawSearch.do with target=aiRltLs, parses XML, groups results by law, formats text output, and appends suggestions.
    async handler(args, client) {
      try {
        const xml = await client.fetchApi({
          endpoint: "lawSearch.do",
          target: "aiRltLs",
          extraParams: {
            query: args.query,
            search: args.search,
            display: String(args.display),
          },
        });
    
        const result = parseSearchXML<RelatedItem>(
          xml,
          "aiRltLsSearch",
          "법령조문",
          (itemXml) => ({
            법령ID: extractTag(itemXml, "법령ID"),
            법령명: extractTag(itemXml, "법령명"),
            시행일자: extractTag(itemXml, "시행일자"),
            공포일자: extractTag(itemXml, "공포일자"),
            조문번호: extractTag(itemXml, "조문번호"),
            조문가지번호: extractTag(itemXml, "조문가지번호"),
            조문제목: extractTag(itemXml, "조문제목"),
          }),
          // aiSearch와 동일 quirk — totalCnt 대신 검색결과개수
          { totalCntTag: "검색결과개수" }
        );
    
        if (result.totalCnt === 0) {
          return notFoundResponse(
            `AI 연관법령 결과 없음: "${args.query}" (search=${args.search})`,
            [
              `intelligent_law_search(query="${args.query}") — 본문 직접 매칭`,
              `search_law(query="${args.query}") — 법령명 검색`,
            ]
          );
        }
    
        let text = `AI 연관법령 — "${args.query}" (${args.search === "0" ? "법령조문" : "행정규칙조문"})\n`;
        text += `총 ${result.totalCnt}건\n\n`;
    
        // 법령별 그룹핑 (같은 법령에 여러 조문 매칭 시 중복 노출 방지)
        const grouped = new Map<string, RelatedItem[]>();
        for (const item of result.items) {
          const key = item.법령ID ?? "unknown";
          const list = grouped.get(key) ?? [];
          list.push(item);
          grouped.set(key, list);
        }
    
        for (const [, items] of grouped) {
          const first = items[0]!;
          text += `[${first.법령명 ?? "(법령명 없음)"}] (lawId=${first.법령ID ?? "-"})\n`;
          if (first.시행일자) text += `  시행: ${first.시행일자}\n`;
          for (const item of items) {
            const num = item.조문번호 ? parseInt(item.조문번호, 10) : null;
            const branch =
              item.조문가지번호 && item.조문가지번호 !== "00"
                ? `의${parseInt(item.조문가지번호, 10)}`
                : "";
            if (num !== null) {
              text += `  - 제${num}조${branch}`;
              if (item.조문제목) text += ` (${item.조문제목})`;
              text += "\n";
            }
          }
          text += "\n";
        }
    
        const firstItem = result.items[0];
        if (firstItem?.법령ID) {
          text = appendSuggestions(text, [
            {
              tool: "get_law_text",
              args: { lawId: firstItem.법령ID },
              reason: `${firstItem.법령명 ?? "추천 법령"} 전체 본문`,
            },
            {
              tool: "intelligent_law_search",
              args: { query: args.query },
              reason: "본문 직접 매칭 (조문 내용 포함)",
            },
          ]);
          if (firstItem.법령ID) {
            text += `\n📎 출처: AI 연관법령 — 첫 결과 ${lawDetailUrl(firstItem.법령ID)}`;
          }
        }
    
        return { content: [{ type: "text", text }] };
      } catch (err) {
        return formatToolError(err, "get_intelligent_related_laws");
      }
    },
  • Input schema defining query (string, min 1), search (enum '0'/'1', default '0'), and display (int 1-100, default 20).
    const inputSchema = z.object({
      query: z
        .string()
        .min(1)
        .describe(
          "키워드. AI가 의미적으로 연관된 법령 조문 추천 (intelligent_law_search보다 폭넓은 의미 매칭)."
        ),
      search: z
        .enum(["0", "1"])
        .default("0")
        .describe("검색범위: 0=법령조문 (기본), 1=행정규칙조문"),
      display: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(20)
        .describe("결과 개수 (기본 20)"),
    });
  • Tool registration: getIntelligentRelatedLaws is imported and included in ALL_TOOLS array at line 80.
      getIntelligentRelatedLaws,
      // W2 — terminology primitives
      getLegalTerm,
      getTermArticles,
      getLawAbbreviations,
      // W2.5 — navigation
      getLawTree,
      // W3 — Layer C RAG corpus (PIPC 가이드 + 상담사례, BM25 인덱스)
      searchPrivacyCorpus,
      searchPrivacyCases,
      searchPrivacyGuides,
      // W3 — Layer B+ hints (PIPC 공식 출처 인덱스화)
      getSectoralRelatedLaws,
      getPipcCuratedCorpus,
      // W4 — Validator
      verifyPipaCitation,
    ];
  • Import statement for getIntelligentRelatedLaws from the primitives module.
    import { getIntelligentRelatedLaws } from "./primitives/get-intelligent-related-laws.js";
  • The RelatedItem interface used for parsing XML response items (법령ID, 법령명, 시행일자, etc.).
    interface RelatedItem {
      법령ID?: string;
      법령명?: string;
      시행일자?: string;
      공포일자?: string;
      조문번호?: string;
      조문가지번호?: string;
      조문제목?: string;
    }
Behavior3/5

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

The description discloses that the tool returns AI-recommended article titles (not full text) and compares matching scope with a sibling. With no annotations, it partially describes behavior but lacks details on AI variability, latency, or reliability.

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 (2-3 sentences), front-loaded with the primary action, and includes a clear next step. No superfluous content, earning a high score.

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?

Without an output schema, the description adequately indicates it returns a list of article titles and suggests a follow-up tool. It covers the tool's purpose and usage flow but lacks output format details (e.g., structure, pagination). For the complexity level, it is reasonably complete.

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 coverage is 100%, and parameter descriptions in the schema already explain each field. The description adds no significant new semantic meaning beyond restating the tool's purpose and a follow-up step, so baseline 3 is appropriate.

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 it retrieves AI-recommended related law clauses list based on semantic keyword matching. It distinguishes itself from the sibling tool 'intelligent_law_search' by noting broader semantic matching and that it matches article titles, not full text.

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?

The description explicitly recommends using 'get_law_text(lawId)' to retrieve full text of recommended articles, providing a clear follow-up step. It implies when to use this tool versus 'intelligent_law_search' but does not explicitly state exclusions or alternatives for other scenarios.

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