Skip to main content
Glama
badchars

osint-mcp-server

by badchars

bgp_asn

Retrieve ASN details, including name, description, contacts, and all announced IPv4/IPv6 prefixes, using BGPView.

Instructions

Look up ASN details and announced IPv4/IPv6 prefixes via BGPView. Returns ASN name, description, contacts, and all announced prefixes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
asnYesAutonomous System Number (e.g. 13335)

Implementation Reference

  • The main handler function `bgpAsn` that implements the tool logic: fetches ASN details and prefixes from BGPView API, with caching (30 min TTL) and rate limiting (2s interval).
    export async function bgpAsn(asn: number): Promise<BgpAsnResult> {
      const key = `asn:${asn}`;
      const cached = cache.get(key);
      if (cached) return cached;
    
      const [info, prefixes] = await Promise.all([
        bgpFetch(`/asn/${asn}`),
        bgpFetch(`/asn/${asn}/prefixes`),
      ]);
    
      const result: BgpAsnResult = {
        asn: info.asn,
        name: info.name ?? "",
        description: info.description_short ?? info.description_full ?? "",
        countryCode: info.country_code ?? "",
        emailContacts: info.email_contacts ?? [],
        abuseContacts: info.abuse_contacts ?? [],
        website: info.website,
        ipv4Prefixes: (prefixes.ipv4_prefixes ?? []).map((p: any) => ({
          prefix: p.prefix, name: p.name, description: p.description, countryCode: p.country_code,
        })),
        ipv6Prefixes: (prefixes.ipv6_prefixes ?? []).map((p: any) => ({
          prefix: p.prefix, name: p.name, description: p.description, countryCode: p.country_code,
        })),
      };
    
      cache.set(key, result);
      return result;
    }
  • The `BgpAsnResult` interface defines the schema/return type for the ASN lookup: ASN number, name, description, country code, contacts, IPv4 and IPv6 prefixes.
    interface BgpAsnResult {
      asn: number;
      name: string;
      description: string;
      countryCode: string;
      emailContacts: string[];
      abuseContacts: string[];
      website?: string;
      ipv4Prefixes: { prefix: string; name: string; description: string; countryCode: string }[];
      ipv6Prefixes: { prefix: string; name: string; description: string; countryCode: string }[];
    }
  • The tool registration in `src/protocol/tools.ts`: defines the tool name `bgp_asn`, description, input schema (z.number() for 'asn'), and wires execution to the `bgpAsn` handler.
    const bgpAsnTool: ToolDef = {
      name: "bgp_asn",
      description: "Look up ASN details and announced IPv4/IPv6 prefixes via BGPView. Returns ASN name, description, contacts, and all announced prefixes.",
      schema: {
        asn: z.number().describe("Autonomous System Number (e.g. 13335)"),
      },
      execute: async (args) => json(await bgpAsn(args.asn as number)),
    };
  • The tool is included in the exported tools array (line 516), making it available in the MCP tool list.
    bgpAsnTool,
    bgpIpTool,
    bgpPrefixTool,
  • src/index.ts:31-31 (registration)
    Registration in the main `src/index.ts` file as part of the 'BGP / ASN' tool category listing.
    { label: "BGP / ASN", env: null, tools: ["bgp_asn", "bgp_ip", "bgp_prefix"] },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool performs a lookup and returns specific fields, but omits potential behavioral traits such as rate limits, authentication requirements, data freshness, or error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences efficiently convey the tool's purpose, source, and output. No extraneous information; each word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple lookup tool with one parameter and no output schema, the description adequately covers the main functionality and return fields. It could note potential limits on prefix lists, but overall is sufficiently complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with a clear description for the sole parameter 'asn'. The description adds no additional semantic value beyond what the schema already provides, meeting the baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action (look up) and resource (ASN details and announced prefixes), and specifies the source (BGPView). It distinguishes itself from siblings like bgp_ip and bgp_prefix by focusing on ASN-level data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when needing ASN details or prefixes, but does not explicitly state when to use versus alternatives like bgp_ip or bgp_prefix, nor provide any exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/badchars/osint-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server