Skip to main content
Glama
moimran

EVE-NG MCP Server

by moimran

delete_node

Remove a node from an EVE-NG lab to delete its data and configuration permanently. This action cannot be undone.

Instructions

Delete a node from a lab.

This tool permanently removes a node from the lab. All node data and configuration will be lost. This action cannot be undone.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argumentsYes

Implementation Reference

  • The primary handler function for the 'delete_node' MCP tool. It processes DeleteNodeArgs, ensures EVE-NG connection, invokes the client helper, and formats success/error responses as TextContent.
    @mcp.tool()
    async def delete_node(arguments: DeleteNodeArgs) -> list[TextContent]:
        """
        Delete a node from a lab.
    
        This tool permanently removes a node from the lab. All node data
        and configuration will be lost. This action cannot be undone.
        """
        try:
            logger.info(f"Deleting node {arguments.node_id} from {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."
                )]
    
            # Delete node
            result = await eveng_client.delete_node(arguments.lab_path, arguments.node_id)
    
            if result.get('status') == 'success':
                return [TextContent(
                    type="text",
                    text=f"Successfully deleted node {arguments.node_id} from {arguments.lab_path}\n\n"
                         f"⚠️  The node has been permanently removed from the lab.\n"
                         f"This action cannot be undone."
                )]
            else:
                return [TextContent(
                    type="text",
                    text=f"Failed to delete node: {result.get('message', 'Unknown error')}"
                )]
    
        except Exception as e:
            logger.error(f"Failed to delete node: {e}")
            return [TextContent(
                type="text",
                text=f"Failed to delete node: {str(e)}"
            )]
  • Pydantic BaseModel defining the input arguments for the delete_node tool: lab_path and node_id with descriptions.
    class DeleteNodeArgs(BaseModel):
        """Arguments for delete_node tool."""
        lab_path: str = Field(description="Full path to the lab (e.g., /lab_name.unl)")
        node_id: str = Field(description="Node ID to delete")
  • Top-level registration of all tools in the main server class, which chains through tools/__init__.py to register_node_tools and ultimately the @mcp.tool() decorator for delete_node.
    # Register tools
    register_tools(self.mcp, self.eveng_client)
  • Intermediate registration call for node management tools specifically, invoking register_node_tools where delete_node is defined and registered via @mcp.tool().
    # Node management tools
    register_node_tools(mcp, eveng_client)
    
    # Network management tools
    register_network_tools(mcp, eveng_client)
  • Supporting method in EVENGClientWrapper that wraps the underlying EVE-NG API delete_node call, handles connection, logging, and error propagation.
    async def delete_node(self, lab_path: str, node_id: str) -> Dict[str, Any]:
        """Delete a node from a lab."""
        await self.ensure_connected()
    
        try:
            result = await asyncio.to_thread(self.api.delete_node, lab_path, node_id)
            self.logger.info("Deleted node", lab_path=lab_path, node_id=node_id)
            return result
        except Exception as e:
            self.logger.error("Failed to delete node", **log_error(e, {"lab_path": lab_path, "node_id": node_id}))
            raise EVENGAPIError(f"Failed to delete 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