thealeph_batch_query_ptr
Query multiple PTR records in a single batch request to resolve IP addresses, hostnames, and ASN data for network analysis.
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)Primary handler function for thealeph_batch_query_ptr tool. Validates input, invokes the API client, formats results into a readable 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-199 (schema)JSON Schema definition for the tool, specifying input parameters for batch PTR queries with validation rules.{ 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:227-257 (registration)Tool dispatch registration in executeTool method's switch statement, mapping tool name to handler.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}`); } }
- src/tools.js:176-220 (registration)Tool registration in getToolDefinitions() array returned to MCP server for 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'] } }, { name: 'thealeph_traceroute_mapper', description: 'Enrich traceroute hops with network intelligence including ASN, PTR records, and geographic locations', inputSchema: { type: 'object', properties: { traceroute: { type: 'string', description: 'Traceroute output as a string' }, mode: { type: 'string', description: 'Traceroute format mode', enum: ['string', 'RIPE'], default: 'string' } }, required: ['traceroute'] } } ];
- src/client.js:158-162 (helper)Supporting API client method that performs the HTTP POST request to the backend batch_query endpoint.async batchQueryPTR(queries) { return this.makeRequest('POST', '/api/batch_query', { data: { queries } }); }