Skip to main content
Glama

Game engines have grown MCP servers — Unity, Unreal, Godot and Defold all have one, so an assistant can see a real scene instead of guessing from a prompt. tModLoader has not had one. This is that.

Status: alpha — it has only ever run on one install; see Known limits before adopting it. Nothing defaults to anybody's install, the mod-side half is a folder you vendor (responder/), and CI compiles it with nothing of any mod's on the compile line.

Quick start

uv tool install tmodloader-mcp    # or: pip install tmodloader-mcp

# the two paths with no default — every plausible default names somebody's install
export TMODLOADER_SAVE_DIR="/mnt/c/Users/<you>/Documents/My Games/Terraria/tModLoader"
export TMODLOADER_MOD_SOURCE="$TMODLOADER_SAVE_DIR/ModSources/<YourMod>"

Then:

  1. Vendor the responder — copy responder/ into your mod's source tree and subclass DevResponder. It is a folder of C#, not a PyPI dependency, because it compiles inside your mod.

  2. Point your MCP client at the server — the block in Using it from Claude Code.

  3. Ask the game something — launch, then diag. Or open with the start_a_session prompt, which lists the worlds and characters that actually exist here.

This needs WSL2 driving a Windows tModLoader — Requirements says why before anything else does.

Related MCP server: roblox-studio-bridge MCP

How it works

The game is asked by writing a file it polls, not by sending it input:

┌─────────────────────────────────────────────────────┐
│  an agent — Claude Code, or anything speaking MCP   │
└──────────────────────┬──────────────────────────────┘
                       │  tools · prompts · capture:// resources
┌──────────────────────▼──────────────────────────────┐
│  tmodloader-mcp — this package (Python, WSL2)       │
└──────────────────────┬──────────────────────────────┘
                       │  writes  <mod>-capture.trigger
                       │  reads   <mod>-diag-<token>.txt,
                       │          <mod>-shot-<token>.png, ...
┌──────────────────────▼──────────────────────────────┐
│  the tModLoader save directory                      │
│  plain files on disk — no socket, no keystrokes     │
└──────────────────────▲──────────────────────────────┘
                       │  polls every few frames, writes
                       │  each answer next to its trigger
┌──────────────────────┴──────────────────────────────┐
│  DevResponder — C# you vendor into YOUR mod,        │
│  inside tModLoader, a real game, on Windows         │
└─────────────────────────────────────────────────────┘

No synthetic keystrokes, no window focus, and nothing that can be fooled by another window sitting on top of the game. That last point is the reason for the design: OS-level screen capture was tried first and returned a picture of Discord — a window in front of the game — while passing every check available. Reading the game's own back buffer cannot contain another window by construction, not by luck.

Captures name a region and have no default. The frame holds only the game, but that still includes a character name, a world name and any chat on screen, so a request says which corner it wants.

The mod side of that protocol — every filename, what each one contains, and which failures it has to be able to express — is written down in docs/MOD_CONTRACT.md, and implemented in responder/. You can read the contract or vendor the folder; the folder is the same document with a compiler checking it.

Since 0.6.0 replies are tagged: a request may carry a short id the responder echoes back first, so a late answer can never be mistaken for the next request's. Older vendored copies keep working — the tag is only sent to a responder that advertises taking it.

What the mod side answers

These are verbs, driven through the trigger tool, not separate MCP tools.

The reads come with the base class — every consumer serves them, and vendoring an upgrade can never hand your mod a power it did not have before:

Verb

What it answers

capture / shot

a photograph of the frame, by named region

diag

whatever your mod chose to report

tiles

tile-type counts in a rectangle

entities

NPC, item or projectile counts, filterable by rectangle

find

one line per entity: id, position, health

players

who is connected

The writes are opt-ins, each one line you write in RegisterCommands:

Opt-in

Verbs it adds

DevMutations

time weather spawn give teleport settile cleartile despawn

DevCommandBridge

command commandlist — runs any mod's own registered ModCommands

DevChat

chat say

One line each is deliberately the whole mechanism: not a setting, not a marker file, not an environment variable, because each of those can be switched on somewhere other than the source somebody will read when they ask why an NPC appeared in their world. responder/README.md has the detail, including why DevCommandBridge is the answer to "what about an escape hatch" and why there is no reflect_invoke here.

The answers, verbatim

Every line below is real — the same server and client the live checks drive, quoted rather than paraphrased:

spawn:1,20        OK: spawned 20 of 20 id=1 at tile 2101,252

time:dusk         sent to a CLIENT:
                  REFUSED: "time" changes something the SERVER owns, and a
                  client that changed it would be corrected by the next world
                  packet - the change would appear to work and then undo
                  itself. Send this to the server: time@<server-address>.

give:8,5          sent to the SERVER:
                  REFUSED: "give" needs a local player, and a dedicated
                  server has none - it runs the world without standing in
                  it. Ask a client, by name.

spawn:0,1         REFUSED: 0 is not a NPC id - it is how Terraria spells
                  "nothing", so this would have succeeded and done nothing

spawn:banana,5    REFUSED: "banana" is not a positive whole NPC id

