next_turn
Advance to the next turn in combat during Dungeons & Dragons campaigns, ensuring smooth progression and organized gameplay within the D&D MCP Server.
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:647-669 (handler)The main handler function for the 'next_turn' tool. It advances the current turn in combat by cycling through the initiative order stored in the game state. Updates the game state with the new current turn and returns a confirmation message.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']}"
- src/gamemaster_mcp/main.py:646-646 (registration)The @mcp.tool decorator registers the next_turn function as an MCP tool.@mcp.tool
- src/gamemaster_mcp/main.py:647-647 (schema)The function signature defines the schema: no input parameters, returns a string.def next_turn() -> str: