Skip to main content
Glama

provide_user_input

Resume a waiting interactive agent by submitting required user input, facilitating communication between ACP agents and MCP-compatible tools via the ACP-MCP Server.

Instructions

Provide user input to resume a waiting interactive agent

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
run_idYes
user_inputYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'provide_user_input' MCP tool. Decorated with @mcp.tool() for automatic registration. It resumes the interactive agent by calling InteractiveManager.resume_interactive_agent and returns a JSON-serialized result.
    @mcp.tool()
    async def provide_user_input(
        run_id: str,
        user_input: str
    ) -> str:
        """Provide user input to resume a waiting interactive agent"""
        
        try:
            result = await manager.resume_interactive_agent(run_id, user_input)
            
            return json.dumps(result, indent=2)
            
        except Exception as e:
            return f"Error: {e}"
  • The call to register_interactive_tools in the server's _register_all_tools method, which executes the tool definitions and registrations including 'provide_user_input'.
    register_interactive_tools(self.mcp, self.interactive_manager)
  • The InteractiveManager.resume_interactive_agent method, which contains the core logic invoked by the 'provide_user_input' tool handler for resuming agent execution with user input.
    async def resume_interactive_agent(
        self,
        run_id: str,
        user_input: str
    ) -> Dict[str, Any]:
        """Resume an agent that was waiting for user input"""
        
        if run_id not in self.pending_interactions:
            return {
                "status": "error",
                "error": f"No pending interaction found for run_id: {run_id}"
            }
        
        pending = self.pending_interactions[run_id]
        
        # Check timeout
        current_time = asyncio.get_event_loop().time()
        if current_time - pending.timestamp > pending.timeout_seconds:
            del self.pending_interactions[run_id]
            return {
                "status": "timeout",
                "error": "Interaction timed out"
            }
        
        try:
            # Resume the agent with user input
            # Note: This is a simplified version - actual ACP resume implementation may vary
            resume_payload = {
                "run_id": run_id,
                "resume_input": user_input
            }
            
            # For now, we'll simulate resume by starting a new session
            # In a real implementation, this would use ACP's resume endpoint
            run = await self.orchestrator.execute_agent_sync(
                agent_name=pending.agent_name,
                input_text=user_input,
                session_id=pending.session_id
            )
            
            # Clean up pending interaction
            del self.pending_interactions[run_id]
            
            # Check if agent needs more input
            if hasattr(run, 'await_request') and run.await_request:
                # Agent needs more input
                new_pending = PendingInteraction(
                    run_id=run.run_id,
                    agent_name=pending.agent_name,
                    session_id=pending.session_id,
                    await_message=run.await_request.get('message', 'Agent is waiting for more input'),
                    timestamp=current_time,
                    timeout_seconds=pending.timeout_seconds
                )
                
                self.pending_interactions[run.run_id] = new_pending
                
                return {
                    "status": "awaiting_more_input",
                    "run_id": run.run_id,
                    "message": new_pending.await_message
                }
            
            else:
                # Agent completed
                output = ""
                if run.output:
                    # Handle ACP output format - run.output is already a list of messages
                    output_text = ""
                    for message in run.output:
                        if isinstance(message, dict) and "parts" in message:
                            for part in message["parts"]:
                                if isinstance(part, dict) and "content" in part:
                                    output_text += part["content"] + "\n"
                    output = output_text.strip() if output_text else "No text content"
                
                # Store final result
                self.interaction_results[run_id] = {
                    "output": output,
                    "error": run.error,
                    "completed_at": current_time
                }
                
                return {
                    "status": "completed",
                    "run_id": run.run_id,
                    "output": output,
                    "error": run.error
                }
                
        except Exception as e:
            # Clean up on error
            if run_id in self.pending_interactions:
                del self.pending_interactions[run_id]
            
            return {
                "status": "error",
                "error": str(e)
            }
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 states the tool resumes a waiting agent but doesn't explain what 'resume' entails (e.g., does it trigger further processing, is it idempotent, are there rate limits?). For a tool that likely involves state changes in interactive agents, this lack of detail is a significant gap, leaving the agent with minimal behavioral insight.

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

Conciseness5/5

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

The description is a single, clear sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core action and purpose, making it efficient and easy to parse. Every part of the sentence contributes essential information, earning its place.

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 that an output schema exists, the description doesn't need to explain return values. However, with no annotations, 0% schema coverage, and two required parameters, the description is incomplete—it lacks details on behavioral traits and parameter semantics. For a tool that interacts with waiting agents, more context on usage and effects would be beneficial, but the presence of an output schema slightly mitigates this.

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 the input schema provides no descriptions for parameters. The description doesn't add any meaning beyond the schema—it doesn't explain what 'run_id' refers to (e.g., an identifier from a paused agent) or what 'user_input' should contain (e.g., text to continue the interaction). With two required parameters and no compensation in the description, this leaves the agent guessing about parameter usage.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Provide user input to resume a waiting interactive agent.' It specifies the action ('provide user input') and the target ('resume a waiting interactive agent'), which is specific and actionable. However, it doesn't explicitly differentiate from sibling tools like 'cancel_interaction' or 'list_pending_interactions', which handle related but distinct operations.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a run_id from a waiting agent), exclusions, or how it differs from tools like 'cancel_interaction' or 'get_async_run_result'. Without such context, the agent might struggle to select this tool appropriately in complex scenarios.

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

Related 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/GongRzhe/ACP-MCP-Server'

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