INNER CODE UNIT · Python
execute_unreal_command
prajwalshettydev/UnrealGenAISupport · Content/Python/mcp_server.py:175
def execute_unreal_command(command: str) -> str:
"""
Execute an Unreal Engine command-line (CMD) command.
Args:
command: A string containing the Unreal Engine command to execute (e.g., "obj list", "stat fps").
Returns:
Message indicating success or failure, including any output or errors.
Note:
This tool executes commands directly in Unreal Engine's command system, similar to the editor's console.
It is intended for built-in editor commands (e.g., "stat fps", "obj list") and not for running Python scripts.
Do not use this tool with 'py' commands (e.g., "py script.py"); instead, use `execute_python_script` for Python
execution, which provides dedicated safety checks and output handling. Output capture is limited; for detailed
output, consider wrapping the command in a Python script with `execute_python_script`.
"""
try: