editor_validate_assets
Validate assets in Unreal Engine projects to identify errors, check asset status, and generate detailed validation reports with error details.
Instructions
Validate assets in the project to check for errors
Example output: {'total_validated': 100, 'valid_assets': [{'path': '/Game/Meshes/SM_Cube', 'class': 'StaticMesh', 'size': '1024'}], 'invalid_assets': [{'path': '/Game/Missing/Asset', 'error': 'Asset does not exist'}], 'validation_summary': {'valid_count': 95, 'invalid_count': 5, 'success_rate': 95.0}}
Returns validation results with asset status and error details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| asset_paths | No |
Implementation Reference
- Main handler function that validates assets: checks existence, loads them, validates data, collects valid/invalid lists and summary statistics.def validate_assets( asset_paths: Optional[Union[str, List[str]]] = None, ) -> Dict[str, Any]: validation_results = { "total_validated": 0, "valid_assets": [], "invalid_assets": [], "validation_summary": {}, } if asset_paths: assets_to_validate = ( asset_paths if isinstance(asset_paths, list) else [asset_paths] ) else: asset_registry = unreal.AssetRegistryHelpers.get_asset_registry() all_assets = asset_registry.get_all_assets() assets_to_validate = [ str(asset.package_path) + "/" + str(asset.asset_name) for asset in all_assets[:100] ] # Limit to 100 for performance validation_results["total_validated"] = len(assets_to_validate) for asset_path in assets_to_validate: try: if not unreal.EditorAssetLibrary.does_asset_exist(asset_path): validation_results["invalid_assets"].append( {"path": asset_path, "error": "Asset does not exist"} ) continue asset = unreal.EditorAssetLibrary.load_asset(asset_path) if not asset: validation_results["invalid_assets"].append( {"path": asset_path, "error": "Failed to load asset"} ) continue asset_data = unreal.EditorAssetLibrary.find_asset_data(asset_path) if not asset_data.is_valid(): validation_results["invalid_assets"].append( {"path": asset_path, "error": "Asset data is invalid"} ) continue validation_results["valid_assets"].append( { "path": asset_path, "class": asset.get_class().get_name(), "size": asset_data.get_tag_value("AssetFileSize") or "Unknown", } ) except Exception as e: validation_results["invalid_assets"].append( {"path": asset_path, "error": str(e)} ) # Generate summary validation_results["validation_summary"] = { "valid_count": len(validation_results["valid_assets"]), "invalid_count": len(validation_results["invalid_assets"]), "success_rate": round( len(validation_results["valid_assets"]) / validation_results["total_validated"] * 100, 2, ) if validation_results["total_validated"] > 0 else 0, } return validation_results
- server/editor/tools.ts:32-35 (helper)Helper function that templates the Python script with asset_paths parameter for execution via tryRunCommand.export const UEValidateAssets = (asset_paths?: string) => Template(read("./scripts/ue_validate_assets.py"), { asset_paths: asset_paths || "", })
- server/index.ts:316-333 (registration)Registers the 'editor_validate_assets' tool with MCP server, including description, schema, and handler that delegates to editorTools.UEValidateAssetsserver.tool( "editor_validate_assets", "Validate assets in the project to check for errors\n\nExample output: {'total_validated': 100, 'valid_assets': [{'path': '/Game/Meshes/SM_Cube', 'class': 'StaticMesh', 'size': '1024'}], 'invalid_assets': [{'path': '/Game/Missing/Asset', 'error': 'Asset does not exist'}], 'validation_summary': {'valid_count': 95, 'invalid_count': 5, 'success_rate': 95.0}}\n\nReturns validation results with asset status and error details.", { asset_paths: z.string().optional(), }, async ({ asset_paths }) => { const result = await tryRunCommand(editorTools.UEValidateAssets(asset_paths)) return { content: [ { type: "text", text: result, }, ], } }, )
- server/index.ts:319-321 (schema)Zod input schema defining optional asset_paths as string (likely comma-separated or single path).{ asset_paths: z.string().optional(), },