Skip to content

mcp_tools

dmingolla edited this page Jul 9, 2025 · 2 revisions

MCP Tools

The OpenNebula MCP Server provides a suite of tools for interacting with your cloud infrastructure. They are grouped into three categories.

Infrastructure Tools

These tools provide read-only access to information about your OpenNebula cloud's core infrastructure.

list_clusters

Lists all OpenNebula clusters accessible to the current user.

list_clusters() -> str

Returns: An XML string containing the list of clusters.


list_hosts

Lists all available compute hosts.

list_hosts(cluster_id: str = None) -> str

Parameters:

  • cluster_id (optional): The ID of a specific cluster to filter the hosts by.

Returns: An XML string containing the list of hosts.


list_datastores

Lists all available storage datastores.

list_datastores() -> str

Returns: An XML string containing the list of datastores.


list_networks

Lists all available virtual networks.

list_networks() -> str

Returns: An XML string containing the list of virtual networks.


list_images

Lists all available virtual machine images.

list_images() -> str

Returns: An XML string containing the list of VM images.

VM Template Tools

This category contains tools for managing VM templates.

list_templates

Lists all VM templates available for instantiation.

list_templates() -> str

Returns: An XML string containing the list of VM templates.

Virtual Machine Tools

These tools are used to manage the lifecycle of virtual machines. Tools that modify the system state are marked and require the --allow-write flag to be enabled.

list_vms

Retrieves a list of all virtual machines, with optional filters.

list_vms(state: str = None, host_id: str = None, cluster_id: str = None) -> str

Parameters:

  • state (optional): Filter by VM state ID (e.g., 3, 8).
  • host_id (optional): Filter VMs running on a specific host ID.
  • cluster_id (optional): Filter VMs within a specific cluster ID.

Returns: An XML string containing the list of virtual machines.


get_vm_status

Retrieves detailed information for a single VM.

get_vm_status(vm_id: str) -> str

Parameters:

  • vm_id: The ID of the virtual machine to query.

Returns: An XML string with the detailed status and configuration of the VM.


instantiate_vm (Write Operation)

Creates a new VM from an existing template.

instantiate_vm(template_id: str, vm_name: str = None, cpu: str = None, memory: str = None, network_name: str = None) -> str

Parameters:

  • template_id: The ID of the template to instantiate from.
  • vm_name (optional): A name for the new VM.
  • cpu (optional): The number of virtual CPUs to allocate.
  • memory (optional): The amount of memory in MB to allocate.
  • network_name (optional): The name of the network to attach.

Returns: An XML string containing the details of the newly created VM.


manage_vm (Write Operation)

Performs a lifecycle action on a VM (start, stop, reboot, terminate).

manage_vm(vm_id: str, operation: str, hard: bool = False) -> str

Parameters:

  • vm_id: The ID of the VM to manage.
  • operation: The action to perform (start, stop, reboot, terminate).
  • hard (optional): If True, forces the operation (e.g., a hard stop instead of a graceful one).

Returns: A status message indicating the result of the operation.


execute_command (Write Operation)

Executes a non-interactive shell command inside a running VM.

execute_command(vm_ip_address: str, command: str) -> str

Parameters:

  • vm_ip_address: The IP address of the target VM.
  • command: The shell command to execute.

Returns: An XML string containing the standard output of the command.

Clone this wiki locally