Skip to main content
Glama
NU-AquaLab

The Aleph MCP

by NU-AquaLab

thealeph_query_ptr

Query reverse DNS (PTR) records to retrieve network intelligence including ASN, location, and geo hints for IP addresses, hostnames, or ASN numbers.

Instructions

Query reverse DNS (PTR) records and retrieve network intelligence including ASN, location, and geo hints

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ptr_recordNoPTR record hostname to query
ipNoIP address to query
asnNoASN number to query

Implementation Reference

  • The handler function for 'thealeph_query_ptr' that validates input parameters, calls the API client to query PTR records, and formats a rich markdown response with results including PTR record, IP, ASN, location info, regex pattern, and geo hints.
    async queryPTR(params) { try { const { ptr_record, ip, asn } = params; if (!ptr_record && !ip && !asn) { return '❌ Please provide at least one of: ptr_record, ip, or asn'; } const result = await this.client.queryPTR(ptr_record, ip, asn); let response = 'πŸ”Ž PTR Query Results\n\n'; if (result.ptr_record) { response += `**PTR Record:** ${result.ptr_record}\n`; } if (result.ip) { response += `**IP Address:** ${result.ip}\n`; } if (result.asn) { response += `**ASN:** ${result.asn}\n`; } if (result.location_info) { response += `**Location Info:** ${JSON.stringify(result.location_info, null, 2)}\n`; } if (result.regular_expression) { response += `**Regex Pattern:** \`${result.regular_expression}\`\n`; } if (result.geo_hint) { response += `**Geo Hint:** ${JSON.stringify(result.geo_hint, null, 2)}\n`; } return response; } catch (error) { return `❌ PTR query failed: ${error.message}`; } }
  • The input schema and definition for the 'thealeph_query_ptr' tool, defining parameters ptr_record, ip, asn as optional.
    { name: 'thealeph_query_ptr', description: 'Query reverse DNS (PTR) records and retrieve network intelligence including ASN, location, and geo hints', inputSchema: { type: 'object', properties: { ptr_record: { type: 'string', description: 'PTR record hostname to query' }, ip: { type: 'string', description: 'IP address to query' }, asn: { type: 'integer', description: 'ASN number to query' } }, required: [] } },
  • src/tools.js:226-256 (registration)
    The executeTool dispatcher that registers and routes 'thealeph_query_ptr' to its handler via switch case.
    async executeTool(toolName, params = {}) { switch (toolName) { case 'thealeph_health_check': return this.healthCheck(params); case 'thealeph_current_stats': return this.currentStats(params); case 'thealeph_daily_stats': return this.dailyStats(params); case 'thealeph_summary_stats': return this.summaryStats(params); case 'thealeph_export_stats': return this.exportStats(params); case 'thealeph_asn_classifications': return this.asnClassifications(params); case 'thealeph_asn_regex': return this.asnRegex(params); case 'thealeph_asn_hints': return this.asnHints(params); case 'thealeph_asn_infrastructure_mapping': return this.asnInfrastructureMapping(params); case 'thealeph_asn_hint_mapping': return this.asnHintMapping(params); case 'thealeph_query_ptr': return this.queryPTR(params); case 'thealeph_batch_query_ptr': return this.batchQueryPTR(params); case 'thealeph_traceroute_mapper': return this.tracerouteMapper(params); default: throw new Error(`Unknown tool: ${toolName}`); }
  • API client helper method that constructs the POST request to The Aleph API '/api/query' endpoint with provided PTR, IP, or ASN parameters.
    async queryPTR(ptrRecord = null, ip = null, asn = null) { const data = {}; if (ptrRecord) data.ptr_record = ptrRecord; if (ip) data.ip = ip; if (asn) data.asn = asn; return this.makeRequest('POST', '/api/query', { data }); }
  • Generic HTTP request helper with retry logic used by all API calls, including queryPTR.
    async makeRequest(method, endpoint, options = {}) { for (let attempt = 1; attempt <= this.retryAttempts; attempt++) { try { const response = await this.axios.request({ method, url: endpoint, ...options }); return response.data; } catch (error) { if (attempt === this.retryAttempts) { throw error; } // Wait before retry (exponential backoff) await new Promise(resolve => setTimeout(resolve, this.retryDelay * Math.pow(2, attempt - 1)) ); } } }

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/NU-AquaLab/thealeph-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server