Skip to main content
Glama

search_legal_terms

Find definitions and explanations of legal terms from Korean statutes. Submit a term to retrieve its legal meaning and interpretation.

Instructions

[용어사전] 법령용어 정의·해설 검색.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes검색할 법령용어 (예: '선의', '악의', '하자', '채권')
displayYes페이지당 결과 개수 (기본값: 20, 최대: 100)
pageYes페이지 번호 (기본값: 1)
apiKeyNo법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달

Implementation Reference

  • The main handler function `searchLegalTerms` that executes the tool logic. It calls the LawApiClient to search legal terminology (법령용어), parses XML results, and formats the output. Uses `parseSearchXML` with rootTag 'LsTrmSearch' and itemTag 'lstrm'. Handles empty results with suggestions and errors via `formatToolError`.
    export async function searchLegalTerms(
      apiClient: LawApiClient,
      args: SearchLegalTermsInput
    ): Promise<{ content: Array<{ type: string, text: string }>, isError?: boolean }> {
      try {
        const xmlText = await apiClient.fetchApi({
          endpoint: "lawSearch.do",
          target: "lstrm",
          extraParams: {
            query: args.query,
            display: (args.display || 20).toString(),
            page: (args.page || 1).toString(),
          },
          apiKey: args.apiKey,
        });
        // parseSearchXML 사용 (rootTag: LsTrmSearch, itemTag: lstrm)
        const { totalCnt, page: currentPage, items: terms } = parseSearchXML(
          xmlText, "LsTrmSearch", "lstrm",
          (content) => ({
            용어명: extractTag(content, "법령용어명") || extractTag(content, "용어명") || extractTag(content, "용어"),
            용어ID: extractTag(content, "법령용어ID"),
            용어정의: extractTag(content, "용어정의") || extractTag(content, "정의"),
            관련법령: extractTag(content, "관련법령") || extractTag(content, "법령명"),
            일상용어: extractTag(content, "일상용어"),
            영문용어: extractTag(content, "영문용어") || extractTag(content, "영문"),
            상세링크: extractTag(content, "법령용어상세링크") || extractTag(content, "법령용어상세검색"),
          }),
          { useIndexOf: true }
        );
    
        const totalCount = totalCnt;
    
        if (totalCount === 0) {
          let errorMsg = "검색 결과가 없습니다.";
          errorMsg += `\n\n💡 개선 방법:`;
          errorMsg += `\n   1. 단순 용어로 검색:`;
          errorMsg += `\n      search_legal_terms(query="채권")`;
          errorMsg += `\n\n   2. 유사 용어 시도:`;
          errorMsg += `\n      - "선의" / "악의" (법률상 의미)`;
          errorMsg += `\n      - "하자" / "담보" / "보증"`;
          errorMsg += `\n\n   3. 법령 검색으로 용어 사용례 확인:`;
          errorMsg += `\n      search_law(query="${args.query}")`;
    
          return {
            content: [{
              type: "text",
              text: errorMsg
            }],
            isError: true
          };
        }
    
        let output = `법령용어 검색 결과 (총 ${totalCount}건, ${currentPage}페이지):\n\n`;
    
        for (const term of terms) {
          output += `📌 ${term.용어명}\n`;
          if (term.용어정의) {
            output += `   정의: ${term.용어정의}\n`;
          }
          if (term.관련법령) {
            output += `   관련법령: ${term.관련법령}\n`;
          }
          if (term.일상용어) {
            output += `   일상용어: ${term.일상용어}\n`;
          }
          if (term.영문용어) {
            output += `   영문: ${term.영문용어}\n`;
          }
          output += `\n`;
        }
    
        output += `\n💡 법령에서 용어 사용례를 확인하려면 search_law(query="용어명")을 사용하세요.`;
    
        return {
          content: [{
            type: "text",
            text: truncateResponse(output)
          }]
        };
      } catch (error) {
        return formatToolError(error, "search_legal_terms");
      }
    }
  • Zod schema `searchLegalTermsSchema` defining input validation: query (string), display (number 1-100, default 20), page (number >=1, default 1), apiKey (optional string).
    export const searchLegalTermsSchema = z.object({
      query: z.string().describe("검색할 법령용어 (예: '선의', '악의', '하자', '채권')"),
      display: z.number().min(1).max(100).default(20).describe("페이지당 결과 개수 (기본값: 20, 최대: 100)"),
      page: z.number().min(1).default(1).describe("페이지 번호 (기본값: 1)"),
      apiKey: z.string().optional().describe("법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달"),
    });
  • Tool registration entry mapping the name 'search_legal_terms' to the schema and handler, with description '[용어사전] 법령용어 정의·해설 검색.'
    {
      name: "search_legal_terms",
      description: "[용어사전] 법령용어 정의·해설 검색.",
      schema: searchLegalTermsSchema,
      handler: searchLegalTerms
  • Import of `searchLegalTerms` and `searchLegalTermsSchema` from './tools/legal-terms.js' in the registry.
    import { searchLegalTerms, searchLegalTermsSchema } from "./tools/legal-terms.js"
  • Query router entry that routes natural language queries (e.g., '법률용어', '법령용어', '용어정의', '뜻') to the 'search_legal_terms' tool with a pattern-based extract function.
    {
      name: "legal_terms",
      patterns: [
        /법률?\s*용어|법령\s*용어|용어\s*정의|용어\s*뜻|뭐야$|뜻이?$/,
      ],
      tool: "search_legal_terms",
      extract: (query) => ({
        query: query.replace(/법률?용어|법령용어|용어정의|뜻이?|뭐야|의$/g, "").replace(/\s+/g, " ").trim(),
      }),
      reason: "용어 키워드 → 법령용어 검색",
      priority: 10,
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It only says 'search' but does not disclose behavioral traits such as whether it is read-only, authentication needs, or what the response contains. This is insufficient for a search tool.

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, clear sentence with a prefix tag. It is appropriately sized and front-loaded, but it sacrifices detail for brevity.

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?

With 4 parameters, no output schema, and a brief description, the tool lacks explanation of pagination behavior, result format, or how it differs from other search tools. It is incomplete for an agent to select and invoke correctly.

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%, and each parameter has a clear description in the schema. The tool's description adds no additional meaning beyond what the schema provides. Baseline of 3 is appropriate.

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 states it searches legal term definitions and explanations, with a glossary tag. It clearly identifies the verb (search) and resource (legal terms). However, it does not distinguish from siblings like 'get_legal_term_detail' or 'search_interpretations', but the name itself is specific.

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?

The description provides no guidance on when to use this tool versus alternatives. It does not mention context, exclusions, or prerequisites. The user must infer usage from the name alone.

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