Skip to main content
Glama

list_k8s_resources

List Kubernetes resources with optional filtering by namespace, resource types, and cluster to retrieve security insights and runtime data.

Instructions

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

Input Schema

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

Implementation Reference

  • The handler function that executes the tool logic: constructs query parameters and calls the RAD Security 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 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:319-326 (registration)
    Tool metadata registration in the listTools handler, including name, description, and input schema.
    { name: "list_k8s_resources", description: "List Kubernetes resources with optional filtering by namespace, resource types, and cluster", inputSchema: zodToJsonSchema( kubeobject.ListKubernetesResourcesSchema ), },
  • src/index.ts:1073-1089 (registration)
    Dispatch handler in the CallToolRequest switch statement that parses args and invokes the listKubernetesResources function.
    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