Skip to main content
Glama

get_ordinance

Retrieve the full text of a Korean local ordinance or rule by providing its sequence number.

Instructions

[자치법규] 조례/규칙 전문 조회.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ordinSeqYes자치법규 일련번호
apiKeyNo법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달

Implementation Reference

  • Main handler function for the get_ordinance tool. Fetches ordinance details via API client, parses JSON response, formats output including articles (with TOC for >20 articles), and returns tool response.
    export async function getOrdinance(
      apiClient: LawApiClient,
      input: GetOrdinanceInput
    ): Promise<{ content: Array<{ type: string, text: string }>, isError?: boolean }> {
      try {
        const jsonText = await apiClient.getOrdinance(input.ordinSeq, input.apiKey)
        const json = JSON.parse(jsonText)
    
        const lawService = json?.LawService
    
        if (!lawService) {
          return {
            content: [{
              type: "text",
              text: "자치법규 데이터를 찾을 수 없습니다."
            }],
            isError: true
          }
        }
    
        const ordinance = lawService.자치법규기본정보 || {}
    
        let resultText = `자치법규명: ${ordinance.자치법규명 || "알 수 없음"}\n`
        resultText += `제정일: ${ordinance.공포일자 || ""}\n`
        resultText += `자치단체: ${ordinance.지자체기관명 || ""}\n`
        resultText += `시행일: ${ordinance.시행일자 || ""}\n`
    
        if (ordinance.담당부서명) {
          resultText += `소관부서: ${ordinance.담당부서명}\n`
        }
    
        resultText += `\n━━━━━━━━━━━━━━━━━━━━━━\n\n`
    
        // 조문 내용 (단일 객체 → 배열 정규화)
        const rawArticles = lawService.조문?.조
        const articles = Array.isArray(rawArticles) ? rawArticles : rawArticles ? [rawArticles] : []
    
        if (articles.length > 0) {
          // 대형 조례(20개 초과): TOC 반환 (law-text.ts 패턴)
          if (articles.length > 20) {
            const tocItems: string[] = []
            for (const article of articles) {
              if (article.조제목) tocItems.push(article.조제목)
            }
            resultText += `📋 목차 (총 ${articles.length}개 조문)\n\n`
            resultText += tocItems.join("\n")
            resultText += `\n\n💡 전체 내용이 길어 목차만 표시합니다.`
            resultText += `\n💡 특정 조문 조회: get_law_text(mst="${input.ordinSeq}", jo="제XX조")`
          } else {
            for (const article of articles) {
              if (article.조제목) {
                resultText += `${article.조제목}\n`
              }
              if (article.조내용) {
                resultText += `${cleanHtml(String(article.조내용))}\n\n`
              }
            }
          }
        }
    
        // 상위법령 동적 추천 (조례명 키워드 기반)
        const name = (ordinance.자치법규명 || "").toLowerCase()
        const parentLawHints: string[] = []
        if (/휴직|병가|육아/.test(name)) parentLawHints.push('search_law(query="지방공무원법") → 제63조(휴직)')
        if (/복무|근무/.test(name)) parentLawHints.push('search_law(query="지방공무원법") → 제48조(복무)')
        if (/징계|파면|해임/.test(name)) parentLawHints.push('search_law(query="지방공무원법") → 제69조(징계)')
        if (/수당|급여|보수/.test(name)) parentLawHints.push('search_law(query="지방공무원 보수규정")')
        if (/임용|채용|승진|전보/.test(name)) parentLawHints.push('search_law(query="지방공무원 임용령")')
    
        if (parentLawHints.length > 0) {
          resultText += `\n💡 상위법령 참고:\n`
          parentLawHints.forEach(h => { resultText += `   - ${h}\n` })
        } else {
          resultText += `\n💡 상위법령 확인: search_law 또는 get_related_laws 도구를 사용하세요.`
        }
    
        return {
          content: [{
            type: "text",
            text: truncateResponse(resultText)
          }]
        }
      } catch (error) {
        return formatToolError(error, "get_ordinance")
      }
    }
  • Zod schema defining input parameters for get_ordinance: ordinSeq (required string) and apiKey (optional string).
    export const GetOrdinanceSchema = z.object({
      ordinSeq: z.string().describe("자치법규 일련번호"),
      apiKey: z.string().optional().describe("법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달")
    })
  • Registration of get_ordinance in the MCP tool registry with name, description, schema, and handler references.
    {
      name: "get_ordinance",
      description: "[자치법규] 조례/규칙 전문 조회.",
      schema: GetOrdinanceSchema,
      handler: getOrdinance
    },
  • API client method that makes the HTTP request to the law service API to fetch ordinance data by ordinSeq.
    async getOrdinance(ordinSeq: string, apiKey?: string): Promise<string> {
      const apiParams = new URLSearchParams({
        target: "ordin",
        OC: this.getApiKey(apiKey),
        type: "JSON",
        MST: ordinSeq,
      })
    
      const url = `${LAW_API_BASE}/lawService.do?${apiParams.toString()}`
      const text = await this.fetchText(url, "getOrdinance")
      this.checkHtmlError(text, "자치법규를 찾을 수 없습니다. ordinSeq를 확인해주세요")
    
      return text
    }
  • Tool chain configuration linking search_ordinance to get_ordinance as its detail tool with ordinSeq as the detail parameter.
    search_ordinance: {
      detailTool: "get_ordinance",
      detailParam: "ordinSeq",
      idRegex: BRACKET_ID,
    },
Behavior2/5

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

With no annotations, the description carries full burden for behavioral disclosure. It merely states '조회' (inquiry) and '전문' (full text), implying a read-only operation but does not confirm safety, idempotency, or any potential side effects. No error conditions or return format details are provided.

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

Conciseness3/5

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

The description is extremely concise (one short sentence), which is efficient for a simple tool. However, it omits potentially useful context such as return value structure or usage notes, making it borderline adequate.

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 the lack of output schema and annotations, the description falls short. It does not explain what the returned 'full text' looks like, how to interpret the response, or handle errors. For a tool that likely returns a large textual document, this is insufficient.

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?

The input schema has 100% coverage with descriptions for both parameters (ordinSeq and apiKey). The description adds no additional meaning beyond the schema, so a baseline score of 3 is appropriate.

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 states it retrieves the full text of a local ordinance or rule (조례/규칙 전문 조회). The verb '조회' (inquiry) combined with '전문' (full text) indicates the core purpose. However, it doesn't explicitly differentiate from sibling tools like get_alio_regulation or get_law_text, though the context '자치법규' (local ordinance) implies a specific scope.

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 is provided on when to use this tool versus alternatives such as get_alio_regulation or search_ordinance. There is no mention of prerequisites, exclusions, or typical use cases, leaving the agent without decision-making support.

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