Skip to main content
Glama

modify_terrain

Modify combat terrain by adding, removing, or clearing obstacles, difficult terrain, water, and hazards to simulate spells, abilities, and environmental effects.

Instructions

Add, remove, or clear terrain in a combat encounter. Supports obstacles, difficult terrain, water, and hazards. Use for dynamic battlefield changes from spells (Wall of Stone, Spike Growth), abilities, or environmental effects.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encounterIdYesThe encounter to modify
operationYesOperation type
terrainTypeYesType of terrain
positionsNoArray of "x,y" coordinate strings
hazardDetailsNoDetails for hazard terrain
sourceNoSource of terrain change (spell, ability, etc.)
durationNoRounds until auto-removed

Implementation Reference

  • Registration of the 'modify_terrain' tool in the central registry. Includes description, input schema conversion from Zod schema, and a handler that performs validation and delegates to the core modifyTerrain implementation.
    modify_terrain: {
      name: 'modify_terrain',
      description: 'Add, remove, or clear terrain in a combat encounter. Supports obstacles, difficult terrain, water, and hazards. Use for dynamic battlefield changes from spells (Wall of Stone, Spike Growth), abilities, or environmental effects.',
      inputSchema: toJsonSchema(modifyTerrainSchema),
      handler: async (args) => {
        try {
          const validated = modifyTerrainSchema.parse(args);
          const result = modifyTerrain(validated);
          return success(result);
        } catch (err) {
          if (err instanceof z.ZodError) {
            const messages = err.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', ');
            return error(`Validation failed: ${messages}`);
          }
          const message = err instanceof Error ? err.message : String(err);
          return error(message);
        }
      },
    },
  • The tool handler function for modify_terrain. It validates the input arguments using modifyTerrainSchema, calls the modifyTerrain function with validated args, and returns the result wrapped in a success response. Handles Zod validation errors and general exceptions.
    handler: async (args) => {
      try {
        const validated = modifyTerrainSchema.parse(args);
        const result = modifyTerrain(validated);
        return success(result);
      } catch (err) {
        if (err instanceof z.ZodError) {
          const messages = err.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', ');
          return error(`Validation failed: ${messages}`);
        }
        const message = err instanceof Error ? err.message : String(err);
        return error(message);
      }
    },
  • Reference to the input schema for the tool, converted from the Zod schema modifyTerrainSchema using toJsonSchema for MCP compatibility.
    inputSchema: toJsonSchema(modifyTerrainSchema),
  • Import statement bringing in the modifyTerrain function (handler logic) and modifyTerrainSchema from the combat module.
    import { manageCondition, manageConditionSchema, createEncounter, createEncounterSchema, executeAction, executeActionSchema, advanceTurn, advanceTurnSchema, rollDeathSave, rollDeathSaveSchema, modifyTerrain, modifyTerrainSchema, renderBattlefield, renderBattlefieldSchema, getEncounter, getEncounterSchema, endEncounter, endEncounterSchema, manageEncounter, manageEncounterSchema } from './modules/combat.js';
Behavior3/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 indicates this is a mutation tool ('add, remove, or clear terrain') which implies destructive operations, but doesn't specify permission requirements, side effects, or error conditions. The mention of 'dynamic battlefield changes' and examples like 'Wall of Stone' provide some context, but lacks details on rate limits, authentication needs, or what happens when operations fail.

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

Conciseness5/5

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

The description is perfectly concise and well-structured with two sentences that each earn their place. The first sentence states the core functionality and supported terrain types, while the second provides usage context and examples. There's zero wasted language and the information is front-loaded effectively.

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

Completeness4/5

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

Given the tool's complexity (7 parameters, nested objects, no output schema, and no annotations), the description does a good job providing context. It explains the tool's purpose, usage scenarios, and terrain types supported. However, for a mutation tool with no annotations or output schema, it could benefit from more information about return values, error conditions, or system constraints.

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 schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds meaningful context by explaining that terrain types include 'obstacles, difficult terrain, water, and hazards' and that operations are for 'dynamic battlefield changes from spells, abilities, or environmental effects.' This provides semantic understanding beyond the schema's technical descriptions.

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 purpose with specific verbs ('add, remove, or clear terrain') and resources ('in a combat encounter'), and distinguishes it from siblings by specifying it's for dynamic battlefield changes from spells, abilities, or environmental effects. It explicitly mentions supporting obstacles, difficult terrain, water, and hazards.

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

Usage Guidelines5/5

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

The description provides explicit usage guidelines by stating 'Use for dynamic battlefield changes from spells (Wall of Stone, Spike Growth), abilities, or environmental effects.' This gives clear context for when to use this tool versus alternatives, though it doesn't explicitly name sibling tools, it implies differentiation through its specific use case.

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/Mnehmos/ChatRPG'

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