Skip to main content
Glama

liara_get_mail_server

Retrieve mail server configuration details including settings and status for managing email infrastructure on the Liara cloud platform.

Instructions

Get details of a mail server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mailIdYesThe mail server ID

Implementation Reference

  • The core handler function that implements the logic to retrieve a specific mail server details from the Liara Mail API using the provided mail server ID.
    export async function getMailServer(
        client: LiaraClient,
        mailId: string
    ): Promise<MailServer> {
        validateRequired(mailId, 'Mail server ID');
        const mailClient = createMailClient(client);
        return await mailClient.get<MailServer>(`/v1/mails/${mailId}`);
    }
  • Type definition for the MailServer object, used as the return type for the getMailServer function.
    export interface MailServer {
        _id: string;
        name: string;
        mode: 'DEV' | 'LIVE';
        status: 'ACTIVE' | 'INACTIVE';
        createdAt: string;
    }
  • Helper function that creates a specialized LiaraClient instance configured for the Mail service API endpoint.
    function createMailClient(client: LiaraClient): LiaraClient {
        // Access the internal client to get the API token
        const internalClient = (client as any).client;
        const apiToken = internalClient?.defaults?.headers?.Authorization?.replace('Bearer ', '') || 
                         process.env.LIARA_API_TOKEN;
        const teamId = (client as any).teamId || process.env.LIARA_TEAM_ID;
    
        if (!apiToken) {
            throw new Error('API token is required for Mail operations');
        }
    
        // Create new client with Mail service base URL
        return new LiaraClient({
            apiToken,
            teamId,
            baseURL: 'https://mail-service.liara.ir/api',
        });
    }
  • Validation helper used in the handler to ensure mailId is provided.
    export function validateRequired(value: any, fieldName: string): void {
        if (value === undefined || value === null || value === '') {
            throw new LiaraMcpError(`${fieldName} is required`);
        }
    }
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