get_kubernetes_live_status
Retrieve real-time Kubernetes resource status for specific projects and environments in Octopus Deploy deployments, including multi-tenant support.
Instructions
Get Kubernetes live status for a project and environment
This tool retrieves the live status of Kubernetes resources for a specific project and environment. Optionally include a tenant ID for multi-tenant deployments.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environmentId | Yes | The ID of the environment | |
| projectId | Yes | The ID of the project | |
| spaceName | Yes | The space name | |
| summaryOnly | No | Return summary information only | |
| tenantId | No | The ID of the tenant (for multi-tenant deployments) |
Implementation Reference
- The main handler function that creates an Octopus Deploy client using environment configuration, fetches Kubernetes live status via ObservabilityRepository.getLiveStatus(), and returns a formatted JSON response in MCP content format.async ({ spaceName, projectId, environmentId, tenantId, summaryOnly = false }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const observabilityRepository = new ObservabilityRepository(client, spaceName); const liveStatus = await observabilityRepository.getLiveStatus( projectId, environmentId, tenantId, summaryOnly ); return { content: [ { type: "text", text: JSON.stringify({ projectId, environmentId, tenantId, summaryOnly: summaryOnly, liveStatus: { machineStatuses: liveStatus.MachineStatuses?.map((machine: KubernetesMachineLiveStatusResource) => ({ machineId: machine.MachineId, status: machine.Status, resources: machine.Resources?.map((resource: KubernetesLiveStatusResource) => ({ name: resource.Name, namespace: resource.Namespace, kind: resource.Kind, healthStatus: resource.HealthStatus, syncStatus: resource.SyncStatus, machineId: resource.MachineId, children: resource.Children, desiredResourceId: resource.DesiredResourceId, resourceId: resource.ResourceId })) })), summary: liveStatus.Summary ? { status: liveStatus.Summary.Status, lastUpdated: liveStatus.Summary.LastUpdated } : undefined } }), }, ], }; }
- Zod schema defining the input parameters for the tool: required spaceName, projectId, environmentId; optional tenantId and summaryOnly.{ spaceName: z.string().describe("The space name"), projectId: z.string().describe("The ID of the project"), environmentId: z.string().describe("The ID of the environment"), tenantId: z.string().optional().describe("The ID of the tenant (for multi-tenant deployments)"), summaryOnly: z.boolean().optional().describe("Return summary information only") },
- src/tools/getKubernetesLiveStatus.ts:7-72 (registration)The registerGetKubernetesLiveStatusTool function registers the tool on the MCP server, providing name, description, input schema, output metadata, and handler.export function registerGetKubernetesLiveStatusTool(server: McpServer) { server.tool( "get_kubernetes_live_status", `Get Kubernetes live status for a project and environment This tool retrieves the live status of Kubernetes resources for a specific project and environment. Optionally include a tenant ID for multi-tenant deployments.`, { spaceName: z.string().describe("The space name"), projectId: z.string().describe("The ID of the project"), environmentId: z.string().describe("The ID of the environment"), tenantId: z.string().optional().describe("The ID of the tenant (for multi-tenant deployments)"), summaryOnly: z.boolean().optional().describe("Return summary information only") }, { title: "Get Kubernetes live status from Octopus Deploy", readOnlyHint: true, }, async ({ spaceName, projectId, environmentId, tenantId, summaryOnly = false }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const observabilityRepository = new ObservabilityRepository(client, spaceName); const liveStatus = await observabilityRepository.getLiveStatus( projectId, environmentId, tenantId, summaryOnly ); return { content: [ { type: "text", text: JSON.stringify({ projectId, environmentId, tenantId, summaryOnly: summaryOnly, liveStatus: { machineStatuses: liveStatus.MachineStatuses?.map((machine: KubernetesMachineLiveStatusResource) => ({ machineId: machine.MachineId, status: machine.Status, resources: machine.Resources?.map((resource: KubernetesLiveStatusResource) => ({ name: resource.Name, namespace: resource.Namespace, kind: resource.Kind, healthStatus: resource.HealthStatus, syncStatus: resource.SyncStatus, machineId: resource.MachineId, children: resource.Children, desiredResourceId: resource.DesiredResourceId, resourceId: resource.ResourceId })) })), summary: liveStatus.Summary ? { status: liveStatus.Summary.Status, lastUpdated: liveStatus.Summary.LastUpdated } : undefined } }), }, ], }; } ); }
- src/tools/getKubernetesLiveStatus.ts:74-79 (registration)Registers the tool definition in the global TOOL_REGISTRY, specifying toolset 'kubernetes', read-only, and the registration function for conditional enabling.registerToolDefinition({ toolName: "get_kubernetes_live_status", config: { toolset: "kubernetes", readOnly: true }, registerFn: registerGetKubernetesLiveStatusTool, minimumOctopusVersion: "2025.3", });