Dwarf Fortress (DFHack)
v1.4.1MCP server exposing a live Dwarf Fortress fort to an AI agent as curated, semantic tools
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
artifacts_and_engravings Artifacts and engravings
The fort's art, as labeled facts. Returns the named ARTIFACTS (paginated), SITE-SCOPED BY DEFAULT — only artifacts belonging to the loaded fort, which is almost always what is meant by "our artifacts". Pass scope="world" for every artifact in the world (an old world holds hundreds that have nothing to do with your fort; in world scope each row carries site_local so the two are still distinguishable). artifact_count always reflects the scope actually applied, and artifact_count_world always gives the unfiltered world total. Each artifact carries its name (dwarven + translated), item type and…
| Parameter | Type | Description |
|---|---|---|
cursor | string | Opaque pagination cursor from a previous call's next_cursor; omit for the first page. |
limit | integer | Artifacts per page (default 25, max 100). Engravings are always fully aggregated. |
scope | string | Which artifacts to return. "site" (default) = only this fort's artifacts. "world" = every artifact in the world, each tagged with site_local. |
burrows Burrows
The fort's burrows as facts: each burrow's id, name, exact tile_count (dfhack.burrows.isAssignedBlockTile summed over every assigned block — the precise painted area, not a bounding box), assigned_units (citizens/animals manually confined to it, id-sorted and capped at 200 — assigned_units_total is always the full count and assigned_units_truncated flags when capped), and civilian_alert_linked — whether this burrow is currently one of the safety burrows for the civilian alert (see civilian_alert). civilian_alert reports the alert's own state: configured (has the fort ever set up a civili…
chronicle Chronicle
The fort's announcement/report stream (combat, deaths, moods, artifacts, sieges, migrants, ...) as triaged, cursor-addressable events. Reads the rolling, front-pruned report window. Each event carries a stable `id` (monotonic and save/load-stable); pass the returned top-level `cursor` back as `since` to fetch only newer events (id > since). Omitting `since` returns the most recent `limit` events (default 50, max 200), oldest-to-newest. If `since` predates the retained window the response sets pruned:true (earlier events are gone — not silently omitted). Events are triaged into categories (de…
| Parameter | Type | Description |
|---|---|---|
categories | array | Optional subset of categories to return: death, birth, marriage, battle, siege, mood, artifact, migrants, diplomacy, cave-in, megabeast, other. |
limit | integer | Max events to return (default 50, capped at 200); newest are kept. |
since | integer | Cursor: return only events with id greater than this (from a prior `cursor`). |
citizen Citizen
A deep dossier on ONE citizen, chained by unit_id from find_unit (or chronicle). Where find_unit stays compact, this is the depth: the walkable social graph (spouse, parents, children, friends, grudges — each with a unit_id you can pass back into citizen() to walk the graph), worshipped deities with worship strength, NOTABLE personality extremes (only the top/bottom facets, not the full 50-facet dump), skills of note, likes/detests, physical highlights, and recent thoughts as the game phrases them (raw caption templates that may contain unfilled [quality]/[deity]/[relation] placeholders, sur…
| Parameter | Type | Description |
|---|---|---|
unit_id * | string | A live unit_id (all digits), e.g. from a find_unit match |
defenses Defenses
Where the threats are versus what you have to fight them with. Returns active hostiles the fort has DISCOVERED (same fog-of-war gate and same count as threats()' active_hostiles and military()'s hostiles_on_map — a unit standing on an undiscovered tile is never listed and never leaks its position or creature token) with map positions and their geometry to the fort core and to the nearest drawbridge (dist = 8-directional tile count (Chebyshev), dz = z-levels with + meaning above the threat, dir = compass bearing; the nearest bridge is chosen on 3D distance, so a bridge many z-levels away neve…
environment Environment
The fort's ambient conditions right now: current season and dominant weather (none/rain/snow), the surface temperature with whether exposed water is currently frozen (the freezing point is 10000 DF units; composes with geology()'s freeze-in-winter fact), the alignment of the biomes visible at embark (evil / good / reanimating booleans), and — for each cavern the fort has ALREADY breached — whether it is open to fort pathing or sealed off. Fog-of-war honest: reports NOTHING about undiscovered cavern layers (a fort that has breached none returns an empty caverns list). Small fixed-size paylo…
farming Farming
The fort's farm plots and seed stock as facts — the early-survival pipeline that stocks (food OUTPUTS) and game_data (what is plantable, in the abstract) don't cover. Each plot's tile size, whether it's open to the sky right now (open_to_sky — light/weather exposure, NOT a surface-vs-underground fact: a roofed surface plot is open_to_sky:false, indistinguishable here from a genuinely underground one), its crop assignment for each of the 4 seasons (SPRING/SUMMER/AUTUMN/WINTER; crop is the plant token or absent if that season is fallow), whether that crop is eligible to grow in that season (…
find_unit Find unit
Look up citizens by a name fragment or profession (case-insensitive, matches either). Returns a compact dossier per match: profession, age, stress level, current job, squad, and health flags (wounded/patient/unconscious). Useful for questions like "how is the chief medical dwarf" or "find Urist". Each match carries a unit_id — pass it to citizen() for a deep dossier (personality, the walkable social graph, worship, skills, preferences, recent thoughts). Returns {"error":"no fort loaded"} if no fort is active.
| Parameter | Type | Description |
|---|---|---|
query * | string | Name fragment or profession to search for |
fluids Fluids
Water and magma engineering facts the Earthworks tier (tile_region, geology) does not cover: aquifer layers, standing/flowing water, the magma sea's top, flood exposure at the fort interior, and well water-source depth. Revealed-only, fog-of-war safe — undiscovered tiles never contribute to any field here, the same as tile_region/defenses. aquifer_layers[] groups contiguous revealed z-levels sharing the same light/heavy classification (a mix of both within a run of z-levels reads "mixed") with light_tiles/heavy_tiles tile counts (capped at 50 layers). water_layers[] is a per-z-level aggregat…
fort_health Fort health
The fort's computational health as facts — FPS death is the true endgame boss, and nothing else reports it. fps/gfps are the engine's own currently calculated simulation/graphics frame rates (df.global.enabler.calculated_fps/calculated_gfps — the same numbers DF's own FPS counter shows), not an average or a history. items.total is the fort-wide item-object count (df.global.world.items.all, unfiltered by forbidden/dump/rotten/construction state — every item DF is tracking counts toward this, since object count, not usable stock, is what costs simulation time); items.stone/corpses/clothes…
fort_status Fort status
One-call situational overview of the currently loaded Dwarf Fortress fort: name, in-game date and season, population, created wealth, a happiness breakdown (miserable/unhappy/content/happy), recent_deaths, and a pre-triaged list of alerts worth attention. recent_deaths covers deaths recorded AT THIS SITE within the last game year: how many were the fort's own citizens, what killed them (citizen_causes, e.g. THIRST/STARVATION/STRUCK_DOWN), how many of those citizens were slain BY another citizen (the murder/loyalty-cascade signal, which no other tool reports), and how many of the dead were outs…
game_data Game data
Look up the LOADED WORLD's raws (ground truth for THIS world) and return curated, labeled facts. This is the authoritative source for procedural creatures (demons, forgotten beasts, titans) that never appear on the wiki. Covers six kinds via the `kind` filter (default creature): creature, material, plant, reaction, item, building. Pass a token (e.g. "DEMON_4", "INORGANIC:IRON", "MAKE_SOAP_FROM_TALLOW"), a name (case-insensitive substring, e.g. "flame phantom", "plump helmet"), or — for creature — a live unit_id (all digits). A single strong hit returns a full dossier for that kind; several…
| Parameter | Type | Description |
|---|---|---|
query * | string | A raws token or case-insensitive name fragment for the chosen kind (e.g. "IRON", "plump helmet", "MAKE_SOAP_FROM_TALLOW"); for the creature kind, a live unit_id (all digits) also resolves. |
kind | string | Which raws table to search; defaults to creature. One of creature | material | plant | reaction | item | building. |
geology Geology
A one-call geological survey of the embark, REVEALED-INFO ONLY by default. Returns surface_z_max — the highest open-to-sky ground z-level found ANYWHERE on the embark (NOT map_overview()'s surface_z_at_core, which is the surface directly above the fort centre only; on a sloped map the two legitimately differ by many z-levels); the layer stack the fort has exposed (each band z_top..z_bottom with a kind — soil/sedimentary/metamorphic/igneous — and the in-game material names, e.g. "limestone", that game_data/wiki_lookup resolve); the aquifer (presence, light vs. heavy type, and z-range, eno…
| Parameter | Type | Description |
|---|---|---|
reveal_hidden | boolean | Bypass fog of war: also report undiscovered caverns and the magma-sea z-range regardless of discovery. Default false (undiscovered depths omitted). |
hauling_routes Hauling routes
The fort's minecart hauling infrastructure: routes, each route's stops, and the vehicle (minecart) objects fort-wide. routes[] is {id, name?, stops[], vehicles[]}. Each stop is {id, name?, pos:{x,y,z}, stockpiles[], conditions[], parked_vehicle_id?} — stockpiles[] is {building_id, take, give} for every stockpile linked to that stop (take = the cart picks items up from that stockpile, give = the cart drops items into it; a link can be both). conditions[] is that stop's departure conditions — {direction, mode, timeout, load_percent, at_most, desired} — mode is how a dwarf moves the cart on…
identify Identify
One-call "what is this creature and how do I handle it": fuses THIS WORLD's raws (ground truth) with the DF wiki (strategy). Pass a creature token (e.g. "DEMON_4"), a name ("flame phantom"), or a live unit_id (all digits) — same contract as game_data. Returns the creature dossier (flags, attacks, interactions — e.g. a TRAPAVOID flag means cage traps cannot hold it) plus 1-2 trimmed wiki strategy excerpts. Procedural creatures (demons, forgotten beasts, titans) have no wiki page, so strategy leans on their traits plus the most relevant trait page (fire, building destroyer). Use this instead…
| Parameter | Type | Description |
|---|---|---|
query * | string | Creature token, name fragment, or a live unit_id (all digits) |
injuries_and_health Injuries and health
The fort's medical picture, counted on CURRENT condition rather than on history. wounded = dwarves carrying at least one wound with live damage (bleeding, pain, swelling, an unset fracture, a severed part, infection). old_wounds_only = dwarves whose every wound has resolved to a scar or to an inert record — DF never deletes a healed wound, so these keep a wound entry forever and are NOT casualties. patients = dwarves the game itself flags as needing healthcare, bedridden = flagged should-not-move. unconscious counts only genuine unconsciousness: a normally SLEEPING dwarf also carries a nonze…
jobs_and_labor Jobs and labor
Workforce utilization: how many working-age dwarves are busy vs. idle (children/babies excluded from the labor pool), the idle percentage, and a ranked breakdown of what jobs the fort is currently working on. High idle can mean unassigned labor or nothing queued. cancellations aggregates recent job-cancellation OCCURRENCES (the currently-retained report buffer, roughly the last few months of play) by their reason text, sorted most-frequent first — counting occurrences, not report rows: DF collapses consecutive identical cancellations into one report and tallies the extras separately, so a re…
livestock_and_pastures Livestock and pastures
The fort's tame animal economy as facts — every prior tool sees hostiles (threats) or nothing at all here. tame_total/pets/livestock split ownership; by_group[]/by_group_total/by_group_truncated count tame animals by species/sex/adult-or-not, capped at 100 distinct combinations. grazers reports total vs pastured, plus the individual animals NOT in any pasture zone — a grazer with no pasture cannot graze and silently starves; this is normally invisible (juveniles graze too, so grazer status is NOT gated on adulthood). egg_layers reports counts only (total, fort-wide nestbox count, how many…
map_overview Map overview
Cheap spatial orientation to run BEFORE any per-tile terrain read: map extents (x/y/z tile counts), the fort-core coordinate (the same 3D citizen centroid defenses() reports), surface_z_at_core — the surface z-level directly above the fort center, i.e. the highest open-to-sky ground tile in THAT ONE COLUMN, or null if the core is not under open sky (this is NOT geology()'s surface_z_max, which is the highest open-to-sky ground tile anywhere on the embark; on a sloped map the two legitimately differ by many z-levels, so pick the one you mean) — the z-levels that carry player activity (const…
mandates_and_justice Mandates and justice
The fort's nobility overhead as facts. Active production mandates (a noble's make-N-of-an-item quota with its remaining count and days to deadline) and export bans, listed by item. Unmet noble room demands (an appointed noble holds no room zone of a type their position requires: office, bedroom, dining, tomb). Justice state: open criminal cases, convictions awaiting punishment (prison sentences, scheduled beatings and hammerstrikes), and restraint capacity (chains + cages actually CONSTRUCTED vs. how many are free, with placed-but-not-yet-built ones counted separately in restraints_unbuilt) so…
mechanisms Mechanisms
The fort's lever/pressure-plate wiring as facts — players (and an AI co-pilot) routinely forget which lever raises which bridge; this makes it legible. levers[] lists every lever with its position, current state (0/1 — the physical orientation, NOT which way any linked gate is), linked_targets (every building its mechanism items connect to — bridge/door/floodgate/hatch/support/weapon-trap — with that target's id, type, position, and a state string (raised/lowered/raising/lowering for a Bridge, closed/open/closing/opening for a Floodgate, closed/open (no transitional state) for a Door/H…
military Military
The fort's military: number of squads, how many living present dwarves are actually enlisted (soldiers), filled squad positions, and readiness read against hostiles currently on the map (great-danger split out). Each squad also reports: roster[] — one row per FILLED position whose occupant is a LIVING, PRESENT unit (a dead or off-map holder still counts toward filled but is omitted here, so gear sitting on a corpse never generates a false alert) — that soldier's uniform_complete flag, and (only when incomplete) uniform[], aggregated by item type (ARMOR/HELM/PANTS/GLOVES/SHOES/SHIELD/WEAPON…
moods Strange moods
Any active strange mood (fey/secretive/possessed/macabre/fell) and its material countdown. For each moody dwarf: the mood type, the driving skill, the workshop claimed (or that none is yet, via workshop_status: unclaimed/gathering/working), the raw mood countdown, and every demanded material cross-referenced against fort stock — needed, gathered so far, and how many the fort actually has (have). The early warning is "demands bones, fort has zero": it reports the demand vs. the stock, not what to go collect. Returns {"active":[]} when no strange mood is in progress (the common case), and {"er…
nobles_and_administrators Nobles and administrators
The fort's appointed positions (manager, bookkeeper, broker, chief medical dwarf, sheriff, expedition leader/mayor, militia commander/captain, hammerer, and any higher noble the site has grown into) as facts: each position's holder(s) or vacancy — each holder always carries histfig_id, plus unit_id when that historical figure has a loaded unit on this map (a holder living off-map still has no unit_id). A vacant position is a common, otherwise-invisible cause of "why won't this validate" — work_order_create needs a manager, trade needs a broker, mandates_and_justice punishments need a hamme…
petitions Petitions
The fort's outstanding agreements as facts: location petitions (temple/guildhall requests from a deity's worshippers or a guild) and residency/citizenship petitions (a migrant or visitor asking to join the fort), each with its petitioner, agreed date, and resolution status. location_petitions[] carries building (TEMPLE/GUILDHALL), tier (1 = temple/guildhall, 2 = complex/grand), the petitioning deity (temple) or guild profession (guildhall) when one was named, age_days since the petition was raised, and warned_ready (the fort has already been told the location can be established — a still-out…
rooms_and_zones Rooms and zones
The fort's facility inventory, each count paired with its demand-side number where one exists: bedrooms (assigned/unassigned vs. adults without one), dining halls and seats, the hospital (beds, traction benches, whether a well is inside, and medical supplies physically stocked), wells (working state and water source: water/frozen/magma/unknown), temples (dedicated deities, whether an all-inclusive temple exists, and deities worshipped by citizens that lack a dedicated temple), taverns, libraries, guildhalls, and coffins free vs. dead awaiting burial (loose corpses of the fort's own race). ghos…
site_history Site history
This fort's entry in the PERMANENT world saga (the durable history event log, not the pruned live report stream). Returns the founding (year, in-game date, and owning civilization in both Dwarven and English), the fort name in Dwarven and English with a word-by-word etymology, prior sieges/battles fought AT this site (attacker/defender civ and general, capped at 20, most-recent-first), and the notable historical figures who died here (name, race, cause, slayer, capped at 25). Scoped strictly to the loaded site. A young fort with no war history degrades to empty battle/death lists (not an error…
stockpiles Stockpiles
The fort's hauling/logistics picture: every stockpile as a fact sheet, plus fort-wide backlog signals stockpiles alone don't surface. piles[] is one row per stockpile building: id, exact bounds (x1/y1/x2/y2/z — the bounding box; an irregularly-shaped pile's real footprint can be smaller, see size), size (the pile's real tile count — for an irregular pile this reads its room.extents occupancy map rather than the bounding box, so holes/excluded tiles are correctly excluded), categories[] (which of the 17 top-level stockpile groups this pile accepts — animals/food/furniture/corpses/refuse/s…
stocks Stocks
Food and drink as estimated days-of-supply for the current population, plus counts of critical materials (wood, fuel, cloth, tanned hides, stone) and lists of notably low or high stocks. Days-of-supply assume ~2 food and ~5 drink per dwarf per season. clothing reports the citizens wearing worn (wear >= 2 — "X" heavily-worn/threadbare, or "XX" tattered/mangled; DF's own 4-stage scale is item -> x-item-x -> X-item-X -> XX-item-XX -> destroyed) shoes/armor/pants/gloves/helm — a chronic, easy-to-miss stress source — and how many citizens currently have no shoes worn at all (a count, since th…
threats Threats
Dangerous units currently on the map, grouped by creature type. Separates ACTIVE hostiles from CONTAINED ones (caged/chained), flags great-danger creatures (megabeasts, titans, demons, forgotten beasts), invaders, and the undead, and returns a pre-triaged alerts list. Returns {"error":"no fort loaded"} if no fort is active.
tile_region Tile region
A bounded window of ONE z-level rendered as an ASCII character grid plus a self-describing legend (every response carries the legend for exactly the glyphs it uses). Renders terrain shape (undug stone #, undug soil ",", dug floor ., ramps r/v, up/down stairs </>/x, fortifications F, trees T), constructed floor +, water ~ and magma %, and building footprints collapsed to FOUR CLASSES — workshop/furnace W, stockpile S, machine M, furniture n — never per-building detail. The grid glyph is depth-blind; a separate sparse liquids list carries per-tile [{x,y,type,depth}] (flow_size 1..7). Undisco…
| Parameter | Type | Description |
|---|---|---|
x0 | integer | window corner X (with y0,x1,y1 for an explicit rectangle) |
x1 | integer | opposite window corner X |
y0 | integer | window corner Y |
y1 | integer | opposite window corner Y |
z | integer | z-level to render; defaults to the busiest citizen level |
trade Trade and caravans
The trade picture right now: whether a trade depot exists, is complete, and is wagon-accessible (DF's own pathability check, not merely built); which caravans are present and their lifecycle state (none / approaching / at depot / leaving, with days remaining where knowable) and civ; whether a broker is assigned, present, at the depot, and their current job; and the count and approximate value of goods staged in the depot. Each caravan also reports manifest (count, approximate value, and a by-category breakdown of goods the caravan itself is carrying, before anything is unloaded to the depot  
unmet_needs Unmet needs
Why the fort is stressed: the dwarven needs system aggregated across all citizens. Returns the top unmet needs (e.g. prayer, drink, socializing) ranked by how many dwarves are distracted, each with the worst focus level (how starved the need is), plus how many dwarves have at least one unmet need. Reading worst_focus: it is DF's raw focus_level — 0 is neutral, positive means recently satisfied (caps at 400), negative means starved. There is NO single floor: the minimum is -16320 x that dwarf's need_level for that need, so a level-1 need bottoms out at -16320, a level-2 need at -32640, a leve…
wiki_lookup Wiki lookup
Fetch a Dwarf Fortress wiki article as clean, readable text, pinned to the DF2014 namespace. Follows redirects (multi-hop) and honors section fragments (e.g. "Weapon trap" resolves to the Weapon Trap section of the Trap page). Cache-first to disk (~30-day TTL); pass refresh:true to bypass. Pure HTTP — works without the game running. Returns {title, url, text, from_cache, resolved_from?} or {error} if the page is not found.
| Parameter | Type | Description |
|---|---|---|
title * | string | Article title or topic (namespace optional) |
refresh | boolean | Bypass the disk cache and refetch |
section | string | Section/heading name to scope to |
wiki_search Wiki search
Search the Dwarf Fortress wiki (MediaWiki) for candidate article titles and cleaned snippets. Discovery/disambiguation step before wiki_lookup; biased to the DF2014 (Steam/Premium) namespace. Pure HTTP — works without the game running. Returns {results:[{title, snippet}]} (up to 8).
| Parameter | Type | Description |
|---|---|---|
query * | string | What to search the DF wiki for |
work_details Work details
List the fort’s work details (the labor-management groups) as facts: each detail’s name, mode (OnlySelectedDoesThis / EverybodyDoesThis / NobodyDoesThis / Default), the labor tokens it enables, and its assigned citizens. The member list is id-sorted and capped at 200 per detail — member_count is always the full count and members_truncated flags when the list is capped; member_names gives readable names parallel to members. Both parameters are OPTIONAL narrowing: detail (exact name) returns ONLY that detail; members_after (a unit id) starts each member list after that id — a truncated d…
| Parameter | Type | Description |
|---|---|---|
detail | string | exact work detail name — return ONLY that detail, e.g. "Miners" |
members_after | integer | member-list cursor: list members with id AFTER this (use members_cursor from a truncated response) |
work_order_list Work order list
List the fort’s active manager (work) orders as facts: id, job type, output item/material tokens, amount total/left, repeat frequency, bound workshop, condition count, and per-order validation state (active + validated; validated:false means the order cannot currently be fulfilled). Also reports whether a manager noble is assigned. `count` is the fort total; the page is sorted by id and capped at 256 — when capped, truncated:true and next_cursor gives the after_id for the next page. READ-ONLY and always available (not behind the actuator gate); also the readback sensor for work_order_creat…
| Parameter | Type | Description |
|---|---|---|
after_id | integer | pagination cursor: return only orders with id greater than this (from next_cursor) |