Skip to main content
Glama

list_k8s_resources

Filter and list Kubernetes resources by namespace, resource types, or cluster using pagination for organized results in RAD Security's environment.

Instructions

List Kubernetes resources with optional filtering by namespace, resource types, and cluster

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cluster_idNoCluster ID to filter resources
kindsNoList of kinds to filter. Example: ['Deployment', 'ServiceAccount', 'Pod']
namespaceNoNamespace to filter resources
pageNoPage number for pagination
page_sizeNoNumber of items per page

Implementation Reference

  • The main handler function that implements the list_k8s_resources tool. It constructs query parameters from inputs and calls the RAD Security client API to list Kubernetes resources.
    export async function listKubernetesResources( client: RadSecurityClient, kinds: string[] | undefined, namespace?: string, clusterId?: string, page: number = 1, pageSize: number = 20 ): Promise<any> { const params: Record<string, any> = { page, page_size: pageSize, resource_types: kinds?.join(',') }; if (namespace) { params.namespace = namespace; } if (clusterId) { params.cluster_id = clusterId; } return client.makeRequest( `/accounts/${client.getAccountId()}/resources`, params ); }
  • Zod schema defining the input parameters and validation for the list_k8s_resources tool.
    export const ListKubernetesResourcesSchema = z.object({ namespace: z.string().optional().describe("Namespace to filter resources"), kinds: z.array(z.string()).optional().describe("List of kinds to filter. Example: ['Deployment', 'ServiceAccount', 'Pod']"), cluster_id: z.string().optional().describe("Cluster ID to filter resources"), page: z.number().optional().default(1).describe("Page number for pagination"), page_size: z.number().optional().default(20).describe("Number of items per page"), });
  • src/index.ts:214-217 (registration)
    Tool registration in the ListTools response, providing name, description, and input schema for list_k8s_resources.
    name: "list_k8s_resources", description: "List Kubernetes resources with optional filtering by namespace, resource types, and cluster", inputSchema: zodToJsonSchema(kubeobject.ListKubernetesResourcesSchema), },
  • src/index.ts:569-581 (registration)
    Dispatch case in the CallTool handler that routes list_k8s_resources calls to the implementation function after parsing arguments.
    case "list_k8s_resources": { const args = kubeobject.ListKubernetesResourcesSchema.parse(request.params.arguments); const response = await kubeobject.listKubernetesResources( client, args.kinds, args.namespace, args.cluster_id, args.page, args.page_size ); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], };

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/rad-security/mcp-server'

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