time:teatime      REFUSED: "teatime" is not one of dawn, noon, dusk, midnight

tiles:0,0,1000,1000
                  REFUSED: 1000 by 1000 is 1000000 tiles, past the limit of
                  16384 one query may scan

The refusals are the point. Each one says what was wrong, what would have been right, and — when the verb belongs to the other side of the wire — where to send it instead, because the reader is an agent and an agent retries exactly as well as the refusal explains.

The tool surface

Most of what this does could be a CLI, and where that is true it should stay one — a stateless local binary does not need a protocol in front of it. What earns the surface here is that a running game is not stateless:

A session

Tool

What it buys over bash

launch / stop

Session state across calls

join

A second client into a session that is already running

status

Asking whether a session exists without provoking an error

restart

stop → build → launch in the one order that works

inventory

The worlds, characters and mods launch needs and cannot check

Asking the game

Tool

What it buys over bash

trigger

The write → poll → timeout → clean-up loop, written once

commands

What the mod says it serves, read from the mod, not a copy here

diag

Structured fields AND the records under them, not text to sed

wait_until

Waiting for a state on one budget, instead of sleeping a guess

heartbeat

WHICH silence — absent, stale, still loading, or not armed

Pictures

Tool

What it buys over bash

shot

A path per call, a whole PNG behind it, refusals as refusals

captures

Which captures exist, as names — a reader that takes no paths

read_capture

The picture itself, for an agent not on this machine

prune_captures

Removing captures without a delete loose enough to reach a world

Logs

Tool

What it buys over bash

logs

Any log, filtered — including the run that already rotated away

log_files

Which logs exist right now, and how many old runs are archived

log_since

Only what a log gained, and whether it rotated under you

log_watch

Blocking until a line appears, instead of a guessed sleep

Building, the API, and the saves

Tool

What it buys over bash

build_mod

Encodes tModLoader's refusal to build while the game is open

api_search

What the INSTALLED tModLoader actually exposes, with signatures

save_snapshot

Copying the world and characters aside before a run mutates them

save_restore

Putting them back, saving what it overwrote so it can be undone

save_snapshots

Which copies exist, newest first

Those one-liners are where the hand-written version actually went wrong: a pkill pattern that matched its own command line, a readiness check that passed on a killed process's leftover heartbeat, and — for one stretch — a shot row promising a PNG check that did not exist: the file was waited for and renamed, never opened. It exists now, and reads the end that decides — a truncated PNG has a perfectly valid signature, so the trailer is what is checked. The gap was recorded here rather than quietly corrected, because a README is read by people deciding what they no longer have to check.

Two prompts ship with it: diagnose_silence walks the four reasons the mod might not answer, with this install's heartbeat, mod list and logs already read; start_a_session lists the worlds and characters that actually exist here — the two preconditions launch states and cannot check. Both render the failure into the text when the configuration is unusable, because a diagnostic that refuses to render has failed at the one moment it was for.

Captures are also addressable as capture://{name} resources. Both surfaces share one reader that takes a name, never a path, and serves only capture-shaped files inside the save directory — a reader that opened whatever it was handed would be the leak this project exists to prevent.

What it cannot do

There is no headless singleplayer. Terraria has no entry point for it — -join -player -skipselect lands at the main menu, measured rather than assumed. launch("singleplayer") refuses and says so instead of launching something else and letting you believe otherwise. Singleplayer testing needs a human to load a world; the other tools then drive it normally.

That matters more than it sounds: a bug that only appeared in singleplayer shipped once precisely because every harness ran server-plus-client.

There is no bare dedicated server either. An empty server runs no update hooks, so the mod never polls and never answers — measured on one process, changing only whether a client was attached: silent for 90s alone, answering within 30s of a client joining. launch("server") refuses for the same reason singleplayer does — what it promises is a game that can answer, and a server on its own never becomes one. Start one outside this tool if you want a server to join yourself.

Requirements

WSL2 on Windows, driving a Windows tModLoader. This is the one requirement worth reading before the others, because it is not a preference — sessions are listed and killed through Windows' own tasklist.exe and taskkill.exe, and build_mod hands tModLoader a Windows path because it builds inside a Windows process. A native Linux or macOS tModLoader cannot be driven by this as it stands. The configuration check every tool runs first says so by name rather than failing later on a missing file in System32; if you are on WSL and those tools live somewhere unusual, set TMODLOADER_TASKLIST, TMODLOADER_TASKKILL and TMODLOADER_POWERSHELL.

  • Python 3.12+

  • tModLoader installed (1.4.4.9 is what this is tested against)

  • A mod embedding the trigger-file responder — copy responder/ into your mod's source tree and subclass DevResponder

  • A .NET SDK, for api_search only — the index is built by a small C# tool. Everything else works without one.

Install

uv tool install tmodloader-mcp    # or: pip install tmodloader-mcp
                                  # or none at all: uvx tmodloader-mcp

The package is the Python half only. The responder is not on PyPI and could not usefully be — it is C# that compiles inside your mod — so it is vendored from responder/ in the repository, however you obtained the package.

