thealeph_batch_query_ptr
Query multiple PTR records in a single batch request to resolve IP addresses to hostnames efficiently.
Instructions
Query multiple PTR records in a single batch request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| queries | Yes | Array of query objects, each with optional ptr_record, ip, and/or asn |
Implementation Reference
- src/tools.js:563-595 (handler)Main handler function for 'thealeph_batch_query_ptr' tool. Validates input, calls the API client, processes results, and formats the markdown response.async batchQueryPTR(params) { try { const { queries } = params; if (!queries || queries.length === 0) { return 'β Please provide at least one query'; } const result = await this.client.batchQueryPTR(queries); let response = `π¦ Batch PTR Query Results (${queries.length} queries)\n\n`; if (Array.isArray(result)) { result.forEach((item, idx) => { response += `**Query ${idx + 1}:**\n`; if (item.ptr_record) response += ` - PTR: ${item.ptr_record}\n`; if (item.ip) response += ` - IP: ${item.ip}\n`; if (item.asn) response += ` - ASN: ${item.asn}\n`; if (item.location_info) { response += ` - Location: ${JSON.stringify(item.location_info)}\n`; } response += '\n'; }); } else { response += JSON.stringify(result, null, 2); } return response; } catch (error) { return `β Batch PTR query failed: ${error.message}`; } }
- src/tools.js:176-198 (schema)Input schema and metadata definition for the 'thealeph_batch_query_ptr' tool, used for MCP tool discovery.{ name: 'thealeph_batch_query_ptr', description: 'Query multiple PTR records in a single batch request', inputSchema: { type: 'object', properties: { queries: { type: 'array', description: 'Array of query objects, each with optional ptr_record, ip, and/or asn', items: { type: 'object', properties: { ptr_record: { type: 'string' }, ip: { type: 'string' }, asn: { type: 'integer' } } }, minItems: 1, maxItems: 100 } }, required: ['queries'] }
- src/tools.js:250-251 (registration)Registration of the tool handler in the executeTool switch statement dispatcher.case 'thealeph_batch_query_ptr': return this.batchQueryPTR(params);
- src/client.js:158-162 (helper)API client helper method that sends the batch PTR queries to the Aleph API endpoint '/api/batch_query'.async batchQueryPTR(queries) { return this.makeRequest('POST', '/api/batch_query', { data: { queries } }); }