Skip to main content
Glama

role_create

Create Kubernetes Role objects with specific permissions in a namespace to control access to cluster resources.

Instructions

Create a Role in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Role name rules: List of policy rules

Returns: Status of the creation operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
rulesYes

Implementation Reference

  • The main handler function for the 'role_create' MCP tool. It is decorated with @mcp.tool() for registration and other decorators for context and permissions. The function creates a Kubernetes RBAC Role in the given namespace with the specified name and rules using the Kubernetes RBAC API.
    @mcp.tool()
    @use_current_context
    @check_readonly_permission
    def role_create(context_name: str, namespace: str, name: str, rules: list):
        """
        Create a Role in the specified namespace.
    
        Args:
            context_name: The Kubernetes context name
            namespace: The Kubernetes namespace
            name: The Role name
            rules: List of policy rules
    
        Returns:
            Status of the creation operation
        """
        rbac_v1: RbacAuthorizationV1Api = get_api_clients(context_name)["rbac"]
        role = V1Role(
            metadata=V1ObjectMeta(name=name),
            rules=[V1PolicyRule(**rule) for rule in rules]
        )
        created_role = rbac_v1.create_namespaced_role(namespace=namespace, body=role)
        return {"name": created_role.metadata.name, "status": "Created"}
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. It states 'Create a Role' and mentions a return value ('Status of the creation operation'), but lacks critical behavioral details: required permissions, whether creation is idempotent, error conditions (e.g., duplicate names), or side effects. For a mutation tool with zero annotation coverage, this is insufficient.

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 front-loads the purpose in one sentence, followed by a clear 'Args' and 'Returns' section. Every sentence earns its place, with no redundant information. Minor improvement could be made by integrating the sections more seamlessly, but it's highly efficient.

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

Completeness2/5

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

Given the complexity (Kubernetes role creation), lack of annotations, no output schema, and 0% schema description coverage, the description is incomplete. It doesn't explain what a 'Role' is, the format of 'rules', potential errors, or the meaning of the return 'Status'. For a tool with significant context, this leaves too many gaps for effective agent use.

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?

Schema description coverage is 0%, so the description must compensate. It lists all 4 parameters with brief explanations, adding meaning beyond the bare schema (e.g., 'context_name: The Kubernetes context name'). However, it doesn't explain the structure of 'rules' (policy rules) or provide examples, leaving some ambiguity. Since it documents all parameters, it scores above baseline but not perfectly.

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 ('Create') and resource ('a Role in the specified namespace'), making the purpose unambiguous. It distinguishes from siblings like 'clusterrole_create' by specifying 'Role' (namespace-scoped) vs 'ClusterRole' (cluster-scoped). However, it doesn't explicitly contrast with other creation tools (e.g., 'deployment_create'), 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?

No guidance is provided on when to use this tool versus alternatives. While the name implies creation, there's no mention of prerequisites (e.g., needing proper permissions), when to use 'role_create' vs 'clusterrole_create', or what happens if a role with the same name already exists. The description lacks any contextual usage instructions.

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