Configuration

Every path is an environment variable. Two are required, because every plausible default for them names somebody's own install:

Variable

Meaning

TMODLOADER_SAVE_DIR

Required. Where the mod writes artifacts

TMODLOADER_MOD_SOURCE

Required. Mod source directory (WSL path)

TMODLOADER_DIR

tModLoader install; defaults to Steam's layout

TMODLOADER_WORLD_WIN

Default world, as Windows spells it — see below

TMODLOADER_MOD_SOURCE_WIN

Usually leave unset — see below

TMODLOADER_MOD_NAME

Usually leave unset — see below

export TMODLOADER_SAVE_DIR="/mnt/c/Users/<you>/Documents/My Games/Terraria/tModLoader"
export TMODLOADER_MOD_SOURCE="$TMODLOADER_SAVE_DIR/ModSources/<YourMod>"

The required two have no default on purpose: a default pointing at the author's disk does not fail on yours — it resolves, worst case to something that exists, and the server drives an install you never chose. Both unset variables are reported together, so this costs one restart, not two.

TMODLOADER_WORLD_WIN is the world launch loads when you do not pass one. It has no default either; with neither set, launch refuses and lists the worlds actually in your save directory, with the Windows paths it wants. inventory answers the same question without launching anything.

save_snapshot copies that world too, unless you pass world. save_restore puts back the world its snapshot holds. If the last launch loaded a different world, both refuse until you pass world, so a restore cannot quietly miss the world the run changed.

TMODLOADER_MOD_NAME is the mod's internal name, which every artifact filename is built from: <modname>-diag-<token>.txt, <modname>-shot-<token>.png, lowercased, where <token> identifies which player's client wrote it — except <modname>-capture.trigger and <modname>-commands.txt, which stay one name shared by every client (see docs/MOD_CONTRACT.md for why). tModLoader takes the mod's name from the source folder, so it is derived from TMODLOADER_MOD_SOURCE and only needs setting for a checkout whose folder is named something other than the mod. Deriving it is also what keeps two mods driven from one machine out of each other's trigger files — they share a save directory.

TMODLOADER_MOD_SOURCE_WIN is the mod source as Windows sees it, which -build needs because tModLoader compiles inside a Windows process with no /mnt/c. It is derived from TMODLOADER_MOD_SOURCE, so setting that one is enough for a source on a drive mount. Set it yourself only if your mod source lives outside /mnt/<drive>, where there is no drive letter to translate to and the server will ask for it by name.

The two describe one directory. If you set both to different places the server refuses to start and says so, rather than driving one and building the other.

Using it from Claude Code

A .mcp.json ships with the repository, so a session started in this directory finds the server:

{
  "mcpServers": {
    "tmodloader": {
      "command": "uv",
      "args": ["run", "tmodloader-mcp"],
      "env": {
        "TMODLOADER_SAVE_DIR": "${TMODLOADER_SAVE_DIR}",
        "TMODLOADER_MOD_SOURCE": "${TMODLOADER_MOD_SOURCE}"
      }
    }
  }
}

The two paths are read from your environment rather than written down — a committed config with real paths would be one person's paths in everybody's checkout. Export them where the client is launched, not only in an interactive shell: the substitution is the client's, against its own environment, and a value passed through as literal ${TMODLOADER_SAVE_DIR} is treated as absent and reported by that name. claude mcp list names any that are missing.

A process's environment is a copy taken when it starts, and nothing outside can add to it afterwards. So a long-lived parent — a daemon, an agent host, a desktop session — hands every client it spawns the environment it had on the day it started, however long ago that was, and adding the variables to your profile today does not reach it. The symptom is a shell where env | grep TMODLOADER prints all three sitting next to a server that sees none of them. Restarting the client is not enough if the thing that spawned the client is the stale one; restart that.

Nothing can be repaired from inside a running session: the value was gone before the process started.

A project-scoped .mcp.json needs approving once — Claude Code will not run a server a repository asked it to run without being told to. Start claude in this directory and accept the prompt.

To drive the harness from the directory where you actually develop your mod, copy the block into that project's .mcp.json and point --directory at this checkout:

"args": ["run", "--directory", "/path/to/tmodloader-mcp", "tmodloader-mcp"]

Or, with the package from PyPI, no checkout at all:

"command": "uvx",
"args": ["tmodloader-mcp"]

The repository's own .mcp.json stays on uv run deliberately — inside this checkout you want the code in front of you, not the release behind it.

Known limits

Everything below is a fact about this repository rather than a plan; the struck-through history this section replaced lives in CHANGELOG.md, which is where a changelog belongs.

The thing most worth knowing about this project is that its hardest bugs were found by RUNNING it. Two clients overwriting each other's answers, a capture lock bounded by a guess, a dedicated server with no address to be told apart by, and — most recently — a save-snapshot feature whose entire premise turned out to be false when somebody finally measured it. The unit suite passed against every one of those. The changelog is the record.

