next_turn
Advance combat to the next turn in Dungeons & Dragons campaigns to manage encounter flow and track initiative order.
Instructions
Advance to the next turn in combat.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/gamemaster_mcp/main.py:646-669 (handler)The handler function for the 'next_turn' tool. It advances the current turn in an ongoing combat by finding the next participant in the initiative order and updating the game state. The @mcp.tool decorator also handles registration.@mcp.tool def next_turn() -> str: """Advance to the next turn in combat.""" game_state = storage.get_game_state() if not game_state or not game_state.in_combat: return "Not currently in combat." if not game_state.initiative_order: return "No initiative order set." # Find current turn index and advance current_index = 0 if game_state.current_turn: for i, participant in enumerate(game_state.initiative_order): if participant["name"] == game_state.current_turn: current_index = i break next_index = (current_index + 1) % len(game_state.initiative_order) next_participant = game_state.initiative_order[next_index] storage.update_game_state(current_turn=next_participant["name"]) return f"**Next Turn:** {next_participant['name']}"