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)
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"asn": "<asn>"
},
"name": "whois_as"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| asn | Yes |
Implementation Reference
- src/index.ts:78-91 (handler)Handler function for the 'whois_as' MCP tool that performs whois lookup for an ASN by calling whoisAsn(asn) and formatting the result as text content.
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 to validate and parse the ASN parameter.
{ 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 on the MCP server using server.tool() with name, description, schema, and handler.
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 }; } } );