Skip to main content
Glama

search_english_law

Search English translations of Korean laws by statute name or keyword. Supports pagination and sorting by date or name.

Instructions

[영문] 영문 법령 검색.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNo법령명 검색어 (영문 또는 한글, 예: 'Customs Act', '관세법')
displayYes페이지당 결과 개수 (기본값: 20, 최대: 100)
pageYes페이지 번호 (기본값: 1)
sortNo정렬 옵션: lasc/ldes (법령명순), dasc/ddes (날짜순)
apiKeyNo법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달

Implementation Reference

  • Main handler function for the search_english_law tool. Takes a LawApiClient and SearchEnglishLawInput, fetches the law search API endpoint 'lawSearch.do' with target 'elaw', parses the XML response to extract law entries, and returns formatted results with Korean/English law names, effective dates, and links.
    export async function searchEnglishLaw(
      apiClient: LawApiClient,
      args: SearchEnglishLawInput
    ): Promise<{ content: Array<{ type: string, text: string }>, isError?: boolean }> {
      try {
        const extraParams: Record<string, string> = {
          display: (args.display || 20).toString(),
          page: (args.page || 1).toString(),
        };
        if (args.query) extraParams.query = args.query;
        if (args.sort) extraParams.sort = args.sort;
    
        const xmlText = await apiClient.fetchApi({
          endpoint: "lawSearch.do",
          target: "elaw",
          extraParams,
          apiKey: args.apiKey,
        });
        // parseSearchXML 사용 (rootTag: "" = 전체 XML, itemTag: law)
        // 영문법령 API는 루트 태그가 일정하지 않아 전체 XML에서 추출
        const { totalCnt, page: currentPage, items: allLaws } = parseSearchXML(
          xmlText, "", "law",
          (content) => ({
            법령ID: extractTag(content, "법령ID"),
            영문법령명: extractTag(content, "법령명영문"),
            한글법령명: stripHtml(extractTag(content, "법령명한글")),
            시행일자: extractTag(content, "시행일자"),
            법령구분: extractTag(content, "법령구분명"),
            법령상세링크: extractTag(content, "법령상세링크"),
          })
        );
    
        const totalCount = totalCnt;
        // 유효한 항목만 필터링 (기존 동작 유지)
        const laws = allLaws.filter(item => item.법령ID || item.영문법령명);
    
        if (totalCount === 0) {
          let errorMsg = "검색 결과가 없습니다.";
          errorMsg += `\n\n💡 개선 방법:`;
          errorMsg += `\n   1. 한글 법령명으로 검색:`;
          errorMsg += `\n      search_english_law(query="관세법")`;
          errorMsg += `\n\n   2. 영문 법령명으로 검색:`;
          errorMsg += `\n      search_english_law(query="Customs Act")`;
          errorMsg += `\n\n   3. 한글 법령 먼저 검색 후 영문 조회:`;
          errorMsg += `\n      search_law(query="${args.query || '법령명'}") → get_english_law_text(lawId="...")`;
    
          return {
            content: [{
              type: "text",
              text: errorMsg
            }],
            isError: true
          };
        }
    
        let output = `영문법령 검색 결과 (총 ${totalCount}건, ${currentPage}페이지):\n\n`;
    
        for (const law of laws) {
          output += `[${law.법령ID}] ${law.영문법령명}\n`;
          output += `  한글명: ${law.한글법령명 || "N/A"}\n`;
          output += `  시행일자: ${law.시행일자 || "N/A"}\n`;
          output += `  법령구분: ${law.법령구분 || "N/A"}\n`;
          if (law.법령상세링크) {
            output += `  링크: ${law.법령상세링크}\n`;
          }
          output += `\n`;
        }
    
        output += `\n💡 영문 전문을 조회하려면 get_english_law_text(lawId="법령ID")를 사용하세요.`;
    
        return {
          content: [{
            type: "text",
            text: output
          }]
        };
      } catch (error) {
        return formatToolError(error, "search_english_law");
      }
    }
  • Zod schema for search_english_law input validation. Defines fields: query (optional string for search term in English or Korean), display (count per page, 1-100, default 20), page (page number, default 1), sort (sort option), and apiKey (optional API key).
    export const searchEnglishLawSchema = z.object({
      query: z.string().optional().describe("법령명 검색어 (영문 또는 한글, 예: 'Customs Act', '관세법')"),
      display: z.number().min(1).max(100).default(20).describe("페이지당 결과 개수 (기본값: 20, 최대: 100)"),
      page: z.number().min(1).default(1).describe("페이지 번호 (기본값: 1)"),
      sort: z.enum(["lasc", "ldes", "dasc", "ddes"]).optional()
        .describe("정렬 옵션: lasc/ldes (법령명순), dasc/ddes (날짜순)"),
      apiKey: z.string().optional().describe("법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달"),
    });
  • Registration of search_english_law in the tool registry with name 'search_english_law', description '[영문] 영문 법령 검색.', schema reference to searchEnglishLawSchema, and handler reference to searchEnglishLaw.
    {
      name: "search_english_law",
      description: "[영문] 영문 법령 검색.",
      schema: searchEnglishLawSchema,
      handler: searchEnglishLaw
    },
  • Tool chain configuration linking search_english_law to its detail tool get_english_law_text with lawId parameter and an ID regex pattern for extracting law IDs from search results.
    search_english_law: {
      detailTool: "get_english_law_text",
      detailParam: "lawId",
      idRegex: /\[([^\]]+)\]/,  // 영문 법령 ID는 숫자가 아닐 수 있음
    },
  • Query router entry that routes queries matching '영문', '영어', or 'English' patterns to the search_english_law tool with appropriate query extraction.
    // ── 12. 영문 법령 ──
    {
      name: "english_law",
      patterns: [
        /영문|영어|English/i,
      ],
      tool: "search_english_law",
      extract: (query) => ({
        query: query.replace(/영문|영어|English|법령/gi, "").replace(/\s+/g, " ").trim(),
      }),
      reason: "영문 키워드 → 영문법령 검색",
      priority: 10,
    },
Behavior1/5

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

No annotations are provided, so the description must disclose behavioral traits. It does not mention whether the tool is read-only, requires authentication (though apiKey parameter suggests it), rate limits, or any side effects. The single sentence fails to inform the agent about tool behavior.

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 only one sentence, but it is under-specified rather than concise. It lacks essential details such as the scope of search or return format, making it insufficiently informative for an AI agent.

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?

For a search tool with no output schema, the description should at least mention what is returned (e.g., a list of law titles, identifiers). It does not provide enough context about the search scope or results, leaving the agent without necessary completeness.

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?

The input schema has 100% coverage with descriptions for all parameters (query, display, page, sort, apiKey). The description adds no extra parameter information, so a baseline score of 3 is appropriate since the schema already explains parameter semantics sufficiently.

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?

The description '[영문] 영문 법령 검색.' translates to 'Search English law.' It states the resource (English law) and a verb (search) but is extremely vague. It does not specify whether it searches law names, texts, or official translations, nor does it distinguish from sibling search tools like search_law or search_ai_law.

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. There are many sibling search tools (e.g., search_law, search_ai_law, search_precedents) but no comparative context or conditions for use.

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