Skip to content

Tongs

All plugins
Status
Released
Latest version
0.38.04 Dec 2026
Requires
Anvil 1.23 or newer
Game builds
EU4 1.37.5 (Steam, Windows 64-bit)EU4 1.37.5.2 (GOG, Windows 64-bit)EU4 1.37.5.0 (GOG, Windows 64-bit)
Declares gameplay changes
Yes: may affect multiplayer and ironman

The easiest way is the Catalog page of Anvil Manager. The zip below is for installing by hand.

Download Tongs 0.38.0

Windows 64-bit · 802 KB · released · All releases

Check this file4050eff1cd0a75ee8ec050579c706266903e9846deb2279da73206d5592e2f1a

This is its SHA-256. Compare it with Get-FileHash .\tongs-windows-x64.zip in PowerShell, or with SHA256SUMS.txt of the release.

To see that GitHub built it from the public source: gh attestation verify .\tongs-windows-x64.zip -R happy-dwarf-team/tongs. How to check a download

Subscribe on the Steam WorkshopInstall Anvil first (1.23 or newer): the Workshop cannot install it. Anvil loads the plugin once you approve it. See Install plugins. The Workshop does not reach a GOG game.

Tongs lets scripts and AI agents control a running game through a local named pipe, instead of reading pixels from screenshots. Every command answers with the state read from the game, so a script can check that its action worked. It is a tool for testing and measuring. You do not need it to play.

What you get

  • Read the game: the date, speed and pause, the window, the worker threads, the interface’s widgets, open events, provinces, countries and a country’s armies and navies.
  • Take screenshots of the window or a part of it, also while it is covered.
  • Time the game between two dates, to measure how fast it runs.
  • Use the keyboard and mouse as a player would, and click widgets and event options by name. The window does not need focus. This is off until you allow it.
  • Drill, split and merge units as the unit panel’s buttons do. These are inputs too, off until you allow them.
  • Run console commands and load saves. These change the game, and they are off until you allow them separately.
  • An MCP server for agents such as Claude Code.

Install

Tongs needs Anvil 1.23 or newer; take the latest. Its one dependency, the standard plugin anvil-game, comes with Anvil.

  1. Install the plugin any way you like.
  2. Turn it on: set enabled = true under Settings. It does nothing until you do.
  3. Start the game and send a command with one of the clients:
Terminal window
.\tongs.ps1 state
# {"ok":true,"in_game":true,"date":"1719.3.17","speed":2,"paused":true,...}
.\tongs.ps1 'run_until 1719.6.1 speed=5'
# {"ok":true,"command":"run_until","reached":true,"game_days":76.000,"days_per_second":12.352,"wall_ms":6153,...}

Settings

Everything but the journal is off by default. Change a setting on the Plugins page of Anvil Manager, or in anvil/data/tongs/settings.toml, one name = value per line. Settings apply at the next start.

Setting Default What it does
enabled off Opens the pipe, so that scripts can read the game
input off Allows keyboard and mouse commands, unit commands, moving the camera and opening province views
journal on Writes every command sent on the pipe, with its outcome and the game date, to anvil/data/tongs/journal/
console_allow empty Under Game calls: danger commands that game calls may run, separated by commas or spaces, for example "leak"
instance empty Only for several games on one computer: the pipe becomes \\.\pipe\tongs-NAME
bridge off Under Wine and Proton: also serves the commands on a socket on 127.0.0.1, for a native Linux client. Needs enabled. Ignored on Windows
bridge_folder empty Under Wine and Proton: where bridge.json (the port and a token) goes; empty means ~/.local/state/tongs. Use a folder only you can enter

To change a value for one start only, set an environment variable ANVIL_TONGS_<NAME>, for example ANVIL_TONGS_ENABLED=true. The file stays as it is.

Game calls

Console commands and loading saves are the module Game calls, off by default. They change game state. Turn it on under Tongs in Anvil Manager or the Anvil panel, or in anvil/anvil.toml:

enabled_modules = ["tongs.game_calls"]

To allow game calls in ironman or multiplayer, see Multiplayer and ironman.

Several games on one computer

Give each game its own instance, for example host and guest, in its settings file or with ANVIL_TONGS_INSTANCE=guest for one start. Point each client at its game with TONGS_INSTANCE=guest or --instance guest. Two games on one computer sets up two copies (GOG and Steam) with the same playset for one multiplayer game, on Linux and Windows.

