File size: 750 Bytes
ad8ba8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from src.infrastructure.tools.registry import tool_registry
from src.infrastructure.sandbox.docker_manager import docker_sandbox

async def file_read(session_id: str, path: str) -> str:
    """Read a file from the sandbox"""
    if not docker_sandbox:
        return "Error: Sandbox unavailable"
    return await docker_sandbox.read_file(session_id, path)

tool_registry.register(
    name="file_read",
    description="Read a file from the sandbox",
    parameters={
        "type": "OBJECT",
        "properties": {
            "session_id": {"type": "STRING", "description": "The session ID"},
            "path": {"type": "STRING", "description": "The file path"}
        },
        "required": ["session_id", "path"]
    },
    func=file_read
)