abyss-api / agent /tools /__init__.py
KyleEastwood's picture
Upload folder using huggingface_hub
cc15101 verified
Raw History Blame Contribute Delete
668 Bytes
from .search import search
from .calculator import calculate
from .code_runner import run_code
from .files import file_op
from server.safety.toolguard import screen_tool_call
TOOLS = {
"search": search,
"calc": calculate,
"code": run_code,
"file": file_op,
}
def dispatch(tool_name: str, args: str) -> str:
# Phase W: screen + audit every tool call before it runs.
allowed, message = screen_tool_call(tool_name, args)
if not allowed:
return message
fn = TOOLS.get(tool_name.lower())
if fn is None:
return f"Unknown tool '{tool_name}'. Available: {', '.join(TOOLS)}"
return fn(args)