MCPcopy Create free account
hub / github.com/53AI/53AIHub / executeSandboxRuntimeRunShell

Function executeSandboxRuntimeRunShell

api/service/tools/sandbox_runtime_executor.go:280–307  ·  view source on GitHub ↗
(ctx context.Context, args map[string]interface{})

Source from the content-addressed store, hash-verified

278}
279
280func executeSandboxRuntimeRunShell(ctx context.Context, args map[string]interface{}) (*ToolResult, error) {
281 command, ok := args["command"].(string)
282 if !ok || strings.TrimSpace(command) == "" {
283 return nil, fmt.Errorf("missing command argument")
284 }
285 session, err := runtimeSessionForContext(ctx)
286 if err != nil {
287 return nil, err
288 }
289 timeout := 30
290 if v, exists := args["timeout"]; exists {
291 timeout = parseIntValue(v, timeout)
292 }
293 cwd := resolveSandboxCWD(ctx, args)
294 if strings.TrimSpace(cwd) == "" {
295 cwd = config.SandboxRuntimeContainerWorkdir
296 }
297 result, err := getSandboxRuntimeResult(ctx, session, sandboxruntime.CommandRequest{
298 Command: command,
299 Cwd: cwd,
300 Env: resolveSandboxEnvVars(ctx, args),
301 TimeoutSeconds: timeout,
302 })
303 if err != nil {
304 return nil, err
305 }
306 return result, nil
307}
308
309func executeSandboxRuntimeReadFile(ctx context.Context, args map[string]interface{}) (*ToolResult, error) {
310 path, ok := args["path"].(string)

Callers 2

ExecuteToolWithResultFunction · 0.85
ExecuteToolStreamFunction · 0.85

Calls 6

runtimeSessionForContextFunction · 0.85
parseIntValueFunction · 0.85
resolveSandboxCWDFunction · 0.85
getSandboxRuntimeResultFunction · 0.85
resolveSandboxEnvVarsFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected