get_k8s_resource
Gets one or more Kubernetes resources from a cluster. Resources can be filtered by type, name, namespace, and label selectors. Returns the resources in YAML format. This is similar to running kubectl get.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"parent": "<parent>",
"resourceType": "<resourceType>"
},
"name": "get_k8s_resource"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Optional. The name of the resource to retrieve. If not specified, all resources of the given type are returned. | |
| parent | Yes | Required. The cluster, which owns this collection of resources. Format: projects/{project}/locations/{location}/clusters/{cluster} | |
| pageSize | No | Optional. The maximum number of resources to return. If not specified, 500 is used. The maximum value is 1000; values above 1000 will be coerced to 1000. | |
| namespace | No | Optional. The namespace of the resource. If not specified, all namespaces are searched. | |
| pageToken | No | Optional. A page token, received from a previous `GetK8SResource` call. Provide this to retrieve the subsequent page of resources when listing resources. Cannot be used when `name` is specified. | |
| outputFormat | No | Optional. The output format. One of: (table, wide, yaml, json). If not specified, defaults to table. When both custom_columns and output_format are specified, output_format is ignored. | |
| resourceType | Yes | Required. The type of resource to retrieve. Kubernetes resource/kind name in singular form, lower case. e.g. "pod", "deployment", "service". | |
| customColumns | No | Optional. Custom columns to display in table output. Accepts either kubectl custom-columns format (e.g., "NAME:.metadata.name,IMAGE:.spec.containers[*].image") or comma-separated field names (e.g., "metadata.name,spec.replicas"). When both custom_columns and output_format are specified, output_format is ignored. | |
| fieldSelector | No | Optional. A field selector to filter resources. | |
| labelSelector | No | Optional. A label selector to filter resources. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| errors | No | Errors encountered during retrieval. | |
| output | No | The output of the command in the requested format. It may contain resources in YAML or JSON format, or a table in plain text, or errors. | |
| nextPageToken | No | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |