Skip to main content
Glama

place_prop

Add or manage interactive battlefield props like barrels, doors, and chests to enhance tactical encounters in role-playing games.

Instructions

Place or manage interactive props on the battlefield (barrels, doors, chests, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encounterIdYes
operationNoplace
nameNo
typeNo
positionNo
propIdNo
stateNo
lockedNo
lockDCNo
coverTypeNo
blocksMovementNo
destructibleNo
hpNo
acNo
sizeNo
descriptionNo
hiddenNo
trapDCNo
trapDamageNo
triggerNo

Implementation Reference

  • The core handler function for the place_prop tool. Handles all operations: place (create new prop), list (show all props), remove (delete by ID), update (modify properties), move (relocate prop). Integrates with encounter terrain bounds, validates positions, generates unique IDs, and stores props in per-encounter memory. Returns formatted ASCII output.
    export function placeProp(input: PlacePropInput): string {
      const content: string[] = [];
      const operation = input.operation || 'place';
    
      // Validate encounter exists
      const encounter = getEncounterState(input.encounterId);
      if (!encounter) {
        throw new Error(`Encounter not found: ${input.encounterId}`);
      }
    
      // Get grid bounds from terrain
      const gridWidth = encounter.terrain?.width || 20;
      const gridHeight = encounter.terrain?.height || 20;
    
      // Initialize props array for this encounter if needed
      if (!encounterProps.has(input.encounterId)) {
        encounterProps.set(input.encounterId, []);
      }
      const props = encounterProps.get(input.encounterId)!;
    
      switch (operation) {
        case 'place': {
          // Validate position bounds
          const pos = input.position!;
          if (pos.x < 0 || pos.x >= gridWidth || pos.y < 0 || pos.y >= gridHeight) {
            throw new Error(`Position (${pos.x}, ${pos.y}) is out of bounds (grid is ${gridWidth}x${gridHeight})`);
          }
    
          // Create new prop
          const prop: Prop = {
            id: generatePropId(),
            name: input.name!,
            type: input.type!,
            position: { x: pos.x, y: pos.y, z: pos.z ?? 0 },
          };
    
          // Add optional properties
          if (input.state !== undefined) prop.state = input.state;
          if (input.locked !== undefined) prop.locked = input.locked;
          if (input.lockDC !== undefined) prop.lockDC = input.lockDC;
          if (input.coverType !== undefined) prop.coverType = input.coverType;
          if (input.blocksMovement !== undefined) prop.blocksMovement = input.blocksMovement;
          if (input.destructible !== undefined) {
            prop.destructible = input.destructible;
            if (input.hp !== undefined) {
              prop.hp = input.hp;
              prop.maxHp = input.hp;
            }
            if (input.ac !== undefined) prop.ac = input.ac;
          }
          if (input.size !== undefined) prop.size = input.size;
          if (input.description !== undefined) prop.description = input.description;
          if (input.hidden !== undefined) prop.hidden = input.hidden;
          if (input.trapDC !== undefined) prop.trapDC = input.trapDC;
          if (input.trapDamage !== undefined) prop.trapDamage = input.trapDamage;
          if (input.trigger !== undefined) prop.trigger = input.trigger;
    
          props.push(prop);
    
          // Build output
          content.push(centerText('PROP PLACED', PROP_DISPLAY_WIDTH));
          content.push('');
          content.push(`Name: ${prop.name}`);
          content.push(`Type: ${prop.type}`);
          content.push(`Position: (${prop.position.x}, ${prop.position.y}, ${prop.position.z ?? 0})`);
          content.push(`ID: ${prop.id}`);
          content.push('');
          content.push(BOX.LIGHT.H.repeat(PROP_DISPLAY_WIDTH));
          content.push('');
    
          // Show properties
          content.push(centerText('PROPERTIES', PROP_DISPLAY_WIDTH));
          content.push('');
    
          if (prop.state) content.push(`State: ${prop.state}`);
          if (prop.size) content.push(`Size: ${prop.size}`);
          if (prop.coverType) content.push(`Cover: ${prop.coverType}`);
          if (prop.blocksMovement) content.push('Blocks Movement: Yes');
          if (prop.destructible) {
            content.push('Destructible: Yes');
            if (prop.hp) content.push(`HP: ${prop.hp}`);
            if (prop.ac) content.push(`AC: ${prop.ac}`);
          }
          if (prop.locked) {
            content.push('Locked: Yes');
            if (prop.lockDC) content.push(`Lock DC: ${prop.lockDC}`);
          }
          if (prop.hidden) content.push('Hidden: Yes');
          if (prop.trapDC) content.push(`Trap DC: ${prop.trapDC}`);
          if (prop.trapDamage) content.push(`Trap Damage: ${prop.trapDamage}`);
          if (prop.trigger) content.push(`Trigger: ${prop.trigger}`);
          if (prop.description) {
            content.push('');
            content.push(`Description: ${prop.description}`);
          }
    
          return createBox('PROP PLACED', content);
        }
    
        case 'list': {
          content.push(centerText('ENCOUNTER PROPS', PROP_DISPLAY_WIDTH));
          content.push('');
          content.push(`Encounter: ${input.encounterId}`);
          content.push(`Total Props: ${props.length}`);
          content.push('');
          content.push(BOX.LIGHT.H.repeat(PROP_DISPLAY_WIDTH));
          content.push('');
    
          if (props.length === 0) {
            content.push('No props placed.');
          } else {
            for (const prop of props) {
              content.push(`${prop.name} (${prop.type})`);
              content.push(`  ID: ${prop.id}`);
              content.push(`  Position: (${prop.position.x}, ${prop.position.y}, ${prop.position.z ?? 0})`);
              if (prop.state) content.push(`  State: ${prop.state}`);
              content.push('');
            }
          }
    
          return createBox('PROP LIST', content);
        }
    
        case 'remove': {
          const propIndex = props.findIndex(p => p.id === input.propId);
          if (propIndex === -1) {
            throw new Error(`Prop not found: ${input.propId}`);
          }
    
          const removedProp = props.splice(propIndex, 1)[0];
    
          content.push(centerText('PROP REMOVED', PROP_DISPLAY_WIDTH));
          content.push('');
          content.push(`Name: ${removedProp.name}`);
          content.push(`Type: ${removedProp.type}`);
          content.push(`ID: ${removedProp.id}`);
          content.push('');
          content.push('Prop has been removed from the encounter.');
    
          return createBox('PROP REMOVED', content);
        }
    
        case 'update': {
          const prop = props.find(p => p.id === input.propId);
          if (!prop) {
            throw new Error(`Prop not found: ${input.propId}`);
          }
    
          // Update properties
          if (input.state !== undefined) prop.state = input.state;
          if (input.locked !== undefined) prop.locked = input.locked;
          if (input.lockDC !== undefined) prop.lockDC = input.lockDC;
          if (input.coverType !== undefined) prop.coverType = input.coverType;
          if (input.blocksMovement !== undefined) prop.blocksMovement = input.blocksMovement;
          if (input.hp !== undefined) prop.hp = input.hp;
          if (input.hidden !== undefined) prop.hidden = input.hidden;
    
          content.push(centerText('PROP UPDATED', PROP_DISPLAY_WIDTH));
          content.push('');
          content.push(`Name: ${prop.name}`);
          content.push(`ID: ${prop.id}`);
          content.push('');
          content.push(BOX.LIGHT.H.repeat(PROP_DISPLAY_WIDTH));
          content.push('');
          content.push(centerText('CURRENT STATE', PROP_DISPLAY_WIDTH));
          content.push('');
          if (prop.state) content.push(`State: ${prop.state}`);
          if (prop.locked) content.push('Locked: Yes');
          if (prop.hidden) content.push('Hidden: Yes');
          content.push(`Position: (${prop.position.x}, ${prop.position.y}, ${prop.position.z ?? 0})`);
    
          return createBox('PROP UPDATED', content);
        }
    
        case 'move': {
          const prop = props.find(p => p.id === input.propId);
          if (!prop) {
            throw new Error(`Prop not found: ${input.propId}`);
          }
    
          if (!input.position) {
            throw new Error('New position required for move operation');
          }
    
          const newPos = input.position;
          if (newPos.x < 0 || newPos.x >= gridWidth || newPos.y < 0 || newPos.y >= gridHeight) {
            throw new Error(`Position (${newPos.x}, ${newPos.y}) is out of bounds`);
          }
    
          const oldPos = { ...prop.position };
          prop.position = { x: newPos.x, y: newPos.y, z: newPos.z ?? 0 };
    
          content.push(centerText('PROP MOVED', PROP_DISPLAY_WIDTH));
          content.push('');
          content.push(`Name: ${prop.name}`);
          content.push(`ID: ${prop.id}`);
          content.push('');
          content.push(`From: (${oldPos.x}, ${oldPos.y}, ${oldPos.z ?? 0})`);
          content.push(`To: (${prop.position.x}, ${prop.position.y}, ${prop.position.z ?? 0})`);
    
          return createBox('PROP MOVED', content);
        }
    
        default:
          throw new Error(`Unknown operation: ${operation}`);
      }
    }
  • Zod input schema for place_prop tool. Defines parameters for all operations (place, remove, update, move, list). Validates required fields per operation (e.g., name/type/position for place, propId for remove/update/move). Supports rich prop attributes: state, locked/lockDC, coverType, blocksMovement, destructible/hp/ac, size, description, hidden, trapDC/damage/trigger.
    export const placePropSchema = z.object({
      encounterId: z.string(),
      operation: PropOperationSchema.default('place'),
    
      // For place operation
      name: z.string().optional(),
      type: PropTypeSchema.optional(),
      position: PropPositionSchema.optional(),
    
      // For remove/update/move operations
      propId: z.string().optional(),
    
      // Prop properties
      state: z.string().optional(), // 'open', 'closed', 'on', 'off', etc.
      locked: z.boolean().optional(),
      lockDC: z.number().min(1).max(30).optional(),
      coverType: PropCoverTypeSchema.optional(),
      blocksMovement: z.boolean().optional(),
      destructible: z.boolean().optional(),
      hp: z.number().min(1).optional(),
      ac: z.number().min(1).max(30).optional(),
      size: PropSizeSchema.optional(),
      description: z.string().optional(),
    
      // Trap properties
      hidden: z.boolean().optional(),
      trapDC: z.number().min(1).max(30).optional(),
      trapDamage: z.string().optional(),
      trigger: z.string().optional(),
    }).refine((data) => {
      // For place operation, name, type, and position are required
      if (data.operation === 'place') {
        return data.name !== undefined && data.type !== undefined && data.position !== undefined;
      }
      // For remove/update/move, propId is required
      if (['remove', 'update', 'move'].includes(data.operation)) {
        return data.propId !== undefined;
      }
      return true;
    }, {
      message: 'Place operation requires name, type, and position. Remove/update/move require propId.',
    });
  • MCP tool registration entry. Converts Zod schema to JSON Schema for MCP compatibility. Handler validates inputs with placePropSchema, calls placeProp(validated), and formats success/error responses.
    place_prop: {
      name: 'place_prop',
      description: 'Place or manage interactive props on the battlefield (barrels, doors, chests, etc.)',
      inputSchema: toJsonSchema(placePropSchema),
      handler: async (args) => {
        try {
          const validated = placePropSchema.parse(args);
          const result = placeProp(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);
        }
      },
    },
Behavior2/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 mentions 'place or manage' which hints at mutation, but fails to describe permissions, side effects, response format, or any constraints like rate limits or destructive impacts. This is inadequate for a tool with 20 parameters and complex operations.

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 a single, efficient sentence that front-loads the core purpose. There is no wasted text, and it directly addresses the tool's function without redundancy.

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

Completeness2/5

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

Given the high complexity (20 parameters, nested objects, no output schema, and no annotations), the description is insufficient. It lacks details on behavioral traits, parameter usage, and output expectations, making it incomplete for effective tool invocation.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for all 20 parameters. It only vaguely references props like barrels and doors, adding minimal meaning beyond the schema. Key parameters like 'operation', 'propId', and 'state' are unexplained, leaving significant gaps in understanding.

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

Purpose4/5

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

The description clearly states the verb ('place or manage') and resource ('interactive props on the battlefield') with examples like barrels, doors, and chests. It distinguishes this tool from siblings that handle characters, encounters, or terrain modification, though it doesn't explicitly differentiate from 'modify_terrain' which might overlap.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'modify_terrain' or other sibling tools. The description implies usage for props in encounters but doesn't specify prerequisites, exclusions, or contextual triggers.

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/mnehmos.chatrpg.game'

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