get_admin_appeal_text
Retrieve the full text of Korean administrative appeal precedents by providing the case series number.
Instructions
[행심] 행정심판례 전문.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | 행정심판재결례일련번호 (검색 결과에서 획득) | |
| caseName | No | 사건명 (선택사항, 검증용) | |
| apiKey | No | 법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달 |
Implementation Reference
- src/tools/admin-appeals.ts:102-167 (handler)The main handler function for the 'get_admin_appeal_text' tool. It takes an 'id' (required) and optional 'caseName'/'apiKey', fetches the full text of an administrative appeal decision from the API, parses the JSON response, and formats the output with details like case number, dates, ruling summary, and reasoning.
export async function getAdminAppealText( apiClient: LawApiClient, args: GetAdminAppealTextInput ): Promise<{ content: Array<{ type: string, text: string }>, isError?: boolean }> { try { const extraParams: Record<string, string> = { ID: args.id }; if (args.caseName) extraParams.LM = args.caseName; const responseText = await apiClient.fetchApi({ endpoint: "lawService.do", target: "decc", 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.DeccService && !data.행정심판례) { throw new Error("행정심판례를 찾을 수 없거나 응답 형식이 올바르지 않습니다."); } const appeal = data.DeccService || data.행정심판례; let output = `=== ${appeal.사건명 || "행정심판례"} ===\n\n`; output += `📋 기본 정보:\n`; output += ` 사건번호: ${appeal.사건번호 || "N/A"}\n`; output += ` 처분일자: ${appeal.처분일자 || "N/A"}\n`; output += ` 의결일자: ${appeal.의결일자 || "N/A"}\n`; output += ` 처분청: ${appeal.처분청 || "N/A"}\n`; output += ` 재결청: ${appeal.재결청 || "N/A"}\n`; output += ` 재결례유형: ${appeal.재결례유형명 || "N/A"}\n`; output += `\n`; if (appeal.주문) { output += `📌 주문:\n${appeal.주문}\n\n`; } if (appeal.청구취지) { output += `📝 청구취지:\n${appeal.청구취지}\n\n`; } if (appeal.재결요지) { output += `📋 재결요지:\n${appeal.재결요지}\n\n`; } if (appeal.이유) { output += `📄 이유:\n${appeal.이유}\n`; } return { content: [{ type: "text", text: truncateResponse(output) }] }; } catch (error) { return formatToolError(error, "get_admin_appeal_text") } } - src/tools/admin-appeals.ts:94-98 (schema)Zod schema defining the input for 'getAdminAppealText': 'id' (required string, the administrative appeal case serial number), 'caseName' (optional string for verification), and 'apiKey' (optional string).
export const getAdminAppealTextSchema = z.object({ id: z.string().describe("행정심판재결례일련번호 (검색 결과에서 획득)"), caseName: z.string().optional().describe("사건명 (선택사항, 검증용)"), apiKey: z.string().optional().describe("법제처 Open API 인증키(OC). 사용자가 제공한 경우 전달"), }); - src/tool-registry.ts:370-375 (registration)Registration of the tool in the tool registry. Maps the tool name 'get_admin_appeal_text' to its schema and handler function.
{ name: "get_admin_appeal_text", description: "[행심] 행정심판례 전문.", schema: getAdminAppealTextSchema, handler: getAdminAppealText }, - src/lib/tool-chain-config.ts:46-47 (registration)Tool chain configuration linking 'search_admin_appeals' to its detail tool 'get_admin_appeal_text', specifying that the 'id' parameter is passed via the BRACKET_ID regex.
search_admin_appeals: { detailTool: "get_admin_appeal_text", - src/tools/admin-appeals.ts:100-100 (helper)TypeScript type inferred from the Zod schema for type safety in the handler function.
export type GetAdminAppealTextInput = z.infer<typeof getAdminAppealTextSchema>;