Unreal_mcp / tests
AGENTS.md903 starsChanged 6 months agoMITView on GitHub
Test infrastructure for the TypeScript MCP server and Unreal bridge contracts. Vitest tests run without Unreal; MCP integration suites normally require a built server plus a connected Unreal Editor. The mock smoke test is scripts/smoke-test.ts, not under this directory. It imports dist/index.js (so npm run build must run first), uses linked in-memory transports, and self-sets MOCK_UNREAL_CONNECTION. It asserts exactly one public tool (unreal), that search/describe/configure work, that perActionSchemas is false, and that a hidden parent tool called directly is rejected.…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 3
Test infrastructure for the TypeScript MCP server and Unreal bridge contracts.
- Very specific: line 61
Use { scenario, toolName, arguments, expected }.
- Very specific: line 63
Keep the standard relative runToolTests import shape.
- Distinctive: line 65
Use unique actor/asset names, usually timestamped, and add explicit cleanup for created state.
- Very specific: line 72
Put success, error, or timeout first according to what the case is proving.
- Very specific: line 74
Do not use broad masks such as success|error or place timeout after error.
- Very specific: line 84
Treat reports/ as disposable evidence.
- Distinctive: line 89
When moving or renaming implementation files, update contract paths and assertions only when the intended invariant changed.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TEST KNOWLEDGE BASE
Test infrastructure for the TypeScript MCP server and Unreal bridge contracts. Vitest tests run without Unreal; MCP integration suites normally require a built server plus a connected Unreal Editor.
STRUCTURE
tests/
|-- test-runner.mjs # stdio client, setup/cleanup, expectations, JSON reports
|-- test-runner-response-utils.mjs # response-path assertions and filtered capture selection
|-- integration.mjs # compact representative parent-tool integration suite
|-- expectation-utils.mjs # shared expectation parsing
|-- mcp-tools/
| |-- core/ # actor, editor, assets, blueprints, levels, inspect, tools
| |-- gameplay/ # animation, AI, character, combat, effects, GAS, inventory
| |-- utility/ # audio, behavior trees, networking, sequences
| `-- world/ # environment, geometry, level structure, PCG
|-- parameter-combination-audit.mjs # audit CLI entrypoint
|-- parameter-audit-*.mjs # CLI, schema extraction, suite capture, coverage, context
|-- fold-twins.mjs # one twin case per folded family, applied by the runner and the audit capture
|-- unit/ # Vitest behavior, security, routing, and source contracts
`-- reports/ # generated JSON only; never add AGENTS or hand-authored filesThe mock smoke test is scripts/smoke-test.ts, not under this directory. It imports dist/index.js (so npm run build must run first), uses linked in-memory transports, and self-sets MOCK_UNREAL_CONNECTION. It asserts exactly one public tool (unreal), that search/describe/configure work, that perActionSchemas is false, and that a hidden parent tool called directly is rejected. It does NOT assert a 23-tool listing.
TIMEOUT LADDER
| Scope | Default | Override |
| Vitest unit | 10s | vitest.config.ts testTimeout |
| Integration per-case | 5s | UNREAL_MCP_TEST_CASE_TIMEOUT_MS, or per-case timeoutMs (cleanup cases use 30s) |
| Per-call server | 60s | UNREAL_MCP_TEST_CALL_TIMEOUT_MS |
| Client / progress | 300s | UNREAL_MCP_TEST_CLIENT_TIMEOUT_MS |
| Bridge port wait | 10s | none; createConnectedClient is passed 10000 |
| Inter-case throttle | 100ms | UNREAL_MCP_TEST_THROTTLE_MS |
Other runner env: MCP_AUTOMATION_WS_HOST (127.0.0.1), MCP_AUTOMATION_WS_PORTS (8090,8091), UNREAL_MCP_SERVER_CMD/ARGS/CWD, UNREAL_MCP_FORCE_DIST, UNREAL_MCP_AUTO_BUILD / UNREAL_MCP_NO_AUTO_BUILD, UNREAL_MCP_ALLOW_TS_FALLBACK, UNREAL_MCP_TEST_LOG_RESPONSES.
The runner AUTO-BUILDS: if dist/cli.js is missing, or source is newer than dist, it runs npm run build unless UNREAL_MCP_NO_AUTO_BUILD=1. It still needs a live editor.
A build that is attempted and FAILS now aborts the run. It used to fall through to ts-node-esm src/cli.ts, so a full green could be reported while dist/ — the artifact the package ships — was broken. Set UNREAL_MCP_ALLOW_TS_FALLBACK=1 to run source anyway and accept that dist/ is unverified. Choosing source deliberately (stale dist with UNREAL_MCP_NO_AUTO_BUILD=1) is unchanged.
WHERE TO LOOK
| Task | Location | Notes |
| Change live test execution | test-runner.mjs, test-runner-response-utils.mjs | Owns server spawn, response normalization, retries, assertions, captures, cleanup, reports |
| Add broad integration coverage | integration.mjs | Canonical quick suite across parent tools |
| Add tool/action coverage | mcp-tools/<category>/*.test.mjs | Import runToolTests directly and keep setup before dependent cases |
| Change expectation parsing | expectation-utils.mjs, unit/test_runner.test.ts | Lock evaluator changes with focused unit cases |
| Change parameter audit | parameter-audit-*.mjs | Schema AST, suite capture, live/static evidence, reporting |
| Change architectural contracts | unit/plugin/, unit/source_structure.test.ts, unit/tools/handler_structure.test.ts | These inspect source text and layout; they do not compile Unreal |
COMMANDS
npm run test:unit # Vitest: src/**/*.test.ts and tests/unit/**/*.test.ts
npm run test:smoke # mock in-memory MCP check against built dist/
npm test # tests/integration.mjs; Unreal-dependent
npm run test:params # static + strict + optional-strict parameter auditINTEGRATION CASES
- Use
{ scenario, toolName, arguments, expected }; optional fields includeassertions,captureResult, andtimeoutMs. - Export no custom harness: end each suite with
runToolTests('<suite-name>', cases). - Keep the standard relative
runToolTestsimport shape; the static audit replaces that import while evaluating suite definitions. - Cases keep naming the pre-fold actions. At run time
runToolTestsderives one twin per folded family (fold-twins.mjs): the first case naming a folded member is re-run as the family's primary plus its selector value, right after its source case. The audit captures the same twins, so every advertised primary and selector is covered without hand-written duplicates. - Use unique actor/asset names, usually timestamped, and add explicit cleanup for created state.
- Captures use
{ key, fromField }; array captures may addwhere: { path, equals|includes }andselectField. Later arguments reference${captured:key}. - Assertions address response paths such as
structuredContent.result.assetPath. The operatorsevaluateAssertionsimplements are exactly:equals,approximately(with a nonnegativetolerance),includes,notIncludes,length,minLength,includesObject, andgte(numeric, the counterpart ofminLength). - An assertion naming no recognised operator is REFUSED rather than passed. It used to fall through every check and report success, which is how two
gteassertions sat here asserting nothing;ASSERTION_OPERATORSintest-runner-response-utils.mjsis the list, and adding an operator means adding it there.
EXPECTATION GRAMMAR
- Strings split on literal
oror|; the first token is the primary intent. - Put
success,error, ortimeoutfirst according to what the case is proving. - Success-primary cases may name narrow state alternatives such as
already exists,not found,not loaded, orNOT_PARTITIONED. - Do not use broad masks such as
success|erroror placetimeoutaftererror; crashes, bridge loss, and non-primary timeouts are infrastructure failures. - Object expectations support
condition,successPattern, anderrorPattern; prefer patterns for exact controlled fallback codes. structuredContent.success: false, nested failures, orisError: truemust not pass a success-primary case unless an explicit allowed alternative matches.
AUDIT CONTRACTS
- Parameter schemas come from the generated parent definitions (the surface the server exposes); suite coverage is captured from
mcp-tools/plusintegration.mjs. - Missing or extra actions always fail the parameter audit.
--strictalso fails undeclared test parameters, so a case for a removed action or param must go with it. --optional-strictfails optional schema parameters absent from static coverage;npm run test:paramsenables all strict static gates.- A folded family's former names count as declared actions (
readFoldedActionsByTool), never as extra actions. - Live audit mode consumes the latest
<suite>-test-results-*.json; only successful live responses prove optional-parameter coverage. - Treat
reports/as disposable evidence. Diagnose failures from the newest JSON, but never edit reports to satisfy a gate.
SOURCE-CONTRACT TESTS
- Many
unit/plugin/*contracts.test.tscases read C++/C# files and assert required or forbidden source patterns. - Structure tests enforce responsibility boundaries, resolvable local includes, naming rules, and the 250 pure-line ceiling.
- When moving or renaming implementation files, update contract paths and assertions only when the intended invariant changed.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

