Skip to main content
Glama

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
NameRequiredDescriptionDefault
encounterIdYes
actorIdNo
actorNameNo
actionTypeYes
actionCostNoaction
targetIdNo
targetNameNo
weaponTypeNo
damageExpressionNo
damageTypeNo
moveToNo
advantageNo
disadvantageNo
manualAttackRollNo
manualDamageRollNo
shoveDirectionNo
spellSlotNo
spellNameNo
pactMagicNo
aoeShapeNo
aoeRadiusNo
aoeCenterNo
saveAbilityNo
saveDCNo
spellDamageNo
spellDamageTypeNo
halfOnSaveNo
spellRangeNoSpell range in feet. 0 = self/touch, 5 = touch, etc.

Implementation Reference

  • 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); } }, },
  • 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); } },
  • Reference to executeActionSchema (Zod schema converted to JSON schema for MCP) used for input validation. Schema imported from './modules/combat.js'.
    inputSchema: toJsonSchema(executeActionSchema),

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