Skip to main content
Glama
moimran
by moimran

list_node_templates

Retrieve available node templates for creating network nodes in EVE-NG labs, including supported images and configuration options.

Instructions

List available node templates in EVE-NG.

This tool retrieves all available node templates that can be used to create nodes in labs, including their supported images and options.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argumentsYes

Implementation Reference

  • The @mcp.tool()-decorated asynchronous handler function implementing the core logic of the 'list_node_templates' tool. It checks connection, fetches templates via eveng_client, formats them nicely, and returns TextContent.
    @mcp.tool() async def list_node_templates(arguments: ListTemplatesArgs) -> list[TextContent]: """ List available node templates in EVE-NG. This tool retrieves all available node templates that can be used to create nodes in labs, including their supported images and options. """ try: logger.info("Listing available node templates") if not eveng_client.is_connected: return [TextContent( type="text", text="Not connected to EVE-NG server. Use connect_eveng_server tool first." )] # Get templates templates = await eveng_client.list_node_templates() if not templates.get('data'): return [TextContent( type="text", text="No node templates found on the server." )] # Format templates information templates_text = "Available Node Templates:\n\n" for template_name, template_info in templates['data'].items(): templates_text += f"📦 {template_name}\n" templates_text += f" Type: {template_info.get('type', 'Unknown')}\n" templates_text += f" Description: {template_info.get('description', 'No description')}\n" # Show available images if any if 'listimages' in template_info and template_info['listimages']: templates_text += f" Images: {', '.join(template_info['listimages'])}\n" templates_text += "\n" return [TextContent( type="text", text=templates_text )] except Exception as e: logger.error(f"Failed to list node templates: {e}") return [TextContent( type="text", text=f"Failed to list node templates: {str(e)}" )]
  • Pydantic model defining the input schema for the list_node_templates tool. No arguments are required.
    class ListTemplatesArgs(BaseModel): """Arguments for list_node_templates tool.""" pass # No arguments needed
  • Registration call to register_node_tools(mcp, eveng_client), which defines the @mcp.tool()-decorated handler for list_node_templates inside the function.
    # Node management tools register_node_tools(mcp, eveng_client)
  • Helper method in EVENGClientWrapper that calls the underlying EVE-NG API to list node templates, used by the tool handler.
    async def list_node_templates(self) -> Dict[str, Any]: """List available node templates.""" await self.ensure_connected() try: templates = await asyncio.to_thread(self.api.list_node_templates) self.logger.debug("Listed node templates") return templates except Exception as e: self.logger.error("Failed to list node templates", **log_error(e)) raise EVENGAPIError(f"Failed to list node templates: {str(e)}")
  • Top-level registration in the MCP server initialization where all tools, including list_node_templates, are registered by calling register_tools.
    # Register tools register_tools(self.mcp, self.eveng_client)

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