thealeph_query_ptr
Query PTR records to retrieve network intelligence including ASN, location, and geo hints for IP addresses or hostnames.
Instructions
Query reverse DNS (PTR) records and retrieve network intelligence including ASN, location, and geo hints
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ptr_record | No | PTR record hostname to query | |
| ip | No | IP address to query | |
| asn | No | ASN number to query |
Implementation Reference
- src/tools.js:522-558 (handler)The main handler function that processes input parameters, validates them, calls the API client, and formats the response with PTR query results including ASN, location, regex, 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}`; } }
- src/tools.js:154-175 (schema)The tool definition including name, description, and input schema specifying optional parameters ptr_record (string), ip (string), asn (integer).{ 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:248-249 (registration)The switch case in executeTool method that registers and dispatches the 'thealeph_query_ptr' tool call to its handler.case 'thealeph_query_ptr': return this.queryPTR(params);
- src/client.js:146-153 (helper)Supporting API client method that constructs the request payload and makes the HTTP POST to /api/query endpoint for PTR querying.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 }); }