Skip to main content
Glama
moimran

EVE-NG MCP Server

by moimran

stop_node

Gracefully shut down a running node in an EVE-NG network lab to preserve its state and stop operations.

Instructions

Stop a specific node.

This tool stops a running node in the lab. The node will be gracefully shut down and its state will be preserved.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argumentsYes

Implementation Reference

  • The main MCP tool handler function for 'stop_node'. It validates arguments, checks EVE-NG connection, calls the underlying client API, and formats the response as TextContent.
    async def stop_node(arguments: NodeControlArgs) -> list[TextContent]:
        """
        Stop a specific node.
    
        This tool stops a running node in the lab. The node will be gracefully
        shut down and its state will be preserved.
        """
        try:
            logger.info(f"Stopping node {arguments.node_id} in {arguments.lab_path}")
    
            if not eveng_client.is_connected:
                return [TextContent(
                    type="text",
                    text="Not connected to EVE-NG server. Use connect_eveng_server tool first."
                )]
    
            # Stop node
            result = await eveng_client.stop_node(arguments.lab_path, arguments.node_id)
    
            if result.get('status') == 'success':
                return [TextContent(
                    type="text",
                    text=f"Successfully stopped node {arguments.node_id} in {arguments.lab_path}\n\n"
                         f"The node has been shut down and its state has been preserved."
                )]
            else:
                return [TextContent(
                    type="text",
                    text=f"Failed to stop node: {result.get('message', 'Unknown error')}"
                )]
    
        except Exception as e:
            logger.error(f"Failed to stop node: {e}")
            return [TextContent(
                type="text",
                text=f"Failed to stop node: {str(e)}"
            )]
  • Pydantic model defining the input schema/arguments for the stop_node tool: lab_path and node_id.
    class NodeControlArgs(BaseModel):
        """Arguments for node control operations."""
        lab_path: str = Field(description="Full path to the lab (e.g., /lab_name.unl)")
        node_id: str = Field(description="Node ID to control")
  • Registration call to register_node_tools within the overall register_tools function, which registers the stop_node tool using @mcp.tool() decorators inside node_management.py.
    # Node management tools
    register_node_tools(mcp, eveng_client)
  • Underlying client method called by the MCP handler to perform the actual stop_node API call to EVE-NG.
    async def stop_node(self, lab_path: str, node_id: str) -> Dict[str, Any]:
        """Stop a specific node."""
        await self.ensure_connected()
    
        try:
            result = await asyncio.to_thread(self.api.stop_node, lab_path, node_id)
            self.logger.info("Stopped node", lab_path=lab_path, node_id=node_id)
            return result
        except Exception as e:
            self.logger.error("Failed to stop node", **log_error(e, {"lab_path": lab_path, "node_id": node_id}))
            raise EVENGAPIError(f"Failed to stop node: {str(e)}")

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/moimran/eveng-mcp'

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