get_jobs
Retrieve all Kubernetes jobs from a specified namespace to monitor batch workloads and track execution status in your cluster.
Instructions
Get all jobs 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_jobs"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | No | default |
Implementation Reference
- kubernetes.py:86-94 (handler)Handler function for the 'get_jobs' MCP tool. Decorated with @mcp.tool() for registration. Executes kubectl get jobs -n {namespace} -o json, parses and returns the JSON output or an error dictionary.
@mcp.tool() async def get_jobs(namespace: str = "default") -> dict: """Get all jobs in the specified namespace""" try: cmd = ["kubectl", "get", "jobs", "-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 jobs: {str(e)}"}