uefn-scripting-batch
Run 5+ MCP calls server-side in one request with ProgrammaticToolset (get_execution_environment, execute_tool_script) for batched reads, widget chains and edit+build. Use when several calls can share
SKILL.mduser-level-skills/uefn-scripting-batch/SKILL.md
GitHubuefn-scripting-batch
Source: Claude/docs/mcp/scripting-batch.md, recipes.json (only tool-ok or proven; proven = the same call form already worked in real work), SKILLS-PROPOSAL.md B7.
Read first
- Read
uefn-mcp-lab-guard(the guard sees only the OUTER call, so the script itself must use lab paths only). - Ping with a cheap read before the first write script.
- If the MCP does not answer: stop and report. Never close or kill a running editor (after a crash:
uefn_session.py recover, opt-in).
Rules
- Paths inside scripts: GUID form
/09e4e8d3-83f9-4ee0-9777-072ed3984380/root_ai_lab/...; nothing outside the lab, no other project's mount. - The guard is not bypassed (no sandbox-escape attempts; dunder access is out of scope); a refusal is reported verbatim.
- If a recipe fails: exact error text, then STOP.
- No write script without a cleanup plan: inner errors cannot be caught and there is NO rollback, the caller deletes what was created.
Verified recipes (toolset editor_toolset.toolsets.programmatic.ProgrammaticToolset)
| Tool | Args | Note |
|---|---|---|
| get_execution_environment | {} |
returns instructions, supported_modules (json, math, datetime, copy, re, time), language python |
execute_tool_script #batch_reads |
script: several read tools, returns a dict | read only; timing with time |
execute_tool_script #create_widget_chain |
CreateWidgetBlueprint, AddWidget Overlay (parentWidget None), AddWidget StackBox, CompileWidgetBlueprint, save |
cleanup: AssetTools/delete {path} of the blueprint |
execute_tool_script #verse_edit_build |
Replace + BuildAll, returns diagnostics | ~5 s for two builds; cleanup as Replace |
Script shape: define run() returning a dict; call execute_tool("<Toolset>.<Tool>", json.dumps(args))["returnValue"] (dot between toolset and tool inside scripts).
Traps (exact messages)
- Forbidden import:
Import of 'os' is not permitted. Allowed modules: frozenset({'json', 'time', 'math', 'datetime', 'copy', 're'}); same for subprocess, sys, unreal. Script must define a callable run() function.;run() must return a dict[str, Any], returned list.- Args as dict:
TypeError: the JSON object must be str, bytes or bytearray, not dict(usejson.dumps). - A failing inner tool cannot be caught (
try/exceptdoes not work); the script aborts and earlier writes stay (seen: orphanWBP_Scr007with its Overlay). - No state between scripts;
open(..., "w")refused (Mode 'w' is not permitted); reads only in the editor's allowed directories;eval/execare NameError. - Before a write script check
existsinside it; on failure list what was written and delete it.
To try (not verified)
recipe/apply_material_instance_to_actor(ONE script: add actor, set overrideMaterials, read back, reset, remove): status unverified in recipes.json; materials area; apply+read+reset+remove must stay in one script.recipe/animate_owner_actor_with_script_and_restore: status field is unverified (the innerverifiedflag is inconsistent); loop ofset_actor_transformwithtime.sleep, restores the original transform. Confirm before use.