Skip to main content
Glama

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
NameRequiredDescriptionDefault
characterIdNo
characterNameNo
operationNo
slotLevelNo
countNo
pactMagicNo
slotsNo
batchNo

Implementation Reference

  • 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); } }, },
  • 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); } },
  • Import of manageSpellSlots handler function and manageSpellSlotsSchema Zod schema from './modules/characters.js'.
    manageSpellSlots, manageSpellSlotsSchema,

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