Skip to main content
Glama

analyze_alio_regulation

Analyze regulation metadata including classification, enactment and revision history, document structure, and table of contents to assess regulatory scope and complexity.

Instructions

[ALIO] 규정 메타(분류/제정/개정) + 구조(조문 수, 별표/별지 수, 본문 길이) + 조문 목차 분석. 깊은 리스크 분석은 본문을 analyze_document 에 전달.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
institutionYes기관코드 또는 기관명
regIdNo
titleNoregId 대신 사용 가능
showTOCYes조문 목차 표시
maxTocItemsYes목차 최대 표시 수

Implementation Reference

  • Main handler function 'analyzeAlioRegulation' that loads the index, finds the institution and regulation, reads markdown, splits articles, computes structure metrics (article count, annex count, form count, table count, line count), builds a metadata + TOC response, and returns it.
    export async function analyzeAlioRegulation(
      _api: LawApiClient,
      input: AnalyzeAlioRegulationInput
    ): Promise<ToolResponse> {
      try {
        const idx = await loadIndex()
        const inst = findInstitution(idx, input.institution)
        if (!inst) {
          return {
            content: [{ type: "text", text: `기관을 찾을 수 없습니다: ${input.institution}` }],
            isError: true,
          }
        }
        const manifest = idx.manifests.get(inst.apbaId)
        const entry = manifest?.regulations.find((r) =>
          input.regId ? r.regId === input.regId : input.title ? r.title.includes(input.title) : false
        )
        if (!entry) {
          return {
            content: [{ type: "text", text: `규정을 찾을 수 없습니다.` }],
            isError: true,
          }
        }
        const md = await readRegulationMd(inst.apbaId, entry.regId)
        if (!md) {
          return {
            content: [{ type: "text", text: `본문 파일 없음 (parseError: ${entry.parseError ?? "(없음)"})` }],
            isError: true,
          }
        }
    
        const articles = splitArticles(md)
        const annexCount = (md.match(/\[\s*별\s*표\s*\d*\s*\]/g) || []).length
        const formCount = (md.match(/\[\s*별\s*지\s*\d*\s*\]/g) || []).length
        const tableCount = (md.match(/^\|.*\|.*$/gm) || []).length // markdown 표 행
        const lineCount = md.split("\n").length
    
        const lines: string[] = []
        lines.push(`# 규정 분석 — [${inst.apbaId}] ${inst.apbaNa}`)
        lines.push("")
        lines.push("## 메타")
        lines.push(`- 규정명: ${entry.title}`)
        lines.push(`- regId: ${entry.regId}`)
        lines.push(`- 분류: ${entry.category ?? "(미분류)"}`)
        lines.push(`- 제정: ${entry.issuedAt ?? "(미상)"} | 최근 개정: ${entry.revisedAt ?? "(미상)"}`)
        lines.push(`- 개정 이력: ${entry.revisions?.length ?? 0}회`)
        lines.push(`- 원본 파일: ${entry.primaryFileName ?? "(이름 없음)"} (${entry.fileType ?? "?"})`)
        if (entry.fallbackParser) {
          lines.push(`- ⚠️ OCR 변환: ${entry.fallbackParser} (정확도 한계 가능)`)
        }
        lines.push("")
        lines.push("## 구조")
        lines.push(`- 본문 라인 수: ${lineCount.toLocaleString()}`)
        lines.push(`- 본문 길이: ${md.length.toLocaleString()}자`)
        lines.push(`- 조문 수: ${articles.length}개`)
        lines.push(`- 별표: ${annexCount}건`)
        lines.push(`- 별지/서식: ${formCount}건`)
        lines.push(`- 마크다운 표 행: ${tableCount}행`)
    
        if (input.showTOC && articles.length > 0) {
          lines.push("")
          lines.push(`## 조문 목차 (top ${Math.min(input.maxTocItems, articles.length)})`)
          const topArts = articles.slice(0, input.maxTocItems)
          for (const a of topArts) {
            lines.push(`- ${a.heading}`)
          }
          if (articles.length > input.maxTocItems) {
            lines.push(`- ... (총 ${articles.length}개 중 ${input.maxTocItems}개 표시)`)
          }
        }
    
        lines.push("")
        lines.push("> 💡 깊은 리스크/금액/조항 충돌 분석은 본문을 `analyze_document` 도구에 전달.")
    
        return { content: [{ type: "text", text: truncateResponse(lines.join("\n")) }] }
      } catch (err) {
        return formatToolError(err, "analyze_alio_regulation")
      }
    }
  • Zod schema 'AnalyzeAlioRegulationSchema' defining input: institution (required), regId or title (one required), showTOC (bool, default true), maxTocItems (5-100, default 30).
    export const AnalyzeAlioRegulationSchema = z
      .object({
        institution: z.string().describe("기관코드 또는 기관명"),
        regId: z.string().optional(),
        title: z.string().optional().describe("regId 대신 사용 가능"),
        showTOC: z.boolean().default(true).describe("조문 목차 표시"),
        maxTocItems: z.number().min(5).max(100).default(30).describe("목차 최대 표시 수"),
      })
      .refine((v) => !!(v.regId || v.title), {
        message: "regId 또는 title 중 하나는 필수",
        path: ["regId"],
      })
  • Registration of the 'analyze_alio_regulation' tool in the MCP tool registry with name, description, schema (AnalyzeAlioRegulationSchema) and handler (analyzeAlioRegulation).
    {
      name: "analyze_alio_regulation",
      description: "[ALIO] 규정 메타(분류/제정/개정) + 구조(조문 수, 별표/별지 수, 본문 길이) + 조문 목차 분석. 깊은 리스크 분석은 본문을 analyze_document 에 전달.",
      schema: AnalyzeAlioRegulationSchema,
      handler: analyzeAlioRegulation
    },
  • Imports used by the handler: loadIndex, findInstitution, readRegulationMd (index-loader.ts), splitArticles (compare.ts), truncateResponse, formatToolError.
    import { z } from "zod"
    import type { LawApiClient } from "../../lib/api-client.js"
    import { findInstitution, loadIndex, readRegulationMd } from "../../lib/alio/index-loader.js"
    import { splitArticles } from "../../lib/alio/compare.js"
    import { truncateResponse } from "../../lib/schemas.js"
Behavior2/5

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

No annotations are provided, so the description bears full responsibility for behavioral disclosure. It only states what the tool does without mentioning side effects, idempotency, authentication needs, or output format, leaving significant 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 two sentences, front-loaded with the core functionality, and wastes no words. Every sentence contributes purpose and usage guidance.

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

Completeness3/5

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

Given the tool's complexity (5 parameters, many siblings), the description is somewhat lacking. It covers core purpose and one alternative but omits output details, prerequisites, and broader usage context, making it minimally adequate.

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 high (80%), so baseline is 3. The description adds context for 'showTOC' and 'maxTocItems' by tying them to the TOC analysis, but does not clarify 'regId' (undocumented in schema) or add meaning beyond the schema for other parameters.

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 analyzes regulation metadata, structure, and table of contents for ALIO regulations. It distinguishes itself from 'analyze_document' for deep risk analysis, making the purpose specific and unambiguous.

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 deep risk analysis to 'analyze_document', providing a clear when-not-to-use scenario. However, it does not elaborate on when to prefer this tool over other siblings like 'get_alio_regulation' or 'analyze_regulation_delegation'.

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/workbookbulb863/korean-law-alio-mcp'

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