Skip to main content
Glama

get_current_cluster

Retrieve the active Kubernetes cluster from the kubeconfig file using the k8s-pilot MCP server to manage and switch contexts efficiently.

Instructions

Get the current cluster from the kubeconfig file. :return:

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_current_cluster' tool. It fetches the kubeconfig, identifies the current context, and returns a ContextInfo object for the current cluster.
    @mcp.tool() def get_current_cluster(): """ Get the current cluster from the kubeconfig file. :return: """ config_data = get_kubeconfig() current_context = config_data.get("current-context") contexts = config_data.get("contexts", []) for ctx in contexts: if ctx["name"] == current_context: return ContextInfo( name=ctx["name"], cluster=ctx["context"].get("cluster"), user=ctx["context"].get("user"), current=True, ) return None
  • tools/cluster.py:30-30 (registration)
    Registration of the 'get_current_cluster' tool using the @mcp.tool() decorator.
    @mcp.tool()

Other Tools

Related Tools

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