whois_as
Retrieve WHOIS information for Autonomous System Numbers (ASNs) to identify network ownership and registration details.
Instructions
Looksup whois information about the Autonomous System Number (ASN)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| asn | Yes |
Implementation Reference
- src/index.ts:78-91 (handler)The handler function for the 'whois_as' tool. It takes an ASN (as number), performs a WHOIS lookup using the external 'whoisAsn' function from 'whoiser' library, formats the result as text content, and handles errors appropriately.async ({ asn }) => { try { const result = await whoisAsn(asn); return { content: [{ type: 'text', text: `ASN whois lookup for: \n${JSON.stringify(result)}` }], }; } catch (err: unknown) { const error = err as Error; return { content: [{ type: 'text', text: `Error: ${error.message}` }], isError: true }; } }
- src/index.ts:77-77 (schema)Input schema for the 'whois_as' tool using Zod. Validates ASN as string matching 'AS' followed by digits (case-insensitive), then transforms it by removing 'AS' prefix and parsing to integer.{ asn: z.string().regex(/^AS\d+$/i).transform(s => parseInt(s.slice(2))) },
- src/index.ts:74-92 (registration)Registration of the 'whois_as' tool in the MCP server using server.tool(), including name, description, schema, and inline handler function.server.tool( 'whois_as', 'Looksup whois information about the Autonomous System Number (ASN)', { asn: z.string().regex(/^AS\d+$/i).transform(s => parseInt(s.slice(2))) }, async ({ asn }) => { try { const result = await whoisAsn(asn); return { content: [{ type: 'text', text: `ASN whois lookup for: \n${JSON.stringify(result)}` }], }; } catch (err: unknown) { const error = err as Error; return { content: [{ type: 'text', text: `Error: ${error.message}` }], isError: true }; } } );