Skip to main content
Glama
SoapyRED

FreightUtils MCP Server

cbm_calculator

Read-onlyIdempotent

Calculate cubic metres (CBM) for sea freight shipments. Enter length, width, and height in centimetres to get volume in CBM, cubic feet, or litres.

Instructions

Calculate cubic metres (CBM) for a shipment.

CBM is the standard volume unit in international shipping. One CBM = 1m x 1m x 1m = 1,000 litres. Ocean freight carriers price per "freight tonne" (1 CBM or 1,000 kg, whichever is greater).

Use this tool when you need to:

  • Calculate the volume of a shipment for sea freight quoting

  • Convert dimensions to CBM, cubic feet, or litres

  • Determine freight tonnes for ocean shipping

Input dimensions in centimetres. Specify pieces to get total volume for multiple identical items.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
length_cmYesLength in centimetres
width_cmYesWidth in centimetres
height_cmYesHeight in centimetres
piecesNoNumber of identical pieces (default: 1)

Implementation Reference

  • The cbm_calculator tool definition including its handler function. The handler calls apiGet('cbm', ...) with the input dimensions converted to short param names (l, w, h, pcs). This is the primary implementation of the tool logic.
    const cbmCalculator: ToolDef = {
      name: 'cbm_calculator',
      description: `Calculate cubic metres (CBM) for a shipment.
    
    CBM is the standard volume unit in international shipping. One CBM = 1m x 1m x 1m = 1,000 litres. Ocean freight carriers price per "freight tonne" (1 CBM or 1,000 kg, whichever is greater).
    
    Use this tool when you need to:
    - Calculate the volume of a shipment for sea freight quoting
    - Convert dimensions to CBM, cubic feet, or litres
    - Determine freight tonnes for ocean shipping
    
    Input dimensions in centimetres. Specify pieces to get total volume for multiple identical items.`,
    
      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'),
        pieces: z.number().int().positive().optional().describe('Number of identical pieces (default: 1)'),
      }).strict(),
    
      annotations: readOnlyAnnotations('CBM Calculator'),
    
      handler: async (args) =>
        apiGet('cbm', { l: args.length_cm, w: args.width_cm, h: args.height_cm, pcs: args.pieces }),
    };
  • Input schema for cbm_calculator defined via Zod: requires positive numbers for length_cm, width_cm, height_cm, and an optional positive integer for pieces.
    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'),
      pieces: z.number().int().positive().optional().describe('Number of identical pieces (default: 1)'),
    }).strict(),
  • src/tools.ts:713-733 (registration)
    The ALL_TOOLS array where cbmCalculator is registered as the first exported tool. This array is iterated over in server.ts to register the tool with the MCP server.
    export const ALL_TOOLS: ToolDef[] = [
      cbmCalculator,
      chargeableWeightCalculator,
      ldmCalculator,
      adrLookup,
      adrExemptionCalculator,
      adrLqEqCheck,
      airlineLookup,
      containerLookup,
      hsCodeLookup,
      incotermsLookup,
      palletFittingCalculator,
      unitConverter,
      consignmentCalculator,
      unlocodeLookup,
      ukDutyCalculator,
      shipmentSummary,
      uldLookup,
      vehicleLookup,
      getSubscribeLink,
    ];
  • Uses the readOnlyAnnotations('CBM Calculator') helper to mark the tool as read-only, idempotent, and non-destructive.
    annotations: readOnlyAnnotations('CBM Calculator'),
  • The apiGet helper function that the handler delegates to. It makes an HTTP GET request to the FreightUtils API at /api/cbm with the query parameters.
    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 readOnlyHint=true and idempotentHint=true. The description adds behavioral context: it calculates volumes, accepts dimensions in cm, and handles multiple pieces. It does not contradict annotations and provides useful conversion information (CBM, litres). Could mention that it returns only the calculated volume without 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?

The description is concise, well-structured with bullet points, and every sentence provides essential information. No redundant or vague wording. The front-loaded first sentence immediately states the tool's purpose.

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?

Given no output schema, the description mentions conversions to cubic feet and litres but does not explicitly state the return format (e.g., total CBM, litres). However, for a simple calculation tool, it covers usage context well. A clearer description of the output would improve completeness.

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?

All parameters are documented in the schema with 100% coverage. The description adds value by specifying that dimensions are in centimetres and that the pieces parameter is for multiple identical items, which goes beyond the schema's basic descriptions.

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 cubic metres for shipments, defines CBM, and lists specific use cases like sea freight quoting and dimension conversion. It distinguishes itself from sibling calculators (e.g., chargeable_weight_calculator, ldm_calculator) by focusing on volume calculation.

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 explicitly states when to use the tool (volume calculation, sea freight quoting, dimension conversion) and provides context (input in cm, pieces for multiple items). It does not explicitly mention when not to use or name alternatives, but the use cases are clear.

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