Contributing to UEAgent¶
Thanks for helping. This file explains how the code is laid out, how a tool is added and what a change has to pass. How a call travels through the editor is in docs/architecture.md, and how a release is made in RELEASING.md.
Ground rules¶
- Open an issue before a large change, so the approach is agreed first.
- Code, comments and docs are in English. Comments say what the code does and why; its history lives in git.
- The C++ is the source of truth: never edit a generated file by hand.
Layout¶
| Path | What lives there |
|---|---|
Source/UEAgent/Private/Commands/<Area>/UEAgent<Family>Commands.cpp |
One command family per file. Its handlers are functions of the family's namespace, and a McpCommandFamilies::FRegistrar at the end of the file lists every command string with the function that runs it. |
Source/UEAgent/Private/Commands/Common/McpCommonUtils.* |
The helpers every family shares (mcp_common). |
Source/UEAgent/Private/Mcp/ |
The HTTP server, the tool catalog with its compact meta-tools, and the contract around each call (preconditions and readback). |
Tools/ |
Python scripts that derive the catalog and the generated tables from the C++, the audits, and catalog_server.py, which lists the tools without the editor for MCP directories. |
Resources/command_catalog.json |
The tool catalog the server publishes (generated). |
Resources/ContractTests/ |
The contract's test vectors. |
Resources/Skills/ |
The agent skills the editor installs into a project (MCP > Skills), in the Agent Skills format. Their names start with ueagent-, and Tools/check_skills.py checks the format and that every tool they name is in the catalog. The server also serves them as MCP prompts and resources (McpPrompts.cpp). The tables of ueagent-tool-map are generated: Tools/codegen_tool_map.py. |
docs/tools/ |
The tool reference (generated). |
docs/, mkdocs.yml |
The documentation site. Tools/mkdocs_hooks.py adds, when it is built, what GitHub does not show: the README sections and root files the pages include, the client tabs, the links from tool names to the reference, the tool chips, the tool explorer's data and llms.txt. |
Adding a tool¶
Name it with its verb first, one verb per operation: get_ reads one thing (get_<x>_info all of it),
list_ enumerates, find_ searches by name or condition, is_/has_ answer yes or no; create_ makes an
asset, add_ puts a part into an asset or actor, spawn_ places an actor in a world; set_ writes;
remove_ takes a part out, delete_ deletes an asset or actor, clear_ empties a list. The generator refuses
the synonyms (read_, inspect_, query_, configure_, update_...).
- Write the handler in its family's
.cpp:TSharedPtr<FJsonObject> HandleDoThing(const TSharedPtr<FJsonObject>& Params). Read required params withmcp_common::ReadRequiredString/ReadRequiredNumber/ReadRequiredBool, and answer withmcp_common::MakeOkReply,MakeSavedReply,MakeOutcomeReplyorMakeErrorReply. - Annotate it right above the function. This text is what the agent reads in the catalog:
// MCP:do_thing - What it does, written for the agent that will call it.
// @param thing_path - What it is, and that it is required.
// @returns { thing_path: string, done: bool }
The description, each @param and the @returns are one line each, and a command has one
@returns: the generator reads one line, and --check fails on text that goes on below. Notes for
whoever maintains the handler go under the @returns line, at its indentation.
The server appends the @returns to the description it publishes, and publishes the tool's MCP
annotations (read-only, destructive, idempotent, open world), which Tools/tool_hints.py derives
from the code the handler runs and from its verb. When the name misleads that rule, say so on a
line of the block, // @hints read-only or // @hints additive idempotent
(python Tools/tool_hints.py --why do_thing shows the verdict and its evidence). A read-only
that the code contradicts fails the generator.
// @hints code-exec marks a tool that runs code or a process the caller supplies, and
// @hints observes one that writes only an image under the project's Saved folder; the catalog
carries them as codeExec and observes, and Tools/tool_hints.py pins both lists.
A long description reads better as short paragraphs: each one after the first goes on its own
// @para line, one line each. // @core puts the tool in the list every client gets by default
(at most 11, so that with the four meta-tools the list stays at 15), and // @pack <name> puts it in
a pack that enable_toolset adds by name, one of PACKS in Tools/codegen_command_catalog.py.
- Add its row to the family's
FRegistrar:{ TEXT("do_thing"), &HandleDoThing }, - Regenerate, in this order (the tables read the catalog):
python Tools/integrate_property_handlers.py
python Tools/codegen_command_catalog.py --write
python Tools/codegen_param_table.py --write
python Tools/codegen_param_aliases.py --write
python Tools/codegen_pie_safety.py --write
python Tools/codegen_tool_docs.py --write
python Tools/codegen_tool_map.py --write
A new family is a new .cpp with its namespace, a // MCP-DOMAIN: <Domain> marker and its
FRegistrar; nothing else changes. Like every file under Source/, it starts with the copyright
notice: python Tools/check_copyright.py --write adds it. A new domain also gets a phrase in DOMAINS
(Tools/codegen_command_catalog.py), which says what the domain covers in find_tools, the tool reference and the
ueagent-tool-map skill; the catalog check fails without it. The server reads the
catalog at editor startup and on mcp.http.restart.
Renaming or retiring a tool¶
A call to an old name keeps working until the next major version, so a rename or a retirement does not break anyone:
- Renamed: give the tool its new name and add
// @renamed-from old_nameto its block. A call to the old name runs the tool. - Retired, because another tool does the same: keep it and add
// @retired other_tool - how to make the same call with other_tool. It still runs under its own name.
Both leave tools/list, find_tools and the reference, and a call answers as before plus
data.retired_name, which says what to call instead. docs/tools/retired.md lists them.
Before a pull request¶
- The plugin builds with no warning of its own.
- The documentation site builds with no warning:
pip install mkdocs-material==9.7.7, thenmkdocs build --strict. - Every generator passes
--check; CI runs them on each push, withTools/check_copyright.py,Tools/check_doc_links.py,Tools/check_skills.py,Tools/check_tool_count.pyandruff check Tools. - The tool counts in the prose say the catalog's count rounded down to the hundred ("more than 1,500"):
Tools/check_tool_count.pyfails when a pull request crosses a hundred and leaves them behind. python Tools/smoke_test.py --launch <a throwaway .uproject> --engine <UE root>passes: it starts a headless editor and checks the server end to end over HTTP.- A change to how
McpToolCatalog.cppbuilds a schema, or to howMcpPrompts.cppserves a prompt or a resource, is made inTools/catalog_server.pytoo: with the editor open,python Tools/catalog_server.py --comparemust find no difference. - The contract self-tests pass in the editor:
mcp.contract.selfteston each vector file inResources/ContractTests, and the automation testsAutomation RunTests UEAgent(the client files, the skills installer and the rest). - A change of behavior says how it was measured: the call before and after, in a headless editor when possible.
- The audits do not get worse:
Tools/audit_outcome_honesty.py(is each mutating tool'ssuccessmeasured?) andTools/audit_runtime_mode.py(which tools need a live editor). CI runsaudit_outcome_honesty.py --checkagainstTools/outcome_honesty_baseline.json: a newhardcoded_successtool fails it. After making tools honest, lower the baseline with--write-baseline.
License of contributions¶
UEAgent is released under the MIT License. By submitting a contribution you agree that it is released under the same license, and you confirm that you wrote it or have the right to submit it under that license.