Languages

The Anvil panel and Anvil Manager show the settings and Tongs’ description in French, German, Spanish, Simplified and Traditional Chinese, Japanese, Korean or Polish. These translations are drafts that native speakers have not checked yet. Corrections are welcome in an issue or a pull request.

Multiplayer and ironman

Anvil suspends Tongs in an ironman or multiplayer game. Keyboard and mouse input acts on the game as a player’s would, and game calls change it, so Tongs is marked as changing gameplay (what each plugin does). While it is suspended:

  • its hooks are out of the game;
  • input commands (except release) and game calls answer with an error;
  • reads go on.

You can allow it there in Anvil Manager or in anvil/anvil.toml. Game calls need an entry of their own:

allow_ironman = ["tongs", "tongs.game_calls"] # Tongs and its game calls in ironman
allow_multiplayer = ["tongs", "tongs.game_calls"] # likewise in multiplayer
  • Loading an ironman save: save load does it only from an ironman game that allows game calls, because the game writes the save as it loads it.
  • Pause and speed in multiplayer: pause, resume and speed press the top bar’s buttons, which post the same commands as a player’s click. Space does not pause a multiplayer game with more than one player. This is read from the game’s code and not tried with a second player.

Limitations

  • Text fields are the game’s own. Home and End select to the start or the end of the text; the game has no Shift+arrow selection and no Ctrl+A.
  • A minimized window takes no keys or clicks: those commands answer an error and send nothing. Reads, the speed buttons and opening a province go on.
  • No dragging. There is no command for it yet.
  • After a load from the in-game menu, that menu stays open and the speed keys do nothing until it is closed. save load leaves no menu.
  • Waits end after 1 hour by default. timeout=S raises that to at most 14,400 s.

Safety

  • Local only. Only programs of the Windows user running the game can connect, and remote clients are refused. There is no network listener, except the bridge socket under Wine, which is off by default, listens on 127.0.0.1 only, and takes a client of the same Linux user with the token from bridge.json.
  • Clients check the pipe. The Python client and the MCP server refuse a pipe that another Windows user created under Tongs’ name.
  • Without the Game calls module it never writes game state. Keys, text and mouse buttons go into the game’s own SDL input queue, as a player’s would. Widget clicks and event choices are mouse clicks too.
  • Console commands are limited. enable_all_commands and the achievement and social commands are always refused, other dangerous ones unless console_allow lists them. Every game call and every refusal is logged with the command, the pipe instance and the game date, and counted, so a measurement can reject a run with one in it.
  • Game text is data. Text from the game and its mods (widgets, events, names, error.log) reaches a client as it is. An agent should treat it as data, not as instructions; the MCP server tells agents so.
  • Files. Screenshots go only to anvil/data/tongs/screenshots/ (the newest 100 are kept). The command journal goes only to anvil/data/tongs/journal/, one file per game start (the newest 20 are kept). Nothing of either goes into the game, its saves or multiplayer. Tongs reads error.log without locking it, so the game can still write, move or delete it.
  • Changes to game code. With enabled = true, Tongs adds a hook that only counts the frames drawn inside a game update. With input = true it also hooks the interface’s cursor query, so the game sees the pointer where the mouse commands set it; the real cursor does not move. Anvil checks every address Tongs uses before it loads the plugin.

Commands

The pipe is \\.\pipe\tongs. A request is one line of text, and the answer is one JSON object on one line. Up to 8 clients can connect at once, so one can wait in run_until while another reads state or sends cancel.

Needs Commands
enabled ping, state, window, threads, screenshot, frames, ui find, ui tree, event list, province, country, player, selection, units, cursor, journal, wait_until, cancel, subscribe, unsubscribe, help
input pause, resume, speed, run_until, key, text, move, click, scroll, release, ui click, event choose, unit drill, unit split, unit merge, province open, province goto, map_mode
the Game calls module console, save load

The command reference has every command, key and answer field.

Timing a run

  • wait_until and run_until count the input and console commands of every client meanwhile, and report pauses, so a measurement can reject a touched run.
  • max_pause=S ends a wait that the game keeps paused, for example on an event with a choice.
  • save load discards the running game without saving. It also loads from the main menu the game starts to, through the menu’s own Continue, so a test can run several saves on one start of the game.

