Skip to main content
Glama

get_batch_alio_regulations

Retrieve up to 20 Korean public institution regulations or articles in a single batch. Specify institution, regulation ID, and optional article for each item to reduce token usage and API calls.

Instructions

[ALIO] 여러 규정/조문 일괄 조회 (최대 20건). 각 항목에 institution+regId+article 지정. 단건 호출 반복보다 토큰/호출 효율적.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYes조회할 규정 목록 (최대 20건)
bodyCharsYes규정당 본문 최대 글자 수 (article 미지정 시 적용, 기본:2000)

Implementation Reference

  • Main handler function for get_batch_alio_regulations. Iterates over up to 20 items, loads the index, finds the institution and regulation, reads markdown content, optionally filters by article, and returns batch results as text.
    export async function getBatchAlioRegulations(
      _api: LawApiClient,
      input: GetBatchAlioRegulationsInput
    ): Promise<ToolResponse> {
      try {
        const idx = await loadIndex()
    
        const sections: string[] = []
        let okCount = 0
        let errCount = 0
    
        for (const item of input.items) {
          const block: string[] = []
          const inst = findInstitution(idx, item.institution)
          if (!inst) {
            block.push(`## ❌ ${item.institution}`)
            block.push(`> 기관을 찾을 수 없습니다.`)
            sections.push(block.join("\n"))
            errCount++
            continue
          }
          const manifest = idx.manifests.get(inst.apbaId)
          const entry = manifest?.regulations.find((r) =>
            item.regId ? r.regId === item.regId : item.title ? r.title.includes(item.title) : false
          )
          if (!entry) {
            block.push(`## ❌ [${inst.apbaId}] ${inst.apbaNa}`)
            block.push(`> 규정을 찾을 수 없습니다 (${item.regId || item.title}).`)
            sections.push(block.join("\n"))
            errCount++
            continue
          }
          const md = await readRegulationMd(inst.apbaId, entry.regId)
          if (!md) {
            block.push(`## ⚠️ [${inst.apbaId}] ${inst.apbaNa} — ${entry.title}`)
            block.push(`> 본문 파일 없음`)
            sections.push(block.join("\n"))
            errCount++
            continue
          }
    
          block.push(`## [${inst.apbaId}] ${inst.apbaNa} — ${entry.title} (regId=${entry.regId})`)
          if (item.article) {
            const target = articleKey(item.article)
            const arts = splitArticles(md)
            const hit = arts.find((s) => articleKey(s.heading) === target)
            if (hit) {
              block.push(`### ${hit.heading}`)
              block.push("")
              block.push(hit.body.trim())
            } else {
              block.push(`> ⚠️ '${item.article}' 조문 없음`)
            }
          } else {
            const body = md.length > input.bodyChars ? md.slice(0, input.bodyChars) + "\n\n... (이하 생략)" : md
            block.push(body)
          }
          sections.push(block.join("\n"))
          okCount++
        }
    
        const header = `# 일괄 조회 — ${input.items.length}건 (성공 ${okCount} / 실패 ${errCount})\n\n`
        const merged = header + sections.join("\n\n---\n\n")
        return { content: [{ type: "text", text: truncateResponse(merged) }] }
      } catch (err) {
        return formatToolError(err, "get_batch_alio_regulations")
      }
    }
  • Zod schemas: ItemSchema (institution + optional regId/title/article) and GetBatchAlioRegulationsSchema (array of 1-20 items + bodyChars limit). Validates input for the batch regulations tool.
    const ItemSchema = z.object({
      institution: z.string().describe("기관코드 또는 기관명"),
      regId: z.string().optional(),
      title: z.string().optional().describe("regId 대신 사용 가능"),
      article: z.string().optional().describe("특정 조문만 (예: '제15조'). 생략 시 전체 본문"),
    })
    
    export const GetBatchAlioRegulationsSchema = z.object({
      items: z.array(ItemSchema).min(1).max(20).describe("조회할 규정 목록 (최대 20건)"),
      bodyChars: z
        .number()
        .min(200)
        .max(10000)
        .default(2000)
        .describe("규정당 본문 최대 글자 수 (article 미지정 시 적용, 기본:2000)"),
    })
  • Registration entry in tool registry. Maps the name 'get_batch_alio_regulations' to GetBatchAlioRegulationsSchema and getBatchAlioRegulations handler.
    {
      name: "get_batch_alio_regulations",
      description: "[ALIO] 여러 규정/조문 일괄 조회 (최대 20건). 각 항목에 institution+regId+article 지정. 단건 호출 반복보다 토큰/호출 효율적.",
      schema: GetBatchAlioRegulationsSchema,
      handler: getBatchAlioRegulations
    },
  • Import statement for getBatchAlioRegulations and GetBatchAlioRegulationsSchema from the batch-regulations module.
    import { getBatchAlioRegulations, GetBatchAlioRegulationsSchema } from "./tools/alio/batch-regulations.js"
  • Helper function articleKey used to normalize article heading strings by removing whitespace and parenthetical content for matching.
          const manifest = idx.manifests.get(inst.apbaId)
          const entry = manifest?.regulations.find((r) =>
            item.regId ? r.regId === item.regId : item.title ? r.title.includes(item.title) : false
          )
          if (!entry) {
            block.push(`## ❌ [${inst.apbaId}] ${inst.apbaNa}`)
            block.push(`> 규정을 찾을 수 없습니다 (${item.regId || item.title}).`)
            sections.push(block.join("\n"))
            errCount++
            continue
          }
          const md = await readRegulationMd(inst.apbaId, entry.regId)
          if (!md) {
            block.push(`## ⚠️ [${inst.apbaId}] ${inst.apbaNa} — ${entry.title}`)
            block.push(`> 본문 파일 없음`)
            sections.push(block.join("\n"))
            errCount++
            continue
          }
    
          block.push(`## [${inst.apbaId}] ${inst.apbaNa} — ${entry.title} (regId=${entry.regId})`)
          if (item.article) {
            const target = articleKey(item.article)
            const arts = splitArticles(md)
            const hit = arts.find((s) => articleKey(s.heading) === target)
            if (hit) {
              block.push(`### ${hit.heading}`)
              block.push("")
              block.push(hit.body.trim())
            } else {
              block.push(`> ⚠️ '${item.article}' 조문 없음`)
            }
          } else {
            const body = md.length > input.bodyChars ? md.slice(0, input.bodyChars) + "\n\n... (이하 생략)" : md
            block.push(body)
          }
          sections.push(block.join("\n"))
          okCount++
        }
    
        const header = `# 일괄 조회 — ${input.items.length}건 (성공 ${okCount} / 실패 ${errCount})\n\n`
        const merged = header + sections.join("\n\n---\n\n")
        return { content: [{ type: "text", text: truncateResponse(merged) }] }
      } catch (err) {
        return formatToolError(err, "get_batch_alio_regulations")
      }
    }
    
    function articleKey(s: string): string {
Behavior2/5

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

No annotations are provided, so the description must carry the full burden. It mentions a limit of 20 items and bodyChars default/min/max, but does not indicate whether the operation is read-only, destructive, or requires special permissions. Safety and side effects are not disclosed.

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-loading the purpose in the first sentence and efficiency in the second. Every sentence provides value without redundancy.

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 complexity of a batch tool with nested items, the description covers the operation's scope and limits (max 20) but does not explain the return format, error handling, or how the response structures multiple results. Without an output schema, more detail would be helpful.

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%, so the description's added value is baseline. It states 'institution+regId+article 지정' but the schema shows only institution as required and article as optional, creating slight ambiguity. It does not clarify the relationship between regId and title or the format of institution.

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 is for batch retrieval of regulations/articles (일괄 조회) with a max of 20 items. It specifies required components per item (institution+regId+article) and highlights efficiency over repeated single calls, distinguishing it from single-regulation tools.

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

Usage Guidelines3/5

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

The description says to use when querying multiple regulations and implies efficiency, but it does not explicitly state when not to use this tool nor compare it to alternatives like get_batch_articles or sequential single calls. It provides some context but lacks exclusion criteria.

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