editor_get_map_info
Retrieve detailed information about the current Unreal Engine map, including actor counts, lighting data, and level structure for development analysis.
Instructions
Get detailed information about the current map/level
Example output: {'map_name': 'TestMap', 'map_path': '/Game/Maps/TestMap', 'total_actors': 45, 'actor_types': {'StaticMeshActor': 20, 'DirectionalLight': 1, 'PlayerStart': 1}, 'lighting': {'has_lightmass_importance_volume': false, 'directional_lights': 1, 'point_lights': 3, 'spot_lights': 0}, 'streaming_levels': 0, 'streaming_level_names': []}
Returns current level information with actor counts and lighting details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The Python script implementing the core tool logic: retrieves current map info including name, path, actor counts by type, lighting details, and streaming levels using Unreal Engine Python API, outputs JSON.from typing import Dict, Any import unreal import json def get_map_info() -> Dict[str, Any]: world = unreal.get_editor_subsystem(unreal.UnrealEditorSubsystem).get_editor_world() if not world: return {"error": "No world loaded"} map_info = {} map_info["map_name"] = world.get_name() map_info["map_path"] = world.get_path_name() all_actors = unreal.get_editor_subsystem( unreal.EditorActorSubsystem ).get_all_level_actors() map_info["total_actors"] = len(all_actors) actor_types = {} for actor in all_actors: actor_class = actor.get_class().get_name() actor_types[actor_class] = actor_types.get(actor_class, 0) + 1 map_info["actor_types"] = dict( sorted(actor_types.items(), key=lambda x: x[1], reverse=True)[:15] ) lighting_info = {} lighting_info["has_lightmass_importance_volume"] = any( actor.get_class().get_name() == "LightmassImportanceVolume" for actor in all_actors ) lighting_info["directional_lights"] = sum( 1 for actor in all_actors if actor.get_class().get_name() == "DirectionalLight" ) lighting_info["point_lights"] = sum( 1 for actor in all_actors if actor.get_class().get_name() == "PointLight" ) lighting_info["spot_lights"] = sum( 1 for actor in all_actors if actor.get_class().get_name() == "SpotLight" ) map_info["lighting"] = lighting_info try: streaming_levels = unreal.EditorLevelLibrary.get_all_level_actors_of_class( unreal.LevelStreamingDynamic ) map_info["streaming_levels"] = len(streaming_levels) map_info["streaming_level_names"] = [ level.get_name() for level in streaming_levels ] except Exception: map_info["streaming_levels"] = 0 map_info["streaming_level_names"] = [] return map_info def main(): map_data = get_map_info() print(json.dumps(map_data, indent=2)) if __name__ == "__main__": main()
- server/index.ts:262-277 (registration)Registers the 'editor_get_map_info' tool with the MCP server: defines name, description, empty input schema, and thin handler that executes the generated Python command via tryRunCommand.server.tool( "editor_get_map_info", "Get detailed information about the current map/level\n\nExample output: {'map_name': 'TestMap', 'map_path': '/Game/Maps/TestMap', 'total_actors': 45, 'actor_types': {'StaticMeshActor': 20, 'DirectionalLight': 1, 'PlayerStart': 1}, 'lighting': {'has_lightmass_importance_volume': false, 'directional_lights': 1, 'point_lights': 3, 'spot_lights': 0}, 'streaming_levels': 0, 'streaming_level_names': []}\n\nReturns current level information with actor counts and lighting details.", {}, async () => { const result = await tryRunCommand(editorTools.UEGetMapInfo()) return { content: [ { type: "text", text: result, }, ], } }, )
- server/editor/tools.ts:22-22 (helper)Helper function that reads and templates the ue_get_map_info.py script (no params needed), generating the Python code string to be executed by the handler.export const UEGetMapInfo = () => Template(read("./scripts/ue_get_map_info.py"))
- server/index.ts:264-264 (schema)Input schema: empty object, no parameters required."Get detailed information about the current map/level\n\nExample output: {'map_name': 'TestMap', 'map_path': '/Game/Maps/TestMap', 'total_actors': 45, 'actor_types': {'StaticMeshActor': 20, 'DirectionalLight': 1, 'PlayerStart': 1}, 'lighting': {'has_lightmass_importance_volume': false, 'directional_lights': 1, 'point_lights': 3, 'spot_lights': 0}, 'streaming_levels': 0, 'streaming_level_names': []}\n\nReturns current level information with actor counts and lighting details.",