agentleFS
ChiR24ChiR24/Unreal_mcp/tests/AGENTS.md

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.

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
  1. Distinctive:

    Test infrastructure for the TypeScript MCP server and Unreal bridge contracts.

    line 3
  2. Very specific:

    Use { scenario, toolName, arguments, expected }.

    line 61
  3. Very specific:

    Keep the standard relative runToolTests import shape.

    line 63
  4. Distinctive:

    Use unique actor/asset names, usually timestamped, and add explicit cleanup for created state.

    line 65
  5. Very specific:

    Put success, error, or timeout first according to what the case is proving.

    line 72
  6. Very specific:

    Do not use broad masks such as success|error or place timeout after error.

    line 74
  7. Very specific:

    Treat reports/ as disposable evidence.

    line 84
  8. Distinctive:

    When moving or renaming implementation files, update contract paths and assertions only when the intended invariant changed.

    line 89

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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 files

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. It does NOT assert a 23-tool listing.

TIMEOUT LADDER

ScopeDefaultOverride
Vitest unit10svitest.config.ts testTimeout
Integration per-case5sUNREAL_MCP_TEST_CASE_TIMEOUT_MS, or per-case timeoutMs (cleanup cases use 30s)
Per-call server60sUNREAL_MCP_TEST_CALL_TIMEOUT_MS
Client / progress300sUNREAL_MCP_TEST_CLIENT_TIMEOUT_MS
Bridge port wait10snone; createConnectedClient is passed 10000
Inter-case throttle100msUNREAL_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

TaskLocationNotes
Change live test executiontest-runner.mjs, test-runner-response-utils.mjsOwns server spawn, response normalization, retries, assertions, captures, cleanup, reports
Add broad integration coverageintegration.mjsCanonical quick suite across parent tools
Add tool/action coveragemcp-tools/<category>/*.test.mjsImport runToolTests directly and keep setup before dependent cases
Change expectation parsingexpectation-utils.mjs, unit/test_runner.test.tsLock evaluator changes with focused unit cases
Change parameter auditparameter-audit-*.mjsSchema AST, suite capture, live/static evidence, reporting
Change architectural contractsunit/plugin/, unit/source_structure.test.ts, unit/tools/handler_structure.test.tsThese 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 audit

INTEGRATION CASES

  • Use { scenario, toolName, arguments, expected }; optional fields include assertions, captureResult, and timeoutMs.
  • Export no custom harness: end each suite with runToolTests('<suite-name>', cases).
  • Keep the standard relative runToolTests import shape; the static audit replaces that import while evaluating suite definitions.
  • Cases keep naming the pre-fold actions. At run time runToolTests derives 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 add where: { path, equals|includes } and selectField. Later arguments reference ${captured:key}.
  • Assertions address response paths such as structuredContent.result.assetPath. The operators evaluateAssertions implements are exactly: equals, approximately (with a nonnegative tolerance), includes, notIncludes, length, minLength, includesObject, and gte (numeric, the counterpart of minLength).
  • 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 gte assertions sat here asserting nothing; ASSERTION_OPERATORS in test-runner-response-utils.mjs is the list, and adding an operator means adding it there.

EXPECTATION GRAMMAR

  • Strings split on literal or or |; the first token is the primary intent.
  • Put success, error, or timeout first according to what the case is proving.
  • Success-primary cases may name narrow state alternatives such as already exists, not found, not loaded, or NOT_PARTITIONED.
  • Do not use broad masks such as success|error or place timeout after error; crashes, bridge loss, and non-primary timeouts are infrastructure failures.
  • Object expectations support condition, successPattern, and errorPattern; prefer patterns for exact controlled fallback codes.
  • structuredContent.success: false, nested failures, or isError: true must 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/ plus integration.mjs.
  • Missing or extra actions always fail the parameter audit. --strict also fails undeclared test parameters, so a case for a removed action or param must go with it.
  • --optional-strict fails optional schema parameters absent from static coverage; npm run test:params enables 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.ts cases 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.