Skip to main content
Glama

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
NameRequiredDescriptionDefault
nameYesThe name of the bucket

Implementation Reference

  • 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`);
    }
  • TypeScript interface defining the structure of the credentials object returned by the tool.
    export interface BucketCredentials {
        accessKey: string;
        secretKey: string;
        endpoint: string;
        bucket: string;
    }
  • TypeScript interface for Bucket details, used in related storage operations.
    export interface Bucket {
        _id: string;
        name: string;
        region: string;
        createdAt: string;
    }
  • 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`);
        }
    }
  • 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;
    }
Install Server

Other Tools

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/razavioo/liara-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server