get_k8s_resource_details
Retrieve Kubernetes resource manifests from RAD Security to analyze configurations and identify security risks in cloud environments.
Instructions
Get the latest manifest of a Kubernetes resource
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cluster_id | Yes | ID of the Kubernetes cluster | |
| resource_uid | Yes | Resource UID to get the details for |
Implementation Reference
- src/operations/kubeobject.ts:17-36 (handler)The handler function that executes the tool: fetches Kubernetes resource details from the API endpoint `/clusters/{clusterId}/resources/{resourceUid}/latest`, handles errors, and decodes the base64-encoded raw manifest.export async function getKubernetesResourceDetails( client: RadSecurityClient, clusterId: string, resourceUid: string ): Promise<any> { const details = await client.makeRequest( `/clusters/${clusterId}/resources/${resourceUid}/latest` ); if (!details) { throw new Error(`No details found for resource_uid: ${resourceUid} in cluster: ${clusterId}`); } // Decode the base64 raw manifest if (details.raw) { details.raw = Buffer.from(details.raw, 'base64').toString('utf-8'); } return details; }
- src/operations/kubeobject.ts:4-7 (schema)Zod schema for input validation: requires cluster_id and resource_uid.export const GetKubernetesResourceDetailsSchema = z.object({ cluster_id: z.string().describe("ID of the Kubernetes cluster"), resource_uid: z.string().describe("Resource UID to get the details for"), });
- src/index.ts:313-318 (registration)Tool registration in the listTools response: defines the tool name, description, and references the input schema.name: "get_k8s_resource_details", description: "Get the latest manifest of a Kubernetes resource", inputSchema: zodToJsonSchema( kubeobject.GetKubernetesResourceDetailsSchema ), },
- src/index.ts:1058-1071 (registration)Tool handler dispatch in the CallToolRequest switch statement: parses arguments using the schema and invokes the getKubernetesResourceDetails handler function.case "get_k8s_resource_details": { const args = kubeobject.GetKubernetesResourceDetailsSchema.parse( request.params.arguments ); const response = await kubeobject.getKubernetesResourceDetails( client, args.cluster_id, args.resource_uid ); return { content: [ { type: "text", text: JSON.stringify(response, null, 2) }, ], };