It has only ever run on one install. One machine, one tModLoader (1.4.4.9), one world, one character. Every live check in tests/ drives a real game rather than a mock, which is the strongest evidence this project has — and it is still evidence from a single configuration. That is what the alpha classifier is for, and the first thing an outside user is likely to find is something install-specific.

Two dedicated servers racing for one trigger: observed once, not proven. Two servers on one save directory — different ports, different worlds, both polling the same trigger file — served six alternating addressed requests, each answered by the server it named, never by the other, always consumed (tests/live_race_check.py). One machine, one run: evidence the claim protocol holds under a real race, not a proof it always will.

There is no escape hatch, deliberately. Other harnesses ship reflect_invoke or execute_code. command is the answer here: it runs a mod's OWN registered ModCommands, which the mod already decided existed, named, and gave a usage line. That keeps every reachable action published, typed and refusable. Arbitrary evaluation would buy unlimited reach and throw that away, so a question nobody wrote a verb for still costs an edit, a rebuild and a relaunch.

A stopped session saves nothing. stop force-kills, so a run that changes the world usually leaves no trace on disk — measured, not assumed. Do not rely on that: a run long enough to autosave, or a graceful exit, does write. Take a save_snapshot before anything that mutates a world you care about.


Available Tools

24 tools
build_modBuild the modA

Compile the configured mod source into a .tmod.

Args: timeout: Seconds to wait for the compile. A large mod on a slow machine can outlast the default, and a build that runs out of time says so rather than reporting a compile failure with no errors in it.

tModLoader REFUSES to build while the game is open, and says so with an error that otherwise reads like a compile failure. That case is reported as itself, with the fix, rather than as a broken build — which is the difference between closing the game and hunting a syntax error that is not there.

Success is read from the output, not the exit code, which is not reliable here.

Inputs: timeout. Returns: ok, errors, summary, warnings, +1 more

capturesList the captures on diskA
Read-only

Every capture in the save directory, newest last.

Names, not paths — a path handed out is a path that can come back changed, and read_capture deliberately accepts only a name.

Inputs: no named parameters. Returns: object

commandsWhat the running mod servesA
Read-only

What this side's mod says it serves, read from the mod itself.

The list is published by the responder when it loads, not assembled here. This harness used to carry its own copy of one mod's twelve commands and its own belief about which read an argument — facts that belonged to running C# and drifted the moment either side changed alone.

responder IS THE USEFUL FIELD when something is wrong. False means no list was published: the mod is not loaded, or is a build with the dev bridge compiled out. That is a different answer from a game still starting, and it used to arrive as a readiness timeout, which names the wrong thing entirely — it reads as slow rather than as never going to answer.

A list that exists but cannot be read is an ERROR rather than responder: false, because it means a responder IS running and this side cannot understand it — a version mismatch, which needs a human rather than a wait.

Args: server: Ask the dedicated server rather than the client. Each side publishes its own list, and they are not always the same.

Inputs: server. Returns: note, commands, responder

diagRead the game's stateA
Read-only

Ask one side of the session what it currently sees, parsed.

Args: server: Read the dedicated server's view instead of the client's. target: Address a specific client by name. timeout: Seconds for the WHOLE call — the reply and then the dump it promises, out of one budget rather than one each. A large world takes longer.

Returns counters as integers and the mod's absence markers as null, so a reading of 0 — a real measurement — cannot be confused with "no data". Asking both sides at the same moment is the only way to answer "the client reports no NPC", which one side alone cannot.

records carries the indented list bodies the scalars only summarise: fields["npcs"] says active=6 mutated=1, and records["npcs"] says which six. Those lines were parsed and discarded until now, so a caller could see that something was there and never what it was.

Inputs: server, target, timeout. Returns: side, fields, records

heartbeatRead the mod's heartbeatA
Read-only

Why the game is not answering, for both sides at once.

launch already reads this file to decide readiness and keeps one bit of it. When a launch SUCCEEDS that is all anyone needs. When it fails, the discarded detail is the entire answer, and what comes back instead is no live heartbeat within 300s — which names the symptom and none of the four causes:

  • absent — nothing ever wrote one. The mod is not loaded, is not enabled in this install, or was built without the dev bridge. For clients this is an EMPTY clients list, not an entry saying so.

  • stale — a game ran and is no longer running. The file outlives the process, so this is indistinguishable from live to anything that only checks whether it exists.

  • live, no world — still loading. Nothing is wrong; wait longer.

  • live, world, not armed — loaded and ticking, bridge not listening.

clients is a LIST because two clients can share one save directory and the old single-client shape reported whichever wrote last. Expect an entry per client — and one more: an entry with player: null is the untokened heartbeat every client writes before its character loads, which nothing deletes and each new client overwrites. Treat it as a slot rather than as a client. A real client is the one carrying a token and an advancing polls.

Reads OFF DISK and needs no session, deliberately: a failed launch raises without storing one, so a tool that required a session could never answer the question it exists for. It is also the only tool here that is useful when nothing else is.

Both sides are returned together because "the client is silent and the server is fine" is a different diagnosis from both being silent, and asking one at a time cannot see the difference.

Inputs: no named parameters. Returns: Every client, plus the server. A LIST rather than one `client` key, because the…

