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
| Name | Required | Description | Default |
|---|---|---|---|
| mailId | Yes | The mail server ID |
Implementation Reference
- src/services/mail.ts:48-55 (handler)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}`); }
- src/api/types.ts:287-293 (schema)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; }
- src/services/mail.ts:13-30 (helper)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', }); }
- src/utils/errors.ts:54-58 (helper)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`); } }