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
| Name | Required | Description | Default |
|---|---|---|---|
| encounterId | Yes | The ID of the encounter to retrieve | |
| verbosity | No | Level of detail to return | standard |
Implementation Reference
- src/registry.ts:900-918 (registration)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); } }, },
- src/registry.ts:904-917 (handler)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); } },
- src/registry.ts:903-903 (schema)Reference to input schema for get_encounter tool, converted from Zod schema getEncounterSchema imported from modules/combat.jsinputSchema: toJsonSchema(getEncounterSchema),
- src/registry.ts:225-225 (helper)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';