Skip to main content
Glama

apply_effect

Apply SRD conditions or custom effects to characters in D&D 5e campaigns. Use standard templates for conditions like blinded or poisoned, or create custom effects with specific modifiers for gameplay management.

Instructions

Apply an ActiveEffect to a character (SRD condition or custom effect).

For SRD conditions (blinded, charmed, deafened, exhaustion, frightened, grappled, incapacitated, invisible, paralyzed, petrified, poisoned, prone, restrained, stunned), uses the standard condition template.

For custom effects, creates a new ActiveEffect with the provided modifiers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
character_name_or_idYesCharacter name, ID, or player name.
effect_nameYesEffect name (SRD condition like 'blinded', 'poisoned', or custom name)
sourceNoSource of the effect (e.g., 'Poison trap', 'Hold Person spell')
durationNoDuration in rounds. None for permanent effects.
custom_modifiersNoJSON list of custom modifiers, e.g. '[{"stat":"attack_roll","operation":"add","value":2}]'

Implementation Reference

  • The implementation of `EffectsEngine.apply_effect` which adds an effect to a character's list of active effects, handling stackability and unique ID generation.
    def apply_effect(character: "Character", effect: ActiveEffect) -> ActiveEffect:
        """Apply an active effect to a character.
    
        Creates a deep copy of the effect with a unique ID and adds it to the
        character's active_effects list. Non-stackable effects with the same name
        will not be duplicated; the existing one is kept.
    
        Args:
            character: The character to apply the effect to.
            effect: The effect template to apply.
    
        Returns:
            The applied ActiveEffect instance (with unique ID), or the existing
            one if a non-stackable duplicate was found.
        """
        # Check for non-stackable duplicates
        if not effect.stackable:
            for existing in character.active_effects:
                if existing.name == effect.name:
                    return existing
    
        # Deep copy to avoid shared state between characters
        applied = deepcopy(effect)
        applied.id = random(length=8)
        character.active_effects.append(applied)
        return applied
Behavior2/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 mentions that SRD conditions use 'standard condition templates' and custom effects create 'new ActiveEffect with provided modifiers', but it doesn't clarify critical behaviors like whether this is a mutating operation, what permissions are required, how conflicts with existing effects are handled, or what the response looks like. For a tool that modifies character state, this leaves significant gaps in understanding its behavior.

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 efficiently structured in three sentences: a clear purpose statement, SRD condition details with examples, and custom effect explanation. Every sentence earns its place by providing essential information without redundancy. The SRD condition list is appropriately formatted for quick scanning.

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 tool's complexity (applying effects to characters), lack of annotations, and no output schema, the description provides adequate basic information but has significant gaps. It explains what the tool does but doesn't cover behavioral aspects like mutation consequences, error conditions, or response format. For a state-modifying tool with 5 parameters, more contextual information would be helpful despite the good schema coverage.

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?

Schema description coverage is 100%, so the schema already documents all 5 parameters thoroughly. The description adds minimal value beyond the schema by mentioning SRD condition examples and the concept of custom modifiers, but doesn't provide additional syntax, format details, or usage examples that aren't already in the parameter descriptions. This meets the baseline for high schema 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 specific action ('Apply an ActiveEffect') and target ('to a character'), distinguishing it from sibling tools like 'remove_effect' or 'update_character'. It explicitly defines two distinct use cases: applying SRD conditions and creating custom effects, providing precise verb+resource+scope differentiation.

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

Usage Guidelines3/5

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

The description implies when to use this tool by listing SRD conditions and mentioning custom effects, but it doesn't provide explicit guidance on when to choose this over alternatives like 'update_character' for stat changes or 'remove_effect' for reversing effects. No prerequisites or exclusions are stated, leaving usage context somewhat implied rather than explicitly defined.

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/Polloinfilzato/dm20-protocol'

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