create-container-registry-auth
Creates authentication credentials (name, username, password) for a container registry to enable private image access.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name for the container registry auth | |
| username | Yes | Registry username | |
| password | Yes | Registry password |
Implementation Reference
- src/index.ts:1382-1406 (handler)Handler for 'create-container-registry-auth' tool. Sends a POST request to /containerregistryauth with name, username, and password parameters.
// Create Container Registry Auth server.tool( 'create-container-registry-auth', { name: z.string().describe('Name for the container registry auth'), username: z.string().describe('Registry username'), password: z.string().describe('Registry password'), }, async (params) => { const result = await runpodRequest( '/containerregistryauth', 'POST', params ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } ); - src/index.ts:1385-1389 (schema)Input schema for the tool: name (string), username (string), password (string) - all required with descriptions.
{ name: z.string().describe('Name for the container registry auth'), username: z.string().describe('Registry username'), password: z.string().describe('Registry password'), }, - src/index.ts:1383-1406 (registration)Registration of the tool via server.tool() with the name 'create-container-registry-auth'.
server.tool( 'create-container-registry-auth', { name: z.string().describe('Name for the container registry auth'), username: z.string().describe('Registry username'), password: z.string().describe('Registry password'), }, async (params) => { const result = await runpodRequest( '/containerregistryauth', 'POST', params ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } ); - src/index.ts:60-99 (helper)The runpodRequest helper function used by the handler to make authenticated API requests to the RunPod API.
async function runpodRequest( endpoint: string, method: string = 'GET', body?: Record<string, unknown> ) { const url = `${API_BASE_URL}${endpoint}`; const headers = { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }; const options: NodeFetchRequestInit = { method, headers, }; if (body && (method === 'POST' || method === 'PATCH')) { options.body = JSON.stringify(body); } try { const response = await fetch(url, options); if (!response.ok) { const errorText = await response.text(); throw new Error(`RunPod API Error: ${response.status} - ${errorText}`); } // Some endpoints might not return JSON const contentType = response.headers.get('content-type'); if (contentType && contentType.includes('application/json')) { return await response.json(); } return { success: true, status: response.status }; } catch (error) { console.error('Error calling RunPod API:', error); throw error; } }