Skip to main content
Glama

get_law_history

Retrieve the list of law amendment history records by date. Provide the registration date, page, and display count to get results.

Instructions

[이력] 법령 변경이력 목록.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regDtYes법령 변경일자 (YYYYMMDD, 예: '20240101')
orgNo소관부처코드 (선택)
displayYes결과 개수 (기본값: 20, 최대: 100)
pageYes페이지 번호 (기본값: 1)
apiKeyNo법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달

Implementation Reference

  • Main handler for get_law_history: calls API client to fetch law change history, parses XML response, formats results into a human-readable text listing law names, IDs, dates, change types, and ministry info.
    export async function getLawHistory(
      apiClient: LawApiClient,
      input: LawHistoryInput
    ): Promise<{ content: Array<{ type: string, text: string }>, isError?: boolean }> {
      try {
        const xmlText = await apiClient.getLawHistory({
          regDt: input.regDt,
          org: input.org,
          display: input.display,
          page: input.page,
          apiKey: input.apiKey
        })
    
        const parser = new DOMParser()
        const doc = parser.parseFromString(xmlText, "text/xml")
    
        const totalCnt = doc.getElementsByTagName("totalCnt")[0]?.textContent || "0"
        const laws = doc.getElementsByTagName("law")
    
        if (laws.length === 0) {
          return {
            content: [{
              type: "text",
              text: `${input.regDt} 날짜에 변경된 법령이 없습니다.`
            }]
          }
        }
    
        let resultText = `법령 변경이력 (${input.regDt}, 총 ${totalCnt}건):\n\n`
    
        for (let i = 0; i < laws.length; i++) {
          const law = laws[i]
    
          const lawName = law.getElementsByTagName("법령명한글")[0]?.textContent || "알 수 없음"
          const lawId = law.getElementsByTagName("법령ID")[0]?.textContent || ""
          const mst = law.getElementsByTagName("법령일련번호")[0]?.textContent || ""
          const promDate = law.getElementsByTagName("공포일자")[0]?.textContent || ""
          const effDate = law.getElementsByTagName("시행일자")[0]?.textContent || ""
          const lawNo = law.getElementsByTagName("공포번호")[0]?.textContent || ""
          const changeType = law.getElementsByTagName("제개정구분명")[0]?.textContent || ""
          const orgName = law.getElementsByTagName("소관부처명")[0]?.textContent || ""
          const lawType = law.getElementsByTagName("법령구분명")[0]?.textContent || ""
          const status = law.getElementsByTagName("현행연혁코드")[0]?.textContent || ""
    
          resultText += `${i + 1}. ${lawName}\n`
          resultText += `   - 법령ID: ${lawId}, MST: ${mst}\n`
          resultText += `   - 법령구분: ${lawType}, 상태: ${status}\n`
          resultText += `   - 공포번호: ${lawNo}\n`
          resultText += `   - 개정구분: ${changeType}\n`
          resultText += `   - 공포일: ${promDate}, 시행일: ${effDate}\n`
          resultText += `   - 소관부처: ${orgName}\n\n`
        }
    
        return {
          content: [{
            type: "text",
            text: resultText
          }]
        }
      } catch (error) {
        return formatToolError(error, "get_law_history")
      }
    }
  • Zod schema defining input parameters: regDt (required date), org (optional ministry code), display (default 20), page (default 1), apiKey (optional override).
    export const LawHistorySchema = z.object({
      regDt: z.string().describe("법령 변경일자 (YYYYMMDD, 예: '20240101')"),
      org: z.string().optional().describe("소관부처코드 (선택)"),
      display: z.number().optional().default(20).describe("결과 개수 (기본값: 20, 최대: 100)"),
      page: z.number().optional().default(1).describe("페이지 번호 (기본값: 1)"),
      apiKey: z.string().optional().describe("법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달")
    })
  • Tool registration entry that maps the tool name 'get_law_history' to its schema and handler function, imported from src/tools/law-history.ts.
    {
      name: "get_law_history",
      description: "[이력] 법령 변경이력 목록.",
      schema: LawHistorySchema,
      handler: getLawHistory
    },
  • API client method that constructs the request URL with target 'lsHstInf' and parameters, then fetches XML text from the law.go.kr DRF endpoint.
    async getLawHistory(params: {
      regDt: string
      org?: string
      display?: number
      page?: number
      apiKey?: string
    }): Promise<string> {
      const apiParams = new URLSearchParams({
        target: "lsHstInf",
        OC: this.getApiKey(params.apiKey),
        type: "XML",
        regDt: params.regDt,
      })
    
      if (params.org) apiParams.append("org", params.org)
      if (params.display) apiParams.append("display", params.display.toString())
      if (params.page) apiParams.append("page", params.page.toString())
    
      const url = `${LAW_API_BASE}/lawSearch.do?${apiParams.toString()}`
      return await this.fetchText(url, "getLawHistory")
    }
Behavior2/5

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

No annotations are provided, and the description does not disclose any behavioral traits beyond listing results. It fails to mention whether the operation is read-only, has rate limits, requires authentication (apiKey parameter hints at this but description doesn't clarify), or any other side effects. The minimal description does not compensate for the lack of annotations.

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 short—a single phrase. While concise, it omits essential details about the tool's behavior and usage. It is not efficiently front-loaded because it lacks the key decision-making information for an AI agent. A 3 reflects that it is not verbose but also not optimally informative.

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 tool has 5 parameters, no output schema, and moderate complexity (pagination, required date), the description is far from complete. It does not explain the structure of the returned list, any ordering (e.g., chronological), or how pagination parameters interact. The agent cannot fully understand the tool's behavior from this description alone.

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% description coverage, with each parameter including a clear description (e.g., 'regDt' explained as date format). The tool description adds no additional semantics beyond what the schema already provides. The baseline score of 3 is appropriate since the schema does the heavy lifting.

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 '[Law] List of law change history' clearly states the tool's purpose as listing law amendment history. The name 'get_law_history' and short description effectively identify the resource, though it doesn't explicitly differentiate from sibling tools like 'get_alio_regulation_history' or 'get_article_history'. However, the context implies a higher-level law history, making it sufficiently clear.

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?

The description provides no guidance on when to use this tool versus alternatives. It does not mention any prerequisites, contexts, or exclusions. The agent is left to infer usage solely from the name and parameter schema, which is inadequate for distinguishing between similar history-related tools.

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