Skip to main content
Glama
study-flamingo

D&D MCP Server

bulk_update_characters

Update health points, temporary HP, and ability scores for multiple D&D characters simultaneously by specified amounts.

Instructions

Update properties for multiple characters at once by a given amount.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
names_or_idsYesList of character names or IDs to update.
hp_changeNoAmount to change current HP by (positive or negative).
temp_hp_changeNoAmount to change temporary HP by (positive or negative).
strength_changeNoAmount to change strength by.
dexterity_changeNoAmount to change dexterity by.
constitution_changeNoAmount to change constitution by.
intelligence_changeNoAmount to change intelligence by.
wisdom_changeNoAmount to change wisdom by.
charisma_changeNoAmount to change charisma by.

Implementation Reference

  • The handler function for the 'bulk_update_characters' tool. It applies bulk changes to HP, temporary HP, and ability scores across multiple specified characters, clamping values appropriately and updating the storage.
    @mcp.tool
    def bulk_update_characters(
        names_or_ids: Annotated[list[str], Field(description="List of character names or IDs to update.")],
        hp_change: Annotated[int | None, Field(description="Amount to change current HP by (positive or negative).")] = None,
        temp_hp_change: Annotated[int | None, Field(description="Amount to change temporary HP by (positive or negative).")] = None,
        strength_change: Annotated[int | None, Field(description="Amount to change strength by.")] = None,
        dexterity_change: Annotated[int | None, Field(description="Amount to change dexterity by.")] = None,
        constitution_change: Annotated[int | None, Field(description="Amount to change constitution by.")] = None,
        intelligence_change: Annotated[int | None, Field(description="Amount to change intelligence by.")] = None,
        wisdom_change: Annotated[int | None, Field(description="Amount to change wisdom by.")] = None,
        charisma_change: Annotated[int | None, Field(description="Amount to change charisma by.")] = None,
    ) -> str:
        """Update properties for multiple characters at once by a given amount."""
        updates_log = []
        not_found_log = []
    
        changes = {
            "hp_change": hp_change,
            "temp_hp_change": temp_hp_change,
            "strength_change": strength_change,
            "dexterity_change": dexterity_change,
            "constitution_change": constitution_change,
            "intelligence_change": intelligence_change,
            "wisdom_change": wisdom_change,
            "charisma_change": charisma_change,
        }
    
        # Filter out None changes
        active_changes = {k: v for k, v in changes.items() if v is not None}
        if not active_changes:
            return "No changes specified."
    
        for name_or_id in names_or_ids:
            character = storage.get_character(name_or_id)
            if not character:
                not_found_log.append(name_or_id)
                continue
    
            char_updates = {}
            char_log = [f"{character.name}:"]
    
            if hp_change is not None:
                new_hp = character.hit_points_current + hp_change
                # Clamp HP between 0 and max HP
                new_hp = max(0, min(new_hp, character.hit_points_max))
                char_updates['hit_points_current'] = new_hp
                char_log.append(f"HP -> {new_hp}")
    
            if temp_hp_change is not None:
                new_temp_hp = character.temporary_hit_points + temp_hp_change
                # Temp HP cannot be negative
                new_temp_hp = max(0, new_temp_hp)
                char_updates['temporary_hit_points'] = new_temp_hp
                char_log.append(f"Temp HP -> {new_temp_hp}")
    
            abilities_updated = False
            ability_changes = {
                "strength": strength_change, "dexterity": dexterity_change,
                "constitution": constitution_change, "intelligence": intelligence_change,
                "wisdom": wisdom_change, "charisma": charisma_change
            }
            for ability, change in ability_changes.items():
                if change is not None:
                    new_score = character.abilities[ability].score + change
                    new_score = max(1, min(new_score, 30)) # Clamp score
                    character.abilities[ability].score = new_score
                    abilities_updated = True
                    char_log.append(f"{ability.capitalize()} -> {new_score}")
    
            if abilities_updated:
                char_updates['abilities'] = character.abilities
    
            if char_updates:
                storage.update_character(str(character.id), **char_updates)
                updates_log.append(" ".join(char_log))
    
        response_parts = []
        if updates_log:
            response_parts.append("Characters updated:\n" + "\n".join(updates_log))
        if not_found_log:
            response_parts.append(f"Characters not found: {', '.join(not_found_log)}")
    
        return "\n".join(response_parts) if response_parts else "No characters found to update."
  • The @mcp.tool decorator registers the bulk_update_characters function as an MCP tool.
    @mcp.tool
  • Pydantic schema definitions for the tool parameters using Annotated and Field.
        names_or_ids: Annotated[list[str], Field(description="List of character names or IDs to update.")],
        hp_change: Annotated[int | None, Field(description="Amount to change current HP by (positive or negative).")] = None,
        temp_hp_change: Annotated[int | None, Field(description="Amount to change temporary HP by (positive or negative).")] = None,
        strength_change: Annotated[int | None, Field(description="Amount to change strength by.")] = None,
        dexterity_change: Annotated[int | None, Field(description="Amount to change dexterity by.")] = None,
        constitution_change: Annotated[int | None, Field(description="Amount to change constitution by.")] = None,
        intelligence_change: Annotated[int | None, Field(description="Amount to change intelligence by.")] = None,
        wisdom_change: Annotated[int | None, Field(description="Amount to change wisdom by.")] = None,
        charisma_change: Annotated[int | None, Field(description="Amount to change charisma by.")] = None,
    ) -> str:
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral context. It states this is an update operation (implying mutation) but doesn't disclose whether changes are permanent/reversible, what permissions are required, how errors are handled for invalid characters, or what the response format looks like. For a batch mutation tool with 9 parameters, this is insufficient.

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 a single, efficient sentence that front-loads the core functionality ('Update properties for multiple characters at once') and adds necessary qualification ('by a given amount'). Every word earns its place with zero redundancy or wasted space.

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

Completeness2/5

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

For a batch mutation tool with 9 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what happens when the tool executes (e.g., partial success handling), what values are returned, or how it differs from the single-character 'update_character' sibling. The agent would have significant gaps in understanding this tool's behavior.

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 9 parameters thoroughly. The description adds only the concept of 'by a given amount' which is already covered in parameter descriptions like 'Amount to change current HP by'. No additional parameter semantics are provided beyond what's in the schema.

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

Purpose4/5

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

The description clearly states the verb ('update'), resource ('multiple characters'), and scope ('properties... at once by a given amount'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from the sibling 'update_character' tool, which appears to be a single-character version, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'update_character' for single-character updates or other property-modifying tools. It mentions 'multiple characters at once' which implies a batch operation, but offers no explicit when/when-not criteria or prerequisites.

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/study-flamingo/gamemaster-mcp'

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