get_k8s_resource_details
Retrieve the manifest of a Kubernetes resource using cluster ID and resource UID for precise details and security insights.
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 main handler function that fetches the latest Kubernetes resource manifest via the RAD Security client API, decodes base64 raw manifest, and returns the details.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 input schema defining cluster_id and resource_uid parameters for the tool.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:209-212 (registration)Tool registration in the listTools handler, defining name, description, and input schema.name: "get_k8s_resource_details", description: "Get the latest manifest of a Kubernetes resource", inputSchema: zodToJsonSchema(kubeobject.GetKubernetesResourceDetailsSchema), },
- src/index.ts:558-567 (handler)Dispatch handler in the CallToolRequest switch statement that parses arguments, calls the kubeobject handler, and formats the MCP response.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) }], };