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,
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes operations (view, expend, restore, set) and features like warlock pact magic, batch support, and caster calculations, which helps clarify the tool's behavior. However, it lacks details on permissions, side effects (e.g., if changes are reversible), or response format, leaving gaps for a mutation tool with complex parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the core purpose and listing operations upfront. Each sentence adds value (e.g., warlock support, caster calculations, batch tracking), with minimal waste, though it could be slightly more structured for readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (8 parameters, nested objects, no output schema, no annotations), the description is moderately complete. It covers the tool's purpose, operations, and key features, but lacks details on parameter usage, error handling, or return values, which are needed for a mutation tool with such a rich schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for all 8 parameters. It mentions operations (view, expend, restore, set), warlock pact magic, batch support, and caster calculations, which loosely maps to parameters like 'operation', 'pactMagic', and 'batch', but does not explain 'characterId', 'characterName', 'slotLevel', 'count', or 'slots' object structure. This adds some meaning but is insufficient given the low coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool manages D&D 5e spell slots with specific operations (view, expend, restore, set), distinguishes it from siblings like manage_inventory or manage_condition by focusing on spell slot mechanics, and mentions support for warlock pact magic and batch party tracking, making the purpose specific and differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool—for managing spell slots in D&D 5e, including operations like viewing, expending, restoring, and setting slots, with support for warlock pact magic and batch party tracking. However, it does not explicitly state when not to use it or name alternatives (e.g., manage_inventory for items), leaving some guidance implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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