manage_spell_slots
Track and adjust D&D 5e spell slots for characters. View current slots, expend spells in combat, restore slots on rest, or set custom values. Supports all casting classes including warlock pact magic and batch party management.
Instructions
Manage D&D 5e spell slots. Operations: view (display slots), expend (use slot), restore (regain slots), set (DM override). Supports warlock pact magic (short rest recovery). Full/half/third casters calculated by class and level. Batch support for party spell tracking.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| characterId | No | ||
| characterName | No | ||
| operation | No | ||
| slotLevel | No | ||
| count | No | ||
| pactMagic | No | ||
| slots | No | ||
| batch | No |
Implementation Reference
- src/registry.ts:565-588 (registration)Registration of the 'manage_spell_slots' tool in the tool registry, including description, input schema conversion from Zod schema, and typed handler that performs validation and delegates to the core manageSpellSlots function.manage_spell_slots: { name: 'manage_spell_slots', description: 'Manage D&D 5e spell slots. Operations: view (display slots), expend (use slot), restore (regain slots), set (DM override). Supports warlock pact magic (short rest recovery). Full/half/third casters calculated by class and level. Batch support for party spell tracking.', inputSchema: toJsonSchema(manageSpellSlotsSchema), handler: async (args) => { try { const validated = manageSpellSlotsSchema.parse(args); const result = manageSpellSlots(validated); if (!result.success) { return error(result.error || 'Failed to manage spell slots'); } 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:570-587 (handler)The MCP tool handler for manage_spell_slots. Validates input using manageSpellSlotsSchema, calls the core manageSpellSlots function with validated args, handles success/error responses with markdown formatting.try { const validated = manageSpellSlotsSchema.parse(args); const result = manageSpellSlots(validated); if (!result.success) { return error(result.error || 'Failed to manage spell slots'); } 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:217-218 (schema)Import of manageSpellSlots handler function and manageSpellSlotsSchema Zod schema from './modules/characters.js'.manageSpellSlots, manageSpellSlotsSchema,