Skip to main content
Glama

manage_encounter

Create and manage RPG encounters by linking simulation states with persistent character records, supporting operations like adding participants, tracking combat, and syncing outcomes.

Instructions

Composite tool for encounter management with state synchronization. Operations: create (with characterId linking), get (with verbosity), end (with participantUpdates), commit (sync to persistent characters), list (active encounters). Supports bridging encounter simulation state with persistent character records.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationNo
seedNo
participantsNo
terrainNo
lightingNobright
surpriseNo
encounterIdNo
verbosityNostandard
outcomeNo
generateSummaryNo
preserveLogNo
notesNo
characterIdsNoSpecific characters to commit (defaults to all)
dryRunNoPreview changes without applying
includeEndedNo
participantNo
manualInitiativeNoManual initiative roll (otherwise rolls automatically)

Implementation Reference

  • Registration of the 'manage_encounter' tool. Defines name, description, input schema from manageEncounterSchema, and a handler that parses arguments with the schema and executes manageEncounter function.
    manage_encounter: { name: 'manage_encounter', description: 'Composite tool for encounter management with state synchronization. Operations: create (with characterId linking), get (with verbosity), end (with participantUpdates), commit (sync to persistent characters), list (active encounters). Supports bridging encounter simulation state with persistent character records.', inputSchema: toJsonSchema(manageEncounterSchema), handler: async (args) => { try { const validated = manageEncounterSchema.parse(args); const result = manageEncounter(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 handler function that implements the tool logic: input validation using manageEncounterSchema, execution of core manageEncounter logic, and response formatting with success or error.
    handler: async (args) => { try { const validated = manageEncounterSchema.parse(args); const result = manageEncounter(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 manageEncounterSchema for input validation (schema definition imported from './modules/combat.js').
    const validated = manageEncounterSchema.parse(args);
  • Import statement for manageEncounter function and manageEncounterSchema 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';

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