Skip to main content
Glama
HOI4 Agent Tools

HOI4 Agent Tools

by klimPaskov

Make focus trees, events and decisions. Edit maps and generate a new world. Preview windows, trees and maps, find the right rule in the docs, fix broken script and balance AI choices.

What it does

Your agent can build and edit focus trees, events, decisions and maps, and generate a new world from a reference image (map guide). It previews focus trees, technology folders, windows and maps, finds the right rule in the game's documentation, fixes broken script and tunes AI choices. You describe what you want; the agent picks the right tools.

Related MCP server: mcdev-mcp

Quick start

  1. Install Node.js 22 (22.19 or later) or 24, and keep Hearts of Iron IV installed for vanilla files, artwork and fonts. The package ships its analysis engine for Windows x64, Linux x64 and arm64, and macOS on Apple silicon. On another platform, such as an Intel Mac, the tools that need the engine say so and how to build it; set HOI4_ENGINE to that build.

  2. Install the server:

    npm install --global hoi4-agent-tools
  3. Print the client configuration:

    hoi4-agent-tools-setup --print-client-config

    Paste the globalInstall block into a JSON client such as Claude Code, Claude Desktop or Cursor, or the codexTomlGlobal block into Codex's config.toml.

  4. Open your mod folder as the agent's workspace and tell it what you want to build or fix.

The setup guide covers several mods, explicit game paths, local wiki snapshots and troubleshooting with --discover and --diagnose.

Watch the Agent Tools demo or use HOI4 Mod Setup to install and connect the server for your mod. Part of the HOI4 modding toolkit with Agentic HOI4 Modding (skills and instructions for your agent) and HOI4 Live Tools (testing in the running game).

Examples

A large focus tree rendered from mod source

Each pair shows a capture from the game next to the server's preview of the same source.

In game

Server preview

Focus tree in game

Focus tree preview

Infantry technology folder in game

Infantry technology folder preview

Video options in game

Video options preview

See more in the examples gallery.

Tools

The server gives your agent previews, documentation, script analysis and editing tools. The agent combines them with its file editor to build events and decisions, repair scripts and adjust AI weights. The tool reference lists exact names, arguments and results for integrations.

A session lists the core tools by default: documentation search, source lookup, script validation, the error log, the mod health check and localisation. They fit in about 8,000 tokens of the agent's context. Set HOI4_AGENT_TOOLS_PROFILES to core,map, core,advanced or all in the client's server entry for the world map tools or the focus, GUI, event, technology and probability editors (tool profiles).

FAQ

Where do edits go? Changes are written to your mod folder; use Git to review or undo them.

Does it run the game? No. Previews come from mod source; test gameplay in HOI4 to see live clicks, AI choices and timing.

Configuration

Started inside a mod folder, the server needs no configuration file. hoi4-agent-tools-setup --init writes one when you work on several mods or the game is not found automatically. For remote or shared use, hoi4-agent-tools-http serves the same tools over HTTP with tokens or OAuth. See the configuration reference and the HTTP guide.

Documentation

Development

npm ci
npm run check

See the contributing guide and the development guide.

License

Apache-2.0; see LICENSE and the third-party notices. Hearts of Iron IV artwork belongs to Paradox Interactive; this project is unaffiliated with Paradox Interactive. The in-game captures were supplied for these comparisons.

Available Tools

13 tools
hoi4.error_logRead the game error logA
Read-onlyIdempotent

Find errors from the last game launch and group them by category, with source files, lines and fix hints. Show which files changed since the log and which errors appeared after a relaunch; mod entries come first. Example: {"scope":"mod","category":"effect"}. Returns at most 20 entries (limit 50) with fix hints and which entries are new since the previous launch.

Inputs: limit, query, scope, offset, +2 more. Returns: code, data, status, blockers, +7 more

hoi4.explain_errorExplain error.log linesA
Read-onlyIdempotent

Explain error.log lines: the rule each one breaks, its file and line with the lines around it, and the fix, from a reviewed catalogue of the game's messages. Says whether the game documents the command a line names, and the closest documented names. Example: {"line":"Invalid trigger 'stability' in events/my_events.txt line : 12"}. Returns up to 20 explanations (10 lines).

Inputs: line, lines, workspaceId. Returns: code, data, status, blockers, +7 more

hoi4.localisation_inspectCheck localisation in every languageA
Read-onlyIdempotent

Read localisation in every language the game and mod ship. key: one key per language with file, line and layer, the languages lacking it and the files mentioning it. audit: keys the mod uses that no language defines, keys missing from a supported language, keys defined twice in one language, and file problems. coverage: keys per language. Example: {"mode":"key","key":"my_event.1.t"} or {"mode":"audit"}. Returns counts per problem and a few examples of each.

Inputs: key, mode, limit, language, +1 more. Returns: code, data, status, blockers, +7 more

hoi4.localisation_writeAdd or fix localisationA
Destructive

Add localisation keys (mode add: key and text; language, file, replace) or repair localisation files (mode fix: BOM, broken quotes, keys missing from supported languages). Game keys are overridden from a replace folder. apply false returns the diff and writes nothing; apply true writes it. Returns up to 10 files with diffs. Example: {"mode":"add","entries":[{"key":"my_focus","text":"My focus"}]}

