execute_script
Run Python inside a live Isaac Sim or Omniverse Kit app to inspect and edit USD scenes, control simulation, and return data via a result variable.
Instructions
Execute Python inside the running Kit app (Isaac Sim, USD Composer, ...).
The script has access to: omni, carb, Usd, UsdGeom, UsdLux, UsdPhysics, Sdf, Gf, mcp.
Assign to 'result' to return data. stdout/stderr are captured.
The `mcp` object provides async access to MCP handlers from within scripts.
Use `await` to call its methods (the script automatically runs as async):
viewport = await mcp.capture_viewport(width=1280)
tree = await mcp.scene_tree()
await mcp.set_camera([5, 3, 5], target=[0, 0, 0])
result = {"tree": tree["result"]}
Available mcp methods:
mcp.capture_viewport(width, height, camera_path)
mcp.set_camera(position, target)
mcp.look_at(prim_path, distance, azimuth, elevation)
mcp.inspect(prim_path, angles, width, height, zoom_offset=0.0, isolate=False)
mcp.scene_tree(root, max_depth)
mcp.prim_properties(prim_path)
mcp.prim_bounds(prim_path)
mcp.set_transform(prim_path, position, rotation, scale)
mcp.create_prim(prim_path, prim_type, **kwargs)
mcp.delete_prim(prim_path)
mcp.set_material(prim_path, color, opacity, roughness, metallic)
mcp.sim_control(action) -- play/pause/stop/step
mcp.sim_state()
mcp.get_logs(count, min_level, channel, search)
Each returns the full handler response dict with "status" and "result" keys.
Use Context7 MCP (library: isaac-sim/isaacsim) to look up the correct API calls.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python to run inside the Kit app; assign to result to return data |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |