MCPcopy Create free account
hub / github.com/disler/always-on-ai-assistant / execute

Function execute

modules/execute_python.py:12–24  ·  view source on GitHub ↗

Execute shell code and return the output as a string.

(command: str)

Source from the content-addressed store, hash-verified

10
11
12def execute(command: str) -> str:
13 """Execute shell code and return the output as a string."""
14 try:
15 # Use shell=True to properly handle shell operators like &&
16 result = subprocess.run(
17 command,
18 shell=True,
19 capture_output=True,
20 text=True,
21 )
22 return result.stdout + result.stderr
23 except subprocess.SubprocessError as e:
24 return str(e)

Callers 4

process_textMethod · 0.90
execute_uv_pythonFunction · 0.85

Calls

no outgoing calls

Tested by 2