liara_get_bucket_credentials
Retrieve S3-compatible credentials for accessing a specific bucket's object storage on the Liara cloud platform.
Instructions
Get S3-compatible credentials for a bucket
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the bucket |
Implementation Reference
- src/services/storage.ts:62-68 (handler)The core handler function that implements the tool logic by validating the bucket name and fetching S3-compatible credentials from the Liara API.export async function getBucketCredentials( client: LiaraClient, name: string ): Promise<BucketCredentials> { validateRequired(name, 'Bucket name'); return await client.get<BucketCredentials>(`/v1/buckets/${name}/credentials`); }
- src/api/types.ts:181-186 (schema)TypeScript interface defining the structure of the credentials object returned by the tool.export interface BucketCredentials { accessKey: string; secretKey: string; endpoint: string; bucket: string; }
- src/api/types.ts:174-179 (schema)TypeScript interface for Bucket details, used in related storage operations.export interface Bucket { _id: string; name: string; region: string; createdAt: string; }
- src/utils/errors.ts:54-58 (helper)Validation helper used in the handler to ensure bucket name is provided.export function validateRequired(value: any, fieldName: string): void { if (value === undefined || value === null || value === '') { throw new LiaraMcpError(`${fieldName} is required`); } }
- src/utils/errors.ts:134-154 (helper)Helper to unwrap API responses, though not directly used in this handler.export function unwrapApiResponse<T>(response: any, expectedArrayKeys?: string[]): T { if (!response) return response; // If it's already the expected type (array or primitive), return as-is if (Array.isArray(response)) { return response as T; } // Common wrapper keys that APIs use const arrayKeys = expectedArrayKeys || ['data', 'items', 'results', 'projects', 'databases', 'buckets', 'zones', 'records', 'backups', 'releases', 'domains', 'vms', 'plans']; // Try to unwrap from common wrapper keys for (const key of arrayKeys) { if (response[key] !== undefined) { return response[key] as T; } } // Return as-is if no wrapper found return response as T; }