Skip to main content
Glama

search_admin_rule

Search Korean administrative rules including instructions, regulations, notices, and guidelines. Filter results by rule type using the knd parameter.

Instructions

[행정규칙] 훈령/예규/고시/지침 검색. knd 파라미터로 종류 필터 가능(1=훈령, 2=예규, 3=고시).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes검색할 행정규칙명
kndNo행정규칙 종류 (1=훈령, 2=예규, 3=고시, 4=공고, 5=일반)
displayYes최대 결과 개수
apiKeyNo법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달

Implementation Reference

  • Main handler function for the search_admin_rule tool. Accepts query, optional knd (type filter), display count, and apiKey. Calls the API client to search administrative rules, parses XML response, and formats results.
    export async function searchAdminRule(
      apiClient: LawApiClient,
      input: SearchAdminRuleInput
    ): Promise<{ content: Array<{ type: string, text: string }>, isError?: boolean }> {
      try {
        const xmlText = await apiClient.searchAdminRule({
          query: input.query,
          knd: input.knd,
          apiKey: input.apiKey
        })
    
        const parser = new DOMParser()
        const doc = parser.parseFromString(xmlText, "text/xml")
    
        const rules = doc.getElementsByTagName("admrul")
    
        if (rules.length === 0) {
          let errorMsg = "검색 결과가 없습니다."
          errorMsg += `\n\n💡 개선 방법:`
          errorMsg += `\n   1. 단순 키워드 사용:`
          const words = input.query.split(/\s+/)
          if (words.length > 1) {
            errorMsg += `\n      search_admin_rule(query="${words[0]}")`
          }
          errorMsg += `\n\n   2. 상위 법령명 검색:`
          errorMsg += `\n      search_law(query="관련 법령명")`
          errorMsg += `\n\n   3. 광범위 검색:`
          errorMsg += `\n      search_all(query="${words[0] || input.query}")`
    
          return {
            content: [{
              type: "text",
              text: errorMsg
            }],
            isError: true
          }
        }
    
        let resultText = `행정규칙 검색 결과 (총 ${rules.length}건):\n\n`
    
        const display = Math.min(rules.length, input.display)
    
        for (let i = 0; i < display; i++) {
          const rule = rules[i]
    
          const ruleName = rule.getElementsByTagName("행정규칙명")[0]?.textContent || "알 수 없음"
          const ruleSeq = rule.getElementsByTagName("행정규칙일련번호")[0]?.textContent || ""
          const ruleId = rule.getElementsByTagName("행정규칙ID")[0]?.textContent || ""
          const promDate = rule.getElementsByTagName("발령일자")[0]?.textContent || ""
          const ruleType = rule.getElementsByTagName("행정규칙종류")[0]?.textContent || ""
          const orgName = rule.getElementsByTagName("소관부처명")[0]?.textContent || ""
    
          resultText += `${i + 1}. ${ruleName}\n`
          resultText += `   - 행정규칙일련번호: ${ruleSeq}\n`
          resultText += `   - 행정규칙ID: ${ruleId}\n`
          resultText += `   - 공포일: ${promDate}\n`
          resultText += `   - 구분: ${ruleType}\n`
          resultText += `   - 소관부처: ${orgName}\n\n`
        }
    
        resultText += `\n💡 상세 내용을 조회하려면 get_admin_rule Tool을 사용하세요.`
    
        return {
          content: [{
            type: "text",
            text: truncateResponse(resultText)
          }]
        }
      } catch (error) {
        return formatToolError(error, "search_admin_rule")
      }
    }
  • Zod schema for search_admin_rule input validation: query (string, required), knd (optional string for rule type filter 1-5), display (optional number, default 20), apiKey (optional string).
    export const SearchAdminRuleSchema = z.object({
      query: z.string().describe("검색할 행정규칙명"),
      knd: z.string().optional().describe("행정규칙 종류 (1=훈령, 2=예규, 3=고시, 4=공고, 5=일반)"),
      display: z.number().optional().default(20).describe("최대 결과 개수"),
      apiKey: z.string().optional().describe("법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달")
    })
  • Registers search_admin_rule in the MCP tool registry with name, description, schema (SearchAdminRuleSchema), and handler (searchAdminRule function).
    {
      name: "search_admin_rule",
      description: "[행정규칙] 훈령/예규/고시/지침 검색. knd 파라미터로 종류 필터 가능(1=훈령, 2=예규, 3=고시).",
      schema: SearchAdminRuleSchema,
      handler: searchAdminRule
    },
  • API client method that builds the URL and calls lawSearch.do with target=admrul to search administrative rules from the National Law Information Center API.
    /**
     * 행정규칙 검색
     */
    async searchAdminRule(params: {
      query: string
      knd?: string
      apiKey?: string
    }): Promise<string> {
      const apiParams = new URLSearchParams({
        OC: this.getApiKey(params.apiKey),
        type: "XML",
        target: "admrul",
        query: params.query,
      })
    
      if (params.knd) apiParams.append("knd", params.knd)
    
      const url = `${LAW_API_BASE}/lawSearch.do?${apiParams.toString()}`
      return await this.fetchText(url, "searchAdminRule")
    }
  • Tool chain configuration linking search_admin_rule to get_admin_rule as its detail tool, extracting ID via '행정규칙ID:' regex pattern.
    search_admin_rule: {
      detailTool: "get_admin_rule",
      detailParam: "id",
      idRegex: /행정규칙ID:\s*(\S+)/,  // 행정규칙은 [ID] 형식이 아님
    },
Behavior3/5

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

With no annotations, the description carries the burden of behavioral disclosure. It explains the knd filter and mentions apiKey for authentication, but lacks information on pagination, error handling, or result format.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence in Korean, front-loading the core purpose. It efficiently conveys the main functionality without unnecessary words.

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

Completeness2/5

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

Given no output schema and many sibling search tools, the description lacks details on return type, pagination, ordering, or error conditions. It does not specify what distinguishes this search from similar tools.

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 description coverage is 100%, so the schema already documents all parameters. The description adds some value by listing knd values and clarifying apiKey purpose, but repeats schema content without meaningful enrichment.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly specifies the tool searches for administrative rules (행정규칙) and mentions the knd parameter for filtering by type. This distinguishes it from general search tools. However, it does not contrast with other specific search siblings like search_law or search_ordinance.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus other search tools. The description does not mention prerequisites, limitations, or context for appropriate use.

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