Skip to main content
Glama

mcp-nutanix

host.go1.79 kB
package tools import ( "context" "github.com/thunderboltsid/mcp-nutanix/internal/client" "github.com/thunderboltsid/mcp-nutanix/pkg/resources" "github.com/mark3labs/mcp-go/mcp" "github.com/mark3labs/mcp-go/server" ) // Host defines the Host tool func HostList() mcp.Tool { return mcp.NewTool("host_list", mcp.WithDescription("List host resources"), mcp.WithString("filter", mcp.Description("Optional text filter (interpreted by LLM)"), ), ) } // HostListHandler implements the handler for the Host list tool func HostListHandler() server.ToolHandlerFunc { return CreateListToolHandler( resources.ResourceTypeHost, // Define the ListResourceFunc implementation func(ctx context.Context, client *client.NutanixClient, filter string) (interface{}, error) { // Special case for Host which doesn't take a filter return client.V3().ListAllHost(ctx) }, ) } // HostCount defines the Host count tool func HostCount() mcp.Tool { return mcp.NewTool("host_count", mcp.WithDescription("Count host resources"), mcp.WithString("filter", mcp.Description("Optional text filter (interpreted by LLM)"), ), ) } // HostCountHandler implements the handler for the Host count tool func HostCountHandler() server.ToolHandlerFunc { return CreateCountToolHandler( resources.ResourceTypeHost, // Define the ListResourceFunc implementation func(ctx context.Context, client *client.NutanixClient, filter string) (interface{}, error) { // Special case for Host which doesn't take a filter resp, err := client.V3().ListAllHost(ctx) if err != nil { return nil, err } res := map[string]interface{}{ "resource_type": "Host", "count": len(resp.Entities), "metadata": resp.Metadata, } return res, nil }, ) }

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/thunderboltsid/mcp-nutanix'

If you have feedback or need assistance with the MCP directory API, please join our Discord server