Skip to main content
Glama

cancel_interaction

Terminate a pending interactive agent session by specifying the run ID, enabling users to manage ongoing interactions on the ACP-MCP-Server efficiently.

Instructions

Cancel a pending interactive agent

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
run_idYes

Implementation Reference

  • MCP tool handler for 'cancel_interaction' decorated with @mcp.tool(). Calls the InteractiveManager's cancel_interaction method and returns success message.
    @mcp.tool()
    async def cancel_interaction(run_id: str) -> str:
        """Cancel a pending interactive agent"""
        
        try:
            success = await manager.cancel_interaction(run_id)
            
            if success:
                return f"Successfully cancelled interaction: {run_id}"
            else:
                return f"No pending interaction found with ID: {run_id}"
                
        except Exception as e:
            return f"Error: {e}"
  • Core implementation in InteractiveManager class: removes the run_id from pending_interactions if present and returns True/False.
    async def cancel_interaction(self, run_id: str) -> bool:
        """Cancel a pending interaction"""
        
        if run_id in self.pending_interactions:
            del self.pending_interactions[run_id]
            return True
        return False
  • Registers the interactive tools including 'cancel_interaction' by calling register_interactive_tools on the MCP instance.
    register_interactive_tools(self.mcp, self.interactive_manager)

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