Skip to main content
Glama
rad-security

RAD Security

Official
by rad-security

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
NameRequiredDescriptionDefault
cluster_idYesID of the Kubernetes cluster
resource_uidYesResource UID to get the details for

Implementation Reference

  • 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;
    }
  • 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) },
        ],
      };

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