Skip to main content
Glama

get_historical_law

Retrieve historical Korean law texts as they existed at a specific point in time. Provide a law serial number and optional article number to get the exact legal text from that date.

Instructions

[이력] 특정 시점 연혁법령 조회.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mstYes법령일련번호 (MST) - search_historical_law 에서 획득
joNo특정 조문 번호 (예: '제38조')
apiKeyNo법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달

Implementation Reference

  • Main handler function for get_historical_law. Fetches a specific historical law text by MST (law serial number) from the lawjosub API, with JSON/HTML fallback and response formatting.
    export async function getHistoricalLaw(
      apiClient: LawApiClient,
      input: GetHistoricalLawInput
    ): Promise<{ content: Array<{ type: string; text: string }>; isError?: boolean }> {
      try {
        // 법제처 lawjosub: 특정 시점(MST) 본문. JSON 또는 HTML.
        const extraParams: Record<string, string> = { MST: input.mst }
        if (input.jo) extraParams.JO = input.jo
    
        let body: string
        try {
          body = await apiClient.fetchApi({
            endpoint: "lawService.do",
            target: "lawjosub",
            type: "JSON",
            extraParams,
            apiKey: input.apiKey,
          })
        } catch {
          // JSON 미지원 시 HTML 폴백
          body = await apiClient.fetchApi({
            endpoint: "lawService.do",
            target: "lawjosub",
            type: "HTML",
            extraParams,
            apiKey: input.apiKey,
          })
        }
    
        const text = body.trim().startsWith("{") || body.trim().startsWith("[")
          ? formatJsonBody(body)
          : stripHtml(body)
    
        if (!text || text.length < 20) {
          return {
            content: [
              {
                type: "text",
                text: `[NOT_FOUND] MST=${input.mst} 본문을 가져오지 못했습니다.`,
              },
            ],
            isError: true,
          }
        }
    
        return {
          content: [{ type: "text", text: truncateResponse(text) }],
        }
      } catch (err) {
        return formatToolError(err, "get_historical_law")
      }
    }
  • Zod schema for get_historical_law input: mst (required), jo (optional article number), apiKey (optional).
    export const getHistoricalLawSchema = z.object({
      mst: z.string().describe("법령일련번호 (MST) - search_historical_law 에서 획득"),
      jo: z.string().optional().describe("특정 조문 번호 (예: '제38조')"),
      apiKey: z.string().optional().describe("법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달"),
    })
  • TypeScript type inferred from the Zod schema for get_historical_law input.
    export type GetHistoricalLawInput = z.infer<typeof getHistoricalLawSchema>
  • Tool registration entry mapping the name 'get_historical_law' to its schema and handler function.
    {
      name: "get_historical_law",
      description: "[이력] 특정 시점 연혁법령 조회.",
      schema: getHistoricalLawSchema,
      handler: getHistoricalLaw
    },
  • Import of getHistoricalLaw and getHistoricalLawSchema from the historical-law module.
    import { getHistoricalLaw, getHistoricalLawSchema, searchHistoricalLaw, searchHistoricalLawSchema } from "./tools/historical-law.js"
Behavior2/5

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

No annotations are present, so the description must carry the full burden of behavioral disclosure. It only states the tool performs an inquiry but does not reveal whether it is read-only, requires authentication (API key hinted in schema), or what the response format is.

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 a single sentence, which is concise but lacks important context. It is front-loaded with a tag, but overall it could be more informative without becoming verbose.

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 annotations and output schema, the description should explain more about what the tool returns and how to use it effectively. It only describes the action without clarifying outputs or usage steps, making it incomplete for an agent.

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%, with each parameter having a description in the schema. The tool description adds no additional meaning beyond the schema, such as how '특정 시점' relates to the 'mst' parameter. 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 the tool is for querying historical laws at a specific time, using a specific verb ('조회') and resource ('연혁법령'). However, it does not explicitly differentiate from sibling 'search_historical_law', which likely searches for historical laws before retrieving details.

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 prerequisites (e.g., using search_historical_law first) or the appropriate context for invocation.

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