Skip to main content
Glama
NU-AquaLab

The Aleph MCP

by NU-AquaLab

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
NameRequiredDescriptionDefault
queriesYesArray of query objects, each with optional ptr_record, ip, and/or asn

Implementation Reference

  • 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}`;
      }
    }
  • 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);
  • 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 }
      });
    }

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