cr_list_images
Retrieve a list of container images stored in a given namespace and region of the IBM Cloud Container Registry.
Instructions
List container images in the registry
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | No | ||
| region | No |
Implementation Reference
- The handler function for the cr_list_images tool. It makes a GET request to the Container Registry API /v1/images endpoint, passing an optional namespace query parameter and the account ID header.
server.tool("cr_list_images", "List container images in the registry", { namespace: z.string().optional(), region: z.string().optional(), }, async (p) => safeTool(async () => { const accountId = await acct(); return client.request(`${api(p.region||r)}/v1/images`, {headers:{"Account":accountId},queryParams:{namespace:p.namespace}}); })); - Input schema for cr_list_images defined inline using Zod: optional 'namespace' and 'region' string parameters.
namespace: z.string().optional(), region: z.string().optional(), - src/tools/container-registry/index.ts:35-35 (registration)Tool registration via server.tool() at line 35 in src/tools/container-registry/index.ts. Called from src/server.ts line 86 via registerContainerRegistryTools().
server.tool("cr_list_images", "List container images in the registry", { - src/config.ts:26-27 (helper)Endpoint helper: CONTAINER_REGISTRY_API builds the API base URL (e.g. https://us-south.icr.io/api) that is used by the handler.
export const IBM_ENDPOINTS = { IAM: "https://iam.cloud.ibm.com", - src/lib/utils.ts:70-77 (helper)The safeTool helper wraps the handler to catch errors and return proper MCP success/error responses.
export async function safeTool<T>(fn: () => Promise<T>): Promise<ReturnType<typeof successContent> | ReturnType<typeof errorContent>> { try { const result = await fn(); return successContent(result); } catch (error) { return errorContent(error); } }