Skip to main content
Glama

get_customs_interpretation_text

Retrieve the full text of a Korean customs interpretation by its serial number, including the query, answer, reasoning, and related statutes.

Instructions

[관세] 관세 해석례 전문 조회. 질의요지·회답·이유·관련법령 포함.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesCustoms interpretation serial number (법령해석일련번호) from search results
interpretationNameNoInterpretation name (optional, for verification)
apiKeyNo법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달

Implementation Reference

  • Main handler function that fetches the full text of a customs interpretation by serial number (ID) from the Law API. Parses the JSON response and formats it with basic info, question summary, reply, reasoning, related laws, and original document link.
    export async function getCustomsInterpretationText(
      apiClient: LawApiClient,
      args: GetCustomsInterpretationTextInput
    ): Promise<{ content: Array<{ type: string, text: string }>, isError?: boolean }> {
      try {
        const extraParams: Record<string, string> = { ID: args.id };
        if (args.interpretationName) extraParams.LM = args.interpretationName;
    
        const responseText = await apiClient.fetchApi({
          endpoint: "lawService.do",
          target: "kcsCgmExpc",
          type: "JSON",
          extraParams,
          apiKey: args.apiKey,
        });
    
        let data: any;
        try {
          data = JSON.parse(responseText);
        } catch (err) {
          throw new Error("Failed to parse JSON response from API");
        }
    
        if (!data.CgmExpcService) {
          throw new Error("Customs interpretation not found or invalid response format");
        }
    
        const expc = data.CgmExpcService;
        const basic = {
          안건명: expc.안건명,
          법령해석일련번호: expc.법령해석일련번호,
          업무분야: expc.업무분야,
          해석일자: expc.해석일자,
          해석기관명: expc.해석기관명,
          질의기관명: expc.질의기관명,
          등록일시: expc.등록일시
        };
        const content = {
          질의요지: expc.질의요지,
          회답: expc.회답,
          이유: expc.이유,
          관련법령: expc.관련법령,
          관세법령정보포털원문링크: expc.관세법령정보포털원문링크
        };
    
        let output = `=== ${basic.안건명 || "Customs Interpretation"} ===\n\n`;
    
        output += `📋 기본 정보:\n`;
        output += `  해석일련번호: ${basic.법령해석일련번호 || "N/A"}\n`;
        output += `  업무분야: ${basic.업무분야 || "N/A"}\n`;
        output += `  해석일자: ${basic.해석일자 || "N/A"}\n`;
        output += `  질의기관: ${basic.질의기관명 || "N/A"}\n`;
        output += `  해석기관: ${basic.해석기관명 || "N/A"}\n`;
        output += `  등록일시: ${basic.등록일시 || "N/A"}\n\n`;
    
        if (content.질의요지) {
          output += `📌 질의요지:\n${content.질의요지}\n\n`;
        }
    
        if (content.회답) {
          output += `📝 회답:\n${content.회답}\n\n`;
        }
    
        if (content.이유) {
          output += `💡 이유:\n${content.이유}\n\n`;
        }
    
        if (content.관련법령) {
          output += `📖 관련법령:\n${content.관련법령}\n\n`;
        }
    
        if (content.관세법령정보포털원문링크) {
          output += `🔗 원문 링크: ${content.관세법령정보포털원문링크}\n`;
        }
    
        return {
          content: [{
            type: "text",
            text: truncateResponse(output)
          }]
        };
      } catch (error) {
        return formatToolError(error, "get_customs_interpretation_text");
      }
    }
  • Zod schema for input validation: requires 'id' (serial number), optional 'interpretationName' for verification, and optional 'apiKey'.
    export const getCustomsInterpretationTextSchema = z.object({
      id: z.string().describe("Customs interpretation serial number (법령해석일련번호) from search results"),
      interpretationName: z.string().optional().describe("Interpretation name (optional, for verification)"),
      apiKey: z.string().optional().describe("법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달"),
    });
  • Registration of the tool in the tool registry: name 'get_customs_interpretation_text' with description, schema reference, and handler reference.
    {
      name: "get_customs_interpretation_text",
      description: "[관세] 관세 해석례 전문 조회. 질의요지·회답·이유·관련법령 포함.",
      schema: getCustomsInterpretationTextSchema,
      handler: getCustomsInterpretationText
    },
  • Tool-chain configuration mapping search_customs_interpretations to get_customs_interpretation_text as the detail tool, enabling automatic chaining from search results to full text retrieval.
    search_customs_interpretations: {
      detailTool: "get_customs_interpretation_text",
      detailParam: "id",
      idRegex: BRACKET_ID,
Behavior2/5

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

No annotations are present, and the description does not disclose behavioral traits such as read-only nature, error handling, or required permissions. The description only lists output components.

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 concise Korean sentence that front-loads the purpose. It could be more structured but avoids unnecessary words.

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

Completeness4/5

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

Without an output schema, the description usefully specifies the response contents (query points, answers, reasons, related laws). However, it does not mention that the ID comes from a search result, which is important context.

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 coverage is 100%, so the schema fully documents parameters. The description adds no extra meaning beyond the schema, achieving baseline for high coverage.

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 retrieves the full text of customs interpretation cases, listing components (query points, answers, reasons, related laws). It is distinct from sibling tools like search_customs_interpretations and get_interpretation_text, though not explicitly differentiated.

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 is provided on when to use this tool versus alternatives (e.g., after searching). The agent must infer that this is for full text retrieval given an ID from search results.

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