Skip to main content
Glama

get_encounter

Retrieve combat encounter states with customizable detail levels for game management in ChatRPG's Dungeon Master system.

Instructions

Get the current state of a combat encounter. Supports verbosity levels: minimal (LLM context), summary (quick overview), standard (default DM view), detailed (full state dump).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encounterIdYesThe ID of the encounter to retrieve
verbosityNoLevel of detail to returnstandard

Implementation Reference

  • Registration of the get_encounter tool in the MCP tool registry. Defines name, description, input schema (converted from Zod getEncounterSchema), and handler function that validates input using getEncounterSchema.parse and executes getEncounter(validated) returning formatted success result.
    get_encounter: {
      name: 'get_encounter',
      description: 'Get the current state of a combat encounter. Supports verbosity levels: minimal (LLM context), summary (quick overview), standard (default DM view), detailed (full state dump).',
      inputSchema: toJsonSchema(getEncounterSchema),
      handler: async (args) => {
        try {
          const validated = getEncounterSchema.parse(args);
          const result = getEncounter(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 get_encounter, which handles input validation using getEncounterSchema and delegates to the core getEncounter function, formatting the response with success() or error().
    handler: async (args) => {
      try {
        const validated = getEncounterSchema.parse(args);
        const result = getEncounter(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 input schema for get_encounter tool, converted from Zod schema getEncounterSchema imported from modules/combat.js
    inputSchema: toJsonSchema(getEncounterSchema),
  • Import statement bringing in getEncounter function (core handler logic) and getEncounterSchema from combat.js 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 adds value by describing verbosity levels and their purposes, which goes beyond the input schema. However, it does not cover other behavioral aspects like error handling, permissions, or response format, leaving gaps for a read operation.

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 front-loaded with the core purpose and efficiently lists verbosity levels in a single, well-structured sentence. Every part earns its place without redundancy, making it highly concise and clear.

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

Completeness3/5

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

Given the tool's complexity (read operation with verbosity options) and no output schema, the description is somewhat complete but lacks details on return values or error cases. It compensates partially with verbosity context but does not fully address what the tool outputs, leaving room for improvement.

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

Parameters3/5

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

Schema description coverage is 100%, so the input schema already documents both parameters well. The description adds minimal value by mentioning verbosity levels but does not provide additional semantics beyond what the schema specifies (e.g., details on what each verbosity level entails). Baseline 3 is appropriate as the schema does the heavy lifting.

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 specific action ('Get the current state') and resource ('a combat encounter'), distinguishing it from siblings like 'create_encounter' or 'manage_encounter'. It precisely defines the tool's function without being tautological or vague.

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

Usage Guidelines3/5

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

The description implies usage by mentioning verbosity levels for different contexts (e.g., 'minimal' for LLM context), but does not explicitly state when to use this tool versus alternatives like 'get_character' or 'get_session_context'. It provides some contextual hints but lacks direct guidance on tool selection.

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