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
| Name | Required | Description | Default |
|---|---|---|---|
| run_id | Yes |
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
- acp_mcp_server/server.py:89-89 (registration)Registers the interactive tools including 'cancel_interaction' by calling register_interactive_tools on the MCP instance.register_interactive_tools(self.mcp, self.interactive_manager)