Skip to main content
Glama
alicenjr

Dynamic Reincarnation Story

by alicenjr

process_user_input

Process user choices to generate personalized reincarnation story paths, allowing players to become characters like vengeful spirits or fantasy heroes based on their decisions.

Instructions

Process user input and generate narrative response with options

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYes
user_inputYes

Implementation Reference

  • main.py:295-337 (handler)
    The core handler function for the process_user_input MCP tool. It manages story state, generates prompts for narrative continuation and next options based on user input.
    @mcp.tool() def process_user_input(user_id: str, user_input: str) -> str: """Process user input and generate narrative response with options""" state = get_user_state(user_id) if not state["story_started"]: return "Please start the story first by typing 'Arise'." if not state["current_path"]: return "Please choose a reincarnation path first." # Generate narrative based on user input narrative_prompt = str(generate_narrative_prompt( user_input=user_input, path=state["current_path"], step=state["story_step"], previous_context=state["current_context"] )) # Update context for next iteration state["current_context"] = f"Step {state['story_step']}: {user_input[:100]}..." state["story_step"] += 1 state["choices_made"].append(user_input) # Generate options for next step options_prompt = str(generate_options_prompt( current_narrative=f"User's action: {user_input}. Context: {state['current_context']}", path=state["current_path"], step=state["story_step"], previous_choices=state["choices_made"][-3:] # Last 3 choices )) return f""" NARRATIVE GENERATION PROMPT: {narrative_prompt} After the narrative is generated, use this prompt to create three options: OPTIONS GENERATION PROMPT: {options_prompt} The AI will now generate the next part of your story based on your input: "{user_input}" """

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/alicenjr/Dynamic-Reincarnation-mcp'

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