Skip to main content
Glama
study-flamingo

D&D MCP Server

update_character

Modify character details in D&D campaigns by updating attributes like name, stats, hit points, background, and notes to reflect gameplay changes.

Instructions

Update a character's properties.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
name_or_idYesThe name or ID of the character to update.
nameNoNew character name. If you change this, you must use the character's ID to identify them.
player_nameNoThe name of the player in control of this character
descriptionNoA brief description of the character's appearance and demeanor.
bioNoThe character's backstory, personality, and motivations.
backgroundNoCharacter background
alignmentNoCharacter alignment
hit_points_currentNoCurrent hit points
hit_points_maxNoMaximum hit points
temporary_hit_pointsNoTemporary hit points
armor_classNoArmor class
inspirationNoInspiration status
notesNoAdditional notes about the character
strengthNoStrength score
dexterityNoDexterity score
constitutionNoConstitution score
intelligenceNoIntelligence score
wisdomNoWisdom score
charismaNoCharisma score

Implementation Reference

  • MCP tool handler for 'update_character', including registration via @mcp.tool decorator and input schema via Annotated parameters with Field descriptions. Handles fetching character, preparing updates, calling storage, and returning confirmation.
    def update_character(
        name_or_id: Annotated[str, Field(description="The name or ID of the character to update.")],
        name: Annotated[str | None, Field(description="New character name. If you change this, you must use the character's ID to identify them.")] = None,
        player_name: Annotated[str | None, Field(description="The name of the player in control of this character")] = None,
        description: Annotated[str | None, Field(description="A brief description of the character's appearance and demeanor.")] = None,
        bio: Annotated[str | None, Field(description="The character's backstory, personality, and motivations.")] = None,
        background: Annotated[str | None, Field(description="Character background")] = None,
        alignment: Annotated[str | None, Field(description="Character alignment")] = None,
        hit_points_current: Annotated[int | None, Field(description="Current hit points", ge=0)] = None,
        hit_points_max: Annotated[int | None, Field(description="Maximum hit points", ge=1)] = None,
        temporary_hit_points: Annotated[int | None, Field(description="Temporary hit points", ge=0)] = None,
        armor_class: Annotated[int | None, Field(description="Armor class")] = None,
        inspiration: Annotated[bool | None, Field(description="Inspiration status")] = None,
        notes: Annotated[str | None, Field(description="Additional notes about the character")] = None,
        strength: Annotated[int | None, Field(description="Strength score", ge=1, le=30)] = None,
        dexterity: Annotated[int | None, Field(description="Dexterity score", ge=1, le=30)] = None,
        constitution: Annotated[int | None, Field(description="Constitution score", ge=1, le=30)] = None,
        intelligence: Annotated[int | None, Field(description="Intelligence score", ge=1, le=30)] = None,
        wisdom: Annotated[int | None, Field(description="Wisdom score", ge=1, le=30)] = None,
        charisma: Annotated[int | None, Field(description="Charisma score", ge=1, le=30)] = None,
    ) -> str:
        """Update a character's properties."""
        character = storage.get_character(name_or_id)
        if not character:
            return f"❌ Character '{name_or_id}' not found."
    
        updates = {k: v for k, v in locals().items() if v is not None and k not in ["name_or_id", "character"]}
        updated_fields = [f"{key.replace('_', ' ')}: {value}" for key, value in updates.items()]
    
        if not updates:
            return f"No updates provided for {character.name}."
    
        storage.update_character(str(character.id), **updates)
    
        return f"Updated {character.name}'s properties: {'; '.join(updated_fields)}."
  • Storage class method that performs the actual persistence of character updates to the campaign data file, handling attribute updates, name changes, and saving.
    def update_character(self, name_or_id: str, **kwargs) -> None:
        """Update a character's data."""
        if not self._current_campaign:
            raise ValueError("No current campaign")
    
        logger.info(f"📝 Attempting to update character '{name_or_id}' with data: {kwargs}")
        character = self._find_character(name_or_id)
        if not character:
            e = ValueError(f"❌ Character '{name_or_id}' not found!")
            logger.error(e)
            raise e
    
        original_name = character.name
        new_name = kwargs.get("name")
    
        for key, value in kwargs.items():
            if hasattr(character, key):
                logger.debug(f"📝 Updating character '{original_name}': {key} -> {value}")
                setattr(character, key, value)
    
        character.updated_at = datetime.now()
    
        if new_name and new_name != original_name:
            # If name changed, update the dictionary key
            logger.debug(f"🏷️ Character name changed from '{original_name}' to '{new_name}'. Updating dictionary key.")
            self._current_campaign.characters[new_name] = self._current_campaign.characters.pop(original_name)
    
        self._current_campaign.updated_at = datetime.now()
        self._save_campaign()
        logger.info(f"✅ Character '{new_name or original_name}' updated successfully.")
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 states this is an update operation, implying mutation, but doesn't mention permission requirements, whether changes are reversible, error conditions, or what happens to unspecified properties. For a mutation tool with 19 parameters and no annotation coverage, this leaves significant behavioral gaps.

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 states the core purpose without any wasted words. It's appropriately sized for a tool with comprehensive schema documentation and is perfectly front-loaded with the essential information.

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 mutation tool with 19 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what happens when properties are updated (e.g., partial updates, validation rules), doesn't mention the response format, and provides no behavioral context. The schema handles parameter documentation well, but the description fails to address the broader operational context.

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%, with each parameter well-documented in the schema itself. The description adds no additional parameter information beyond what's already in the schema, so it meets the baseline of 3 for adequate but not enhanced parameter semantics.

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 'Update a character's properties' clearly states the verb ('Update') and resource ('character's properties'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'bulk_update_characters' or 'update_game_state', which would require specifying this is for individual character updates.

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?

No guidance is provided about when to use this tool versus alternatives like 'bulk_update_characters' for multiple characters or 'create_character' for new characters. The description offers no context about prerequisites, typical use cases, or exclusions, leaving the agent to infer usage from the tool name alone.

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