Skip to main content
Glama
paladini

devutils-mcp-server

ip_validate

Validate IPv4 or IPv6 addresses to determine type, class, scope, and identify private, loopback, or multicast addresses for network configuration and security checks.

Instructions

Validate and classify an IPv4 or IPv6 address. Returns type, class, scope, and whether it's private/loopback/multicast.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYesIP address to validate

Implementation Reference

  • The ip_validate tool handler, which validates IPv4 and IPv6 addresses and returns their classification details.
    server.tool(
      "ip_validate",
      "Validate and classify an IPv4 or IPv6 address. Returns type, class, scope, and whether it's private/loopback/multicast.",
      { ip: z.string().describe("IP address to validate") },
      async ({ ip }) => {
        // IPv4 check
        const ipv4Regex =
          /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
        const v4Match = ip.match(ipv4Regex);
    
        if (v4Match) {
          const parts = [
            parseInt(v4Match[1]),
            parseInt(v4Match[2]),
            parseInt(v4Match[3]),
            parseInt(v4Match[4]),
          ];
    
          if (parts.some((p) => p > 255)) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify(
                    { valid: false, error: "Octet value exceeds 255" },
                    null,
                    2
                  ),
                },
              ],
            };
          }
    
          const result = {
            valid: true,
            version: "IPv4",
            address: ip,
            class:
              parts[0] < 128
                ? "A"
                : parts[0] < 192
                  ? "B"
                  : parts[0] < 224
                    ? "C"
                    : parts[0] < 240
                      ? "D (Multicast)"
                      : "E (Reserved)",
            is_private:
              parts[0] === 10 ||
              (parts[0] === 172 && parts[1] >= 16 && parts[1] <= 31) ||
              (parts[0] === 192 && parts[1] === 168),
            is_loopback: parts[0] === 127,
            is_link_local: parts[0] === 169 && parts[1] === 254,
            is_multicast: parts[0] >= 224 && parts[0] <= 239,
            is_broadcast: parts.every((p) => p === 255),
          };
    
          return {
            content: [
              { type: "text" as const, text: JSON.stringify(result, null, 2) },
            ],
          };
        }
    
        // IPv6 basic check
        const ipv6Regex = /^([0-9a-f]{0,4}:){2,7}[0-9a-f]{0,4}$/i;
        if (ipv6Regex.test(ip) || ip === "::1" || ip === "::") {
          const result = {
            valid: true,
            version: "IPv6",
            address: ip,
            is_loopback: ip === "::1",
            is_unspecified: ip === "::",
            is_link_local: ip.toLowerCase().startsWith("fe80"),
            is_multicast: ip.toLowerCase().startsWith("ff"),
          };
    
          return {
            content: [
              { type: "text" as const, text: JSON.stringify(result, null, 2) },
            ],
          };
        }
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(
                { valid: false, error: "Not a valid IPv4 or IPv6 address" },
                null,
                2
              ),
            },
          ],
        };
      }
Behavior4/5

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

No annotations provided, so description carries full burden. Compensates well by detailing return structure ('type, class, scope, and whether it's private/loopback/multicast'), effectively disclosing the analytical nature of the tool without claiming side effects.

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 efficient sentences with zero waste. First sentence declares action and target, second sentence details return value. Perfectly front-loaded and appropriately sized for a single-parameter utility.

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

Completeness5/5

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

For a simple utility with 1 parameter and no output schema, description is complete. It compensates for missing output schema by detailing return fields (type, class, scope, flags) that would typically appear in output documentation.

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

Parameters4/5

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

Schema has 100% description coverage (baseline 3). Description adds value by specifying accepted IP versions ('IPv4 or IPv6'), providing format context beyond the generic 'IP address' in 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?

Description uses specific verbs ('Validate and classify') with specific resource ('IPv4 or IPv6 address'). Clearly distinguishes from sibling encoding/hashing tools by focusing on IP address analysis.

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?

Provides implied usage through domain specificity (IP addresses vs encoding/hashing), but lacks explicit when-to-use guidance or distinction from potentially related sibling 'cidr_calculate'. No prerequisites or exclusions mentioned.

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/paladini/devutils-mcp-server'

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