Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
queryYes처분 유형 + 키워드 (예: '건축허가 거부 근거', '보조금 환수')
apiKeyNo

Implementation Reference

  • 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)
      }
    }
  • 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(),
    })
  • 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
    },
  • 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,
    },
Behavior3/5

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

Without annotations, the description adds some behavioral context by outlining the multi-step process (3-step comparison followed by parallel searches of interpretation cases, precedents, and administrative appeal). However, it does not explain side effects, authentication needs, or rate limits, leaving gaps.

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 very concise, fitting the core purpose and workflow into a single short sentence. It is front-loaded with the keyword 'chain' and 'disposition basis,' making it scannable. No unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity as a chain that combines multiple legal sources, the description provides adequate context about the workflow and intended use. However, it lacks details about output format, return structure, or whether the result is a composite summary, which an agent might need for reliable invocation.

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?

The input schema already describes the 'query' parameter with examples. The tool description reinforces the expected input pattern but does not further clarify parameters or the undocumented 'apiKey'. Schema coverage is 50%, and the description adds marginal value.

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 clearly states the tool provides a 'disposition basis' for administrative actions, listing a specific workflow (3-step comparison, interpretation cases, precedents, administrative appeal in parallel). This differentiates it from sibling tools that focus on single types of legal documents.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions 'for questions on permission/disposition,' which implies a usage context, but it does not provide explicit guidance on when to use this tool versus sibling chain tools or when not to use it. No alternatives are named.

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