Inputs: mode (required), file, apply, fixes, +6 more. Returns: code, data, status, blockers, +7 more

hoi4.mod_healthCheck a whole modA
Read-onlyIdempotent

Check a whole mod in one call: the last error.log, the engine check (unknown effects, triggers and modifiers, duplicate ids, broken overrides), script validation, and the localisation and asset audits. Returns the 10 problems that matter most, each counted with 2 examples, its fix and the tool to use next, and which audits ran. Example: {"limit":5} or {"checks":["error_log","engine_check"]}. Takes up to a minute on a large mod.

Inputs: limit, checks, workspaceId. Returns: code, data, status, blockers, +7 more

hoi4.mod_indexExplore mod content and find free IDsA
Read-onlyIdempotent

Summarize the content in a mod or find a free event ID across the mod, game and dependencies. Use overview for descriptors, folders and definitions (the 50 busiest namespaces; pass a namespace or prefix to list those starting with it), or next_id with a namespace or prefix. Example: {"mode":"next_id","kind":"event","namespace":"my_mod"}. Returns a compact summary; the first call indexes the mod, which takes seconds on a large one.

Inputs: kind, mode, layer, prefix, +2 more. Returns: code, data, status, blockers, +7 more

hoi4.reference_contextFind docs for a modding taskA
Read-onlyIdempotent

Find documentation for the content you are building: events, decisions, ideas, focuses, technology, GUI, maps, localisation or AI. Example: {"surface":"event","question":"fire an event after a delay"}. Returns up to 16 short sections; read more with hoi4.reference_read.

Inputs: surface (required), limit, question, workspaceId. Returns: code, data, status, blockers, +7 more

hoi4.reference_readRead a modding ruleA
Read-onlyIdempotent

Read a documentation section returned by reference_search or reference_context. Pass its id and revision. Example: {"id":"","revision":""}. Returns at most 80 lines (40 by default) and 8,000 bytes, with a line to continue from.

Inputs: id (required), revision (required), source, maxLines, +3 more. Returns: code, data, status, blockers, +7 more

hoi4.script_guardFind invented commands in new scriptA
Read-onlyIdempotent

Check the files you wrote for invented commands: every effect, trigger and modifier that the installed game documentation does not list and no loaded file defines, with its file, line and the closest real name. Checks the named paths, or the mod script files changed in the last 120 minutes. Needs hoi4-engine. Example: {"paths":["events/my_events.txt"]}. Returns up to 40 names.

Inputs: paths, workspaceId, sinceMinutes. Returns: code, data, status, blockers, +7 more

hoi4.script_validateCheck HOI4 script commands and scopesA
Read-onlyIdempotent

Find broken syntax, commands and scopes in an effect, trigger or mod file using the installed docs. Unknown helpers and native argument blocks stay unresolved. Example: {"source":"add_political_power = 10","kind":"effect","scope":"country"} or {"path":"events/a.txt"}. {"closure":true} instead counts whether the references of the whole mod resolve, per kind. Returns up to 12 findings.

Inputs: kind, path, limit, scope, +5 more. Returns: code, data, status, blockers, +7 more

hoi4.skillRead the mod's modding skillsA
Read-onlyIdempotent

List the modding skills installed in the mod, or load one by name, at the kit version HOI4 Mod Setup pinned, with its hash. A file edited since Setup installed it is refused unless acceptLocalEdits. Example: {"name":"hoi4-events"}. Returns up to 20,000 bytes of text; continue from nextOffset.

Inputs: file, name, offset, workspaceId, +1 more. Returns: code, data, status, blockers, +7 more

hoi4.source_lookupFind definitions and usagesB
Read-onlyIdempotent

Find where a script symbol is defined and used across the game, DLC and mod. Pass a symbol, or a file path and line. Example: {"symbol":"my_scripted_effect"}. Returns up to 3 definitions with source text and 10 usages; keyPath and view=structure navigate nested blocks.

Inputs: kind, line, path, view, +13 more. Returns: code, data, status, blockers, +7 more

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 13 tools

    Disambiguation4/5

    Most tools have clearly distinct roles: reference_search/read/context form a discovery→read pipeline, error_log/explain_error/mod_health span finding→explaining→overall checking. The closest overlap is script_validate vs script_guard (both analyze scripts), but descriptions differentiate syntax/command validation from invented-name detection, so an agent can choose correctly.

    Naming Consistency4/5

    All names use a consistent hoi4. prefix and snake_case, so the convention is readable. There is minor variation in ordering—some are verb_noun (reference_search, script_validate, explain_error) while others are noun_verb (localisation_write, mod_health, error_log)—but no mixed casing or chaotic styles.

    Tool Count5/5

    13 tools is well within the sweet spot for a modding assistant toolkit. Each tool covers a distinct facet (docs, validation, errors, health, localisation, index, skills) and none feels redundant.

    Completeness4/5

    Strong lifecycle coverage: search/read docs, validate, guard against invented commands, diagnose launch errors, whole-mod health, localisation read/write, and indexing. The main gap is a general script-authoring/edit tool (only localisation_write exists), but core diagnosis and writing workflows are covered.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers