Skip to main content
Glama
SoapyRED

FreightUtils MCP Server

chargeable_weight_calculator

Read-onlyIdempotent

Calculate air freight chargeable weight by comparing actual and volumetric weight with an adjustable divisor.

Instructions

Calculate air freight chargeable weight (volumetric vs actual).

Airlines charge by "chargeable weight" — the greater of actual weight or volumetric weight. The IATA standard volumetric factor is 6,000 (1 CBM = 166.67 kg). Some carriers use different factors (e.g., 5,000 for DHL).

Use this tool when you need to:

  • Quote air freight shipments

  • Determine if a shipment is charged by volume or weight

  • Compare volumetric factors across carriers

A ratio > 1.0 means the shipment is "volumetric" (light for its size). A ratio < 1.0 means it's "heavy" (dense cargo).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
length_cmYesLength in centimetres
width_cmYesWidth in centimetres
height_cmYesHeight in centimetres
gross_weight_kgYesActual gross weight in kilograms
piecesNoNumber of identical pieces (default: 1)
factorNoVolumetric divisor (default: 6000 IATA standard, DHL uses 5000)

Implementation Reference

  • The handler function that executes chargeable_weight_calculator logic. Calls the external FreightUtils API endpoint 'chargeable-weight' via apiGet, passing length_cm, width_cm, height_cm, gross_weight_kg, pieces, and factor as query parameters.
    handler: async (args) =>
      apiGet('chargeable-weight', {
        l: args.length_cm, w: args.width_cm, h: args.height_cm,
        gw: args.gross_weight_kg, pcs: args.pieces, factor: args.factor,
      }),
  • Zod schema defining input validation for chargeable_weight_calculator. Accepts length_cm, width_cm, height_cm, gross_weight_kg (required positives), plus optional pieces (default 1) and factor (default 6000 IATA standard). Uses .strict() to reject unknown keys.
    schema: z.object({
      length_cm: z.number().positive().describe('Length in centimetres'),
      width_cm: z.number().positive().describe('Width in centimetres'),
      height_cm: z.number().positive().describe('Height in centimetres'),
      gross_weight_kg: z.number().positive().describe('Actual gross weight in kilograms'),
      pieces: z.number().int().positive().optional().describe('Number of identical pieces (default: 1)'),
      factor: z.number().int().positive().optional().describe('Volumetric divisor (default: 6000 IATA standard, DHL uses 5000)'),
    }).strict(),
  • src/tools.ts:713-715 (registration)
    The tool is registered in the ALL_TOOLS array, which is iterated by the server to register each tool with the MCP SDK via server.tool().
    export const ALL_TOOLS: ToolDef[] = [
      cbmCalculator,
      chargeableWeightCalculator,
  • src/server.ts:18-41 (registration)
    Server registration: iterates ALL_TOOLS and calls server.tool() for each tool definition, wrapping handler results in text content for MCP response protocol.
    // Register every tool
    for (const tool of ALL_TOOLS) {
      server.tool(
        tool.name,
        tool.description,
        tool.schema.shape,
        tool.annotations,
        async (args: Record<string, unknown>) => {
          try {
            const result = await tool.handler(args);
            return {
              content: [
                { type: 'text' as const, text: JSON.stringify(result, null, 2) },
              ],
            };
          } catch (err: unknown) {
            const message = err instanceof Error ? err.message : String(err);
            return {
              content: [{ type: 'text' as const, text: `Error: ${message}` }],
              isError: true,
            };
          }
        },
      );
  • The apiGet helper function used by the chargeable_weight_calculator handler to make GET requests to the external FreightUtils API.
    export async function apiGet(endpoint: string, params: Record<string, unknown>): Promise<unknown> {
      const url = new URL(`${BASE_URL}/${endpoint}`);
      for (const [k, v] of Object.entries(params)) {
        if (v === undefined || v === null || v === '') continue;
        url.searchParams.set(k, String(v));
      }
    
      const res = await fetch(url.toString(), {
        headers: { 'Accept': 'application/json' },
      });
    
      if (!res.ok) {
        const body = await res.text();
        throw new Error(`FreightUtils API error ${res.status}: ${body}`);
      }
    
      return res.json();
    }
Behavior4/5

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

Annotations already indicate readOnly and idempotent. Description adds details on ratio interpretation and carrier-specific factors, providing behavioral context beyond annotations.

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?

Very concise, well-structured with bullet points, no unnecessary words.

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?

Adequately covers the calculation concept and usage; lacks explicit output description but is sufficient for a calculator tool.

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 has 100% coverage with descriptions; description adds context on factor defaults but does not significantly enhance parameter understanding beyond 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 it calculates air freight chargeable weight comparing volumetric vs actual, distinguishing it from sibling tools like cbm_calculator and ldm_calculator.

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?

Explicitly lists use cases (quote shipments, determine volume vs weight, compare factors) but does not explicitly state when not to use it.

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/SoapyRED/freightutils-mcp'

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