inventoryWhat this install hasA
Read-only

The worlds, characters and mods on this machine.

launch states two preconditions and could check neither. player must already exist — it does not create one, and a duplicate is kicked — and world wants a WINDOWS path the caller had to know in advance. Both are facts about directories sitting right there, and until now the only way to learn either was to launch and read the failure: a kick for the wrong character, and a readiness timeout blaming the heartbeat for the wrong world. Each world's path_win is the exact string launch(world=...) wants, and each player's name is the exact string launch(player=...) wants. That name is read from inside the .plr and can differ from the file's name, which is reported as file. difficulty matters because a journey character cannot join a non-journey world, and the other way round. A character file that cannot be read is listed with error.

The mods answer something else. commands reports responder: false for three different situations — the mod is not built, or it is built and switched off, or it is on and was compiled without the dev bridge — and enabled plus built_here separate the first two.

THOSE TWO ARE NOT ONE FACT. A mod can be enabled and have no .tmod here, because a workshop mod is installed from somewhere else entirely; on the install this was written against, CheatSheet is exactly that. Collapsing them into installed would report it missing and send someone rebuilding a mod that was never the problem.

Inputs: no named parameters. Returns: mods, worlds, players

joinJoin a second client to the running sessionA

Bring another character into the session that is already running.

Args: player: Character name. Must already exist — -player does not create one — and must not be one this session already has, in any casing. timeout: Seconds to wait for that client to report a live, world-ready heartbeat of its own.

The protocol has supported several clients since answers became per-player; the LIFECYCLE supported one, so the arrangement that work exists to make safe could only be reached by spawning a game by hand. This is that, with the waiting done properly.

It waits for THIS client, not for a process. A new pid says something started — not that a character loaded, that the join was accepted, or that a world is under it. And it watches only that player's own tokened heartbeat: the unsuffixed <mod>-hooks.txt is a shared slot holding whichever client booted last, so accepting it would return against the heartbeat of the game that was already here.

Address the new client by name — diag(target=...), shot(target=...) — which already works, because addressing was never the half that was missing. stop takes it down with everything else the session started.

Inputs: player (required), timeout. Returns: joined, player, started_pids

launchLaunch a game sessionA

Start tModLoader and wait until it can actually answer.

Args: mode: "server_client" — a server plus one joined client. It is the only mode there is, and the only way to observe what a CLIENT sees, which is where most sync bugs live. The other two are refused because the engine cannot satisfy them: "singleplayer" has no headless entry point, and "server" alone never ticks, so the mod never polls and never answers. port: Server port. Change it only if something else holds the default. player: Character name for the client. Must already exist — -player does not create one, and a duplicate name is kicked. world: WINDOWS path to a .wld, overriding TMODLOADER_WORLD_WIN. A WSL path is refused rather than tried: tModLoader runs as a Windows process, cannot resolve /mnt/c, and the only symptom is a readiness timeout blaming the heartbeat. timeout: Seconds to wait for readiness. Raise it on a slow machine or a large world — the default assumes neither.

Waits for a heartbeat that is BOTH recent and reporting a live world. Those fail differently — a stale-but-ready heartbeat means the process died, a fresh-but-not-ready one means it is still loading — and checking only existence conflates them.

Inputs: mode, port, world, player, +1 more. Returns: mode, port, world, player, +1 more

log_filesList the logs this install hasA
Read-only

Which logs exist right now, and how many earlier runs are archived.

Read off disk rather than listed as a constant: which logs exist depends on what was run, and a server-only session writes no client.log at all.

Inputs: no named parameters. Returns: object

logsRead a side's logA
Read-only

Tail one of tModLoader's logs, optionally filtered.

Args: name: Which log — see log_files for what this install actually has. client.log and server.log are the game; Launch.log and the environment-*.log pair are written by the launcher, which is where a run that died BEFORE the game started says why. previous: Read the run BEFORE this one. tModLoader zips the previous run's logs into Old/ when a new run starts, so after a failed launch and a retry the failure is in an archive and the live log belongs to the retry. contains: Keep only lines containing this substring, case-insensitively. Applied to the WHOLE log before the tail, so this returns the last N MATCHING lines rather than the matches among the last N. lines: How many trailing lines to return. Zero returns none; a negative count is refused rather than guessed at.

Useful when a launch fails: the reason is usually in a log and not in anything the trigger protocol can reach, because the game never got far enough to poll. Which is also why previous exists — the obvious thing to do after a failed launch is launch again, and that rotates the evidence.

Inputs: name, lines, contains, previous. Returns: object

log_sinceRead what a log has gainedA
Read-only

Only what a log has gained since you last looked.

Args: name: A log filename from log_files. offset: The next_offset from your previous call, or 0 to start at the beginning. BYTES, not lines — a line count is not a resume point, because the number of lines you have read is not where the file continues. contains: Case-insensitive filter, applied to the new lines only. fingerprint: The previous call's fingerprint, or omit on the first. It is how a rotation is detected when the NEW log has already outgrown your offset — without it that case reads as a quiet continuation, silently skipping the head of the new run.

