MCPcopy Create free account
hub / github.com/buct2012dbl/Dorchestrator / execute

Function execute

coding-agent/src/tools/bash-tool.ts:24–58  ·  view source on GitHub ↗
(
    args: { command: string; timeout?: number },
    context: ToolContext
  )

Source from the content-addressed store, hash-verified

22 required: ['command']
23 },
24 async execute(
25 args: { command: string; timeout?: number },
26 context: ToolContext
27 ): Promise<ToolResult> {
28 try {
29 const timeout = args.timeout || 30000;
30
31 const { stdout, stderr } = await execAsync(args.command, {
32 cwd: context.workingDirectory,
33 timeout,
34 maxBuffer: 10 * 1024 * 1024, // 10MB
35 shell: '/bin/bash'
36 });
37
38 return {
39 success: true,
40 data: {
41 stdout: stdout.trim(),
42 stderr: stderr.trim(),
43 command: args.command
44 }
45 };
46 } catch (error: any) {
47 return {
48 success: false,
49 error: error.message,
50 data: {
51 stdout: error.stdout?.trim() || '',
52 stderr: error.stderr?.trim() || '',
53 code: error.code,
54 command: args.command
55 }
56 };
57 }
58 }
59};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected