Skip to main content
Glama
badchars

osint-mcp-server

by badchars

bgp_ip

Retrieve BGP routing information for an IP address, revealing matching prefixes, autonomous system numbers, and regional internet registry allocation.

Instructions

Look up BGP routing information for an IP address. Returns matching prefixes, ASNs, and RIR allocation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYesIP address to look up

Implementation Reference

  • The main handler function `bgpIp` that looks up BGP routing information for an IP address. It calls the BGPView API at `/ip/{ip}`, maps the response to include prefixes (with ASN, name, description, country code) and RIR allocation info, and caches results for 30 minutes.
    export async function bgpIp(ip: string): Promise<BgpIpResult> {
      const key = `ip:${ip}`;
      const cached = cache.get(key);
      if (cached) return cached;
    
      const data = await bgpFetch(`/ip/${ip}`);
    
      const result: BgpIpResult = {
        ip,
        prefixes: (data.prefixes ?? []).map((p: any) => ({
          prefix: p.prefix, asn: p.asn?.asn, name: p.name, description: p.description, countryCode: p.country_code,
        })),
        rir: data.rir_allocation?.rir_name ?? "",
      };
    
      cache.set(key, result);
      return result;
    }
  • The `BgpIpResult` interface defining the shape of the response: ip, prefixes (prefix, asn, name, description, countryCode), and rir.
    interface BgpIpResult {
      ip: string;
      prefixes: { prefix: string; asn: number; name: string; description: string; countryCode: string }[];
      rir: string;
    }
  • The tool definition/registration for 'bgp_ip' with name, description, Zod schema (ip: string), and execute callback that calls bgpIp().
    const bgpIpTool: ToolDef = {
      name: "bgp_ip",
      description: "Look up BGP routing information for an IP address. Returns matching prefixes, ASNs, and RIR allocation.",
      schema: {
        ip: z.string().describe("IP address to look up"),
      },
      execute: async (args) => json(await bgpIp(args.ip as string)),
    };
  • Registration of bgpIpTool in the tools array alongside other BGP tools.
    // BGP (3)
    bgpAsnTool,
    bgpIpTool,
    bgpPrefixTool,
  • The `bgpFetch` helper function making requests to the BGPView API with rate limiting and error handling.
    async function bgpFetch(path: string): Promise<any> {
      await limiter.acquire();
      const res = await fetch(`https://api.bgpview.io${path}`);
      if (!res.ok) throw new Error(`BGPView returned ${res.status}`);
      const json = await res.json();
      if (json.status !== "ok") throw new Error(`BGPView error: ${json.status_message ?? "unknown"}`);
      return json.data;
    }
Behavior2/5

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

No annotations provided; the description lacks disclosure of behavioral traits like rate limits, authentication, or side effects. It is a read operation but does not state this explicitly.

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 concise sentences, no redundancy. Perfectly front-loaded and efficient.

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?

Tool is simple with one parameter and no output schema; the description is adequate. Could mention limitations (e.g., IPv4/IPv6) but not required.

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% for the single parameter 'ip', so the description adds minimal value. It does not clarify format or constraints beyond the schema.

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 purpose (lookup BGP routing info for an IP) and specifies the output (prefixes, ASNs, RIR allocation). This distinguishes it from sibling tools like bgp_asn and bgp_prefix.

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

Usage Guidelines2/5

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

No explicit guidance on when to use this tool versus alternatives (e.g., bgp_asn, bgp_prefix). The description merely states function without context or exclusions.

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