Skip to main content
Glama

create_encounter

Generate D&D 5e combat encounters with participants, terrain, and initiative tracking for roleplaying games.

Instructions

Create a D&D 5e combat encounter with participants, terrain, and initiative tracking

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
seedNo
participantsYes
terrainNo
lightingNobright
surpriseNo

Implementation Reference

  • Registration of the 'create_encounter' tool, including name, description, input schema conversion from Zod schema, and handler function that validates arguments using createEncounterSchema and calls the createEncounter function to perform the logic.
    create_encounter: {
      name: 'create_encounter',
      description: 'Create a D&D 5e combat encounter with participants, terrain, and initiative tracking',
      inputSchema: toJsonSchema(createEncounterSchema),
      handler: async (args) => {
        try {
          const validated = createEncounterSchema.parse(args);
          const result = createEncounter(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 executes the core logic: Zod validation with createEncounterSchema, execution of createEncounter(validated), and formatting success/error response.
    handler: async (args) => {
      try {
        const validated = createEncounterSchema.parse(args);
        const result = createEncounter(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);
      }
    },
  • Usage of createEncounterSchema for input validation (schema imported from './modules/combat.js'). The schema definition itself is not in this file.
    const validated = createEncounterSchema.parse(args);
  • Call to the helper function createEncounter which contains the detailed implementation logic (imported from './modules/combat.js').
    const result = createEncounter(validated);
  • Import statement bringing in createEncounter function and createEncounterSchema 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';
Behavior2/5

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

With no annotations, the description carries full burden but provides minimal behavioral context. It mentions 'initiative tracking' but doesn't explain how initiative is calculated, whether the encounter is automatically started, or what happens on creation (e.g., persistence, side effects). For a complex creation tool with nested objects, this is inadequate.

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 a single, efficient sentence that front-loads the core purpose. However, given the complexity of the tool, it could benefit from additional structured details without becoming verbose.

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?

For a tool with 5 parameters, complex nested objects, no annotations, and no output schema, the description is incomplete. It doesn't cover parameter meanings, behavioral expectations, or what the tool returns (e.g., encounter ID, initiative order), leaving significant gaps for agent understanding.

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 but fails to do so. It mentions 'participants, terrain, and initiative tracking' which hints at some parameters, but doesn't explain what 'seed' does, the structure of participants/terrain objects, or the purpose of 'lighting' and 'surprise' parameters. This leaves most parameters undocumented.

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 action ('create') and resource ('D&D 5e combat encounter'), specifying it includes participants, terrain, and initiative tracking. This distinguishes it from general encounter management tools like 'manage_encounter' or 'end_encounter', though it doesn't explicitly differentiate from all siblings.

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. It doesn't mention prerequisites (e.g., needing characters created first with 'create_character'), when to use 'manage_encounter' for modifications instead, or how it relates to 'get_encounter' for retrieval.

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