Skip to main content
Glama
alicenjr

Dynamic Reincarnation Story

by alicenjr

process_user_input

Processes user choices to generate personalized narrative responses and story paths in interactive reincarnation storytelling.

Instructions

Process user input and generate narrative response with options

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYes
user_inputYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:295-338 (handler)
    The handler function decorated with @mcp.tool() that implements the core logic for processing user input during story progression. It generates narrative prompts and option prompts based on the current story state.
    @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}"
    """
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions generating a 'narrative response with options', hinting at output behavior, but fails to detail critical aspects like whether this is a read-only or mutative operation, authentication needs, rate limits, or error handling. For a tool with no annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action. It avoids unnecessary words and gets straight to the point, making it easy to parse. However, it could be more structured by explicitly separating purpose from behavior, but it earns high marks for brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema, the description need not explain return values, which helps completeness. However, with no annotations, 0% schema coverage, and multiple sibling tools, the description lacks sufficient context about usage, parameters, and behavioral traits. It provides a basic overview but leaves gaps in understanding the tool's full role and requirements.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning parameters 'user_id' and 'user_input' are undocumented in the schema. The description does not add any meaning beyond the parameter names—it doesn't explain what 'user_id' refers to (e.g., a unique identifier) or the expected format/content of 'user_input'. With two required parameters and no compensation in the description, this falls short of the baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'process user input and generate narrative response with options', which provides a vague purpose. It mentions a verb ('process') and resource ('user input') but lacks specificity about what kind of processing occurs or what 'narrative response' entails. It doesn't clearly distinguish from siblings like 'handle_user_message' or 'record_answers_and_choose_path', leaving ambiguity about its unique role.

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?

The description offers no guidance on when to use this tool versus alternatives. With siblings such as 'handle_user_message' and 'record_answers_and_choose_path', which likely involve similar user input processing, there is no indication of context, prerequisites, or exclusions. This leaves the agent without direction on tool selection.

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

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