--- name: mcp-tool-contracts description: Canonical, single-source-of-truth mapping of "what I want to do via UEFN's MCP server" to "the exact tool that actually works for it in this kit's setup" — referenced by coder, qa-regression, and project-bootstrap instead of each describing the check in its own words. --- # MCP tool contracts Every agent that talks to UEFN's MCP server needs to do the same handful of things (verify which project is open, list real project content, and so on). This file is the ONE place that says which tool actually does each of those things in this kit's setup — every agent file references this file by name instead of restating the instruction in its own prose. **Why this file exists**: a v1.67 incident traced back to the exact same generic instruction ("list a couple of files through the MCP tools") appearing, worded slightly differently, in three separate agent files (`coder.md`, `qa-regression.md`, `project-bootstrap.md`). `coder` picked `AssetTools.find_assets` on `/Game` — the intuitive-sounding choice — which silently returns nothing useful for this kit's custom project content even with the right project open, and reads exactly like "the wrong project is open in UEFN," sending debugging in the wrong direction. Fixing the wording in all three files at once worked, but it relied on remembering to touch all three every time this file's contents change. A single referenced file can't diverge from itself. ## Contract: use the whole MCP (map first) **Use:** `py -3 Claude/hooks/mcp_map.py --find ` before any MCP work. See `references/use-whole-mcp.md` for full details. ## Contract: verifying which project UEFN has open **Use:** `ValkyrieToolset.VerseToolset.ListFiles` via `call_tool`. See `references/verifying-project-open.md`. ## Contract: detecting MCP mode (before reading or changing anything in the level) **How the tools are called:** in this kit the UEFN tools are reached through the single MCP tool `mcp__unreal-mcp__call_tool` (the name of the MCP server can differ per machine, look for a `call_tool`), with arguments like `{"toolset_name": "ValkyrieToolset.VerseToolset", "tool_name": "ListFiles", "arguments": {}}`. A tool list that shows only `...call_tool` is NOT `offline`: make the call through it. If the first call answers with a schema error, the tool exists: read the schema it returns and retry with the right arguments. Only when no such MCP tool exists, or the call fails with a connection error, is the mode `offline` (UEFN closed or the MCP not running): then say which of the two it was. **Recipes on 43.00:** a recipe may carry `args43` and `tool43`: use them instead of `args` and the old tool name when the tools are named one by one (UEFN 43.00 and later). Recipes without them have not been checked against 43.00 yet: try them once and replay if the tool answers about its arguments. **UEFN 43.00 and later (measured 2026-11-03):** there is no `call_tool`. Each tool has its own name, `mcp__unreal-mcp___` (for example `mcp__unreal-mcp__VerseToolset_VerseToolset_ListFiles`, `mcp__unreal-mcp__ValkyrieFortniteToolset_DeviceToolset_PlaceDevice`), about 800 of them, loaded on demand: run ToolSearch `select:` before the first call. The dotted names in this file keep meaning the same tool (`ValkyrieToolset.VerseToolset` / `ListFiles` is now `VerseToolset` / `ListFiles`); the map `mcp_map.py --find WORDS` gives the exact current name. Several steps in one go: `execute_tool_script` with `async def run():` and `await execute_tool("EditorToolset.LevelToolset.GetCurrentLevel", {...})` (a plain `def run()` is refused). Positions are shown in LUF but tools take engine XYZ. **Modes:** `live` = the UEFN MCP answers (`ValkyrieToolset.VerseToolset.ListFiles` works and matches the project identity, see above). `offline` = no MCP tools, or the check fails. **Procedure:** run the project-identity check once per session. In `live` mode you may read devices and wiring in the level (read-only unless the task is a change). In `offline` mode work from the Verse map and the code only, and name in the report exactly which devices, settings and wiring were not inspected. Never skip the level silently and never guess device settings. ## Contract: reading the devices placed in the level (read-only, only when the mode is `live`) **Tools seen working in this kit's logs** (names can change with UEFN updates; if one is missing, call `describe_toolset` on its toolset and use the closest read tool): `editor_toolset.toolsets.scene.SceneTools.find_actors` (which device actors of a class exist and where), `ValkyrieToolset.DeviceToolset.ListEventBindings` (wiring between devices), `ValkyrieToolset.DeviceToolset.GetDeviceProperties` / `ListDeviceProperties` (settings), `editor_toolset.toolsets.object.ObjectTools.get_properties`. **Procedure:** first reuse what is already written: if the project has `Claude/docs/DEPENDENCY-MAP*.md` or `Claude/docs/map/DEVICES.md`, learn from it and do not call the MCP again for the same facts. Otherwise read only the device classes that the Verse map cards reference (`@editable` types), one class at a time, and write the result compactly to `Claude/docs/map/DEVICES.md` (class, count, who wires it to whom, the few settings that matter). Counts per class are only the start: the wiring (`ListEventBindings`) and the key settings (`GetDeviceProperties`) are the information the next sessions need, so read them in the same pass (max 40 devices per pass, most-referenced first, list the rest). Never change anything in the level while learning. Facts only: a device nobody references in the sources you searched is "no reference found in ", never "unused". ## Contract: reading the island configuration and deducing the shape of the game (read-only, `live` mode) **Use:** the Island/Experience Settings device (class name contains `IslandSettings`, seen as "Experience Settings"), the team and inventory settings, and the Player Spawner devices, found with `find_actors` and read with `GetDeviceProperties` or `ObjectTools.get_properties`. Read them in the first learning/bootstrap pass, together with the device wiring. **Don't use:** the owner. Max players, teams, rounds, time limit, win condition, spawn mode, vehicles per player are FACTS in the level: never put them in a "to confirm" list. Never change a setting. **Procedure:** read the settings and group the Player Spawners by position cluster, `priorityGroup`, `useAsIslandStart`, `visibleInGame`, team and outgoing bindings. Deduce and write, each with its evidence and marked `[I]`: (1) max players and teams; (2) a cluster flagged island-start, hidden in game and with no bindings is a PRE-LOBBY (Epic's pregame-lobby pattern), a cluster whose spawn event drives vehicles, loadouts or a countdown is the GAME START; (3) compare capacity: game-start pads and vehicles per player versus max players, and report the gap as a finding, not as a question; (4) rounds, time limit and win condition from the settings. Write the result as `## Island configuration` in `Claude/docs/map/DEVICES.md` and as deduced facts in SPEC.md. When a deduction rule worked, queue it as a pattern in the genre skill (`skills_lib.py propose --section run-loop` or `devices`) so the next map starts from it. ## Contract: UI, Verse files, sessions and other toolsets (read first, write only when asked) **Use:** `references/read-tools-proven.md` lists the read tools proven on a real run and which need a real object first. `references/ui-session-tools.md` lists the toolsets beyond the device reads above (widgets, Verse fields, bindings, Verse files and build, sessions, entities, assets). **Don't use:** a write tool for a task that is only a question; never guess a tool name, run `describe_toolset`. **Procedure:** for screens built with Epic's Verse UI Kit follow the `verse-ui-kit` skill. ## Contract: changing a reference or an array on an object (read back, then stop and ask) **Use:** the property-set tools of the MCP, when the property is an object reference (a device pointing to another device, a widget, an asset) or an array of references. **Don't use:** as a "quick fix" to rewire a level. A reference set through the MCP can silently replace the one the editor had, and a wrong or empty one breaks the owner's graph without any error from the tool. **Procedure:** (1) read the property first and keep the old value in the reply; (2) set it only when the owner asked for exactly that change; (3) read it back and compare: if it differs from what was asked, or any other reference of the same object changed, STOP, tell the owner, and do not try again by guessing; (4) never change several references in one go without reading each back. Real case: after reference assignments the manager device kept its settings but the round started with 0 participants. ## Contract: wire-after-build (retry wiring after Verse build) **When:** Setting a Verse `@editable` property or wiring an event binding fails with an error indicating the Verse code is not yet compiled/available — e.g. "class not found", "no hash", "stale reflection", "not compiled", "no editable properties", "reflection not ready". **Use:** Run `verse_check.py` to trigger a Verse build once. Poll the device's editable properties via `GetDeviceProperties` until the expected field appears, up to 60s total. Then retry the original wiring/set-property operation ONCE. **Don't use:** A tight loop that retries without building, or retries more than once after the build. Never guess which field will appear — wait for the device's actual property list to include it. **Procedure:** 1. On failure, check the error text against the known "not built yet" signatures (see references/wire-after-build-errors.md). 2. Run `verse_check.py` — returns `{"state": "clean"}` when build succeeds with 0 errors. 3. Poll `GetDeviceProperties` for the target device every 2-3s (max 60s total) until the expected `@editable` field name appears. 4. Retry the original operation (SetDeviceProperty or AddEventBinding) exactly once. 5. If it still fails, report expected/seen/tried and stop. Do not loop. **Known "not built yet" error texts** — see `references/wire-after-build-errors.md` for the full list (exact strings from kit logs, MCP responses, uefn-lessons). ## Adding a new contract When a new MCP-tool gotcha gets discovered (a tool that seems right by name but doesn't do what's expected, or two tools that both technically work but one is clearly the intended one for this kit), add it here as a new `## Contract:` section with the same three fields — Use / Don't use / Procedure — rather than describing it inline in whichever agent file happened to discover it. Also add a short entry to `~/.claude/skills/uefn-lessons/SKILL.md` if the gotcha would help on a different island, not just this project (see that skill's own guidance on the "would this help on a different island?" test).