resource_list_keys
Retrieve resource keys (credentials) for IBM Cloud resources. Filter results by resource instance ID and set a limit on the number of keys returned.
Instructions
List resource keys (credentials)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resource_instance_id | No | Filter by resource instance | |
| limit | No |
Implementation Reference
- The handler function for resource_list_keys tool. Makes a GET request to the Resource Controller API's /resource_keys endpoint, filtering by optional resource_instance_id and limiting results (default 100). Wrapped in safeTool for error handling.
server.tool("resource_list_keys", "List resource keys (credentials)", { resource_instance_id: z.string().optional().describe("Filter by resource instance"), limit: z.number().optional(), }, async (p) => safeTool(() => client.get(`${base}/resource_keys`, { resource_instance_id:p.resource_instance_id, limit:p.limit||100, }))); - Input schema for resource_list_keys: two optional parameters - resource_instance_id (string) to filter by instance, and limit (number) for pagination.
resource_instance_id: z.string().optional().describe("Filter by resource instance"), limit: z.number().optional(), - src/server.ts:16-77 (registration)Import of the registration function that registers the resource_list_keys tool.
import { registerResourceManagementTools } from "./tools/resource-management/index.js"; import { registerBillingTools } from "./tools/billing/index.js"; import { registerSchematicsTools } from "./tools/schematics/index.js"; import { registerContainerRegistryTools } from "./tools/container-registry/index.js"; import { registerCloudFoundryTools } from "./tools/cloud-foundry/index.js"; import { registerCatalogTools } from "./tools/catalog/index.js"; import { registerObservabilityTools } from "./tools/observability/index.js"; /** * Create and configure the IBM Cloud MCP Server with all tools registered. */ export function createServer(config: ServerConfig): McpServer { // Initialize the MCP server const server = new McpServer({ name: "ibm-cloud-mcp-server", version: "1.0.0", }); // Initialize auth and API client const auth = new IAMAuthManager(config.apiKey); const client = new IBMCloudAPIClient(auth); // Override account ID if provided in config if (config.accountId) { // Pre-set the account ID so we don't need to decode JWT // The auth manager will still decode from token if this is empty } const writeMode = config.allowWrite ? "ENABLED" : "DISABLED (read-only)"; console.error(`[IBM Cloud MCP] Region: ${config.region}`); console.error(`[IBM Cloud MCP] Write operations: ${writeMode}`); console.error(`[IBM Cloud MCP] Registering tools...`); // ─── Register all tool domains ──────────────────────────────── registerIAMTools(server, client, config); console.error(` ✓ IAM & Identity (18 tools)`); registerVPCTools(server, client, config); console.error(` ✓ VPC Infrastructure (35 tools)`); registerKubernetesTools(server, client, config); console.error(` ✓ Kubernetes (14 tools)`); registerCOSTools(server, client, config); console.error(` ✓ Cloud Object Storage (12 tools)`); registerCodeEngineTools(server, client, config); console.error(` ✓ Code Engine (16 tools)`); registerDatabaseTools(server, client, config); console.error(` ✓ Databases (10 tools)`); registerWatsonTools(server, client, config); console.error(` ✓ Watson AI (8 tools)`); registerNetworkingTools(server, client, config); console.error(` ✓ Networking (12 tools)`); registerSecurityTools(server, client, config); console.error(` ✓ Security (12 tools)`); registerResourceManagementTools(server, client, config); - src/server.ts:77-78 (registration)Invocation of registerResourceManagementTools which registers resource_list_keys (and other resource management tools) on the MCP server.
registerResourceManagementTools(server, client, config); console.error(` ✓ Resource Management (10 tools)`); - src/lib/api-client.ts:128-147 (helper)The client.get() method used by the handler to make the authenticated HTTP GET request to the Resource Controller API.
async get<T = unknown>(url: string, queryParams?: Record<string, string | number | boolean | undefined>): Promise<T> { return this.request<T>(url, { method: "GET", queryParams }); } async post<T = unknown>(url: string, body?: unknown, queryParams?: Record<string, string | number | boolean | undefined>): Promise<T> { return this.request<T>(url, { method: "POST", body, queryParams }); } async put<T = unknown>(url: string, body?: unknown, queryParams?: Record<string, string | number | boolean | undefined>): Promise<T> { return this.request<T>(url, { method: "PUT", body, queryParams }); } async patch<T = unknown>(url: string, body?: unknown, queryParams?: Record<string, string | number | boolean | undefined>): Promise<T> { return this.request<T>(url, { method: "PATCH", body, queryParams }); } async delete<T = unknown>(url: string, queryParams?: Record<string, string | number | boolean | undefined>): Promise<T> { return this.request<T>(url, { method: "DELETE", queryParams }); }