get_events
Retrieve Kubernetes events from a specific namespace to monitor cluster activity and troubleshoot issues.
Instructions
Get the events of a specific namespace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | No | default |
Implementation Reference
- kubernetes.py:169-178 (handler)The main handler function for the 'get_events' tool. It is decorated with @mcp.tool() which registers it with the FastMCP server. The function executes 'kubectl get events' in the specified namespace, parses the JSON output, and returns it or an error dictionary.@mcp.tool() async def get_events(namespace: str = "default") -> dict: """Get the events of a specific namespace""" try: cmd = ["kubectl", "get", "events", "-n", namespace, "-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 events: {str(e)}"}