roll_check
Roll D&D 5e dice for skill checks, saving throws, attack rolls, and initiative to resolve game actions and determine outcomes.
Instructions
Roll D&D 5e checks including skill checks, ability checks, saving throws, attack rolls, and initiative
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| characterId | No | ||
| characterName | No | ||
| checkType | Yes | ||
| skill | No | ||
| ability | No | ||
| dc | No | ||
| advantage | No | ||
| disadvantage | No | ||
| bonus | No | ||
| contestedBy | No | ||
| contestedCheck | No |
Implementation Reference
- src/registry.ts:779-797 (handler)The registered handler for the 'roll_check' tool. It validates the input arguments using rollCheckSchema, calls the rollCheck function with validated args, and returns a formatted success response with markdown or an error.handler: async (args) => { try { const validated = rollCheckSchema.parse(args); const result = rollCheck(validated); if (!result.success) { return error(result.error || 'Failed to roll check'); } return success(result.markdown); } 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:775-798 (registration)Registration of the 'roll_check' tool in the toolRegistry object, defining name, description, input schema (converted from Zod schema), and handler.roll_check: { name: 'roll_check', description: 'Roll D&D 5e checks including skill checks, ability checks, saving throws, attack rolls, and initiative', inputSchema: toJsonSchema(rollCheckSchema), handler: async (args) => { try { const validated = rollCheckSchema.parse(args); const result = rollCheck(validated); if (!result.success) { return error(result.error || 'Failed to roll check'); } return success(result.markdown); } 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:219-220 (schema)Import declaration for rollCheck function and rollCheckSchema Zod schema used by the roll_check tool.rollCheck, rollCheckSchema,
- src/registry.ts:781-782 (helper)Core execution: parsing with schema and calling rollCheck helper function with validated arguments.const validated = rollCheckSchema.parse(args); const result = rollCheck(validated);