Skip to main content
Glama

liara_get_database

Retrieve configuration details and status information for a specific database on the Liara cloud platform using its name.

Instructions

Get details of a specific database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name of the database

Implementation Reference

  • Handler function that fetches specific database details from Liara API, matching the liara_get_database tool purpose for checking database status.
    export async function getDatabase(
        client: LiaraClient,
        name: string
    ): Promise<Database> {
        validateRequired(name, 'Database name');
        return await client.get<Database>(`/v1/databases/${name}`);
    }
  • Type schema for Database object returned by the getDatabase function.
    export interface Database {
        _id: string;
        name: string;
        type: DatabaseType;
        planID: string;
        status: DatabaseStatus;
        version?: string;
        createdAt: string;
        updatedAt: string;
    }
  • Core API call logic for retrieving database information.
        validateRequired(name, 'Database name');
        return await client.get<Database>(`/v1/databases/${name}`);
    }
  • Extended helper for getting database connection info, referenced indirectly via status check.
    export async function getDatabaseConnection(
        client: LiaraClient,
        databaseName: string
    ): Promise<DatabaseConnectionInfo> {
        validateRequired(databaseName, 'Database name');
        
        const warnings: string[] = [];
        let dbDetails: DatabaseDetails | null = null;
        
        // Try primary endpoint: /v1/databases/{name}
        try {
            dbDetails = await client.get<DatabaseDetails>(`/v1/databases/${databaseName}`);
        } catch (error: any) {
            const { LiaraMcpError } = await import('../utils/errors.js');
            throw new LiaraMcpError(
                `Failed to fetch database details: ${error.message}`,
                'DATABASE_FETCH_ERROR',
                { databaseName, error: error.message },
                [
                    'Verify the database name is correct',
                    'Check if the database exists',
                    'Ensure you have permission to access this database'
                ]
            );
        }
        
        // Try alternative endpoint for connection info if primary doesn't have password
        let connectionInfo: DatabaseDetails | null = null;
        if (!dbDetails.password && !dbDetails.rootPassword && !dbDetails.connectionString) {
            try {
                // Some APIs have a separate connection endpoint
                connectionInfo = await client.get<DatabaseDetails>(
                    `/v1/databases/${databaseName}/connection`
                );
            } catch (error: any) {
                // This endpoint might not exist, that's okay
                warnings.push('Connection-specific endpoint not available, using database details');
            }
        }
        
        // Merge connection info if available
        if (connectionInfo) {
            dbDetails = {
                ...dbDetails,
                ...connectionInfo,
                connection: connectionInfo.connection || dbDetails.connection,
            };
        }
        
        // Extract connection info from nested connection object if present
        if (dbDetails.connection) {
            dbDetails = {
                ...dbDetails,
                hostname: dbDetails.connection.host || dbDetails.hostname,
                port: dbDetails.connection.port || dbDetails.port,
                username: dbDetails.connection.username || dbDetails.username,
                password: dbDetails.connection.password || dbDetails.password,
                database: dbDetails.connection.database || dbDetails.database,
            };
        }
        
        // Validate we have minimum required fields
        const host = dbDetails.hostname || dbDetails.host || dbDetails.internalHostname;
        if (!host) {
            const { LiaraMcpError } = await import('../utils/errors.js');
            throw new LiaraMcpError(
                'Database connection info missing host',
                'INCOMPLETE_CONNECTION_INFO',
                { databaseName, dbDetails },
                [
                    'Verify the database exists and is accessible',
                    'Check if the database is running',
                    'Use liara_get_database to check database status',
                    'The database may need to be started first'
                ]
            );
        }
        
        // Extract password with better fallback logic
        const password = dbDetails.password || 
                        dbDetails.rootPassword || 
                        (dbDetails.connection?.password) || 
                        '';
        
        const passwordAvailable = !!password;
        
        if (!passwordAvailable) {
            warnings.push(
                'Password not returned by API. You may need to:',
                '1. Check the dashboard connection tab for the password',
                '2. Reset the password using liara_reset_database_password',
                '3. Use the password that was shown when the database was created'
            );
        }
        
        // Extract username with better defaults based on database type
        let username = dbDetails.username || 
                      dbDetails.user || 
                      (dbDetails.connection?.username);
        
        // Set default username based on database type if not provided
        if (!username) {
            switch (dbDetails.type) {
                case 'postgres':
                    username = 'postgres';
                    break;
                case 'redis':
                    username = 'default'; // Redis often doesn't use usernames
                    break;
                default:
                    username = 'root';
            }
            warnings.push(`Username not provided, using default: ${username}`);
        }
        
        // Build connection info
        const connectionInfoResult: DatabaseConnectionInfo = {
            host,
            port: dbDetails.port || getDefaultPort(dbDetails.type),
            username,
            password,
            database: dbDetails.database || dbDetails.name || databaseName,
            connectionString: dbDetails.connectionString || buildConnectionString({
                ...dbDetails,
                username,
                password,
            }),
            passwordAvailable,
            warnings: warnings.length > 0 ? warnings : undefined,
        };
        
        return connectionInfoResult;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states a read operation ('Get details'), implying it's likely non-destructive, but doesn't confirm safety, permissions required, rate limits, or error conditions. For a tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core action ('Get details'), making it easy to parse. Every part of the sentence earns its place by clarifying the scope ('of a specific database').

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on usage, behavioral traits, or output format. For a simple read tool, this might suffice, but it doesn't provide a complete picture for reliable agent invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'name' parameter fully documented. The description adds no additional semantic context beyond implying retrieval by name. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('details of a specific database'), making the purpose evident. It distinguishes from sibling tools like 'liara_list_databases' by specifying retrieval of a single database rather than listing. However, it doesn't explicitly contrast with other 'get' tools (e.g., 'liara_get_database_connection'), so it's not fully differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a database name), contrast with 'liara_list_databases' for discovery, or specify use cases like checking status or configuration. Without such context, the agent must infer usage from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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