editor_export_asset
Export Unreal Engine assets to text format for external use or backup. Provide the asset path to retrieve raw binary content.
Instructions
Export an Unreal asset to text
Example output: Binary data of the exported asset file
Returns the raw binary content of the exported asset.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| asset_path | Yes |
Implementation Reference
- server/index.ts:174-191 (registration)Registers the 'editor_export_asset' MCP tool, including description, input schema {asset_path: z.string()}, and inline handler function.server.tool( "editor_export_asset", "Export an Unreal asset to text\n\nExample output: Binary data of the exported asset file\n\nReturns the raw binary content of the exported asset.", { asset_path: z.string(), }, async ({ asset_path }) => { const result = await tryRunCommand(editorTools.UEExportAsset(asset_path)) return { content: [ { type: "text", text: result, }, ], } }, )
- server/index.ts:180-190 (handler)The handler function that runs the templated Python command via tryRunCommand(UEExportAsset(asset_path)) and returns the result as text content.async ({ asset_path }) => { const result = await tryRunCommand(editorTools.UEExportAsset(asset_path)) return { content: [ { type: "text", text: result, }, ], } },
- server/index.ts:178-179 (schema)Zod schema defining the input parameter 'asset_path' as a string.asset_path: z.string(), },
- server/editor/tools.ts:13-13 (helper)Helper function that loads and templates the ue_export_asset.py script with the asset_path parameter.export const UEExportAsset = (asset_path: string) => Template(read("./scripts/ue_export_asset.py"), { asset_path })
- Core Python implementation that exports the Unreal asset to binary data using EditorAssetLibrary.load_asset and Exporter.run_asset_export_task, then outputs the raw bytes.import unreal import sys import tempfile def export_asset(asset_path: str) -> bytes: asset = unreal.EditorAssetLibrary.load_asset(asset_path) if not asset: raise ValueError(f"Asset not found at {asset_path}") export_task = unreal.AssetExportTask() export_task.automated = True export_task.prompt = False export_task.replace_identical = True export_task.exporter = None export_task.object = asset temp_file = tempfile.NamedTemporaryFile(delete=True, suffix=".uasset.copy") export_file_path = temp_file.name export_task.filename = export_file_path result = unreal.Exporter.run_asset_export_task(export_task) if not result: raise RuntimeError( f"Failed to export asset {asset.get_name()} to {export_file_path}" ) file = open(export_file_path, "rb") data = file.read() file.close() temp_file.close() return data def main(): data = export_asset("${asset_path}") sys.stdout.buffer.write(data) if __name__ == "__main__": main()