17 lines
582 B
Python
17 lines
582 B
Python
from tools import TOOL_SCHEMAS, bash, read_file, write_file
|
|
|
|
|
|
async def dispatch_tool(tool_name: str, tool_input: dict, sandbox):
|
|
"""Route tool calls to implementations."""
|
|
|
|
if tool_name == "bash":
|
|
return await bash(command=tool_input["command"], sandbox=sandbox)
|
|
elif tool_name == "read_file":
|
|
return await read_file(tool_input["filepath"], sandbox=sandbox)
|
|
elif tool_name == "write_file":
|
|
return await write_file(
|
|
tool_input["filepath"], tool_input["content"], sandbox=sandbox
|
|
)
|
|
|
|
return f"Unknown tool: {tool_name}"
|