Skip to main content
Glama

get_namespace_details

Retrieve detailed information about a specific Kubernetes namespace, including its configuration and status, to monitor and manage cluster resources effectively.

Instructions

Get detailed information about a specific namespace.

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

Returns: JSON string containing detailed information about the namespace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes

Implementation Reference

  • The primary handler for the 'get_namespace_details' MCP tool. Decorated with @mcp.tool() for automatic registration and @use_current_context for context management. Fetches namespace details via Kubernetes API, extracts key metadata, and returns formatted JSON or error messages.
    @mcp.tool()
    @use_current_context
    def get_namespace_details(context_name: str, namespace: str):
        """
        Get detailed information about a specific namespace.
    
        Args:
            context_name: The Kubernetes context name
            namespace: The name of the namespace to get details for
    
        Returns:
            JSON string containing detailed information about the namespace
        """
        core_v1: CoreV1Api = get_api_clients(context_name)["core"]
    
        try:
            ns = core_v1.read_namespace(namespace)
    
            # Extract useful information
            result = {
                "name": ns.metadata.name,
                "status": ns.status.phase,
                "labels": ns.metadata.labels if ns.metadata.labels else {},
                "annotations": ns.metadata.annotations if ns.metadata.annotations else {},
                "created": ns.metadata.creation_timestamp.strftime(
                    "%Y-%m-%dT%H:%M:%SZ") if ns.metadata.creation_timestamp else None
            }
    
            return json.dumps(result)
        except ApiException as e:
            if e.status == 404:
                return json.dumps({"error": f"Namespace '{namespace}' not found"})
            else:
                return json.dumps({"error": f"API error: {str(e)}"})
  • server/server.py:14-14 (registration)
    Import statement in load_modules() function that loads the tools/namespace.py module, triggering the execution of @mcp.tool() decorators to register the get_namespace_details tool with the MCP server.
    import tools.namespace  # noqa: F401
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'Get detailed information' implies a read-only operation, it doesn't explicitly state whether this requires specific permissions, what format the JSON output contains, or any rate limits or constraints. For a Kubernetes tool with no annotation coverage, this leaves significant behavioral questions unanswered.

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

Conciseness4/5

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

The description is well-structured and appropriately sized. It starts with a clear purpose statement, then provides separate sections for Args and Returns. Each sentence serves a distinct purpose without redundancy. The only minor improvement would be integrating the parameter explanations more naturally rather than as separate labeled sections.

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?

Given the tool's moderate complexity (2 required parameters, no output schema, no annotations), the description provides basic but incomplete coverage. It explains what the tool does and what parameters mean, but lacks crucial context about when to use it versus siblings, what the JSON output contains, and behavioral constraints. For a Kubernetes namespace details tool, this leaves important gaps in understanding.

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

Parameters3/5

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

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description adds basic semantics by explaining that 'context_name' is 'The Kubernetes context name' and 'namespace' is 'The name of the namespace to get details for.' This clarifies what each parameter represents, but doesn't provide format examples, validation rules, or contextual usage guidance. Given the coverage gap, this provides moderate compensation.

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 tool's purpose: 'Get detailed information about a specific namespace.' This specifies the verb ('Get') and resource ('namespace'), making it easy to understand what the tool does. However, it doesn't differentiate from similar tools like 'list_namespaces' or 'get_namespace_resource_quota' among the many sibling tools, which prevents a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With numerous sibling tools including 'list_namespaces' and 'get_namespace_resource_quota', there's no indication of when this detailed view is appropriate versus listing namespaces or getting quota information specifically. The description only states what it does, not when to choose it.

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

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