Skip to main content
Glama
abhijeetka
by abhijeetka

get_current_context

Retrieve the active Kubernetes cluster configuration to verify current operational environment before executing management commands.

Instructions

Get the current Kubernetes context

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_current_context' tool. Decorated with @mcp.tool() for registration and implements the logic to retrieve the current Kubernetes context using 'kubectl config current-context' command.
    @mcp.tool()
    async def get_current_context() -> dict:
        """Get the current Kubernetes context"""
        try:
            cmd = ["kubectl", "config", "current-context"]
            result = subprocess.run(cmd, capture_output=True, text=True, check=True)
            return {"current_context": result.stdout.strip()}
        except subprocess.CalledProcessError as e:
            return {"error": f"Failed to get current context: {str(e)}"}
  • kubernetes.py:206-206 (registration)
    The @mcp.tool() decorator registers the get_current_context function as an MCP tool.
    @mcp.tool()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states what the tool does without disclosing behavioral traits. It doesn't mention whether this is a read-only operation, what format the output returns, potential errors if no context is configured, or authentication requirements. The description is minimal and lacks behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, focused sentence that efficiently communicates the core purpose with zero wasted words. It's appropriately sized for a simple tool and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple 0-parameter tool with no output schema, the description is minimally complete. However, given the Kubernetes domain complexity and lack of annotations, it should ideally explain what a 'context' returns (cluster, namespace, user info) and potential failure modes. The description meets basic requirements but leaves contextual gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the baseline is 4. The description doesn't need to explain parameters since none exist, and it correctly reflects this by not mentioning any parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('current Kubernetes context'), making the purpose immediately understandable. It distinguishes from sibling 'list_contexts' by focusing on the current context rather than listing all contexts. However, it doesn't fully specify what a 'context' entails in Kubernetes terms.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies this should be used when you need to know which Kubernetes context is currently active. It distinguishes from 'list_contexts' by focusing on current vs. all contexts, but doesn't provide explicit guidance on when to choose this over alternatives or mention prerequisites like kubectl configuration.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/abhijeetka/mcp-k8s-server'

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