list_server_types
Retrieve available server configurations to select appropriate resources for deploying applications or managing infrastructure on Hetzner Cloud.
Instructions
List available server types.
Returns information about all available server configurations.
Example:
- List server types: list_server_types()
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- mcp_hetzner/server.py:444-496 (handler)The handler function for the list_server_types tool. It fetches all server types using the Hetzner Cloud client, formats the data including prices per location, and returns a structured list or an error.
@mcp.tool() def list_server_types() -> Dict[str, Any]: """ List available server types. Returns information about all available server configurations. Example: - List server types: list_server_types() """ try: server_types = client.server_types.get_all() result = [] for st in server_types: server_type_info = { "id": st.id, "name": st.name, "description": st.description, "cores": st.cores, "memory_gb": st.memory, "disk_gb": st.disk, "storage_type": st.storage_type, "cpu_type": st.cpu_type, "prices": [] } if hasattr(st, 'prices') and st.prices: price_list = [] for price in st.prices: price_data = {} if hasattr(price, 'price_hourly'): price_data["price_hourly"] = price.price_hourly if hasattr(price, 'price_monthly'): price_data["price_monthly"] = price.price_monthly # Safely add location if available try: if hasattr(price, 'location') and price.location and hasattr(price.location, 'name'): price_data["location"] = price.location.name except: price_data["location"] = None price_list.append(price_data) server_type_info["prices"] = price_list result.append(server_type_info) return { "server_types": result } except Exception as e: return {"error": f"Failed to list server types: {str(e)}"}