Screenshots and the camera

  • screenshot region=X,Y,W,H writes only that part of the window, in the pixels window and ui find use. It is cut at the window’s native size and never scaled.
  • province goto and province open park Tongs’ pointer at the window’s centre, so a real mouse on another screen does not scroll the map away from the target. Moving the real mouse, or release, hands the pointer back.

Reading the world

  • province and country list the province’s or country’s flags, with the date each was set, and its variables, as the game’s triggers see them.
  • country lists the events waiting for that country’s choice: each event’s id (the one event choose and the event window use), key, title key, province, number of options, whether it is hidden, and the date the game chooses for the player.
  • country gives the country’s diplomacy: its alliances, royal marriages, guarantees, military access both ways, subsidies, subjects with their type and warnings, each with the countries in it and its dates; its rivals, overlord and subjects; and its opinion of the player and the player’s of it (the numbers of the diplomacy window), with trust, favors and truce. In multiplayer this shows more than a player sees: every country’s trust and opinions.
  • cursor says what the game has under its pointer: the widget, the province and the army or navy there, read from the game itself rather than from a screenshot.
  • journal says where this start’s command journal is: one line per command, so a test can be followed and repeated.

Tongs reads flags, variables and units through Anvil’s anvil-game plugin.

Units

units lists the armies and navies of the player’s country, or of another country by tag, with their ids. unit drill start|stop, unit split and unit merge take those ids, or selected for what the player has selected. They post the command the unit panel’s button posts.

The answer says how many commands were posted. The game checks each one again when it runs it, so read units a moment later to see the result. For example, a drill while the country is at war is posted and then dropped, because the game does not offer drilling during a war.

Keys

key holds Shift, Ctrl and Alt too: key shift+left, key ctrl+a.

Clients

Any program that can open a named pipe can be a client. The repository has two small ones in scripts/:

  • tongs.ps1 (PowerShell) sends commands and prints one answer line per command.

  • tongs.py (Python 3, standard library only) works from the command line or as a module. It has read timeouts, cancels a wait that is interrupted, refuses answers from another game process, and ready() waits until a started or loaded game takes input:

    import tongs
    tongs.ready(session=1, speed=5) # after starting the game with a save
    with tongs.Tongs() as game:
    print(game.province(295)["owner"]) # the owner's tag, e.g. "RUS"
    result = game.run_until("1720.1.1")
    print(result["days_per_second"])

Their options and the Python methods are in Tongs clients.

MCP server

For agents such as Claude Code, the repository’s mcp/ folder has an MCP server with typed tools, such as tongs_state, tongs_run_until and tongs_ui_click. It runs on the same Windows machine as the game and adds nothing the pipe does not have: Tongs’ own settings still decide what is allowed.

tongs_ready waits until a started or loaded game takes input. When the game’s confirm window holds the load, such as the achievements notice of a modded save, it answers blocked at once instead of waiting for its timeout; save load does the same.

It needs uv (or Python 3.11 or newer with pip) and a clone of the repository:

Terminal window
git clone https://github.com/happy-dwarf-team/tongs
cd tongs\mcp
uv sync --frozen
claude mcp add --transport stdio --scope user tongs -- uv run --frozen --directory C:\path\to\tongs\mcp tongs-mcp

Other MCP clients take the same command. The MCP README lists the tools and the timeouts of common clients.

For other plugins

Another Anvil plugin in the game’s process can use Tongs without the pipe. tongs.ui reads the widget tree, and tongs.navigation selects a province. Their headers and rules are in For other plugins.

Updating from an older version

  • A config.toml from Tongs 0.12 or older is moved into settings.toml on the first start.
  • Tongs 0.34 and older had the settings game_calls, game_calls_ironman and game_calls_multiplayer. The first start with Tongs 0.35 or newer moves your choices to the Game calls module, so game calls stay as you had them.

Tested

All checks ran in the lab on one development machine, on EU4 1.37.5 (Steam) with the original eu4.exe, unless the row says otherwise. Details are in the design notes and the MCP README.

Tongs versions marked “pre” ran from its code shortly before that release.

