Skip to main content
Glama

use_scroll

Cast spells from D&D 5e scrolls with automatic success for known spells or Arcana checks for higher-level magic, consuming the scroll on use.

Instructions

Use a spell scroll in D&D 5e. If spell is on your class list and same/lower level: auto-success. If spell is higher level: Arcana check DC 10 + spell level. On failure: scroll is consumed with no effect. On success: spell is cast from scroll, scroll consumed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
characterIdYes
scrollNameYes
spellLevelYes
casterLevelYes
targetIdNo
targetIdsNo
targetPositionNo
arcanaBonusNo
rollModeNo
manualRollNo
manualRollsNo
isAttackSpellNo
spellSchoolNo

Implementation Reference

  • The main handler function that implements the use_scroll tool logic. Handles Arcana checks when using spell scrolls according to D&D 5e rules (auto-success if spell level <= caster level, otherwise DC 10 + spell level). Generates ASCII art output with scroll stats, targeting info, and result.
    export function useScroll(input: UseScrollInput): string {
      const content: string[] = [];
      const {
        characterId,
        scrollName,
        spellLevel,
        casterLevel,
        targetId,
        targetIds,
        targetPosition,
        arcanaBonus = 0,
        rollMode = 'normal',
        manualRoll,
        manualRolls,
        isAttackSpell,
        spellSchool,
      } = input;
    
      // Get scroll stats
      const stats = SCROLL_STATS[spellLevel];
    
      // Extract spell name from scroll name
      const spellName = scrollName.replace(/^Scroll of /i, '');
    
      content.push(centerText('SPELL SCROLL', DISPLAY_WIDTH));
      content.push('');
      content.push(`Caster: ${characterId}`);
      content.push(`Scroll: ${scrollName}`);
      content.push(`Spell Level: ${spellLevel}`);
    
      if (spellSchool) {
        content.push(`School: ${spellSchool}`);
      }
    
      content.push('');
      content.push(BOX.LIGHT.H.repeat(DISPLAY_WIDTH));
      content.push('');
    
      // Check if Arcana roll is needed
      const needsArcanaCheck = spellLevel > casterLevel;
      let success = true;
    
      if (needsArcanaCheck) {
        const arcanaDC = 10 + spellLevel;
        content.push(`Spell level (${spellLevel}) exceeds caster level (${casterLevel})`);
        content.push(`Arcana Check Required: DC ${arcanaDC}`);
        content.push('');
    
        // Roll Arcana check
        const { finalRoll, rollDisplay } = resolveArcanaRoll(rollMode, manualRoll, manualRolls);
        const total = finalRoll + arcanaBonus;
        success = total >= arcanaDC;
    
        content.push(`Roll: ${rollDisplay}`);
        if (arcanaBonus !== 0) {
          content.push(`Modifier: ${formatModifier(arcanaBonus)}`);
          content.push(`Total: ${finalRoll} ${formatModifier(arcanaBonus)} = ${total}`);
        } else {
          content.push(`Total: ${total}`);
        }
        content.push('');
        content.push(BOX.LIGHT.H.repeat(DISPLAY_WIDTH));
        content.push('');
      }
    
      // Show targeting info if provided
      if (targetId || targetIds || targetPosition) {
        content.push('Targeting:');
        if (targetId) {
          content.push(`  Target: ${targetId}`);
        }
        if (targetIds && targetIds.length > 0) {
          content.push(`  Targets: ${targetIds.join(', ')}`);
        }
        if (targetPosition) {
          content.push(`  Position: (${targetPosition.x}, ${targetPosition.y}${targetPosition.z !== undefined ? `, ${targetPosition.z}` : ''})`);
        }
        content.push('');
      }
    
      // Show spell stats
      content.push(`Spell Save DC: DC ${stats.saveDC}`);
      if (isAttackSpell) {
        content.push(`Spell Attack: +${stats.attackBonus}`);
      }
      content.push('');
      content.push(BOX.LIGHT.H.repeat(DISPLAY_WIDTH));
      content.push('');
    
      // Result
      if (success) {
        content.push(centerText('SUCCESS', DISPLAY_WIDTH));
        content.push('');
        content.push(`${spellName} has been cast!`);
        content.push('The scroll crumbles to dust (consumed).');
      } else {
        content.push(centerText('FAILED', DISPLAY_WIDTH));
        content.push('');
        content.push('The magic fizzles and the scroll is lost!');
        content.push('The scroll crumbles to dust (consumed).');
      }
    
      const title = success ? 'SCROLL CAST' : 'SCROLL FAILED';
      return createBox(title, content);
    }
  • Zod input schema for the use_scroll tool, defining required fields like characterId, scrollName, spellLevel, casterLevel, and optional targeting, roll modes, and spell properties.
    export const useScrollSchema = z.object({
      characterId: z.string(),
      scrollName: z.string(),
      spellLevel: z.number().min(0).max(9),
      casterLevel: z.number().min(1).max(20),
    
      // Targeting (all optional)
      targetId: z.string().optional(),
      targetIds: z.array(z.string()).optional(),
      targetPosition: PositionSchema.optional(),
    
      // Arcana check for higher-level scrolls
      arcanaBonus: z.number().optional(),
      rollMode: RollModeSchema.optional(),
      manualRoll: z.number().min(1).max(20).optional(),
      manualRolls: z.array(z.number().min(1).max(20)).length(2).optional(),
    
      // Optional spell properties
      isAttackSpell: z.boolean().optional(),
      spellSchool: z.string().optional(),
    });
  • Tool registration entry in the central registry. Converts Zod schema to JSON schema for MCP, wraps the handler with validation and error handling using createTypedHandler pattern.
    use_scroll: {
      name: 'use_scroll',
      description: 'Use a spell scroll in D&D 5e. If spell is on your class list and same/lower level: auto-success. If spell is higher level: Arcana check DC 10 + spell level. On failure: scroll is consumed with no effect. On success: spell is cast from scroll, scroll consumed.',
      inputSchema: toJsonSchema(useScrollSchema),
      handler: async (args) => {
        try {
          const validated = useScrollSchema.parse(args);
          const result = useScroll(validated);
          return success(result);
        } 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);
        }
      },
    },
Behavior4/5

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

With no annotations provided, the description carries full burden and does an excellent job disclosing behavioral traits: it explains success conditions (auto-success vs Arcana check), failure consequences (scroll consumed with no effect), success outcomes (spell cast, scroll consumed), and specific mechanics (DC calculation).

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

Conciseness5/5

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

The description is perfectly front-loaded with the core purpose, followed by conditional logic in a logical flow. Every sentence earns its place by explaining different aspects of the scroll usage mechanics without any wasted words.

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?

For a complex tool with 13 parameters, no annotations, and no output schema, the description covers the core behavioral mechanics well but leaves many parameter purposes unexplained. It's adequate for understanding what the tool does but insufficient for understanding all required inputs.

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

Parameters3/5

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

With 0% schema description coverage and 13 parameters, the description doesn't explain any specific parameters beyond implied concepts like 'spell level' and 'Arcana check.' It provides some context for what parameters might be needed but doesn't compensate fully for the schema coverage gap.

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 specific action ('use a spell scroll') and resource ('in D&D 5e'), distinguishing it from sibling tools like 'manage_inventory' or 'synthesize_spell' by focusing on scroll activation mechanics rather than inventory management or spell creation.

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 (activating spell scrolls in D&D 5e) and implies usage through success/failure conditions, but doesn't explicitly mention when not to use it or name alternatives like 'execute_action' for other combat actions.

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/mnehmos.chatrpg.game'

If you have feedback or need assistance with the MCP directory API, please join our Discord server