Skip to main content
Glama

liara_list_dns_records

Retrieve and view DNS records for a specific zone to manage domain configurations and troubleshoot connectivity issues.

Instructions

List DNS records for a zone

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
zoneIdYesThe zone ID
pageNoPage number (1-based)
perPageNoNumber of items per page
limitNoAlternative to perPage: maximum number of items to return
offsetNoAlternative to page: number of items to skip

Implementation Reference

  • The core handler function for listing DNS records in a Liara DNS zone. This implements the logic for the 'liara_list_dns_records' tool by calling the Liara API endpoint /v1/zones/{zoneId}/records.
    export async function listRecords(
        client: LiaraClient,
        zoneId: string,
        pagination?: PaginationOptions
    ): Promise<DnsRecord[]> {
        validateRequired(zoneId, 'Zone ID');
        const params = paginationToParams(pagination);
        const response = await client.get<any>(`/v1/zones/${zoneId}/records`, params);
        return unwrapApiResponse<DnsRecord[]>(response, ['records', 'data', 'items']);
    }
  • Type definitions for DNS records (output) and related types used by the DNS listing tool.
    export interface DnsRecord {
        _id: string;
        zoneID: string;
        type: DnsRecordType;
        name: string;
        value: string;
        ttl: number;
        priority?: number;
    }
  • Input schema for pagination options accepted by the list DNS records handler.
    export interface PaginationOptions {
        page?: number;
        perPage?: number;
        limit?: number; // Alternative to perPage
        offset?: number; // Alternative to page
    }
  • Helper function to unwrap paginated/list API responses, used in the DNS records listing 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;
    }
  • Liara API client class used by the DNS service handlers to make authenticated API calls.
    export class LiaraClient {
        private client: AxiosInstance;
        private teamId?: string;
        private maxRetries: number;
        private retryDelay: number;
    
        constructor(config: LiaraClientConfig) {
            const baseURL = config.baseURL || process.env.LIARA_API_BASE_URL || 'https://api.iran.liara.ir';
    
            this.client = axios.create({
                baseURL,
                headers: {
                    'Authorization': `Bearer ${config.apiToken}`,
                    'Content-Type': 'application/json',
                },
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