Skip to main content
Glama

get_external_links

Need external links to Korean legal documents? Get URLs for laws, precedents, interpretations, ordinances, and admin rules by providing the link type and identifier.

Instructions

[링크] 법령 외부 참조 링크.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
linkTypeYes링크 유형: law (법령), precedent (판례), interpretation (해석례), ordinance (자치법규), admin_rule (행정규칙)
lawIdNo법령ID (법령 링크 생성 시)
mstNo법령일련번호 (법령/자치법규 링크 생성 시)
lawNameNo법령명 (한글 URL 생성용, 예: '관세법')
joNo조문 번호 (한글 URL 생성용, 예: '제38조')
precedentIdNo판례일련번호 (판례 링크 생성 시)
interpretationIdNo법령해석례일련번호 (해석례 링크 생성 시)
adminRuleIdNo행정규칙일련번호 (행정규칙 링크 생성 시)
ordinanceIdNo자치법규ID (자치법규 링크 생성 시)

Implementation Reference

  • Main handler function for the get_external_links tool. Accepts an input with linkType and optional IDs, then delegates to type-specific helper functions to generate external URLs to Korean legal databases (law.go.kr, glaw.scourt.go.kr, etc.).
    export async function getExternalLinks(
      input: ExternalLinksInput
    ): Promise<{ content: Array<{ type: string, text: string }>, isError?: boolean }> {
      try {
        let resultText = "🔗 외부 링크\n\n"
    
        switch (input.linkType) {
          case "law": {
            if (!input.lawId && !input.mst && !input.lawName) {
              return {
                content: [{
                  type: "text",
                  text: "법령 링크 생성을 위해 lawId, mst 또는 lawName이 필요합니다."
                }],
                isError: true
              }
            }
    
            const lawLinks = generateLawLinks(input.lawId, input.mst, input.lawName, input.jo)
            resultText += lawLinks
            break
          }
    
          case "precedent": {
            if (!input.precedentId) {
              return {
                content: [{
                  type: "text",
                  text: "판례 링크 생성을 위해 precedentId가 필요합니다."
                }],
                isError: true
              }
            }
    
            const precedentLinks = generatePrecedentLinks(input.precedentId)
            resultText += precedentLinks
            break
          }
    
          case "interpretation": {
            if (!input.interpretationId) {
              return {
                content: [{
                  type: "text",
                  text: "해석례 링크 생성을 위해 interpretationId가 필요합니다."
                }],
                isError: true
              }
            }
    
            const interpretationLinks = generateInterpretationLinks(input.interpretationId)
            resultText += interpretationLinks
            break
          }
    
          case "ordinance": {
            if (!input.ordinanceId && !input.mst && !input.lawName) {
              return {
                content: [{
                  type: "text",
                  text: "자치법규 링크 생성을 위해 ordinanceId, mst 또는 lawName이 필요합니다."
                }],
                isError: true
              }
            }
    
            const ordinanceLinks = generateOrdinanceLinks(input.ordinanceId, input.mst, input.lawName, input.jo)
            resultText += ordinanceLinks
            break
          }
    
          case "admin_rule": {
            if (!input.adminRuleId) {
              return {
                content: [{
                  type: "text",
                  text: "행정규칙 링크 생성을 위해 adminRuleId가 필요합니다."
                }],
                isError: true
              }
            }
    
            const adminRuleLinks = generateAdminRuleLinks(input.adminRuleId)
            resultText += adminRuleLinks
            break
          }
    
          default:
            return {
              content: [{
                type: "text",
                text: "지원하지 않는 링크 유형입니다."
              }],
              isError: true
            }
        }
    
        return {
          content: [{
            type: "text",
            text: resultText
          }]
        }
      } catch (error) {
        return formatToolError(error, "get_external_links")
      }
    }
  • Zod schema defining the input for get_external_links. Requires linkType enum and various optional IDs for each link type.
    export const ExternalLinksSchema = z.object({
      linkType: z.enum(["law", "precedent", "interpretation", "ordinance", "admin_rule"]).describe(
        "링크 유형: law (법령), precedent (판례), interpretation (해석례), ordinance (자치법규), admin_rule (행정규칙)"
      ),
      lawId: z.string().optional().describe("법령ID (법령 링크 생성 시)"),
      mst: z.string().optional().describe("법령일련번호 (법령/자치법규 링크 생성 시)"),
      lawName: z.string().optional().describe("법령명 (한글 URL 생성용, 예: '관세법')"),
      jo: z.string().optional().describe("조문 번호 (한글 URL 생성용, 예: '제38조')"),
      precedentId: z.string().optional().describe("판례일련번호 (판례 링크 생성 시)"),
      interpretationId: z.string().optional().describe("법령해석례일련번호 (해석례 링크 생성 시)"),
      adminRuleId: z.string().optional().describe("행정규칙일련번호 (행정규칙 링크 생성 시)"),
      ordinanceId: z.string().optional().describe("자치법규ID (자치법규 링크 생성 시)")
    })
    
    export type ExternalLinksInput = z.infer<typeof ExternalLinksSchema>
  • Registration of the get_external_links tool in the tool registry with its name, description, schema, and handler.
    {
      name: "get_external_links",
      description: "[링크] 법령 외부 참조 링크.",
      schema: ExternalLinksSchema,
      handler: (_apiClient, input) => getExternalLinks(input)
    },
  • Import of getExternalLinks handler and schema from the external-links module.
    import { getExternalLinks, ExternalLinksSchema } from "./tools/external-links.js"
  • Helper function to generate law-related external links to law.go.kr, including direct URLs, detail pages, English versions, and history.
    function generateLawLinks(lawId?: string, mst?: string, lawName?: string, jo?: string): string {
      let links = "📜 법령 관련 링크:\n\n"
      let linkNum = 1
    
      // 1. 한글 URL (법령명 기반) - 우선순위 최상위
      if (lawName) {
        if (jo) {
          const url = `https://www.law.go.kr/법령/${encodeURIComponent(lawName)}/${encodeURIComponent(jo)}`
          links += `${linkNum++}. [법제처 조문 직접 링크](${url})\n\n`
        } else {
          const url = `https://www.law.go.kr/법령/${encodeURIComponent(lawName)}`
          links += `${linkNum++}. [법제처 법령 직접 링크](${url})\n\n`
        }
      }
    
      // 2. 법령ID 기반 링크 (쿼리 파라미터)
      if (lawId) {
        const detailUrl = `https://www.law.go.kr/LSW/lawLsInfoP.do?lsiSeq=${lawId}`
        links += `${linkNum++}. [법제처 법령 상세 (ID)](${detailUrl})\n\n`
    
        const engUrl = `https://www.law.go.kr/eng/LSW/lawLsInfoP.do?lsiSeq=${lawId}`
        links += `${linkNum++}. [법령 전문 (영문)](${engUrl})\n\n`
      }
    
      // 3. 법령 연혁
      if (mst) {
        const historyUrl = `https://www.law.go.kr/LSW/lsStmdInfoP.do?lsiSeq=${mst}`
        links += `${linkNum++}. [법령 연혁](${historyUrl})\n\n`
      }
    
      // 4. 법제처 홈페이지
      links += `${linkNum}. [법제처 홈페이지](https://www.law.go.kr/)\n\n`
    
      return links
    }
Behavior1/5

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

No annotations provided. Description lacks any behavioral traits such as read-only nature, side effects, or required permissions. Agent cannot infer what happens when the tool is called.

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

Conciseness2/5

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

While very short, the single sentence is not informative and fails to earn its place. It provides no meaningful guidance.

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

Completeness1/5

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

Given 9 parameters, no output schema, and no annotations, the description is severely incomplete. Agent lacks understanding of return format, parameter combinations, or when to use specific params.

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 descriptions are provided for all parameters (100% coverage), so baseline is 3. The tool description adds no extra meaning beyond the schema.

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

Purpose2/5

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

Description '법령 외부 참조 링크' (Legal external reference link) is vague and essentially restates the tool name 'get_external_links'. It does not specify whether the tool retrieves, generates, or lists links, nor does it differentiate from the sibling 'get_alio_external_links'.

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 alternatives like 'get_alio_external_links' or other search tools. No context on prerequisites or scenarios.

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