Skip to main content
Glama

get_node_details

Retrieve comprehensive Kubernetes node information by specifying context and node name to analyze cluster resources and status.

Instructions

Get detailed information about a specific node.

Args: context_name: The Kubernetes context name node_name: The name of the node to get details for

Returns: JSON string containing detailed information about the node

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
node_nameYes

Implementation Reference

  • Handler function implementing the get_node_details tool. Uses Kubernetes CoreV1Api to fetch node details, extracts info, conditions, capacity, allocatable resources, labels, annotations, taints, addresses, and creation time, then returns as JSON.
    @mcp.tool()
    @use_current_context
    def get_node_details(context_name: str, node_name: str):
        """
        Get detailed information about a specific node.
    
        Args:
            context_name: The Kubernetes context name
            node_name: The name of the node to get details for
    
        Returns:
            JSON string containing detailed information about the node
        """
        core_v1: CoreV1Api = get_api_clients(context_name)["core"]
        node = core_v1.read_node(node_name)
    
        # Extract useful information
        node_info = node.status.node_info
        conditions = {cond.type: cond.status for cond in node.status.conditions}
        capacity = {k: v for k, v in node.status.capacity.items()}
        allocatable = {k: v for k, v in node.status.allocatable.items()}
    
        # Format taints if present
        taints = []
        if node.spec.taints:
            taints = [{
                "key": taint.key,
                "value": taint.value,
                "effect": taint.effect
            } for taint in node.spec.taints]
    
        # Extract labels and annotations
        labels = {}
        annotations = {}
        if node.metadata.labels:
            labels = node.metadata.labels
        if node.metadata.annotations:
            annotations = node.metadata.annotations
    
        result = {
            "name": node.metadata.name,
            "info": {
                "architecture": node_info.architecture,
                "bootID": node_info.boot_id,
                "containerRuntimeVersion": node_info.container_runtime_version,
                "kernelVersion": node_info.kernel_version,
                "kubeProxyVersion": node_info.kube_proxy_version,
                "kubeletVersion": node_info.kubelet_version,
                "machineID": node_info.machine_id,
                "operatingSystem": node_info.operating_system,
                "osImage": node_info.os_image,
                "systemUUID": node_info.system_uuid
            },
            "conditions": conditions,
            "capacity": capacity,
            "allocatable": allocatable,
            "labels": labels,
            "annotations": annotations,
            "taints": taints,
            "addresses": [{"type": addr.type, "address": addr.address} for addr in node.status.addresses],
            "created": node.metadata.creation_timestamp.strftime(
                "%Y-%m-%dT%H:%M:%SZ") if node.metadata.creation_timestamp else None
        }
    
        return json.dumps(result)
  • tools/node.py:29-29 (registration)
    The @mcp.tool() decorator registers the get_node_details function as an MCP tool.
    @mcp.tool()
  • Docstring provides input parameters and output description serving as schema for the tool.
    """
    Get detailed information about a specific node.
    
    Args:
        context_name: The Kubernetes context name
        node_name: The name of the node to get details for
    
    Returns:
        JSON string containing detailed information about the node
    """

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/bourbonkk/k8s-pilot'

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