liara_list_mail_servers
Retrieve and display all configured mail servers for managing email infrastructure on the Liara cloud platform.
Instructions
List all mail servers
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number (1-based) | |
| perPage | No | Number of items per page | |
| limit | No | Alternative to perPage: maximum number of items to return | |
| offset | No | Alternative to page: number of items to skip |
Implementation Reference
- src/services/mail.ts:32-43 (handler)Core handler function implementing liara_list_mail_servers tool logic. Calls Liara Mail API to list servers with pagination support./** * List all mail servers */ export async function listMailServers( client: LiaraClient, pagination?: PaginationOptions ): Promise<MailServer[]> { const mailClient = createMailClient(client); const params = paginationToParams(pagination); const response = await mailClient.get<any>('/v1/mails', params); return unwrapApiResponse<MailServer[]>(response, ['mails', 'mailServers', 'data', 'items']); }
- src/api/types.ts:287-293 (schema)Output schema: MailServer interface defining the structure of each mail server returned by the tool.export interface MailServer { _id: string; name: string; mode: 'DEV' | 'LIVE'; status: 'ACTIVE' | 'INACTIVE'; createdAt: string; }
- src/api/types.ts:22-27 (schema)Input schema: PaginationOptions for optional pagination parameters in list requests.export interface PaginationOptions { page?: number; perPage?: number; limit?: number; // Alternative to perPage offset?: number; // Alternative to page }
- src/services/mail.ts:11-30 (helper)Helper function to create a Mail-specific LiaraClient with correct baseURL and authentication.* Create a specialized Mail service client with the Mail API base URL */ 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', }); }