Local Openplanet bridge for controlling Trackmania from external tools and AI agents.
Website · Latest version · MCP CLI entrypoint · Pack authoring · Pack updates · TestKit sample
tm-control-mcp is an Openplanet plugin that exposes Trackmania’s map editor,
main menu, and related game state over a localhost JSON TCP socket. Coding
agents, scripts, and MCP-style clients can create maps, place freeblocks and
items, drive menu flows, take screenshots, inject ManiaScript, and clean up after
themselves — without clicking the UI by hand.
| Socket | 127.0.0.1:30006 (configurable) |
| Protocol | One newline-terminated JSON request per TCP connection; newline JSON response; socket closes |
| Platform | Trackmania (current) + Openplanet |
| Hard deps | MLHook · MLFeedRaceData |
| Optional | E++ tool pack + Editor++ for placement · Openplanet builtins VehicleState + Camera |
| License | Dual Unlicense or CC0 1.0 — public domain / no attribution required (GitHub may show “Other”) |
| Status | Active development (info.toml 0.4.0) |
| Script timeout | 15000 ms (info.toml [script] timeout) — long menu/place/wait tools need headroom |
| Security | Localhost JSON, no auth → SECURITY.md |
| Releasing | Agent checklist → RELEASE.md · history → CHANGELOG.md |
| Migration | From tm-mcptm → docs/migration-from-mcptm.md |
| Pack updates | Cached version checks in ListToolPacks and Settings → Updates; author guide + Pages template |
Safety: the control socket is localhost-only by design and has no auth. Do not bind it to a public interface. Details: SECURITY.md.
Editor++ placement, named macroblocks, inventory, and provenance cleanup are
provided by the separate E++ tool pack.
Install it with Editor++ and call those tools as tm-mcp-pack-epp.ToolName.
Legacy unprefixed E++ calls return moved_to_pack; discovery (route: tools)
is authoritative for each installed set of plugins.
- Readiness & waiting —
GetReadiness,WaitUntil, andtools/call.py--until-ready/--wait-modeso agents stop guessing “is the editor ready?” - Provenance tags —
SetAgentTag→ place →RemoveByTagcleans agent debris without nuking the whole map (ClearMapContentremains available when you mean it) - Placement verification —
AssertPlacement(deltas, near-point, tags) - Structured errors — failed tools can include
code,retryable,requiredMode,hint(plus the classicerrorstring) - In-plugin guides —
ListGuides/GetGuide(menu nav, vistas, skins, cleanup, manialink runner, …) - Screenshots —
TakeScreenshotnative viewport capture with in-plugin file detection,hideOverlay,forceRes;call.pyadds Linux-side path detection
- Mode / map / dialogs:
GetMode,OpenMapInEditor,GetMapInfo,GetMapEnvironment,SaveMapAs,GetDialog/RespondDialog - Cursor, selection, validation, camera (
ControlCursor,ControlSelection,ControlValidation,ControlCamera,FocusCamera, …) - Freeblock / flying item placement via Editor++ (
PlaceBlockViaEditorPlusPlus,PlaceItemViaEditorPlusPlus) — preferred over raw gridPlaceBlockfor free work - Named macroblocks — compose in memory, batch-add blocks/items (with skins), preflight, place with offset/pivot rotation; durable JSON save/load under the Openplanet data folder
- Inventory browse + picker control (
BrowseInventoryTree,ControlInventory,SelectBlockModel/SelectItemModel/SelectMacroblockModel,ControlEditMode) - Deletion: recent/by-index via E++
DeleteItems/ block delete; clear-all helpers
- Full main-menu stack: route push (
SetMenuPage), UI layer introspection, OnAction clicks (ClickMenuButton/TriggerControlOnAction) - Never use
TriggerPageAction— that path crashes; this plugin uses the sameCControlBase::OnActiondispatch as a real click - One-shot map create:
CreateMapViaMenu(QuickStart off) or fasterEditNewMap - Leave editor/race:
BackToMainMenu;ShutdownGamestarts a cancellable 30-second countdown withconfirm:true(may lose unsaved work)
RunManialinkScriptinjects ad-hoc ManiaScript through MLHook into menu / playground / editor (same contexts as MLHook’s UILayers browser)- Optional result channel:
collectMs+SendCustomEvent("MLHook_Event_McpAdHoc_Result", …)
Pointer peeks, safe memory reads, gizmo/fuzz helpers, macroblock header dumps —
only in DEV builds (./build.sh dev injects defines = ["DEV"]). Release
.op packages omit these tools from the registry.
Ground truth tool list: {"route":"tools"} at runtime, or every
MakeTool("…") in src/McpTools.as (106 tools (release; +7 DEV-only) at last count).
- Trackmania (Nadeo) running under your normal install (native Windows or Proton/Wine).
- Openplanet for Trackmania.
- Plugins (install from Openplanet site or your usual channel):
- Editor++ — optional, id
Editor
Tested with 0.8.x. Install with the E++ tool pack for free placement, inventory cache, named macroblocks, and E++ delete. The bridge itself does not depend on Editor++. Legacy unprefixed E++ tools returnmoved_to_pack. - MLHook — dependency id
MLHook
Tested with ≥ 0.5.4 (site id 252). Required for menuRouter_Pushand Manialink inject. - MLFeedRaceData — dependency id
MLFeedRaceData
Required forGetRaceData/GetPlayersrace-mode tools.
- Editor++ — optional, id
- This plugin loaded as a folder plugin (dev) or
.oppackage (release build).
Optional host tooling:
python3fortools/call.pyand testsopenplanet-lsp/tm-remote-buildif you use./build.sh devreload (optional; can skip)
git clone https://github.com/clankercode/tm-control-mcp.git
cd tm-control-mcp
# Stage into Openplanet Plugins and reload (if RemoteBuild is available)
./build.sh dev
# If openplanet-lsp false-positives are noisy but in-game compile is green:
TM_PLUGIN_SKIP_LSP=1 ./build.sh devDefault stage path: ~/OpenplanetNext/Plugins/tm-control-mcp
Override with OPENPLANET_DIR / PLUGINS_DIR.
Release .op package:
./build.sh release # → tm-control-mcp-<version>.opMCP adapter CLI: the CLI entrypoint explains the npm launcher for Linux x64 and Windows x64. Build and test Rust only on SSH or hosted CI build machines.
Enable the plugin in Openplanet’s UI. Confirm the socket:
python3 tools/call.py status
python3 tools/call.py GetModeThis plugin exposes Server settings (and any future categories) through Openplanet’s
normal settings UI and via MCP tools (ListPluginSettings / SetPluginSetting).
UI path
- Open the Openplanet overlay in-game.
- Open Settings (or Scripts → plugin settings).
- Select TM Control MCP (dev builds may show TM Control MCP (Dev)).
- Category Server:
- Socket Host — default
127.0.0.1(keep localhost-only) - Socket Port — default
30006 - Startup Delay (ms) — delay before the listener binds
- Trace Requests — append request/response byte counts to plugin storage (
request-trace.log); payload values are never logged - Socket tab — live status, start/stop (the enable flag is hidden)
- Socket Host — default
Host/port/enable apply live (no reload). Bind host is 127.0.0.1 only.
S_TmMcpEnableSocket is hidden; use the Socket tab, TmMcp::SetSocketEnabled,
or SetPluginSetting.
Script execution timeout is not a runtime setting: it is
timeout = 15000 in info.toml (15s). Raise it there and rebuild/reload if a
tool legitimately needs longer than 15s of continuous script time. Openplanet
kills the script if a single invocation exceeds this budget.
Via MCP (after the plugin is loaded):
python3 tools/call.py ListPluginSettings '{"category":"Server"}'
python3 tools/call.py GetPluginSetting '{"varName":"S_TmMcpPort"}'
# Example: change port (applies live; point call.py --port at the new value)
python3 tools/call.py SetPluginSetting '{"varName":"S_TmMcpPort","value":30007}'
# Stop/start the TCP listener without unloading the plugin
python3 tools/call.py SetPluginSetting '{"varName":"S_TmMcpEnableSocket","value":false}'
python3 tools/call.py SetPluginSetting '{"varName":"S_TmMcpEnableSocket","value":true}'| Tool | Role |
|---|---|
ListPlugins |
Meta::AllPlugins (+ optional unloaded) |
GetPlugin |
One plugin by id/name; optional embedded settings |
ControlPlugin |
enable / disable / setEnabled / reload / unload / load / openSettings / getLogs |
ListPluginSettings |
List typed settings for a plugin (default: self) |
GetPluginSetting / SetPluginSetting / ResetPluginSetting |
Read / write / reset |
SavePluginSettings |
Meta::SaveSettings() |
ControlPlugin refuses disable/unload/rebuild of itself so agents cannot brick the
control channel by accident. reload of self is allowed but drops the socket.
There is no ReloadPlugin tool. Reload any plugin with
ControlPlugin {"action":"reload","id":"<plugin id>"}; that includes RemoteBuild
itself when its own reloads are stuck ({"action":"reload","id":"RemoteBuild"}).
load is RemoteBuild-compatible: pass {action:"load", id:"my-plugin"} to load
Plugins/my-plugin/ (or my-plugin.op). If that plugin is already loaded it is
unloaded then loaded from disk (required for .op archives — Openplanet locks
them while loaded). getLogs tails Openplanet.log for compile errors (host-side
in call.py when the in-game reader cannot open the locked log).
One JSON object per connection, newline-terminated. Response is one JSON object + newline.
Status
{"route":"status"}List tools
{"route":"catalog"}{"route":"tools"} is the older bare list. python3 tools/call.py catalog has the
full descriptors (names at data.tools[].name); the ListTools tool is the compact
view: each tool's pack and owning plugin id, plus where each pack registers itself.
An unknown tool name answers code:"unknown_tool" with
suggestions (the closest real names, built-in and pack) and a hint;
call.py prints them on stderr.
Call a tool
{"route":"call","tool":"GetMode","input":{}}Tool names also work as routes:
{"route":"GetMapInfo","input":{}}Typical success shape:
{"ok":true,"route":"call","data":{"tool":"GetMode","result":{"success":true,"output":{"mode":"MapEditor"}}}}Errors may include structured fields:
{"success":false,"error":"…","code":"wrong_mode","retryable":true,"requiredMode":"Editor","hint":"…"}For continuous crash/dialog detection on Linux/Wine and native Windows, use
crashwatch. Its reader reports watcher heartbeat age,
active boxes and new crash-log names; call.py consults it before the existing
on-timeout desktop probe. The watcher never dismisses dialogs or restarts games.
PlayMap performs a bounded raw-file GBX envelope check before queuing a local
map. Invalid or truncated envelopes return INVALID_MAP_FILE; unresolved,
remote and unsupported files report an unverified preflight state. The check
does not parse compressed map bodies or validate embedded items. Malformed
embedded content can still crash the native game loader, outside AngelScript
exception handling; queued:true and envelope_only do not certify safe content.
Use trusted maps and inspect preflight / contentWarning in results.
On a local socket failure, the client checks PID-owned X11/Wine windows for a
crash or message box. It returns dialogs with title/metadata evidence and exit
code 14 when such a box is identified; ordinary transport failures remain
code 4. Unclassified secondary windows are candidates only. Missing display
tools or native Wayland windows leave detection unavailable, so an empty list
does not prove the game is healthy. No window is activated, dismissed, or captured.
tools/tm_get_running_pids.py --json exposes the same dialog classification.
python3 tools/call.py status
python3 tools/call.py --pretty GetMode
python3 tools/call.py GetReadiness '{"want":"editor"}'
python3 tools/call.py --until-ready editor GetMapInfo
python3 tools/call.py --wait-mode Editor --wait-timeout 30 GetMode
python3 tools/call.py tm-mcp-pack-epp.PlaceItemViaEditorPlusPlus \
'{"itemPath":"LightCube2m","x":128,"y":64,"z":128,"yaw":15}'Behavior:
- Compact JSON by default (
--prettyfor humans) - Checks for a real
Trackmania.exeprocess before connecting (Linux/procor native Windowstasklist;--skip-process-checkfor raw socket debug only) --strictvalidates tool input against the live schema when available- Screenshot path detection under common Proton prefixes (
TM_USER_GAME_FOLDERoverride)
Steps 2–3 require the E++ pack. AssertPlacement, readiness, and menu tools remain builtins.
# 1. Preflight
python3 tools/call.py --until-ready editor GetReadiness '{"want":"editor"}'
# 2. Tag agent work, place, verify, clean (requires the E++ pack)
python3 tools/call.py tm-mcp-pack-epp.SetAgentTag '{"tag":"agent:demo"}'
python3 tools/call.py tm-mcp-pack-epp.PlaceItemViaEditorPlusPlus \
'{"itemPath":"LightCube2m","x":200,"y":80,"z":200}'
python3 tools/call.py AssertPlacement \
'{"expectItemsDelta":1,"near":{"x":200,"y":80,"z":200,"radius":5},"tag":"agent:demo","tagMinCount":1}'
python3 tools/call.py tm-mcp-pack-epp.RemoveByTag '{"tag":"agent:demo"}'
# 3. Named macroblock batch place
python3 tools/call.py tm-mcp-pack-epp.CreateNamedMacroblock '{"name":"part-a","replace":true}'
python3 tools/call.py tm-mcp-pack-epp.AddBlocksToNamedMacroblock '{"name":"part-a","blocks":[
{"blockName":"RoadTechStraight","x":0,"y":0,"z":0,"yaw":0},
{"blockName":"RoadTechStraight","x":32,"y":0,"z":0,"yaw":0}
]}'
python3 tools/call.py tm-mcp-pack-epp.PreflightNamedMacroblockPlacement '{"name":"part-a","offsetX":128,"offsetY":64,"offsetZ":128}'
python3 tools/call.py tm-mcp-pack-epp.PlaceNamedMacroblock '{"name":"part-a","offsetX":128,"offsetY":64,"offsetZ":128}'
python3 tools/call.py tm-mcp-pack-epp.SaveNamedMacroblock '{"name":"part-a"}' # durable JSON
# 4. Menu → new map (QuickStart must be off for CreateMapViaMenu)
python3 tools/call.py CreateMapViaMenu \
'{"mapType":"race","environment":"Stadium","mood":"Day","inputDevice":"mouse","difficulty":"simple","timeoutMs":15000}'
# or faster title path (Stadium: omit deco or use 48x48Day; other envs need real deco):
python3 tools/call.py EditNewMap '{"environment":"Stadium","decoration":"48x48Day"}'Habits that keep agents reliable
- Prefer
GetReadiness/WaitUntil/--until-readybefore mutate. - Tag placements; clean with
RemoveByTaginstead of blind clear. - Prefer E++ free placement and named macroblocks over one-by-one grid place.
- After menu nav: wait for
pageVisible/ mode change. - Leased / menu-only runs: poll
GetBlockingScreen; whenneedsAction,DismissBlockingScreen {"action":"auto"}(repeat — the disconnect flow lands on PressStart again), thenWaitUntil {"condition":"menuReached"}. - Stadium maps: empty
decoration=""can trap the vista prompt — use a real deco or omit. - Do not depend on old disabled library plugins (
mcp-tm/tm-mcptm).
Ground truth: every MakeTool("…") registration in src/McpTools.as.
Prefer {"route":"catalog"} at runtime if this list drifts.
GetManiaScriptDiagnostics preserves script crash observations without dismissing or restarting anything. ControlFids action=getText reads script text with bounded slices or search, and ScanKinematicItems reads item animation metadata. Registered tool schemas are visible in Settings → TM Control MCP → Tool packs.
Successful public socket calls for the bounded dialog-prone action set include
output.dialogAfter, the same full state returned by GetDialog, sampled after
one rendered frame. output.dialogAfterFrameDelay is 1. The set currently
covers map/menu transitions, save/dialog responses, shadow computation,
validation/editor clicks, and ManiaLink actions; read-only and polling tools do
not incur the extra frame or payload. The runtime route=tools descriptions are
the authoritative per-tool indicator for whether these fields are present. The
snapshot is the global dialog state after the call, not a claim that the tool
caused it; another concurrent request or game action can change that state.
Every socket tool response also carries a compact data.dialog next to
data.result: {"up":false} when no dialog is up, otherwise
{"up":true,"kind","blocking","frame","text","hint"} (hint names the call
that answers it). tools/call.py prints it as one dialog up: line on stderr.
dialogKind (in GetDialog, dialogAfter, readiness) is one of askYesNo,
saveAs, message, wait, frameDialog, menuDialog, none; the raw
BasicDialogs enum in dialog says None for the unsaved-changes prompt, so do
not test it alone. Map switches (EditNewMap, OpenMapInEditor, PlayMap,
BackToMainMenu, CreateMapViaMenu) and ControlValidation starts are refused
with DIALOG_BLOCKING while a dialog needs an answer, and the first three leave
the current map before queueing anything: a save prompt stops them with
output.started:false. Nothing answers a save prompt for you. Design and live
checklist: docs/dialogs.md; in game: GetGuide {topic:dialogs}.
| Tool | Summary |
|---|---|
GetMode |
Current game mode (Menu / Race / Loading / MapEditor / ItemEditor / MediatrackerEditor / …). Editor is only the unknown-editor fallback; WaitUntil equals=Editor still matches any editor. |
OpenMapInEditor |
Open a local map file in the editor (path). Leaves the current map first; stops with DIALOG_BLOCKING on the save prompt. |
GetMapInfo |
Current editor map name and counts (+ bounds). |
GetMapEnvironment |
Collection, decoration, map type/style, mood, collection-unit metadata. |
SetMoodTimeOfDay |
Set MoodTimeOfDay01 (0..1); optional dynamic → MoodIsDynamicTime. Change TOD before a second LM bake. |
ComputeShadows |
Start ComputeShadows1 (does not wait). quality Default default; bustCache default true. Then WaitUntil condition=shadowsClear. |
ControlMapObjectives |
Get/set race objectives: nbClones, nbLaps, isLapRace (E++). |
SaveMapAs |
Save under user Maps (name+folder or fileName; overwrite). |
GetDialog |
Full dialog state: dialogKind, blocking, frames, menu modals. |
RespondDialog |
Respond: yes, no, cancel, ok, validate, hide, frame-ok, frame-cancel, … frame-ok refuses (AMBIGUOUS_FRAME, nothing clicked) a menu frame of several cards with no ButtonOk, e.g. the server join card; frame-ok/cancel report output.frameClosed. |
GetBlockingScreen |
Detect the full-page menu screens GetDialog cannot see (ManiaLink pages): kind start-screen|connecting|connection-failed|connection-error|ubi-connect|welcome-back|none, error/status text, visible buttons with the action each maps to. In any mode, maniascript-debugger when the native ManiaScript debugger (any view) covers the game (scriptDebugger; use DismissManiaScriptDebugger). blocking / needsAction / suggestedAction. |
DismissBlockingScreen |
Click the safe button of a blocking screen through the game's own click dispatch. action auto|start|confirm|play-offline|retry|later (explicit must fit the kind, WRONG_KIND); waitMs waits for the state to change and reports after + menuReached. Never clicks Quit game. |
GetMenuFrameTree |
Control tree of a classic engine menu frame (app.ActiveMenus[menuIndex]: map-saved card, server join card); the ids ClickClassicMenuControl takes. |
ClickClassicMenuControl |
Click a control or card on a classic menu frame by id, e.g. {id:"ButtonJoin"} on FrameDialogJoin (ButtonSpectator, ButtonCancel). Not for ManiaLink pages. |
JoinServer |
From the main menu: open a #join=host:password:port link (or #spectate=), confirm the server card, wait for the playground (JOIN_FAILED on timeout). |
| Tool | Summary |
|---|---|
GetReadiness |
Composite preflight (want=editor|menu|any|race). menu/any also report a blocking screen (Page_PressStart / Page_ConnectionError) as a blocking reason; checks.menuBlockingScreen names the kind. |
WaitUntil |
Poll mode/dialog/editorReady/pageVisible/map counts/readiness/shadowsClear/menuReached/blockingScreen (timedOut on budget). |
GetLightmapComputeState |
Whether the editor is computing shadows / lightmap. |
SetAgentTag |
Default provenance tag for subsequent Place* calls (empty clears). |
ListTagged |
List tracked tagged placements (prefix / tag: prefix). |
RemoveByTag |
Delete live objects matching tag (re-resolve by pos+idName); optional dryRun. |
ClearTagIndex |
Drop sidecar index only (no map mutation). |
AssertPlacement |
Verify deltas / near / tags after place. |
| Tool | Summary |
|---|---|
ControlValidation |
Validation / test / playground. testFrom* fail with PLAYGROUND_NOT_STARTED if the playground never starts (waitMs, default 10 s). |
ControlSelection |
Copy-paste / custom selection. |
GetCursor |
Editor cursor coord + selected block name/id. |
GetEditorSelectionState |
Placement modes, picked block, selected models, cursor, variant. |
ControlCursor |
raise/lower/rotate/move (relative/cardinal), followCamera, RGB, … |
ControlEditMode |
Inspect/set EditMode / PlaceMode; optional model select. |
GetEditorCamera / SetEditorCamera |
Numeric camera target/angles/distance. |
ControlCamera |
centerOnCursor, watchWholeMap/start/CP/finish, zoom, look, … |
AnimateEditorCamera / WaitEditorCamera |
Smooth camera moves in the background: a keyframed path (orbital keys or position+lookAt), an orbit (degrees, spiral, or until stopped), or follow the cursor / a point you retarget. Other camera tools, a new animation, mouse movement or leaving edit mode interrupt it; WaitEditorCamera (max 5 min) reports completion, or the interruption as an error. |
FocusCamera |
Focus on world (x,y,z) via E++ animation. |
MaxFPS |
Get or set the game's frame limit (0 = uncapped); session-only, not saved to the config file. |
ControlPlayCamera |
In-play camera: read state, switch mode (free / cam 1-3 / backwards / alt), place and aim the free camera. |
GetPauseState / ControlPause |
Read the pause state from three game clocks; pause / resume solo or local play with the game's own in-game menu (refuses online). |
GetDisplaySetting / SetDisplaySetting / RestoreDisplaySetting |
Read / set the game's bloom (none / medium / high) with a recorded restore. |
TakeScreenshot |
Native viewport screenshot with file detection (fullName), hideOverlay, forceRes. |
| Tool | Summary |
|---|---|
GetBlocks |
By grid/world radius, model query, freeblock filter. |
GetRecentBlocks |
Last N blocks (freeblock pos/rot readback). |
GetBlockAt |
Exact grid (x,y,z). |
GetItems |
Near world pos, or all up to limit. |
GetRecentItems |
Last N anchored items. |
| Tool | Summary |
|---|---|
GetInventorySummary |
Cache counts + scan status. |
FindInventory |
Search blocks/items/macroblocks. |
RefreshInventory |
Rescan after mid-session content adds. |
BrowseInventoryTree |
Read-only tree (root, path, depth, query, …). |
ControlInventory |
status / select / openFolder via inventory SelectArticle/SelectNode. |
InspectMacroblockModel |
Loaded MB by name/path/index. |
ListMacroblockInstances |
Placed native MB instances. |
FindBlockModels |
Search loaded block models. |
SelectBlockModel / SetCursorBlock |
Set selected block model. |
SelectItemModel / SelectMacroblockModel |
Picker helpers for item/MB. |
| Tool | Summary |
|---|---|
CreateNamedMacroblock |
Create/replace in-memory handle. |
GetNamedMacroblock / ListNamedMacroblocks / ClearNamedMacroblock |
Inspect / list / clear. |
AddBlock(s)ToNamedMacroblock |
Free block specs (variant, bg/fg skins). |
AddItem(s)ToNamedMacroblock |
Flying item specs by inventory path (+ skins). |
PlaceNamedMacroblock |
Place via E++ with offset/pivot rotation + mapPre/mapPost. |
PreflightNamedMacroblockPlacement |
Non-mutating extents/bounds/model checks. |
SaveNamedMacroblock |
Persist JSON under Openplanet data tm-control-mcp/named-mb/. |
LoadNamedMacroblock |
Load durable JSON into memory (resolves models). |
ListSavedNamedMacroblocks |
List durable JSON files. |
| Tool | Summary |
|---|---|
CanPlaceBlock |
Grid/terrain place check without mutating. |
PlaceBlock |
Grid block place. |
PlaceBlockViaEditorPlusPlus |
Free blocks via E++ (preferred for free work). |
PlaceItemViaEditorPlusPlus |
Flying items via E++. |
RemoveBlock |
Remove at grid coords. |
ClearBlocks / ClearItems / ClearMapContent |
PluginMapType remove-all helpers. |
RemoveRecentBlocks / RemoveBlocksByIndex |
E++ block deletion. |
RemoveRecentItems / RemoveItemsByIndex |
E++ DeleteItems (buffer fallback opt-in). |
Undo / Redo |
Editor undo/redo. |
Menu stack is landed. Clicks use CControlBase::OnAction — not
TriggerPageAction. Poll GetActiveMenuPages / GetMode / GetDialog after nav.
| Tool | Summary |
|---|---|
SetMenuPage |
MLHook Router_Push hierarchical route. |
GetMenuPage / ListKnownMenuRoutes |
Mode + menu module; route catalogue. |
EditNewMap |
Title-control new map (env + decoration + mapType). Leaves the current map first; stops with DIALOG_BLOCKING on the save prompt; output.status. |
BackToMainMenu |
Unwind Editor/Race → menu. Stops with blockedByDialog:true on the unsaved-changes dialog (never answers it). |
GetUILayers / GetActiveMenuPages / GetLayerTree / GetLayerXml |
Layer introspection. |
ListManialinkPages / ViewManialinkPage |
What is on screen: pages across menu, playground and editor, and a concise text tree of visible controls (type, id, classes, label text). |
ClickManialinkControl / WaitUntil {condition:manialink} |
Click a control by page + id in any context (menu, map, editor); wait (max 5 min) for a page or control to be shown, gone, or show some text. |
ListMenuManialinkControls / FindMenuButtons / FindControlsByClass / FindControlsByLabel |
Discovery. |
InspectMenuControl / FocusMenuControl / SetMenuControlVisible |
Probe / focus / show-hide. |
ClickMenuButton / TriggerControlOnAction |
Real click dispatch. |
CreateMapViaMenu |
Full Page_MapEditorSettings click-chain → Editor (QuickStart off). |
| Tool | Summary |
|---|---|
RunManialinkScript |
MLHook inject (menu/in-map/in-editor/current); optional collectMs/resultEvent. |
ListGuides / GetGuide |
In-plugin documentation topics. |
| Tool | Summary |
|---|---|
GetInputBindings |
Read-only. Every device the game sees (devices: InputPort.ConnectedDevices) and every pad (pads: InputPort.Script_Pads, with idle time and what it is pressing now), each pad with one binding row per action ({index, action, player, display, raw}, the Settings > Controls list for that controller), noDevice (the list for Device=null), and per-pad named race bindings for actionIds (default GiveUp, Respawn, SecondaryRespawn). filter matches the action name or its binding ({"filter":"delete"} finds every action bound to Delete); boundOnly drops unbound rows. The shared binding list it refills is put back (sharedList.restored). |
| Tool | Summary |
|---|---|
ResolveMwIds |
MwId values to names and names to values, in batches. values (ints, -1, or "0x...") → {value, hex, tag, defined, name, table, slot, problem}; a tag-01 (0x40000000) id is named only after its intern slot is read and found occupied, since GetName() on an unknown one can crash the game. internIndex ORs 0x40000000 into bare table<<16|slot indexes. names → {value, hex, tag, existed} by a read-only intern-table lookup, checked against the live tables first (lookup.verified); register:true uses MwId.SetName instead, which adds missing names to the game's id table and reports registered. DEV builds: ptr (+offset/offsets, count, stride) reads u32 ids from memory and names them (read). |
Only registered when the plugin is built with defines = ["DEV"]
(./build.sh dev). Release .op / release-check builds omit these tools.
| Tool | Summary |
|---|---|
RunGizmoApplyBlock |
Free block through E++ gizmo apply path. |
RunRandomFuzz |
Random place N blocks/items in a world bbox. |
RunComputeItemsDiagnostic / DevComputeItemsPointers |
Macroblock compute-items probes. |
DevSafeRead / DevGetPointers |
Safe memory read / pointer dumps. |
DumpMacroblockHeader |
MB flags/buffers/raw header words. |
| Tool | Summary |
|---|---|
GetTypeInfo |
Live Openplanet Reflection: class + all members. Default {className}. |
ControlFids |
Fids:: drives/get/list/preload/updateTree/extract/getFullPath/fromNod. |
ListPlugins |
Loaded plugins (query, includeDisabled, includeUnloaded). |
GetPlugin |
One plugin by id/name; includeSettings optional. |
ControlPlugin |
enable/disable/reload/unload/load/openSettings/getLogs (no self-disable/unload/rebuild). Reload a plugin (RemoteBuild too): {action:"reload", id}. |
ListPluginSettings |
Settings for a plugin (default: this MCP plugin). |
GetPluginSetting / SetPluginSetting / ResetPluginSetting |
Typed get/set/reset. |
SavePluginSettings |
Persist settings to disk. |
Mutating placement tools include mapPre / mapPost (name, size, block/item/vertex counts, bounds). Prefer verifying with GetBlockAt / GetRecent* / AssertPlacement.
SaveMapAs writes under the user Maps folder; responses may include a Wine/Trackmania gamePathHint — map through your Proton prefix on Linux.
Prefer E++ free placement and named macroblocks for generated builds. Rotation defaults to degrees (pitch/yaw/roll); use *Rad for radians. Autofocus is on by default for free place tools.
Path-based place remains the reliable headless path; ControlInventory is for picker parity / UI-native flows.
RemoveRecentItems / RemoveItemsByIndex call E++ DeleteItems (works when PluginMapType.Items is empty). Direct AnchoredObjects buffer removal is opt-in (forceBufferFallback=true) and reports undoSupported=false.
Block/item specs support variant, bgSkin, fgSkin. Skins apply after successful PlaceNamedMacroblock and are verified when possible. Durable JSON is v2-capable (item skins) with v1 load compatibility. In-memory handles alone do not survive reload — use SaveNamedMacroblock.
For live checks on a leased instance that need the game paused or bloom changed, with no OS input. The agent stays in control the whole time: nothing here runs on its own (no timer, no watcher, no automatic restore), so the agent resumes and restores itself.
Pause. ControlPause {action:pause} opens the game's own in-game (ESC)
menu in solo/local play. It succeeds only after all three clocks
(PlaygroundClientScriptAPI.GameTime, GetCmdBufferCore().SimulationTime and
.GameTime) are unchanged and the menu is observed up on every frame of a full
holdMs window (default 300). Every observed change counts (A→B→A isn't frozen).
If a pre-existing menu wasn't up for the initial hold, the tool samples a fresh
menu-up window. A pause request never closes a pre-existing menu.
ControlPause checks locality, loading, playground, menu and dialog state
after each frame and before a menu action. A loading, locality or context
change aborts; it refuses online (ONLINE_NOT_PAUSABLE) and does not open
behind a blocking dialog (DIALOG_BLOCKING). If a Show did not lead to a
verified pause, the call attempts at most one cleanup Resume, and only if
it observed the menu open and stay up and the fresh local, non-loading,
same-context gate passes. It reports cleanupSkipped when it cannot dispatch.
In explicit Resume and failed-Show cleanup, menuShown, menuShownAfter and
changed are booleans or "unknown" if the menu state could not be read.
Check for an explicit boolean before acting.
CLEANUP_FAILED means closure wasn't verified after a Resume attempt. A timeout
or reload isn't evidence of closure. Call GetPauseState after any failure;
if the menu is up, use ControlPause resume. If lateShowPossible:true, call
GetPauseState again after the menu appears closed. An unobserved or additional
Show may still land, and the API cannot cancel or drain it. A menu or same-address
context replacement with no observed edge cannot be distinguished.
ControlPause {action:resume} closes the in-game menu with
CloseInGameMenu(Resume) only, never Quit or a sub-menu, whoever opened it.
jumpMs reports the first changed value relative to the pre-resume baseline
for each clock where both were measured. A missing entry is unmeasured, not
zero; a resume noop has no jumpMs. Both actions can succeed with changed:false
when the requested state is already verified. The per-call budget is
3×holdMs + timeoutMs + 2 s (max 18 s; tools/call.py waits that plus 5 s, or
--timeout if longer). It is checked per frame, so a hitch can overrun it.
GetPauseState changes nothing and samples online too. Its sample can restart
on an unreadable clock or loading frame if the context holds; by contrast,
loading aborts ControlPause. menuShown, locality and pausable reflect the
end of the read-only sample. menuShownAtStart and menuShown are booleans
or "unknown" if unreadable; check for an explicit boolean before acting.
Bloom. SetDisplaySetting {bloom:none|medium|high} writes the user's own
setting. Persistence and deferred Apply timing are unproven (Q3);
persisted:"assumed" is not a save receipt. Set never overwrites the single
bloom-restore.txt record in plugin storage, and refuses without a valid
port.override marker (IDENTITY_UNKNOWN), while an older record exists
(LEGACY_RECORD_PRESENT), while a wrapper is busy (WRAPPER_BUSY), or when
readable bloom sources disagree (SOURCES_DISAGREE). It reads the prior,
writes and reads back the record, then writes by one mechanism without
yielding (output.mechanism: the tool's own script wrapper, or a direct
Viewport.SystemConfig display/safe config write). APPLY_UNVERIFIED means
same-frame read-back did not verify the change; the record is kept.
sideEffects lists only changes in the same-frame readings of dirtyCounter,
displayMode and windowSize (or "unknown" if unavailable); it cannot rule
out a window or device reset.
RestoreDisplaySetting requires a valid, matching record. If all readable
sources hold the target and no known source is unreadable, it writes the prior
and reads back all sources. If all are already at the prior, it writes nothing
(restored:false, reason already at prior). Normal Restore always keeps
the record. A conflict keeps it too. {force:true} can overwrite the user's
current value only within the same identity and config. A user's same-value
edit cannot be distinguished from the tool's write (limitation). Startup,
disable and unload only report records, never apply or delete them.
Before retiring, GetDisplaySetting must show the same matching pending record
and the prior on every readable source, with none known unreadable, after
an in-instance map reload or a same-prefix restart that preserves the upper dir.
The default tmc stop wipe destroys the record; it is not a confirmation step.
A map reload does not prove the setting was saved or that a deferred Apply finished.
If Apply is unresolved, keep the record. Otherwise call
RestoreDisplaySetting {retire:true}. Only retired:true confirms retirement;
no record is not confirmation. Retire rechecks the identity, config and sources,
refuses if a display call is busy, never writes bloom and cannot combine with
force:true. Don't retire on immediate read-back alone.
What the record binds to. The hash covers the prefix's user, app and plugin
storage paths, active profile and display/safe config, and the tmc port marker.
tmc overlays keep plugin storage in a private per-instance upper directory
that tmc stop wipes by default. The primary has no marker, so Set refuses
there. Limitation: prefixes with identical paths, profile, config and
marker collide. This is a prefix-marker check, not a lease check.
Manual recovery (an older build's display-restore.json / .txt, or a record
from another instance): GetDisplaySetting shows legacyRecord /
restoreRecord with its path and recorded value if readable. Check which
instance wrote it, keep a copy, set bloom in Settings > Graphics if that is the
value to restore, then delete the file. Never copy a record between instances.
Unproven live (2026-11-18): Q1, whether a programmatic menu freezes the
clocks the way ESC does (ESC in solo was measured to); Q2, whether bloom none
takes effect without a restart; Q3, whether Apply resets the window or
device or saves the config at once; Q4, whether a locally hosted server with
no other clients pauses. Guide: pause-bloom.
Openplanet exposes no typed handle to the playground camera, so this tool walks
raw offsets anchored on reflected members where possible. Offsets and the
values they take are lifted from shipped plugins, not guessed — see the header
comment in src/PlayCamera.as for the provenance of each one.
Placing and aiming the free camera is exact. Pass x,y,z and
target{x,y,z} and the camera lands on x,y,z to the millimetre with the
target on the exact screen centre — verified against ProjectWorldToScreen
(960, 540 of 1920x1080) at several angles including straight down. That is the
mode to use for measurement work: known camera point, known look-at, known
distance.
Under the hood that is the orbital form. The free camera has two mutually exclusive parameterisations:
| driven by | orientation | |
|---|---|---|
| free | m_FreeVal_Loc_Translation |
whatever the engine last built |
orbital (m_TargetIsEnabled) |
m_TargetPos + m_Radius + m_Yaw/m_Pitch |
always looks at the target |
pos = target - radius * (cos v * sin h, -sin v, cos v * cos h), h = yaw,
v = pitch, positive pitch above the target — the same convention as the
editor orbital camera in CameraMaths.md, so LookDirToOrbitalAngles is
reused to solve it.
Consequences worth knowing before you trust a number:
pitch/yaw/rollwithout a target do nothing to the view. They are written and read back faithfully, but the free camera only rebuilds its orientation matrix while the player is moving the mouse, so scripted angles sit unused. Aim with a target instead.- A live target overrides a position write, so
x,y,zon its own releases the target first and says so insteps. - Cams 1/2/3 cannot be moved. They are rigidly attached to the car.
set_modeis only consumed on a live playground tick. When the tick does not read the request the camera simply stays put, so the response carriesswitched: true|falseand awarning; judge the result on that and on theafterreadback, never onsuccess. Observed reliable with the game in the foreground and no overlay up, and observed silently dropped — every mechanism, every mode — while the Openplanet overlay and plugin windows were open over the view, withuiSequence: Playing, the window focused, the player spawned, not spectating and not force-cammed. Close the overlay before switching. Free cam itself, and placing it, kept working throughout, because the position is read by the render path rather than the tick.spectator.forceCameraTypeis a 4-bit field:15is the all-bits-set "not forced" sentinel that ManiaScript writes as-1. Seeing 15 does not mean something is forcing the camera;spectator.forcedsays that.- Needs an active playground — solo/local Race, editor test runs, spectating.
NO_PLAYGROUNDin menus. In the map editor useSetEditorCamera/ControlCamerainstead. MediaTracker clips override this camera.
See in-flight diagnostics and recovery for call IDs/ages, worker interruption, deadlines, and recovery without a game restart.
TakeScreenshot triggers the game's native viewport capture (same path as the in-game screenshot key), waits for the file, and returns its game-side fullName + sizeBytes. Options: format (jpg default / webp / tga / dds), waitMs (default 5000; 0/noWait = fire-and-forget), hideOverlay (clean shot without HUD/overlays), forceRes + width/height (capture at a forced resolution; restored after). Crash-prone native paths (360° capture, tiled supersampling, alpha/pixel-output switching) are deliberately not exposed — see the screenshots guide (GetGuide {"topic":"screenshots"}).
Openplanet/plugin UI needs a window capture. The native viewport excludes Openplanet ImGui even with hideOverlay:false. On xsm, activate Trackmania with xdotool search --name '^Trackmania$' windowactivate --sync, then run spectacle -b -n -a -o /tmp/trackmania-with-openplanet.png. Inspect the result for the intended plugin window; see window capture details.
call.py additionally reports detectedScreenshot.linuxPath by diffing the folder before/after (TM_USER_GAME_FOLDER override).
- Routes are hierarchical (
/create/mapeditorsettings, not bare/mapeditorsettings). SetMenuPageonly while main-menu module is active.- Side-effect / playground-launch routes blocked unless
allowPlaygroundLaunch:true. - Enter editor:
EditNewMap(fast) orCreateMapViaMenu(full UI; QuickStart off). - Leave:
BackToMainMenu, poll untilmode=="Menu".
| Arg | Default | Notes |
|---|---|---|
script |
(required) | No outer <manialink> — MLHook wraps as MLHook_<pageUid>. |
context |
current |
menu / in-map / in-editor / current. |
pageUid |
McpAdHoc |
Attach id stem. |
replace |
true |
Replace same uid. |
persist |
true |
If false, remove after waitMs. |
waitMs |
150 |
Yield for inject queue (capped). |
collectMs |
0 |
If >0, register result hook and collect events. |
resultEvent |
McpAdHoc_Result |
Script: SendCustomEvent("MLHook_Event_"+resultEvent, [...]). |
Bad ManiaScript can force a game recovery restart — keep scripts small.
For EditNewMap: Stadium — omit decoration or use 48x48Day. Non-Stadium needs a real decoration string (or use OpenMapInEditor / CreateMapViaMenu). Empty decoration="" can leave the vista prompt up.
src/ Openplanet Angelscript plugin (module TmMcp)
tools/call.py CLI client + wait helpers + screenshot detection
tests/ pytest (call.py waits, camera math, …)
docs/ research/ Design notes and RE notes
AGENTS.md Short agent-oriented project notes
info.toml Openplanet manifest (deps: Editor, MLHook)
build.sh dev stage+reload · release .op pack
# Stage + reload into game
TM_PLUGIN_SKIP_LSP=1 ./build.sh dev
# Unit tests that do not need the game
python3 -m pytest tests/test_call_wait.py -q
# Live smoke (game + plugin running)
python3 tools/call.py status
python3 tools/call.py GetReadiness '{"want":"editor"}'In-game Openplanet compile is the ground truth if LSP reports nested-enum / dependency noise.
Localhost-only control socket with no authentication. Anyone on the machine
can mutate maps, drive menus, and call DEV tools while the plugin is loaded.
Keep Socket Host = 127.0.0.1. Full threat model and hardening:
SECURITY.md.
- Editor++ — free placement, inventory cache, deletion, camera helpers this plugin calls into
- MLHook — menu router push, Manialink inject, custom events
- Sibling tooling in the Openplanet ecosystem (RemoteBuild, openplanet-lsp) optional for the reload loop
Dual-licensed under the Unlicense or CC0 1.0 Universal, at your option. See LICENSE.
No warranty. Trackmania and Nadeo assets remain subject to their own terms; this repo is the control bridge only.
Author: XertroV (info.toml). Maintained under clankercode.
Preserved development tools: editor script control and recovery, confirmed text replacement, user pack operations, and the publication decisions.