NOT A LIVE TAIL, and it cannot be one. Tools here are synchronous and a game session is process-global state, so a launch blocking for five minutes is not something another call watches from the side. What this buys is the read between calls: logs re-reads a file that grows all run, and this returns the new part.

restarted is the field to check. tModLoader ZIPS the previous run's logs and starts fresh, so an offset from a run that has since rotated points past the end of a now-shorter file. Reading there would report an empty log forever, which looks exactly like a quiet game rather than like a log that restarted underneath you. When that happens the read begins again at zero and says so, because handing back the whole file is only correct if the caller is told why.

Inputs: name (required), offset, contains, fingerprint. Returns: lines, restarted, truncated, fingerprint, +1 more

log_watchWait for a line to appear in a logA
Read-only

Block until a log line matches, instead of polling log_since by hand.

Args: name: A log filename from log_files. contains: Case-insensitive text to wait for. REQUIRED — without one this matches the first line written and is log_since wearing a longer name. offset: Where to start reading. 0 includes the log's HISTORY, which is usually what you want ("did the mod load" is a question about a line that is already there). Pass a previous call's next_offset to watch only what comes after it. fingerprint: The fingerprint from an earlier log_since/log_watch, when resuming — see log_since for the rotation it catches. Within one call the polls carry it themselves. timeout: Seconds for the WHOLE call, spent across every poll. poll: Seconds between reads.

THE OFFSET IS THE MECHANISM. Each poll resumes where the last stopped, so a line is matched exactly once — never missed in the gap between two polls, and never re-reported on the next. A watch that re-read the file from the top would match a line written before the wait began and call it news, which is how "wait for the crash" passes on the crash from the PREVIOUS run.

Not matching is an ANSWER, not an error: it returns matched: false with the resume point, so "nothing was logged for 30s" is as expressible as waiting for something. A MISSING log still raises, because that is nobody having been asked rather than a line failing to arrive.

restarted means the log rotated during the wait — tModLoader zips the previous run's logs and starts fresh, so your offset stopped meaning anything and the lines you are holding came out of a different file.

Inputs: name (required), contains (required), poll, offset, +2 more. Returns: lines, polls, elapsed, matched, +3 more

prune_capturesDelete old capturesA
Destructive

Delete all but the newest keep captures, and say which went.

Captures accumulated forever. shot writes one per call and nothing ever removed them, so an agent photographing in a loop grew the SAVE DIRECTORY without bound — the folder holding the worlds and characters, which is not a cache and not somewhere to leave litter.

Args: keep: How many of the newest captures to keep. REQUIRED and deliberately without a default, the same way shot requires a region: this deletes files, and a destructive tool that runs with no arguments is one that gets called by accident. keep=0 removes all of them, which is a real request and has to be spelled out.

Only files matching THIS mod's capture pattern are touched, and each is re-checked to resolve to a direct child of the save directory — the same containment read_capture uses, because a delete that listed and removed through different rules would be looser than the read beside it. The whole set is validated before anything is unlinked, so a refusal costs nothing rather than leaving a half-finished prune.

Newest is decided by MTIME, not by the index in the filename: the index is this harness's counter and the timestamp is the disk's account of what happened.

Inputs: keep (required). Returns: removed, remaining

read_captureRead a capture back as an imageA
Read-only

Return one capture's PNG as image content.

shot answers with a filesystem path, which is worth nothing to an agent that is not running on this machine. This is how the picture itself gets back, and it is a SEPARATE call on purpose: a full-frame PNG is tens of kilobytes before base64, so a caller that only wanted to know the capture succeeded should not be made to pay for the pixels.

Args: name: A capture filename from captures, e.g. <mod>-shot-<token>-001-topleft.png. A NAME, never a path — see captures.read for why the containment is structural.

Inputs: name (required).

restartRebuild and relaunch the sessionA

Stop, rebuild, and start again with the session's own settings.

Args: build: Compile the mod between stopping and starting. On by default, because picking up a code change is the reason this loop exists. timeout: Seconds to wait for readiness on the relaunch. build_timeout: Seconds to allow the compile.

THE ORDER IS THE POINT. tModLoader REFUSES to build while the game is open and reports it with an error that reads like a compile failure, so stop-then-build-then-launch is not a preference — building first sends you hunting a syntax error that is not there. Three separate calls let a caller get that order wrong; this one cannot.

The mode, port, player and WORLD come from the running session rather than from arguments or defaults. That last one is why Session had to start recording the world it resolved: a relaunch that fell back to the configured default would quietly load a different world than the one being tested, and report success.

Needs a running session, because a session is where those settings live. With nothing running there is nothing to reuse — call launch.

Inputs: build, timeout, build_timeout. Returns: Flat on purpose. A nested `BuildOut | None` was the obvious shape and is the sh…

save_restorePut a saved copy backA
Destructive

Overwrite the world and characters with a snapshot.

Args: label: The snapshot to put back. world: WINDOWS path to the .wld. Defaults to the world the snapshot holds, and must be that world when given. Refused without it when the last session from this server loaded a different world: the restore would leave the world that run changed as it is.

