Skip to main content
Glama

get_article_with_precedents

Retrieve a Korean law article and its associated precedents simultaneously using the article number and law details.

Instructions

[통합] 조문 + 관련 판례 동시 조회.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mstNo법령일련번호 (search_law에서 획득)
lawIdNo법령ID (search_law에서 획득)
joYes조문 번호 (예: '제38조')
efYdNo시행일자 (YYYYMMDD 형식)
includePrecedentsYes관련 판례 포함 여부
apiKeyNo법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달

Implementation Reference

  • The main handler function `getArticleWithPrecedents`. It calls `getLawText` to fetch the article, extracts the law name from the result, then calls `searchPrecedents` to find related precedents. Returns combined content with article text + up to 5 related precedents.
    export async function getArticleWithPrecedents(
      apiClient: LawApiClient,
      input: GetArticleWithPrecedentsInput
    ): Promise<{ content: Array<{ type: string, text: string }>, isError?: boolean }> {
      try {
        // 1. 조문 조회
        const articleResult = await getLawText(apiClient, {
          mst: input.mst,
          lawId: input.lawId,
          jo: input.jo,
          efYd: input.efYd,
          apiKey: input.apiKey
        } as GetLawTextInput)
    
        if (articleResult.isError || !input.includePrecedents) {
          return articleResult
        }
    
        let resultText = articleResult.content[0].text
    
        // 2. 법령명 추출 (조문 결과에서)
        const lawNameMatch = resultText.match(/법령명: (.+?)\n/)
        if (!lawNameMatch) {
          return articleResult // 법령명을 찾을 수 없으면 조문만 반환
        }
    
        const lawName = lawNameMatch[1].trim()
        // 3. 관련 판례 검색
        const precedentQuery = `${lawName} ${input.jo}`
    
        try {
          const precedentResult = await searchPrecedents(apiClient, {
            query: precedentQuery,
            display: 5,
            page: 1,
            apiKey: input.apiKey
          })
    
          if (!precedentResult.isError) {
            const precedentText = precedentResult.content[0].text
    
            // 판례 결과가 있으면 추가
            if (precedentText && !precedentText.includes("검색 결과가 없습니다")) {
              resultText += `\n${"=".repeat(60)}\n`
              resultText += `\n📚 관련 판례 (상위 5건)\n\n`
              resultText += precedentText
              resultText += `\n💡 판례 전문을 보려면 get_precedent_text Tool을 사용하세요.`
            } else {
              resultText += `\n\n📚 관련 판례: 검색 결과 없음`
            }
          }
        } catch (error) {
          // 판례 검색 실패는 무시하고 조문 내용만 반환
          // 판례 검색 실패는 무시 (조문 내용만 반환)
        }
    
        return {
          content: [{
            type: "text",
            text: resultText
          }]
        }
      } catch (error) {
        return formatToolError(error, "get_article_with_precedents")
      }
    }
  • Zod schema `GetArticleWithPrecedentsSchema` defining input params: mst (optional), lawId (optional), jo (required), efYd (optional), includePrecedents (default true), apiKey (optional). Requires either mst or lawId via refine.
    export const GetArticleWithPrecedentsSchema = z.object({
      mst: z.string().optional().describe("법령일련번호 (search_law에서 획득)"),
      lawId: z.string().optional().describe("법령ID (search_law에서 획득)"),
      jo: z.string().describe("조문 번호 (예: '제38조')"),
      efYd: z.string().optional().describe("시행일자 (YYYYMMDD 형식)"),
      includePrecedents: z.boolean().optional().default(true).describe("관련 판례 포함 여부"),
      apiKey: z.string().optional().describe("법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달")
    }).refine(data => data.mst || data.lawId, {
      message: "mst 또는 lawId 중 하나는 필수입니다"
    })
    
    export type GetArticleWithPrecedentsInput = z.infer<typeof GetArticleWithPrecedentsSchema>
  • Tool registration in the registry: name 'get_article_with_precedents', description '[통합] 조문 + 관련 판례 동시 조회.', references GetArticleWithPrecedentsSchema and getArticleWithPrecedents handler.
    {
      name: "get_article_with_precedents",
      description: "[통합] 조문 + 관련 판례 동시 조회.",
      schema: GetArticleWithPrecedentsSchema,
      handler: getArticleWithPrecedents
    },
  • Import statement importing the handler and schema from src/tools/article-with-precedents.ts into the registry.
    import { getArticleWithPrecedents, GetArticleWithPrecedentsSchema } from "./tools/article-with-precedents.js"
  • Type alias `GetArticleWithPrecedentsInput` inferred from the Zod schema.
    export type GetArticleWithPrecedentsInput = z.infer<typeof GetArticleWithPrecedentsSchema>
    
    export async function getArticleWithPrecedents(
      apiClient: LawApiClient,
      input: GetArticleWithPrecedentsInput
Behavior2/5

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

No annotations are present, so the description carries full burden. It only states the tool performs a simultaneous search, but fails to disclose whether it is read-only, destructive, or any behavioral traits such as authentication requirements or pagination behavior.

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 short sentence in Korean, conveying the core function without waste. It could be slightly more descriptive in English context, but it remains efficient and front-loaded.

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?

No output schema exists, and the description does not explain the return structure or how article and precedents are combined. Given the lack of output schema, the description should provide more context on the response format, but it does not.

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 baseline is 3. The description adds no extra meaning beyond what the schema already provides for the parameters. It does not elaborate on how parameters interact or format constraints not already in schema.

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 specifies '통합' (integrated) and '조문 + 관련 판례 동시 조회' (simultaneous query of article and related precedents), clearly stating the verb (조회/query) and resource (article + precedents). This distinguishes it from siblings like get_article_detail and get_precedent_text, which handle only one aspect.

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 implies usage when both article and related precedents are needed, but it does not explicitly state when to use versus alternatives like get_article_detail or search_precedents. No when-not guidance or alternative names are provided.

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