Skip to main content
Glama

end_encounter

Conclude combat encounters in ChatRPG by recording outcomes like victory or defeat, generating statistics, and preserving logs for review.

Instructions

End a combat encounter with outcome tracking and optional summary generation. Supports victory, defeat, fled, negotiated outcomes. Can preserve encounter log for review.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encounterIdYesThe encounter to end
outcomeYesHow combat ended
generateSummaryNoInclude combat statistics
preserveLogNoKeep encounter accessible after end
notesNoDM notes about the encounter

Implementation Reference

  • Registration of the 'end_encounter' tool in the central tool registry, including name, description, input schema conversion from Zod endEncounterSchema, and handler wrapper.
    end_encounter: {
      name: 'end_encounter',
      description: 'End a combat encounter with outcome tracking and optional summary generation. Supports victory, defeat, fled, negotiated outcomes. Can preserve encounter log for review.',
      inputSchema: toJsonSchema(endEncounterSchema),
      handler: async (args) => {
        try {
          const validated = endEncounterSchema.parse(args);
          const result = endEncounter(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 MCP tool handler for end_encounter. Validates input arguments using endEncounterSchema, executes the core endEncounter function with validated args, and formats success/error responses.
    handler: async (args) => {
      try {
        const validated = endEncounterSchema.parse(args);
        const result = endEncounter(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);
      }
  • Import statement bringing in endEncounterSchema (Zod schema for input validation) and endEncounter (core handler function) 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?

No annotations are provided, so the description carries the full burden. It discloses key behavioral traits: the tool ends encounters, tracks outcomes (listing types like victory, defeat), and can preserve logs. However, it does not cover critical aspects such as permission requirements, whether the action is reversible, rate limits, or error conditions, leaving gaps for a mutation tool.

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 front-loaded with the core purpose in the first clause and efficiently lists key features in two sentences. Every sentence adds value (e.g., outcome types, log preservation), though it could be slightly more structured by explicitly linking parameters to features.

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 no annotations and no output schema, the description is moderately complete for a mutation tool with 5 parameters. It covers the main action and some behavioral context but lacks details on return values, error handling, or full integration with sibling tools. It meets minimum viability but has clear gaps in completeness.

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 schema already documents all parameters thoroughly. The description adds marginal value by mentioning 'optional summary generation' (hinting at 'generateSummary') and 'preserve encounter log' (hinting at 'preserveLog'), but does not provide additional semantics beyond what the schema specifies. 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 verb ('End') and resource ('a combat encounter') with specific functionality ('outcome tracking and optional summary generation'). It distinguishes from siblings like 'manage_encounter' or 'get_encounter' by focusing on termination rather than ongoing management or retrieval.

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 when an encounter is ready to conclude, but does not explicitly state when to use this tool versus alternatives (e.g., 'manage_encounter' for ongoing adjustments) or provide exclusions. It mentions 'optional summary generation' which hints at context, but lacks explicit guidance on prerequisites or comparisons to sibling tools.

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