exec_in_pod
Execute a command in a Kubernetes pod and return its output. Uses an array format for secure, direct execution without shell interpretation.
Instructions
Execute a command in a Kubernetes pod or container and return the output. Command must be an array of strings where the first element is the executable and remaining elements are arguments. This executes directly without shell interpretation for security.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the pod to execute the command in | |
| namespace | No | Kubernetes namespace | default |
| command | Yes | Command to execute as an array of strings (e.g. ["ls", "-la", "/app"]). First element is the executable, remaining are arguments. Shell operators like pipes, redirects, or command chaining are not supported - use explicit array format for security. | |
| container | No | Container name (required when pod has multiple containers) | |
| timeout | No | Timeout for command - 60000 milliseconds if not specified | |
| context | No | Kubeconfig Context to use for the command (optional - defaults to null) |
Implementation Reference
- The Zod response schema 'ExecInPodResponseSchema' validating the return type (array of content with type and text).
export const ExecInPodResponseSchema = z.object({ content: z.array(ToolResponseContent), });