Tools is broken

This commit is contained in:
eweeman
2026-01-15 17:01:02 -08:00
parent 4a6e2b898f
commit fcc86b52c2
11 changed files with 596 additions and 109 deletions

View File

@@ -583,4 +583,16 @@ def generate_mikrotik_CPE_script(**kwargs: Any) -> Dict[str, Any]:
return {"error": f"An unexpected internal error occurred while generating the script: {str(e)}"} # Return generic error
# --- End Tool Implementation ---
# --------------------------------------------------
# Tool Entrypoint (required by tool_loader)
# --------------------------------------------------
def run(**kwargs):
"""
Tool entrypoint required by the bot runtime.
This must exist so the LLM can execute the tool.
"""
return generate_mikrotik_CPE_script(**kwargs)
# --- END OF FILE mtscripter.py ---

View File

@@ -128,3 +128,11 @@ def get_imail_password(username, domain):
except Exception as e:
return {"status": "error", "message": f"Database error: {str(e)}"}
def run(**kwargs):
"""
Tool entrypoint required by the bot runtime.
This must exist so the LLM can execute the tool.
"""
return get_imail_password(**kwargs)

View File

@@ -0,0 +1,47 @@
TOOL_DEFINITION = {
"name": "calculator",
"description": "Performs basic math calculations. Can add, subtract, multiply, or divide two numbers.",
"input_schema": {
"type": "object",
"properties": {
"operation": {
"type": "string",
"enum": ["add", "subtract", "multiply", "divide"],
"description": "The math operation to perform"
},
"a": {
"type": "number",
"description": "First number"
},
"b": {
"type": "number",
"description": "Second number"
}
},
"required": ["operation", "a", "b"]
}
}
def run(operation: str, a: float, b: float) -> dict:
"""
Execute the calculation.
"""
operations = {
"add": lambda x, y: x + y,
"subtract": lambda x, y: x - y,
"multiply": lambda x, y: x * y,
"divide": lambda x, y: x / y if y != 0 else "Error: Division by zero"
}
if operation not in operations:
return {"error": f"Unknown operation: {operation}"}
result = operations[operation](a, b)
return {
"operation": operation,
"a": a,
"b": b,
"result": result
}