"""Standalone Agent Tools — 执法助手工具集"""

from app.agent.tools.decorator import tool

from app.agent.tools.md_search_tool import search_markdown_knowledge
from app.agent.tools.case_db_tool import query_case_context


@tool
def ask_clarification(question: str, clarification_type: str = "missing_info",
                     context: str = "", options: list[str] = None) -> str:
    """当信息不完整或需求不明确时，向用户请求澄清。

    Args:
        question: 需要澄清的问题
        clarification_type: 澄清类型 (missing_info/ambiguous_requirement/approach_choice/risk_confirmation/suggestion)
        context: 需要此信息的背景说明
        options: 可选项列表（如有）
    """
    result = f"[澄清请求] {question} (类型: {clarification_type})"
    if context:
        result += f"\n背景: {context}"
    if options:
        result += f"\n可选项: {', '.join(options)}"
    return result


def get_all_tools(include_task: bool = False) -> list:
    """Get all available tools for the agent.

    Args:
        include_task: Whether to include the task delegation tool (subagent).

    Returns:
        List of tool instances.
    """
    tools = [
        search_markdown_knowledge, query_case_context, ask_clarification,
    ]

    if include_task:
        from app.agent.subagent import task
        tools.append(task)

    return tools
