manage_condition
Track and modify D&D 5e conditions on characters during gameplay, including adding, removing, querying status, and managing durations for streamlined combat management.
Instructions
Manage D&D 5e conditions on targets (add, remove, query, tick duration)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| targetId | No | ||
| encounterId | No | ||
| operation | No | ||
| condition | No | ||
| source | No | ||
| description | No | ||
| duration | No | ||
| saveDC | No | ||
| saveAbility | No | ||
| exhaustionLevels | No | ||
| roundNumber | No | ||
| batch | No |
Implementation Reference
- src/registry.ts:735-753 (registration)Registration of the manage_condition tool, including name, description, input schema conversion from Zod schema, and a validating handler that delegates to the manageCondition function.manage_condition: { name: 'manage_condition', description: 'Manage D&D 5e conditions on targets (add, remove, query, tick duration)', inputSchema: toJsonSchema(manageConditionSchema), handler: async (args) => { try { const validated = manageConditionSchema.parse(args); const result = manageCondition(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:739-751 (handler)The tool handler function which performs Zod validation on input arguments and executes the core manageCondition logic, returning success or formatted error.handler: async (args) => { try { const validated = manageConditionSchema.parse(args); const result = manageCondition(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:225-225 (schema)Import statement bringing in the manageConditionSchema (Zod schema for input validation) and manageCondition (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';
- src/registry.ts:741-742 (helper)Delegation to the core manageCondition helper function after schema validation. The actual condition management logic resides here.const validated = manageConditionSchema.parse(args); const result = manageCondition(validated);