Skip to main content
Glama
badchars

osint-mcp-server

by badchars

shodan_dns_resolve

Resolve hostnames to IP addresses using Shodan's DNS resolver for network reconnaissance and mapping.

Instructions

Resolve hostnames to IPs using Shodan's DNS resolver. Requires SHODAN_API_KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostnamesYesHostnames to resolve

Implementation Reference

  • Core handler function that calls the Shodan DNS resolve API. Takes hostnames array and API key, returns a record mapping hostnames to IPs (or null).
    export async function shodanDnsResolve(hostnames: string[], apiKey: string): Promise<Record<string, string | null>> {
      await limiter.acquire();
      const csv = hostnames.join(",");
      const res = await fetch(`https://api.shodan.io/dns/resolve?hostnames=${encodeURIComponent(csv)}&key=${apiKey}`);
      if (!res.ok) throw new Error(`Shodan DNS resolve failed: ${res.status}`);
      return res.json();
    }
  • Zod schema for the shodan_dns_resolve tool: expects an array of hostname strings.
    schema: {
      hostnames: z.array(z.string()).describe("Hostnames to resolve"),
    },
  • ToolDef registration for shodan_dns_resolve: defines name, description, schema, and execute handler that calls shodanDnsResolve.
    const shodanDnsResolveTool: ToolDef = {
      name: "shodan_dns_resolve",
      description: "Resolve hostnames to IPs using Shodan's DNS resolver. Requires SHODAN_API_KEY.",
      schema: {
        hostnames: z.array(z.string()).describe("Hostnames to resolve"),
      },
      execute: async (args, ctx) => {
        const key = requireApiKey(ctx.config.shodanApiKey, "Shodan", "SHODAN_API_KEY");
        return json(await shodanDnsResolve(args.hostnames as string[], key));
      },
    };
  • The tool is included in the allTools array, registering it with the MCP system.
    shodanDnsResolveTool,
  • src/index.ts:36-36 (registration)
    shodan_dns_resolve listed under the 'Shodan' tool category with env requirement SHODAN_API_KEY.
    { label: "Shodan", env: "SHODAN_API_KEY", tools: ["shodan_host", "shodan_search", "shodan_dns_resolve", "shodan_exploits"] },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

B3.1/5.0
Behavior2/5

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

With no annotations, the description must convey behavioral traits. It only mentions the API key requirement, omitting details like rate limits, error handling, read-only nature, or output format. This is insufficient for an agent to fully understand the tool's behavior.

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?

The description is extremely concise with two sentences that convey the core purpose and a key requirement. No extraneous information is present, making it efficient and easy to parse.

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

Completeness3/5

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

For a simple tool with one parameter and no output schema, the description covers the basic function and a prerequisite. However, it could be more complete by mentioning the expected output format (e.g., a mapping of hostnames to IPs) to fully inform the agent.

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?

The input schema already describes the 'hostnames' parameter fully (100% coverage). The tool description adds no additional semantic meaning beyond what is in the schema, so a baseline score of 3 is appropriate.

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

Purpose4/5

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

The description clearly states the tool resolves hostnames to IPs using Shodan's DNS resolver. It is straightforward and distinguishes itself from generic DNS tools by specifying the Shodan resolver, though it does not explicitly contrast with siblings.

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 guidance is provided on when to use this tool versus alternatives like dns_lookup or other DNS resolvers. The description only states the action and prerequisite, leaving the agent without context on selection criteria.

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