search_acr_decisions
Retrieve Anti-Corruption and Civil Rights Commission decisions by keyword, date, or name. Filter by page and display count.
Instructions
[권익위] 국민권익위원회 결정문 검색.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | 검색 키워드 (예: '행정심판', '고충민원', '부패행위') | |
| display | Yes | 페이지당 결과 개수 (기본값: 20, 최대: 100) | |
| page | Yes | 페이지 번호 (기본값: 1) | |
| sort | No | 정렬 옵션: lasc/ldes (법령명순), dasc/ddes (날짜순) | |
| apiKey | No | 법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달 |
Implementation Reference
- src/tools/committee-decisions.ts:126-131 (handler)The main handler for the 'search_acr_decisions' tool. Delegates to the generic searchCommitteeDecisions() with target='acr', committeeName='국민권익위원회 결정문', and textToolName='get_acr_decision_text'.
export async function searchAcrDecisions( apiClient: LawApiClient, args: SearchAcrDecisionsInput ): Promise<{ content: Array<{ type: string, text: string }>, isError?: boolean }> { return searchCommitteeDecisions(apiClient, args, "acr", "국민권익위원회 결정문", "get_acr_decision_text"); } - Zod schema for search_acr_decisions. Uses baseSearchSchemaOptionalQuery (query is optional).
export const searchAcrDecisionsSchema = z.object({ ...baseSearchSchemaOptionalQuery, query: z.string().optional().describe("검색 키워드 (예: '행정심판', '고충민원', '부패행위')"), }); export type SearchAcrDecisionsInput = z.infer<typeof searchAcrDecisionsSchema>; - src/tool-registry.ts:413-419 (registration)Registration of the tool in the tool registry with name 'search_acr_decisions', its schema, and handler.
}, { name: "search_acr_decisions", description: "[권익위] 국민권익위원회 결정문 검색.", schema: searchAcrDecisionsSchema, handler: searchAcrDecisions }, - The generic searchCommitteeDecisions helper that searchAcrDecisions delegates to. Calls the lawSearch API, parses XML results, and formats the output.
async function searchCommitteeDecisions( apiClient: LawApiClient, args: { query?: string; display?: number; page?: number; sort?: string; apiKey?: string }, target: string, committeeName: string, textToolName: string ): 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, extraParams, apiKey: args.apiKey, }); // parseSearchXML 사용 (rootTag: searchKey, itemTag: target) const searchKey = getSearchKey(target); const itemKey = target.toLowerCase(); const { totalCnt, page: currentPage, items: decisions } = parseSearchXML( xmlText, searchKey, itemKey, (content) => ({ 결정일련번호: extractTag(content, "결정문일련번호") || extractTag(content, "결정일련번호") || extractTag(content, "판례일련번호") || extractTag(content, "일련번호"), 사건명: extractTag(content, "사건명") || extractTag(content, "안건명") || extractTag(content, "제목"), 사건번호: extractTag(content, "사건번호") || extractTag(content, "의안번호"), 결정일자: extractTag(content, "결정일자") || extractTag(content, "의결일") || extractTag(content, "선고일자") || extractTag(content, "등록일"), 결정유형: 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💡 ${committeeName} 검색 팁:`; errorMsg += `\n 1. 단순 키워드 사용`; errorMsg += `\n 2. 판례 검색: search_precedents(query="${args.query || '키워드'}")`; errorMsg += `\n 3. 법령해석례 검색: search_interpretations(query="${args.query || '키워드'}")`; return { content: [{ type: "text", text: errorMsg }], isError: true }; } let output = `${committeeName} 검색 결과 (총 ${totalCount}건, ${currentPage}페이지):\n\n`; for (const decision of decisions) { const title = decision.사건명 || "(제목 없음)"; output += `[${decision.결정일련번호}] ${title}\n`; if (decision.사건번호) output += ` 사건번호: ${decision.사건번호}\n`; if (decision.결정일자) output += ` 결정일: ${decision.결정일자}\n`; if (decision.결정유형) output += ` 결정유형: ${decision.결정유형}\n`; if (decision.재결청) output += ` 재결청: ${decision.재결청}\n`; if (decision.상세링크) output += ` 링크: ${decision.상세링크}\n`; output += `\n`; } output += `\n💡 전문을 조회하려면 ${textToolName}(id="결정일련번호")를 사용하세요.`; return { content: [{ type: "text", text: output }] }; } catch (error) { return formatToolError(error, `search_${target}_decisions`); } } - Helper function getSearchKey maps the 'acr' target string to 'Acr' for XML parsing. Also maps ftc->Ftc, ppc->Ppc, nlrc->Nlrc.
// Helper functions function getSearchKey(target: string): string { const mapping: Record<string, string> = { ftc: "Ftc", ppc: "Ppc", nlrc: "Nlrc", acr: "Acr", }; return mapping[target] || `${target.charAt(0).toUpperCase() + target.slice(1)}`; } function getServiceKey(target: string): string { const mapping: Record<string, string> = { ftc: "FtcService", ppc: "PpcService", nlrc: "NlrcService", acr: "AcrService", }; return mapping[target] || `${target.charAt(0).toUpperCase() + target.slice(1)}Service`; }