Skip to main content
Glama

get_k8s_resource

Read-onlyIdempotent

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.

Input Schema

NameRequiredDescriptionDefault
nameNoOptional. The name of the resource to retrieve. If not specified, all resources of the given type are returned.
parentYesRequired. The cluster, which owns this collection of resources. Format: projects/{project}/locations/{location}/clusters/{cluster}
pageSizeNoOptional. 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.
namespaceNoOptional. The namespace of the resource. If not specified, all namespaces are searched.
pageTokenNoOptional. 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.
outputFormatNoOptional. 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.
resourceTypeYesRequired. The type of resource to retrieve. Kubernetes resource/kind name in singular form, lower case. e.g. "pod", "deployment", "service".
customColumnsNoOptional. 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.
fieldSelectorNoOptional. A field selector to filter resources.
labelSelectorNoOptional. A label selector to filter resources.

Output Schema

NameRequiredDescriptionDefault
errorsNoErrors encountered during retrieval.
outputNoThe 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.
nextPageTokenNoA token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / pageSize
      Added value: +{
      +  "description": "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.",
      +  "format": "int32",
      +  "type": "integer"
      +}
    • addedInput schema / properties / pageToken
      Added value: +{
      +  "description": "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.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / nextPageToken
      Added value: +{
      +  "description": "A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.",
      +  "type": "string"
      +}
  2. Changed3 schema fields changed
    • changedInput schema / properties / customColumns / description
      Previous value: -"Optional. The field mask to specify columns to display. Use a single \"*\" to get all fields. When both custom_columns and output_format are specified, output_format is ignored."New value: +"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."
    • removedInput schema / properties / customColumns / format
      Removed value: -"google-fieldmask"
    • removedInput schema / properties / customColumns / pattern
      Removed value: -"^(\\s*[^,\\s.]+(\\s*[,.]\\s*[^,\\s.]+)*)?$"
  3. Added

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false, so the safety profile is covered. The description's one behavioral claim, 'Returns the resources in YAML format,' is misleading: the schema says outputFormat defaults to TABLE and only produces YAML when explicitly requested. That inaccuracy actively misleads the agent about behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences, front-loaded with the core action and followed by scope and an analogy. Each sentence carries information, though the YAML sentence is both inaccurate and wasted space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present, the description need not explain return values, and the schema fully documents pagination and selectors. The remaining gap is sibling disambiguation and the incorrect output-format claim, but for a read-only getter the definition is largely sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all ten parameters are already documented with defaults, formats, and enum meanings. The description names only four filter dimensions (type, name, namespace, label selector) and adds no syntax or format detail beyond the schema, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Gets one or more Kubernetes resources from a cluster') and enumerates the filter dimensions. It does not, however, distinguish itself from close siblings like describe_k8s_resource or list_k8s_api_resources, leaving the agent to infer the boundary.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The analogy 'similar to running kubectl get' implies a listing/retrieval use case, which is helpful context. But there is no explicit when-to-use vs. when-not guidance, and no routing to the sibling that handles detailed single-resource inspection (describe_k8s_resource) or the delete/patch counterparts.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources