update_character
Modify existing D&D 5e character attributes including stats, level, equipment, spells, and abilities to reflect gameplay changes and progression.
Instructions
Update an existing D&D 5e character with new stats, HP, level, equipment, etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| characterId | No | ||
| characterName | No | ||
| name | No | ||
| race | No | ||
| class | No | ||
| level | No | ||
| background | No | ||
| characterType | No | ||
| stats | No | ||
| hp | No | ||
| healing | No | ||
| maxHp | No | ||
| ac | No | ||
| speed | No | ||
| resistances | No | ||
| immunities | No | ||
| vulnerabilities | No | ||
| conditionImmunities | No | ||
| spellcastingAbility | No | ||
| knownSpells | No | ||
| preparedSpells | No | ||
| cantrips | No | ||
| skillProficiencies | No | ||
| saveProficiencies | No | ||
| equipment | No | ||
| customClass | No | ||
| customRace | No | ||
| resource | No | ||
| batch | No |
Implementation Reference
- src/registry.ts:490-513 (registration)Registration of the 'update_character' tool, specifying name, description, input schema (referencing updateCharacterSchema), and inline handler function that validates arguments and delegates to updateCharacter function.update_character: { name: 'update_character', description: 'Update an existing D&D 5e character with new stats, HP, level, equipment, etc.', inputSchema: toJsonSchema(updateCharacterSchema), handler: async (args) => { try { const validated = updateCharacterSchema.parse(args); const result = updateCharacter(validated); if (!result.success) { return error(result.error || 'Failed to update character'); } 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:494-511 (handler)The tool handler implementation: parses input using updateCharacterSchema, calls the core updateCharacter function with validated args, handles success/error responses with markdown formatting using success/error helpers.handler: async (args) => { try { const validated = updateCharacterSchema.parse(args); const result = updateCharacter(validated); if (!result.success) { return error(result.error || 'Failed to update character'); } 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); }