Skip to main content
Glama
scvcoder

korean-privacy-law-mcp

by scvcoder

get_admin_rule_text

Retrieves the full text of Korean administrative rules (notices, directives, regulations) using a serial number from a prior search. Enables direct access to PIPC safety measures and processing guidelines.

Instructions

행정규칙 본문 조회 (법제처 lawService · target=admrul). 고시·훈령·예규의 전문. search_admin_rule이 반환한 mst(행정규칙일련번호) 사용. PIPC 안전성 확보조치 기준·표준 처리지침·가명정보 결합 고시 등 직접 조회. 다음: compare_admin_rule_old_new(W2.4)로 신구법 비교.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mstYes행정규칙일련번호 (search_admin_rule 결과의 mst=N). 주의: 행정규칙ID(짧은 번호)와 다름 — 본문 조회는 일련번호만 작동.

Implementation Reference

  • Main tool definition with schema, description, and async handler. The handler calls lawService.do with target=admrul, parses the JSON response, formats the admin rule text from basic info and article contents, appends suggestions for further actions, and returns the result.
    export const getAdminRuleText: Tool<typeof inputSchema> = {
      name: "get_admin_rule_text",
      description:
        "행정규칙 본문 조회 (법제처 lawService · target=admrul). 고시·훈령·예규의 전문. " +
        "search_admin_rule이 반환한 mst(행정규칙일련번호) 사용. " +
        "PIPC 안전성 확보조치 기준·표준 처리지침·가명정보 결합 고시 등 직접 조회. " +
        "다음: compare_admin_rule_old_new(W2.4)로 신구법 비교.",
      inputSchema,
    
      async handler(args, client) {
        try {
          const jsonText = await client.fetchApi({
            endpoint: "lawService.do",
            target: "admrul",
            type: "JSON",
            extraParams: { ID: args.mst },
          });
    
          let parsed: { AdmRulService?: AdminRuleService; Law?: string };
          try {
            parsed = JSON.parse(jsonText);
          } catch {
            return notFoundResponse(`행정규칙 본문 응답 파싱 실패 (mst=${args.mst})`, [
              `search_admin_rule(query="...") — 유효한 mst 확인`,
            ]);
          }
    
          // API가 매칭 실패 시 {"Law": "일치하는 행정규칙이 없습니다 ..."} 반환
          if (parsed.Law && typeof parsed.Law === "string") {
            return notFoundResponse(`행정규칙 없음: ${parsed.Law}`, [
              `search_admin_rule(query="...") — 유효한 mst 확인`,
            ]);
          }
    
          const service = parsed.AdmRulService;
          if (!service) {
            return notFoundResponse(`행정규칙 데이터 없음 (mst=${args.mst})`, [
              `search_admin_rule(query="...") — 유효한 mst 확인`,
            ]);
          }
    
          const info = service.행정규칙기본정보 ?? {};
          const ruleName = info.행정규칙명 ?? "(이름 없음)";
          const ruleKind = info.행정규칙종류 ?? "행정규칙";
    
          let text = `=== ${ruleName} ===\n`;
          text += `종류: ${ruleKind}`;
          if (info.제개정구분명) text += ` · ${info.제개정구분명}`;
          if (info.현행여부 === "Y") text += " · 현행";
          else if (info.현행여부) text += ` · ${info.현행여부}`;
          text += "\n";
          if (info.소관부처명) text += `소관: ${info.소관부처명}\n`;
          if (info.담당부서기관명) text += `담당: ${info.담당부서기관명}\n`;
          if (info.발령일자) text += `발령: ${info.발령일자}`;
          if (info.발령번호) text += ` (${info.발령번호})`;
          if (info.발령일자) text += "\n";
          if (info.시행일자) text += `시행: ${info.시행일자}\n`;
          text += "\n";
    
          const articleLines = asArray(service.조문내용).filter(
            (s): s is string => typeof s === "string"
          );
    
          if (articleLines.length === 0) {
            text += "(조문 데이터 없음)\n";
          } else {
            text += `조문 (총 ${articleLines.length}개 항목):\n\n`;
            const headerStart = text.length;
            for (let i = 0; i < articleLines.length; i++) {
              const line = articleLines[i]!;
              text += `${line}\n\n`;
              if (text.length - headerStart > MAX_BODY_CHARS) {
                const remaining = articleLines.length - i - 1;
                if (remaining > 0) {
                  text += `⋯ ${remaining}개 항목 생략 (12,000자 한도) ⋯\n`;
                }
                break;
              }
            }
          }
    
          // 별표·부칙 메타
          const annexes = asArray(service.별표);
          if (annexes.length) text += `\n[별표] ${annexes.length}건 (별도 조회)\n`;
          const supplementary = asArray(service.부칙);
          if (supplementary.length) text += `[부칙] ${supplementary.length}건\n`;
    
          text = appendSuggestions(text, [
            {
              tool: "compare_admin_rule_old_new",
              args: { mst: args.mst },
              reason: "신구법 비교 (개정 추적, W2.4)",
            },
          ]);
          // args.mst = 행정규칙일련번호 (admRulSeq와 호환)
          text += `\n${formatAdminRuleAttribution(ruleName, args.mst)}`;
    
          return { content: [{ type: "text", text }] };
        } catch (err) {
          return formatToolError(err, "get_admin_rule_text");
        }
      },
    };
  • Input schema using Zod: requires a single 'mst' (min length 1) — the administrative rule serial number from search_admin_rule results.
    const inputSchema = z.object({
      mst: z
        .string()
        .min(1)
        .describe(
          "행정규칙일련번호 (search_admin_rule 결과의 mst=N). " +
            "주의: 행정규칙ID(짧은 번호)와 다름 — 본문 조회는 일련번호만 작동."
        ),
    });
  • AdminRuleBasicInfo interface defining the shape of administrative rule metadata fields (name, kind, department, dates, status, etc.).
    interface AdminRuleBasicInfo {
      행정규칙명?: string;
      행정규칙종류?: string;
      소관부처명?: string;
      발령일자?: string;
      발령번호?: string;
      시행일자?: string;
      현행여부?: string;
      제개정구분명?: string;
      행정규칙ID?: string;
      행정규칙일련번호?: string;
      담당부서기관명?: string;
    }
  • AdminRuleService interface wrapping the basic info, article content, annexes, and supplementary provisions from the API response.
    interface AdminRuleService {
      행정규칙기본정보?: AdminRuleBasicInfo;
      조문내용?: string | string[];
      별표?: unknown;
      부칙?: unknown;
    }
  • Import of getAdminRuleText from the get-admin-rule-text.ts primitive.
    import { getAdminRuleText } from "./primitives/get-admin-rule-text.js";
Behavior3/5

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

No annotations are provided, so the description must disclose behavioral traits. It indicates a read operation (조회) and provides parameter clarification, but does not mention authentication, rate limits, or side effects. The detailed parameter description compensates partially.

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 extremely concise with two sentences and a brief note about the next step. It is front-loaded with the core purpose and immediately useful guidance.

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?

For a single-parameter tool with no output schema, the description fully covers purpose, parameter usage, and downstream action. It is complete and leaves no ambiguity.

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

Parameters5/5

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

The input schema already provides a thorough description for the mst parameter, and the description adds context by explaining its origin (from search_admin_rule) and differentiating it from a short ID. Schema description coverage is 100%, and the description adds value.

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's purpose as retrieving the full text of administrative rules, using the mst serial number from search_admin_rule. It distinguishes itself from siblings like compare_admin_rule_old_new by specifying its function.

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 directs users to use the mst returned by search_admin_rule and suggests the next action (compare_admin_rule_old_new). However, it does not explicitly state when not to use the tool, though the context is clear.

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