Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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']}"
  • The @mcp.tool decorator registers the next_turn function as an MCP tool.
    @mcp.tool
  • The function signature defines the schema: no input parameters, returns a string.
    def next_turn() -> str:

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