39 lines
795 B
Python
39 lines
795 B
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
import time
|
|
|
|
from core.tools.base import BaseTool, ToolContext
|
|
from core.tools.registry import registry
|
|
from core.events import bus
|
|
|
|
|
|
class PingTool(BaseTool):
|
|
name = "ping"
|
|
description = "Health check / liveness probe"
|
|
|
|
def execute(
|
|
self,
|
|
payload: dict[str, Any],
|
|
ctx: ToolContext
|
|
) -> dict[str, Any]:
|
|
message = payload.get("message", "pong")
|
|
|
|
bus.log(
|
|
"TOOLS",
|
|
"ping_execute",
|
|
"INFO",
|
|
{
|
|
"message": message
|
|
}
|
|
)
|
|
|
|
return {
|
|
"status": "ok",
|
|
"echo": message,
|
|
"tool": self.name,
|
|
"timestamp": time.time()
|
|
}
|
|
|
|
|
|
registry.register(PingTool()) |
