Skip to main content
Glama
moimran

EVE-NG MCP Server

by moimran

get_lab_topology

Retrieve complete network lab topology including nodes, networks, and connections for EVE-NG network emulation environments.

Instructions

Get lab topology information.

This tool retrieves the complete topology of the lab including all nodes, networks, and their connections.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argumentsYes

Implementation Reference

  • The primary MCP tool handler for 'get_lab_topology'. It processes arguments, calls the underlying client to fetch topology data, formats connections between nodes and networks into readable text, handles errors, and returns formatted TextContent.
    @mcp.tool()
    async def get_lab_topology(arguments: GetTopologyArgs) -> list[TextContent]:
        """
        Get lab topology information.
    
        This tool retrieves the complete topology of the lab including
        all nodes, networks, and their connections.
        """
        try:
            logger.info(f"Getting topology for 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 topology
            topology = await eveng_client.get_lab_topology(arguments.lab_path)
    
            if not topology.get('data'):
                return [TextContent(
                    type="text",
                    text=f"No topology information found for lab: {arguments.lab_path}"
                )]
    
            # Format topology information
            topology_text = f"Lab Topology: {arguments.lab_path}\n\n"
    
            topology_data = topology['data']
    
            # Show connections
            topology_text += "🔗 Connections:\n"
            if topology_data:
                for connection_id, connection in topology_data.items():
                    src_type = "Node" if connection.get('source_type') == 'node' else "Network"
                    dst_type = "Node" if connection.get('destination_type') == 'node' else "Network"
    
                    topology_text += f"   {src_type} {connection.get('source', 'Unknown')}"
                    if connection.get('source_label'):
                        topology_text += f" ({connection.get('source_label')})"
                    topology_text += f" ↔ {dst_type} {connection.get('destination', 'Unknown')}"
                    if connection.get('destination_label'):
                        topology_text += f" ({connection.get('destination_label')})"
                    topology_text += "\n"
            else:
                topology_text += "   No connections found\n"
    
            return [TextContent(
                type="text",
                text=topology_text
            )]
    
        except Exception as e:
            logger.error(f"Failed to get lab topology: {e}")
            return [TextContent(
                type="text",
                text=f"Failed to get lab topology: {str(e)}"
            )]
  • Pydantic model defining the input schema for the get_lab_topology tool, specifying the required lab_path parameter.
    class GetTopologyArgs(BaseModel):
        """Arguments for get_lab_topology tool."""
        lab_path: str = Field(description="Full path to the lab (e.g., /lab_name.unl)")
  • Specific registration call for network management tools within the main register_tools function, which defines and registers get_lab_topology using @mcp.tool() decorator.
    # Network management tools
    register_network_tools(mcp, eveng_client)
  • Top-level registration of all MCP tools during server initialization, chaining through to the get_lab_topology tool registration.
    # Register tools
    register_tools(self.mcp, self.eveng_client)
  • Supporting helper method in EVENGClientWrapper that ensures connection and proxies the raw API call to retrieve lab topology data, invoked by the MCP tool handler.
    async def get_lab_topology(self, lab_path: str) -> Dict[str, Any]:
        """Get lab topology information."""
        await self.ensure_connected()
    
        try:
            topology = await asyncio.to_thread(self.api.get_lab_topology, lab_path)
            self.logger.debug("Retrieved lab topology", lab_path=lab_path)
            return topology
        except Exception as e:
            self.logger.error("Failed to get lab topology", **log_error(e, {"lab_path": lab_path}))
            raise EVENGAPIError(f"Failed to get lab topology: {str(e)}")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'retrieves' information, implying a read-only operation, but doesn't clarify aspects like whether it requires authentication, has rate limits, returns structured data, or handles errors. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with a brief opening sentence followed by a more detailed explanation. Both sentences are relevant and avoid redundancy, though the structure could be slightly improved by integrating the two parts more seamlessly. It's efficient with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (retrieving topology with 1 parameter), lack of annotations, 0% schema coverage, and no output schema, the description is incomplete. It doesn't address parameter usage, return format, or behavioral traits, making it inadequate for an agent to fully understand how to invoke and interpret results from this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions no parameters at all, failing to explain the 'lab_path' input required by the schema. The description adds no meaning beyond the schema, leaving the parameter's purpose and format unclear to the agent.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'retrieves the complete topology of the lab including all nodes, networks, and their connections.' It specifies the verb ('retrieves') and resource ('complete topology'), though it doesn't explicitly differentiate from siblings like 'get_lab_details' or 'get_node_details' which might provide partial information. The purpose is well-defined but lacks sibling comparison.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention scenarios where this is preferred over other tools like 'get_lab_details' or 'list_nodes', nor does it specify prerequisites or exclusions. Usage is implied only by the general purpose, with no explicit context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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