Skip to main content
Glama

get-pod-metrics

Retrieve detailed performance metrics for a specific Kubernetes pod to monitor resource usage and analyze pod behavior within your cluster.

Instructions

Get detailed metrics for a pod

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
podYesThe name of the pod
namespaceNoThe namespace of the pod (optional, defaults to current context namespace)

Implementation Reference

  • The handler function for the 'get-pod-metrics' tool. It extracts the pod name and optional namespace from arguments, constructs a kubectl command to retrieve the resource specifications (requests/limits) for all containers in the pod using jsonpath and pipes to jq for formatting, executes it via execAsync, and returns the stdout as text content or an error message.
    case "get-pod-metrics": { const { pod, namespace } = args; const nsArg = namespace ? `-n ${namespace}` : ""; const cmd = `kubectl get pod ${pod} ${nsArg} -o jsonpath='{.spec.containers[*].resources}' | jq .`; const { stdout } = await execAsync(cmd); return { content: [{ type: "text", text: stdout || "Unable to get pod metrics" }] }; }
  • Input schema for the 'get-pod-metrics' tool, defining required 'pod' string parameter and optional 'namespace' string.
    inputSchema: { type: "object", properties: { pod: { type: "string", description: "The name of the pod" }, namespace: { type: "string", description: "The namespace of the pod (optional, defaults to current context namespace)" } }, required: ["pod"] }
  • server.js:1095-1111 (registration)
    Registration of the 'get-pod-metrics' tool in the tools array used by ListToolsRequestHandler. Includes name, description, and input schema.
    name: "get-pod-metrics", description: "Get detailed metrics for a pod", inputSchema: { type: "object", properties: { pod: { type: "string", description: "The name of the pod" }, namespace: { type: "string", description: "The namespace of the pod (optional, defaults to current context namespace)" } }, required: ["pod"] } },

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/thekaranpargaie/kube-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server