editor_console_command
Execute console commands directly within Unreal Engine's editor to control game behavior, modify settings, or trigger actions without manual input.
Instructions
Run a console command in Unreal
Example output: (No output for most commands, executed silently)
Executes the console command without returning output.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes |
Implementation Reference
- Python script executed in Unreal Editor that runs the provided console command using unreal.SystemLibrary.execute_console_command.import unreal def execute_console_command(command: str) -> None: unreal.SystemLibrary.execute_console_command(None, command) def main(): execute_console_command("${command}") if __name__ == "__main__": main()
- server/index.ts:231-231 (schema)Zod schema defining the input parameter 'command' as a string for the tool.{ command: z.string() },
- server/index.ts:228-243 (registration)Registers the 'editor_console_command' tool with the MCP server, including description, input schema, and handler function that delegates to editorTools.UEConsoleCommand.server.tool( "editor_console_command", "Run a console command in Unreal\n\nExample output: (No output for most commands, executed silently)\n\nExecutes the console command without returning output.", { command: z.string() }, async ({ command }) => { const result = await tryRunCommand(editorTools.UEConsoleCommand(command)) return { content: [ { type: "text", text: result, }, ], } }, )
- server/editor/tools.ts:18-19 (helper)Helper function that reads the ue_console_command.py script and templates it with the provided command string to generate executable Python code.export const UEConsoleCommand = (command: string) => Template(read("./scripts/ue_console_command.py"), { command })