execute_action
Execute combat actions like attack or dash in ChatRPG encounters to resolve turn-based battles and manage character movements.
Instructions
Execute a combat action in an encounter (attack, dash, disengage, dodge, etc.). Phase 1 supports attack and dash actions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| encounterId | Yes | ||
| actorId | No | ||
| actorName | No | ||
| actionType | Yes | ||
| actionCost | No | action | |
| targetId | No | ||
| targetName | No | ||
| weaponType | No | ||
| damageExpression | No | ||
| damageType | No | ||
| moveTo | No | ||
| advantage | No | ||
| disadvantage | No | ||
| manualAttackRoll | No | ||
| manualDamageRoll | No | ||
| shoveDirection | No | ||
| spellSlot | No | ||
| spellName | No | ||
| pactMagic | No | ||
| aoeShape | No | ||
| aoeRadius | No | ||
| aoeCenter | No | ||
| saveAbility | No | ||
| saveDC | No | ||
| spellDamage | No | ||
| spellDamageType | No | ||
| halfOnSave | No | ||
| spellRange | No | Spell range in feet. 0 = self/touch, 5 = touch, etc. |
Implementation Reference
- src/registry.ts:800-818 (registration)Registration of the 'execute_action' tool in the central registry. Includes name, description, input schema (converted from Zod executeActionSchema), and handler function that validates args and delegates to executeAction function.execute_action: { name: 'execute_action', description: 'Execute a combat action in an encounter (attack, dash, disengage, dodge, etc.). Phase 1 supports attack and dash actions.', inputSchema: toJsonSchema(executeActionSchema), handler: async (args) => { try { const validated = executeActionSchema.parse(args); const result = executeAction(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:804-817 (handler)The tool handler logic: parses input with executeActionSchema, calls executeAction(validated args), and returns formatted success or error result using shared helpers.handler: async (args) => { try { const validated = executeActionSchema.parse(args); const result = executeAction(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:803-803 (schema)Reference to executeActionSchema (Zod schema converted to JSON schema for MCP) used for input validation. Schema imported from './modules/combat.js'.inputSchema: toJsonSchema(executeActionSchema),