level_up
Increase character levels in ChatRPG by adjusting HP, proficiency bonus, spell slots, and tracking new features. Supports multi-level jumps and batch processing for party advancement.
Instructions
Level up a character. Increases level, HP (roll/average/max/manual), proficiency bonus, and spell slots. Supports custom class hit dice and resource scaling. Multi-level jumps allowed (e.g., 1→5). Batch support for party level-ups. Optionally track new features and spells learned.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| characterId | No | ||
| characterName | No | ||
| targetLevel | No | ||
| hpMethod | No | average | |
| manualHp | No | ||
| manualRoll | No | ||
| newFeatures | No | ||
| newSpells | No | ||
| batch | No |
Implementation Reference
- src/registry.ts:594-612 (handler)Handler function that executes the level_up tool: validates input using levelUpSchema, executes levelUp(validated), processes the result (expects {success, markdown, error}), returns formatted success/error response.handler: async (args) => { try { const validated = levelUpSchema.parse(args); const result = levelUp(validated); if (!result.success) { return error(result.error || 'Failed to level up'); } 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:590-613 (registration)Registration of the 'level_up' tool in the toolRegistry object, defining name, description, input schema, and handler.level_up: { name: 'level_up', description: 'Level up a character. Increases level, HP (roll/average/max/manual), proficiency bonus, and spell slots. Supports custom class hit dice and resource scaling. Multi-level jumps allowed (e.g., 1→5). Batch support for party level-ups. Optionally track new features and spells learned.', inputSchema: toJsonSchema(levelUpSchema), handler: async (args) => { try { const validated = levelUpSchema.parse(args); const result = levelUp(validated); if (!result.success) { return error(result.error || 'Failed to level up'); } 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:222-222 (schema)Reference to levelUpSchema Zod schema imported from './modules/characters.js' and used for input validation in the level_up handler.levelUpSchema