Date (2026) Tongs, Anvil, game What was checked Result
19 Oct MCP server, Claude Code Dozens of clicks, keys, speed changes, event choices and console commands The agent drove the game
20–21 Oct Anvil 1.0 (plugin API 2) The widget tree before and after reloading interface files; console commands No crash; the save was unchanged afterwards
25 Oct Anvil 1.3 Widget trees in the lobby, a battle pop-up and hidden grid boxes; clicks in the lobby and on country shields; event choices Worked
27 Oct Anvil 1.5.2 tongs.ui’s find against the pipe’s ui find, over about 16,200 widgets The same matches (tongs#87)
27 Oct Anvil 1.5.2 The time of a cheap hovered call Median 48 µs
28 Oct Anvil 1.5.2 session over two loads through the in-game menu Both counted (tongs#115)
28 Oct Anvil 1.5.2 A wait across a load It ended with an error
max_pause on a run that an event paused It ended after 5 s of pause, not at its 300 s timeout
2 Nov GOG 1.37.5.2 Loading a save through the interface, running to a date, reading the game Worked. Console commands and events not tried
4 Nov 0.26.0, Anvil 1.9.0 A live ironman game Anvil suspended Tongs; reads went on
10 Nov 0.31.0 pre, Anvil 1.18.0 units in a save of Russia at war 62 armies and navies (tongs#180)
10 Nov 0.31.0 pre, Anvil 1.18.0 unit split and unit merge They changed an army as the panel’s buttons do
10 Nov 0.31.0 pre, Anvil 1.18.0 An unknown id, a navy for a drill, units in two provinces Refused
10 Nov 0.31.0 pre, Anvil 1.18.0 A posted unit command during a wait Counted as one input
11 Nov 0.32.0 pre, Anvil 1.19.0 Typing, Backspace, Delete, the arrows, Ctrl+Backspace and a click in text fields Worked; Home and End selected as the game’s fields do (tongs#183)
11 Nov 0.32.0 pre, Anvil 1.19.0 The German and Polish (214) layouts key and text typed the same characters
11 Nov 0.32.0 pre, Anvil 1.19.0 Clicks on land, also right after zooming The click selected the province cursor named at that point (tongs#184)
11 Nov 0.32.0 pre, Anvil 1.19.0 cursor over an army It named the army a click then selected
11 Nov 0.32.0 pre, Anvil 1.19.0 Every command with the window minimized Each answered within 0.2 s
11 Nov 0.32.0 pre, Anvil 1.19.0 The command journal Each start wrote its own (tongs#185)
11–12 Nov 0.33.0 pre; Steam with Anvil built just before 1.20.0, GOG 1.37.5.2 and 1.37.5.0 with Anvil 1.20.0 country and province flags and variables in a save of Russia in 1719: all 3,299 countries and provinces that have any The same flags, dates and variables as the save the game wrote (tongs#188)
11–12 Nov 0.33.0 pre, Anvil 1.19 The same read The answer said the lists need Anvil 1.20
12 Nov pre, Anvil 1.21.0, Steam and GOG 1.37.5.2 country RUS after a lab event, same save It listed the two events opened for the player, with the same ids as their windows; never the hidden one or the one fired for an AI (tongs#192)
12 Nov pre, Anvil built after 1.21.0 country RUS after event choose The chosen event was dropped
12 Nov pre, Anvil 1.20 The same read The answer said the list needs Anvil 1.21
13 Nov pre, Anvil 1.22.0, Steam and GOG 1.37.5.2 country for the 88 countries that own a province, same save The same 402 relations with their dates, 104 rivals, overlords, subjects and 174 opinions, trusts and favors toward the player and back as the save (tongs#193)
13 Nov pre, Anvil 1.22.0 The diplomacy windows of the Ottomans and Great Britain They showed the same opinions, allies, rivals, royal marriage and subjects
26 Nov 0.38.0 pre, Anvil 1.27.0, Steam and GOG 1.37.5.2 screenshot region=, province goto and open with the parked pointer, a load held by the achievements notice (GOG) Regions written at native size, one outside the window refused; the load answered blocked after 2.2 s (tongs#249)

Not tried in these tests: drilling at peace and selected with a real selection (10 Nov).

The French keyboard layout was also tried in the game.

Not tested yet: suspension in a live multiplayer game, pause and speed with a second player, keyboard layouts with an IME, the game’s copy and paste keys, and the Workshop mod in the game.

The name

Like a smith’s tongs, it holds the work from outside the forge.

Supported game builds

  • EU4 1.37.5 (Steam, Windows 64-bit), eu4-1.37.5-steam-win64
  • EU4 1.37.5.2 (GOG, Windows 64-bit), eu4-1.37.5.2-gog-win64
  • EU4 1.37.5.0 (GOG, Windows 64-bit), eu4-1.37.5.0-gog-win64

On any other build Anvil skips the plugin and the game starts normally.