22 lines
599 B
Python
22 lines
599 B
Python
from pathlib import Path
|
|
from typing import Any
|
|
|
|
from app.tools.base import Tool
|
|
|
|
|
|
class FilesTool(Tool):
|
|
name = "files"
|
|
description = "Read and write files within allowed paths."
|
|
|
|
async def run(self, payload: dict[str, Any]) -> dict[str, Any]:
|
|
action = str(payload.get("action", "read")).strip()
|
|
path = Path(str(payload.get("path", "")).strip()).expanduser()
|
|
return {
|
|
"tool": self.name,
|
|
"status": "stub",
|
|
"action": action,
|
|
"path": str(path),
|
|
"message": "File integration is not wired yet.",
|
|
}
|
|
|