from modules.search.news import fetch_news
from modules.search.arxiv import fetch_arxiv
from modules.search.web import fetch_ddg, fetch_torrents

# Tool descriptors
fetch_news_tool = {
    "type": "function",
    "function": {
        "name": "fetch_news",
        "description": "Return news headlines+snippets.",
        "parameters": {
            "type": "object",
            "required": ["query"],
            "properties": {
                "query": {"type": "string"},
                "max_results": {"type": "integer", "default": 10}
            }
        }
    }
}

fetch_arxiv_tool = {
    "type": "function",
    "function": {
        "name": "fetch_arxiv",
        "description": "Return arXiv titles+abstracts.",
        "parameters": {
            "type": "object",
            "required": ["query"],
            "properties": {
                "query": {"type": "string"},
                "max_results": {"type": "integer", "default": 10}
            }
        }
    }
}

fetch_ddg_tool = {
    "type": "function",
    "function": {
        "name": "fetch_ddg",
        "description": "Return DuckDuckGo result snippets.",
        "parameters": {
            "type": "object",
            "required": ["query"],
            "properties": {
                "query": {"type": "string"},
                "max_results": {"type": "integer", "default": 10}
            }
        }
    }
}

fetch_torrents_tool = {
    "type": "function",
    "function": {
        "name": "fetch_torrents",
        "description": "Return torrent search snippets.",
        "parameters": {
            "type": "object",
            "required": ["query"],
            "properties": {
                "query": {"type": "string"},
                "max_results": {"type": "integer", "default": 10}
            }
        }
    }
}

available_functions = {
    "fetch_news": fetch_news,
    "fetch_arxiv": fetch_arxiv,
    "fetch_ddg": fetch_ddg,
    "fetch_torrents": fetch_torrents
}