This DESTROYS what is on disk now, so it saves that first: the state being overwritten is copied to auto-before-restore and returned as undo, which save_restore accepts like any other label. A restore aimed at the wrong snapshot is therefore recoverable rather than final.

The undo is NOT re-taken when that would overwrite the original with nothing unique: after a restore that failed partway (retrying keeps the original in auto-before-restore), or when the save is still exactly what the last restore put back (undo is then that snapshot's label, and the earlier undo survives). undo_kept says which.

Both cases are checked against the files on disk. If the save holds files no snapshot holds while the undo must be kept (the game was played after a failed restore), or while restoring auto-before-restore itself, this refuses and names them: take save_snapshot first, then restore again.

Refuses while the game is running, and refuses a label that does not exist by listing the ones that do.

Inputs: label (required), world. Returns: size, undo, files, label, +2 more

save_snapshotCopy the save asideA

Copy this world and its characters aside, so a run can be undone.

Args: label: The snapshot's name: letters, digits, dot, dash, underscore. world: WINDOWS path to the .wld to copy, as passed to launch. Defaults to TMODLOADER_WORLD_WIN. Refused without it when the last session from this server loaded a different world, rather than copying a world the run never touched.

WHAT THIS IS FOR. The mutating verbs write to a real install and none of that FAILS — it accumulates. Enemy NPCs do not survive a reload, so spawn looks harmless, but give writes the character file, time and weather live in the world, and settile changes it for good. The damage is invisible when it is done and shows up later as a measurement nobody doubts.

Take one before a run that mutates, and save_restore after it.

REFUSES WHILE THE GAME IS RUNNING, naming the pids. A running tModLoader owns these files and writes them out on its own schedule, so a copy taken now is mid-write. Stop the session first.

Copies the world's .wld and .twld and every .plr/.tplr — not the whole Worlds directory, which measured 41MB against 3MB for one world, and not .bak files, which are the game's own safety net.

Inputs: label (required), world. Returns: size, files, label, taken

save_snapshotsList the saved copiesA
Read-only

Every snapshot on this machine, newest first, with its age in seconds.

A snapshot whose manifest cannot be read is omitted rather than listed as empty, because save_restore refuses it for the same reason: putting back nothing and reporting success is the worst available outcome.

restore_state says what the last restore left: "mixed" means it failed partway and the save on disk is half-restored.

Inputs: no named parameters. Returns: root, snapshots, restore_state

shotPhotograph part of the frameA
Read-only

Capture a region of the game's own back buffer and return the PNG path.

Args: region: topleft, topright, bottomleft, bottomright, or full. REQUIRED and deliberately without a default — the frame holds the player's character name, world name and any chat, so a request says which corner it wants. target: Address a specific client. timeout: Seconds for the WHOLE call — the reply and then the PNG, out of one budget rather than one each.

This reads what the game rendered, not the screen, so no other window can appear in it — by construction rather than by luck. It also sees things the in-game capture camera cannot: dust and the interface layer.

The path comes back only once the bytes behind it are a WHOLE PNG. A file exists from the moment it is created rather than the moment it is finished, so waiting on the name alone would hand back half a picture as readily as a whole one — and anything else that landed on that name as readily as either.

Inputs: region (required), target, timeout. Returns: path, region

statusIs a session running?A
Read-only

Whether a session is running, and what it is.

The only read-only way to ask. Without it an agent that lost track had to provoke an error to find out — launch fails when one exists, diag fails when one does not — so the cheapest question on the surface was the one that had to be asked by breaking something.

Reports what this server BELIEVES it started. It does not re-query the process table, so it cannot tell you a game was closed from outside; stop is what verifies against reality.

Inputs: no named parameters. Returns: Always the same shape; absence is a null, not a missing key. NotRequired was th…

stopStop the game sessionA
Destructive

Kill only the processes this session started, and confirm they are gone.

Args: settle: Seconds a killed process may take to leave the process table before it counts as a survivor. /F returns before Windows has caught up, so verifying too eagerly reports a successful teardown as a refused one — raise this on a loaded machine rather than lower it.

Surgical on purpose: a developer usually has their own game open, and a teardown that killed every tModLoader it could find would take it with them.

killed_pids are pids VERIFIED to have left the process table, not pids a kill was aimed at. If any survive, this FAILS rather than answering with a shorter list — and the session is deliberately kept, so calling stop again retries exactly those pids. Releasing it would leave a running game that nothing owns, which is how the next launch ends up refusing to start over a process nobody remembers starting.

Inputs: settle. Returns: note, killed_pids

triggerSend a dev trigger to the gameA

Ask the running game to do something, and return what it said.

Args: command: One of the dev commands THIS mod serves — call commands to see them, since they are the running mod's rather than a list kept here. A word it does not serve is refused before anything is written to disk: a game that does not recognise one does nothing, and from outside that is indistinguishable from a hang. target: Address the request to one player by name. Every request is already addressed to this session's own player by default, so pass this only to ask a DIFFERENT client — one another session drives on the same machine. argument: Only some commands read one — commands says which. Passing one to a command that takes none is refused here, because the mod would refuse it too and that costs a round trip. server: Send to the dedicated server rather than the client. Some commands are server-authoritative and refuse on a client, and each side publishes its own list. timeout: Seconds to wait for the game's reply. A command that does real work on a large world can outlast the default, and for capture that is now safe at any value: the capture lock records the deadline this argument implies, so another session waits it out instead of guessing from the lock's age. Raising it no longer trades a slow capture against a collision.

refused is reported separately from ok: a refusal is the mod deliberately saying no, and treating it as success is how a rejected action reads as a completed one.

note is usually null and is the one field with no other way to reach you: something that happened on the way to this reply which the reply itself cannot show. Currently it says a capture lock was broken to take this picture — captures are serialised across sessions sharing a save directory, and this one's holder was judged gone. It names WHICH rule judged it: the holder's own recorded deadline had passed, or the lock recorded no deadline and the 60s age bound decided instead. The second is the weaker claim — a guess about how long a capture can take — and worth knowing you are reading.

Inputs: command (required), server, target, timeout, +1 more. Returns: ok, note, text, command, +1 more

wait_untilWait until the game reaches a stateA
Read-only

Poll diag until one of its fields satisfies a comparison.

Args: field: A TOP-LEVEL diag field, exactly as diag reports it - vats, items, world-ready. Not a path into one: diag splits key: value and stops, so npcs is the whole string active=4 mutated=0 and there is no npcs.active. op: One of ==, !=, <, <=, >, >=, contains, changed. value: What to compare against, as text - it is converted to whatever type the field actually reads as. Omitted for changed, which baselines on its first reading. server: Watch the dedicated server's view instead of the client's. target: Watch a specific client by name. timeout: Seconds for the WHOLE call, spent across every poll rather than granted to each. poll: Seconds between polls.

Use this instead of sleeping and taking a diag. A guessed sleep is wrong in both directions, and the short one is dangerous: the check reads the state BEFORE the thing happened, which looks exactly like the feature being broken.

THE COMPARISON IS TYPED. diag returns counters as ints and the heartbeat's flags as bools; world-ready == true compares as a boolean and items >= 10 as a number, so neither "10" < "9" nor the truthiness of "False" can come back here.

IT REFUSES WHAT CAN NEVER COME TRUE rather than waiting it out. An unknown field names the fields that do exist; ordering a composite string says what the value actually is. Both used to be spellable and would have reported a timeout - blaming a game that was answering perfectly.

Not matching is an ANSWER, not an error: it returns matched: false with the last reading it took, so a wait that expected nothing to happen is as expressible as one that expected something to.

Inputs: op (required), field (required), poll, value, +3 more. Returns: last, note, polls, elapsed, +1 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 24 tools

    Disambiguation4/5

    Most tools map to a single distinct concern, and the descriptions explicitly carve boundaries (e.g. logs vs log_since vs log_watch vs log_files each stated to be a different mechanism, and read_capture vs captures vs shot vs prune_captures). The largest overlap risk is the four-tool log cluster and the status/heartbeat pair, which an agent could plausibly misselect on a first read, though the text resolves it.

    Naming Consistency4/5

    Names are uniformly snake_case and mostly verb_noun (api_search, read_capture, prune_captures, save_snapshot, wait_until, build_mod). There is a consistent secondary convention where bare-noun names (status, inventory, commands, captures, heartbeat, logs, diag, shot) denote read-only queries while verbs denote actions, which is predictable even though it deviates from a strict verb_noun pattern.

    Tool Count3/5

    24 tools is heavy for one server and sits in the borderline range, though the domain genuinely spans process lifecycle, mod building, in-game diagnostics, log streaming, screenshots, and save snapshots. Several clusters (four log tools, three capture tools, three snapshot tools) push the count up but each member does carry a distinct role.

    Completeness4/5

    Lifecycle (launch/join/restart/stop/status), diagnostics (diag/wait_until/commands/trigger/heartbeat), build, and evidence capture (logs, captures, snapshots) are all covered with sensible before/after semantics. Gaps remain: no tool to create a world or character (launch explicitly requires pre-existing ones), and no way to enable/disable or install mods even though inventory reports their state.

    Maintenance

    ActivityActive
    ResponsivenessUsually handled

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables controlling a real Minecraft Bedrock client by injecting input and reading frames through the launcher's agent socket, including launching, stopping, screenshotting, sending chat, and managing multiple bot instances.
      6
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to install, launch, and control Minecraft: Java Edition clients and servers, including multiple headless instances with isolated profiles. Agents can read the screen and game state, click buttons, type, chat, run commands, join servers, and read logs or send console commands to servers.
      9
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables any local MCP agent host to observe and operate a real Stardew Valley game through 28 tools covering world snapshots, screenshots, movement, inventory, menus, buying/shipping, containers, crafting, placing, fishing, combat and save loading. Writes run only through normal in-game flows under a single-writer control lease with ledger-based idempotency, epoch invalidation, fail-safe release on disconnect, and human takeover via web console or hotkey.
      1
      MIT