get_failing_pods
Identify pods with issues in a Kubernetes namespace to diagnose and resolve cluster problems efficiently.
Instructions
Get all pods with issues in the specified namespace
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_failing_pods"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | No | default |
Implementation Reference
- kubernetes.py:25-33 (handler)The handler function decorated with @mcp.tool(), implementing the logic to retrieve failing (non-Running phase) pods using kubectl in the specified namespace.
@mcp.tool() async def get_failing_pods(namespace: str = "default") -> dict: """Get all pods with issues in the specified namespace""" try: cmd = ["kubectl", "get", "pods", "-n", namespace, "--field-selector=status.phase!=Running", "-o", "json"] result = subprocess.run(cmd, capture_output=True, text=True, check=True) return json.loads(result.stdout) except subprocess.CalledProcessError as e: return {"error": f"Failed to get pods: {str(e)}"}