Skip to main content
Glama

cidr-calculator

Read-onlyIdempotent

Parse an IPv4 CIDR block (or an IP + dotted-decimal mask) and return network, broadcast, first/last usable host, total + usable IP counts, subnet/wildcard masks, the mask in binary, and the legacy IPv4 class.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipNoDotted-decimal IPv4 address, e.g. '192.168.1.10'. Used with `mask` when CIDR notation isn't provided.
cidrNoIPv4 CIDR notation, e.g. '192.168.1.0/24'. Provide this OR (ip + mask). Prefix length must be 0-32.
maskNoDotted-decimal subnet mask, e.g. '255.255.255.0'. Must be a contiguous mask (all 1s then all 0s). Used with `ip` when CIDR notation isn't provided.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidrYesCanonical CIDR notation, e.g. '192.168.1.0/24'.
prefixYesPrefix length, 0-32.
ipClassYesLegacy IPv4 class derived from the first octet (A/B/C/D/E).
networkYesNetwork address (first IP in the block).
hostBitsYesNumber of host bits (32 - prefix).
ipBinaryYesInput IP as 32 bits in dotted-octet binary.
totalIpsYesTotal IP addresses in the block (2^(32 - prefix)).
broadcastYesBroadcast address (last IP in the block); same as network for /32.
usableIpsYesUsable host addresses (totalIps - 2, but 2 for /31 and 1 for /32).
lastUsableYesLast usable host address. Equals network for /31 and /32.
maskBinaryYesSubnet mask as 32 bits split into 4 dotted octets, e.g. '11111111.11111111.11111111.00000000'.
subnetMaskYesSubnet mask in dotted-decimal, e.g. '255.255.255.0'.
firstUsableYesFirst usable host address. Equals network for /31 and /32.
wildcardMaskYesWildcard mask in dotted-decimal (bitwise NOT of subnet mask).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, covering the safety profile. The description adds the input mode flexibility and the full list of computed values, but it does not discuss error behavior or edge cases beyond what schema param descriptions already cover. This is slightly above baseline but not rich.

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?

One well-structured sentence that front-loads the action and input, then enumerates the outputs. No filler.

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?

The tool is simple and stateless; annotations declare it read-only, and an output schema exists to document return values. The description covers the dual input modes and the scope of calculations. It is sufficiently complete for this calculator, though it doesn't explicitly restate validation rules that are already in the schema.

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 description coverage is 100%, so the schema documents all three parameters. The tool description clarifies the relationship between parameters (cidr OR ip+mask) and enumerates the output fields, adding some semantic context but not significantly 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 uses the specific verb 'Parse' and names the resource (IPv4 CIDR block or IP + dotted-decimal mask), then lists the computed outputs. It clearly distinguishes this from sibling calculators, which cover unrelated domains.

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

Usage Guidelines4/5

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

The description specifies the two accepted input forms (CIDR or IP+mask) and implicitly states when to use the tool—whenever network calculations on IPv4 blocks are needed. No alternative tool exists among siblings, so no explicit exclusions are needed. Clarity is high, but it stops short of giving explicit when-not guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources