Skip to main content
Glama

get_related_laws

Retrieve a list of Korean laws related to a specified law ID or name. Customize the number of results up to 100 with the display parameter.

Instructions

[지식베이스] 용어 관련 법령 목록.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lawIdNo법령ID
lawNameNo법령명
displayYes결과 수 (기본:20)
apiKeyNo법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달

Implementation Reference

  • The main handler function for get_related_laws tool. Calls the lawSearch.do API with target=lawRel, parses XML response via parseKBXML, and returns a formatted list of related laws with their type/ID/kind information.
    export async function getRelatedLaws(
      apiClient: LawApiClient,
      args: GetRelatedLawsInput
    ): Promise<{ content: Array<{ type: string; text: string }>; isError?: boolean }> {
      try {
        if (!args.lawId && !args.lawName) {
          throw new Error("lawId 또는 lawName 중 하나는 필수입니다.");
        }
    
        const extraParams: Record<string, string> = {
          display: (args.display || 20).toString(),
        };
        if (args.lawId) extraParams.ID = String(args.lawId);
        if (args.lawName) extraParams.query = String(args.lawName);
    
        let xmlText: string;
        try {
          xmlText = await apiClient.fetchApi({
            endpoint: "lawSearch.do",
            target: "lawRel",
            extraParams,
            apiKey: args.apiKey,
          });
        } catch {
          return {
            content: [{
              type: "text",
              text: `관련법령 조회 실패.\n\n💡 대안:\n   get_law_system_tree(lawName="${args.lawName || args.lawId}") - 법령체계도\n   get_three_tier(lawId="${args.lawId}") - 3단비교`,
            }],
            isError: true,
          };
        }
        const result = parseKBXML(xmlText, "LawRelSearch");
    
        const totalCount = parseInt(result.totalCnt || "0");
        const items = result.data || [];
    
        if (totalCount === 0 || items.length === 0) {
          return {
            content: [{
              type: "text",
              text: `관련법령을 찾을 수 없습니다.\n\n💡 get_law_system_tree 또는 get_three_tier를 사용해보세요.`,
            }],
            isError: true,
          };
        }
    
        let output = `🔗 관련법령 (${totalCount}건):\n\n`;
    
        for (const item of items) {
          output += `📜 ${item.법령명}\n`;
          if (item.관계유형) output += `   관계: ${item.관계유형}\n`;
          if (item.법령ID) output += `   법령ID: ${item.법령ID}\n`;
          if (item.법령종류) output += `   종류: ${item.법령종류}\n`;
          output += `\n`;
        }
    
        output += `\n💡 법령 조회: get_law_text(lawId="법령ID")`;
    
        return { content: [{ type: "text", text: truncateResponse(output) }] };
      } catch (error) {
        return formatToolError(error, "get_related_laws");
      }
    }
  • Zod schema for get_related_laws input: lawId (optional), lawName (optional), display (default 20), apiKey (optional).
    export const getRelatedLawsSchema = z.object({
      lawId: z.string().optional().describe("법령ID"),
      lawName: z.string().optional().describe("법령명"),
      display: z.number().min(1).max(100).default(20).describe("결과 수 (기본:20)"),
      apiKey: z.string().optional().describe("법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달"),
    });
  • Registration of the get_related_laws tool in the tool registry with name, description, schema, and handler.
    {
      name: "get_related_laws",
      description: "[지식베이스] 용어 관련 법령 목록.",
      schema: getRelatedLawsSchema,
      handler: getRelatedLaws
    },
  • API call to lawSearch.do endpoint with target=lawRel, parsed by parseKBXML helper for related law search results.
    let xmlText: string;
    try {
      xmlText = await apiClient.fetchApi({
        endpoint: "lawSearch.do",
        target: "lawRel",
        extraParams,
        apiKey: args.apiKey,
      });
Behavior1/5

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

No annotations are provided, so the description carries full burden. It discloses no behavioral traits: no mention of read-only vs mutation, required permissions, rate limits, or what happens when parameters are omitted (though display has a default). The description is entirely silent on behavior beyond the basic listing.

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?

The description is extremely short (one phrase) but at the cost of clarity. It is under-specified rather than concise, lacking essential information. Front-loading is irrelevant when no useful content exists.

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 4 parameters, no output schema, and numerous sibling tools, the description is severely incomplete. It does not explain the tool's role in the knowledge base, how 'terms' relate to the inputs, or what the output looks like. The agent cannot confidently select or invoke this tool based on the current description.

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 cover 100% of parameters (lawId, lawName, display, apiKey) with Korean labels and defaults. The description adds no extra meaning beyond the schema, so baseline score of 3 is appropriate. However, the description could explain how lawId and lawName interact (e.g., are they combined or alternative filters?), but it does not.

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 is a single vague phrase: 'List of laws related to terms.' It does not clarify whether 'terms' refers to legal terms or something else, nor does it explain how inputs lawId and lawName relate to the purpose. Context with sibling tools like get_legal_term_detail suggests possible overlap, but no differentiation is provided.

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. There is no mention of prerequisites, use cases, or exclusion criteria. With many sibling tools for retrieving laws, the agent has no basis to decide when to invoke this one.

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