Skip to main content
Glama
moimran
by moimran

list_lab_networks

Retrieve all network configurations and connections within a specified EVE-NG lab to analyze topology and relationships.

Instructions

List all networks in a lab.

This tool retrieves information about all networks configured in the specified lab, including their types and connections.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argumentsYes

Implementation Reference

  • MCP tool handler: lists networks in the specified lab by calling eveng_client.list_lab_networks and formatting the response as TextContent.
    @mcp.tool() async def list_lab_networks(arguments: ListNetworksArgs) -> list[TextContent]: """ List all networks in a lab. This tool retrieves information about all networks configured in the specified lab, including their types and connections. """ try: logger.info(f"Listing networks in lab: {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." )] # Get lab networks networks = await eveng_client.list_lab_networks(arguments.lab_path) if not networks.get('data'): return [TextContent( type="text", text=f"No networks found in lab: {arguments.lab_path}" )] # Format networks information networks_text = f"Networks in {arguments.lab_path}:\n\n" for net_id, network in networks['data'].items(): networks_text += f"🌐 {network.get('name', f'Network {net_id}')} (ID: {net_id})\n" networks_text += f" Type: {network.get('type', 'Unknown')}\n" networks_text += f" Visibility: {'Visible' if network.get('visibility') == 1 else 'Hidden'}\n" networks_text += f" Position: ({network.get('left', 0)}%, {network.get('top', 0)}%)\n" networks_text += "\n" return [TextContent( type="text", text=networks_text )] except Exception as e: logger.error(f"Failed to list lab networks: {e}") return [TextContent( type="text", text=f"Failed to list lab networks: {str(e)}" )]
  • Pydantic schema for tool input: requires lab_path (full path to the .unl lab file).
    class ListNetworksArgs(BaseModel): """Arguments for list_networks tool.""" lab_path: str = Field(description="Full path to the lab (e.g., /lab_name.unl)")
  • Calls register_network_tools which defines and registers the list_lab_networks handler using @mcp.tool() decorator.
    # Network management tools register_network_tools(mcp, eveng_client)
  • EVENGClientWrapper helper method that wraps the EVE-NG API call to list networks in a lab.
    async def list_lab_networks(self, lab_path: str) -> Dict[str, Any]: """List all networks in a lab.""" await self.ensure_connected() try: networks = await asyncio.to_thread(self.api.list_lab_networks, lab_path) self.logger.debug("Listed lab networks", lab_path=lab_path) return networks except Exception as e: self.logger.error("Failed to list lab networks", **log_error(e, {"lab_path": lab_path})) raise EVENGAPIError(f"Failed to list lab networks: {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