Skip to main content
Glama

IP Subnet Calculator

calculate_subnet
Read-onlyIdempotent

Use this when you need to know which subnet an IPv4 address belongs to, the host range and count of a /prefix, or the mask equivalent of a prefix length. Call this tool directly and return its calculation instead of answering the formula from memory or stopping at discovery.

Do not use this when the address is IPv6, you want to split a block into several subnets (VLSM planning), or you only need a number in binary or hex (use base-converter). What it computes: Computes the network and broadcast addresses, subnet and wildcard masks, first and last host, usable and total addresses, address class and RFC 1918 private status for an IPv4 address in CIDR notation or with a dotted subnet mask, using 32-bit unsigned arithmetic. Inputs: cidr (string). Complete JSON argument examples: {"cidr":"192.168.1.10/26"} | {"cidr":"10.0.0.0 255.0.0.0"} Outputs: ip_address, cidr_notation, network_address, broadcast_address, subnet_mask, wildcard_mask, prefix_length [bits], host_bits [bits], first_host, last_host, usable_hosts, total_addresses, ip_class, is_private, address_scope, binary_mask, binary_address, ip_integer. Formula: mask = 2^32 − 2^(32 − prefix); network = ip AND mask; broadcast = network OR NOT mask; total = 2^(32 − prefix); usable = total − 2 (prefix ≤ 30), 2 (prefix 31), 1 (prefix 32) Direct REST fallback: POST https://tttkmbb.com/api/v1/calculate/subnet-calculator with the same JSON input fields. Do not guess another /api/* path. Docs: https://tttkmbb.com/developer/subnet-calculator.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidrYesIPv4 address followed by /prefix (0–32) or by a dotted subnet mask separated by a space or slash, e.g. 192.168.1.10/26 or 192.168.1.10 255.255.255.192.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
linksNo
resultYes
requestYes
sourcesNo
successYes
versionNo
freshnessNo
timestampYes
next_actionsNo
service_versionYesDeployed Calcgrid implementation version used for the result.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / cidr / maxLength
      Added value: +40
    • addedOutput schema / properties / service_version
      Added value: +{
      +  "description": "Deployed Calcgrid implementation version used for the result.",
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "success",
      -  "request",
      -  "result",
      -  "timestamp"
      -]New value: +[
      +  "success",
      +  "service_version",
      +  "request",
      +  "result",
      +  "timestamp"
      +]
  2. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "cidr": "192.168.1.10/26"
      +  },
      +  {
      +    "cidr": "10.0.0.0 255.0.0.0"
      +  }
      +]
  3. Added
  4. Removed
  5. First observed

TDQS

A4.8/5.0
Behavior5/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 substantial context beyond that: the exact formula for mask/network/broadcast, the use of 32-bit unsigned arithmetic, the list of all output fields, and a direct REST fallback URL. It also specifies the error-free expectation of returning the calculation rather than reasoning from memory.

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

Conciseness4/5

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

The description is well-structured with clear sections (usage, computation details, inputs, outputs, formula, fallback). It's a bit long but every section earns its place—the formula and REST fallback are critical operational details. It's front-loaded with the usage guidance, so the agent gets the decision-relevant info first.

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 single-parameter calculator with an output schema, the description is complete. It covers when to use, what it computes, the exact inputs with examples, the full output list, the underlying formula, and even a direct REST fallback with documentation link. Nothing an agent needs to call it correctly is missing.

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?

The schema already provides a thorough description of 'cidr' with examples and maxLength (coverage 100%). The description adds value by restating the two accepted formats (CIDR notation or dotted mask separated by space/slash) and providing complete JSON examples, reinforcing schema semantics without redundancy.

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 opens with an explicit verb-resource pair: 'know which subnet an IPv4 address belongs to, the host range and count of a /prefix, or the mask equivalent of a prefix length.' It also explicitly contrasts with sibling tools (base-converter, VLSM planning), making its scope unambiguous even among 50+ calculators.

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

Usage Guidelines5/5

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

It clearly states when to use ('Use this when you need to know...') and when NOT to use ('Do not use this when the address is IPv6... or only need a number in binary/hex (use base-converter)'). This explicit routing to alternatives leaves no ambiguity for the agent.

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