get_daily_term
Find legal terms matching everyday Korean words like '월세' (monthly rent) or '뺑소니' (hit-and-run) for accurate legal research.
Instructions
[지식베이스] 일상용어(월세, 뺑소니 등)로 검색하여 대응하는 법령용어를 찾을 때 사용.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | 검색할 일상용어 (예: '월세', '전세', '뺑소니') | |
| display | Yes | 결과 수 (기본:20) | |
| page | Yes | 페이지 (기본:1) | |
| apiKey | No | 법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달 |
Implementation Reference
- src/tools/knowledge-base.ts:139-185 (handler)The main handler function for the 'get_daily_term' tool. It calls the lawSearch.do API with target 'lstrm' and dicKndCd '011402' to search for daily terms, parses the XML response, and formats results. On empty results it returns a helpful message suggesting other tools. On error it uses formatToolError.
export async function getDailyTerm( apiClient: LawApiClient, args: GetDailyTermInput ): 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(), dicKndCd: "011402", }, apiKey: args.apiKey, }); const result = parseKBXML(xmlText, "LsTrmSearch"); const totalCount = parseInt(result.totalCnt || "0"); const items = result.data || []; if (totalCount === 0 || items.length === 0) { return { content: [{ type: "text", text: `'${args.query}' 일상용어 검색 결과가 없습니다.\n\n💡 법령용어로 검색: search_legal_terms(query="${args.query}")\n💡 AI 검색: search_ai_law(query="${args.query}")` }], isError: true, }; } let output = `🗣️ 일상용어 검색 결과 (${totalCount}건):\n\n`; for (const item of items) { output += `📌 ${item.법령용어명 || item.용어명}\n`; if (item.법령용어ID) output += ` ID: ${item.법령용어ID}\n`; output += `\n`; } output += `\n💡 상세 조회: get_legal_term_detail(query="용어명")`; output += `\n💡 관련 법령용어: get_daily_to_legal(dailyTerm="용어명")`; return { content: [{ type: "text", text: output }] }; } catch (error) { return formatToolError(error, "get_daily_term"); } } - src/tools/knowledge-base.ts:130-137 (schema)Zod schema for the 'get_daily_term' tool input. Defines fields: query (required string), display (number 1-100, default 20), page (number min 1, default 1), apiKey (optional string).
export const getDailyTermSchema = z.object({ query: z.string().describe("검색할 일상용어 (예: '월세', '전세', '뺑소니')"), display: z.number().min(1).max(100).default(20).describe("결과 수 (기본:20)"), page: z.number().min(1).default(1).describe("페이지 (기본:1)"), apiKey: z.string().optional().describe("법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달"), }); export type GetDailyTermInput = z.infer<typeof getDailyTermSchema>; - src/tool-registry.ts:546-551 (registration)Registration of the 'get_daily_term' tool in the MCP tool registry. Maps the tool name to its schema (getDailyTermSchema) and handler (getDailyTerm), with a description for LLM routing.
{ name: "get_daily_term", description: "[지식베이스] 일상용어(월세, 뺑소니 등)로 검색하여 대응하는 법령용어를 찾을 때 사용.", schema: getDailyTermSchema, handler: getDailyTerm },