chain_action_basis
Enter a disposition type and keyword to retrieve the legal basis, with parallel comparison of interpretations, precedents, and administrative appeals.
Instructions
[⛓체인] 처분근거. 3단비교→해석례→판례→행정심판 병렬. 허가/처분 질문 시.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | 처분 유형 + 키워드 (예: '건축허가 거부 근거', '보조금 환수') | |
| apiKey | No |
Implementation Reference
- src/tools/chains.ts:269-306 (handler)Main handler function for chain_action_basis. Takes a query (disposition type + keyword), searches for relevant laws, performs a 3-tier comparison, and parallel fetches interpretations, precedents, and administrative appeals. Also checks for keyword expansions like annex_fee or annex_table to fetch annex tables.
export async function chainActionBasis( apiClient: LawApiClient, input: z.infer<typeof chainActionBasisSchema> ): Promise<ToolResponse> { try { const laws = await findLaws(apiClient, input.query, input.apiKey) if (laws.length === 0) return noResult(input.query) const p = laws[0] const parts = [`═══ 처분 근거 확인: ${p.lawName} ═══`] // Step 1: 3단 비교 (요건 체계) const threeTier = await callTool(getThreeTier, apiClient, { mst: p.mst, apiKey: input.apiKey }) parts.push(secOrSkip("법령 체계 (법률·시행령·시행규칙)", threeTier)) // Step 2: 해석례 + 판례 + 행정심판 (병렬) const [interpR, precR, appealR] = await Promise.all([ callTool(searchInterpretations, apiClient, { query: input.query, display: 5, apiKey: input.apiKey }), callTool(searchPrecedents, apiClient, { query: input.query, display: 5, apiKey: input.apiKey }), callTool(searchAdminAppeals, apiClient, { query: input.query, display: 5, apiKey: input.apiKey }), ]) parts.push(secOrSkip("법령 해석례", interpR)) parts.push(secOrSkip("관련 판례", precR)) parts.push(secOrSkip("행정심판례", appealR)) // 키워드 확장 const exp = detectExpansions(input.query) if (exp.includes("annex_fee") || exp.includes("annex_table")) { const annexes = await callTool(getAnnexes, apiClient, { lawName: p.lawName, apiKey: input.apiKey }) if (!annexes.isError) parts.push(sec("별표 (과태료/기준표)", annexes.text)) } return wrapResult(parts.join("\n")) } catch (error) { return wrapError(error) } } - src/tools/chains.ts:264-267 (schema)Zod schema for chain_action_basis input validation. Accepts 'query' (disposition type + keyword, e.g., '건축허가 거부 근거') and optional 'apiKey'.
export const chainActionBasisSchema = z.object({ query: z.string().describe("처분 유형 + 키워드 (예: '건축허가 거부 근거', '보조금 환수')"), apiKey: z.string().optional(), }) - src/tool-registry.ts:610-615 (registration)Registration entry in the tool registry (allTools array). Maps the name 'chain_action_basis' to its schema (chainActionBasisSchema) and handler (chainActionBasis), with a description in Korean.
{ name: "chain_action_basis", description: "[⛓체인] 처분근거. 3단비교→해석례→판례→행정심판 병렬. 허가/처분 질문 시.", schema: chainActionBasisSchema, handler: chainActionBasis }, - src/lib/query-router.ts:417-450 (helper)Query routing rules that route to 'chain_action_basis'. Two rules: 'action_basis' (matches 허가/인가/처분 keywords) and 'report_action' (matches 신고/등록 keywords). Both include re-route logic to chain_procedure_detail if procedure intent is detected.
// ── 15. 처분/허가 근거 ── { name: "action_basis", patterns: [ /허가|인가|처분|취소\s*사유|거부\s*근거|요건/, ], tool: "chain_action_basis", extract: (query) => { // 절차 키워드도 함께 있으면 procedure로 위임 if (hasProcedureIntent(query)) { return { _reroute: "chain_procedure_detail", query } } return { query } }, reason: "처분/허가 키워드 → 처분근거 체인", priority: 15, }, // ── 16. "신고" — 단독이면 action_basis, "신고 방법/절차"면 procedure ── { name: "report_action", patterns: [ /신고|등록/, ], tool: "chain_action_basis", extract: (query) => { if (hasProcedureIntent(query)) { return { _reroute: "chain_procedure_detail", query } } return { query } }, reason: "신고/등록 키워드 → 처분근거 (절차 키워드 동반 시 절차상세)", priority: 16, },