serviceaccount_delete
Remove a Kubernetes ServiceAccount from a specified namespace using the k8s-pilot MCP server. Input context name, namespace, and ServiceAccount name to execute the deletion and receive status.
Instructions
Delete a ServiceAccount from the specified namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ServiceAccount name
Returns: Status of the deletion operation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/serviceaccount.py:74-91 (handler)The main handler function for the 'serviceaccount_delete' tool. It deletes the specified ServiceAccount in the given namespace using the Kubernetes CoreV1Api.@mcp.tool() @use_current_context @check_readonly_permission def serviceaccount_delete(context_name: str, namespace: str, name: str): """ Delete a ServiceAccount from the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ServiceAccount name Returns: Status of the deletion operation """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] core_v1.delete_namespaced_service_account(name=name, namespace=namespace) return {"name": name, "status": "Deleted"}
- server/server.py:23-23 (registration)The import statement in load_modules() that loads the serviceaccount.py module, triggering the @mcp.tool() decorator to register the 'serviceaccount_delete' tool.import tools.serviceaccount # noqa: F401