Skip to main content
Glama

Defenses

defenses

Reveals discovered hostiles and defensive structures with map positions, terrain, and walkability to inform tactical decisions.

Instructions

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 never wins on horizontal proximity alone), plus an inventory of controllable defensive structures (drawbridges with positions, levers, floodgates, hatches, cage traps, locked doors). Terrain-aware: each threat is classified inside/outside the fort's walled perimeter — "inside" means its tile shares a walkability group with your citizens, i.e. a hostile could walk to your population through connected open space without breaching a wall (walk_group 0 = no walkable footing, e.g. a flier over open air). A perimeter_terrain field reads the busiest citizen level via the terrain substrate: an ASCII tile grid (with legend) plus counts of walls, fortifications (with positions), and open-to-sky vs covered vs undiscovered tiles. Facts only — decide the tactics yourself, and use identify() for a creature's trait facts (e.g. cage traps do not hold a TRAPAVOID creature). Caveats: inside/outside is walking connectivity, so a FLIER or BUILDING_DESTROYER can reach you while reported "outside" — cross-reference its traits. perimeter_terrain is a single z-level and does not synthesize a multi-z approach vector; undiscovered tiles are fog of war ("?") and never leak their real type. Which lever raises which bridge is not recorded in the raws, so bridges and levers are reported separately, not linked. Returns {"error":"no fort loaded"} if no fort is active.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It thoroughly explains fog-of-war gating, the exact distance metric (Chebyshev), the classification of inside/outside via walkability groups, and the per-z-level terrain view. It also discloses caveats about unlinked levers/bridges, undiscovered tiles as '?', and the exact error message when no fort is loaded.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long, but every sentence adds unique, non-redundant information about distance calculations, terrain logic, and caveats. The opening sentence effectively front-loads the core purpose. It could be tightened by splitting into bullet points, but the density of new information justifies its length.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity, empty schema, no annotations, and no output schema, the description is exceptionally complete. It covers all returned data categories, calculation methods, edge cases (e.g., no walkable footing), and the error condition. It leaves no significant behavioral aspect unexplained.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the description correctly omits parameter details. The baseline for no params is 4, and the description adds no irrelevant parameter info. It confirms the schema's emptiness by focusing entirely on the output and behavior.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's dual purpose: reporting active discovered hostiles with their geometry to fort structures, and listing controllable defensive structures. It distinguishes itself from siblings like threats() by explicitly comparing its hostiles count to threats()' active_hostiles and adding the defensive inventory. The verb 'returns' and concrete resources make the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage context, telling the agent to use identify() for creature trait facts (explicit alternative) and warning about fliers/buildings that may be reported 'outside' despite being a threat. It also notes limitations like single-z terrain, implicitly guiding when to cross-reference other tools. However, it doesn't explicitly say when to prefer this over threats() or military(), but the added defensive structures make the unique value clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/alexanderolvera/dfhack-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server