Skip to main content
Glama

Get Time in Transit

get_time_in_transit

Estimate delivery dates and transit times for UPS shipments between two locations by providing origin and destination postal codes, total weight, and optional ship date.

Instructions

Get estimated delivery dates and transit times between two locations. Returns the expected delivery date and time for each available UPS service.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
shipFromYes
shipToYes
weightYesTotal shipment weight in lbs
shipDateNoShip date in YYYY-MM-DD format (defaults to today)

Implementation Reference

  • Handler function for the get_time_in_transit tool. Builds the request body from shipFrom/shipTo/weight/shipDate, calls the UPS Time-in-Transit API endpoint, and formats the response.
    async ({ shipFrom, shipTo, weight, shipDate }) => {
    	const todayRaw = new Date().toISOString().split('T')[0] ?? '';
    	const formattedDate = shipDate ? shipDate.replace(/-/g, '') : todayRaw.replace(/-/g, '');
    
    	const body = {
    		originCountryCode: shipFrom.countryCode,
    		originPostalCode: shipFrom.postalCode,
    		destinationCountryCode: shipTo.countryCode,
    		destinationPostalCode: shipTo.postalCode,
    		weight: String(weight),
    		weightUnitOfMeasure: UNITS.WEIGHT_LBS,
    		shipDate: formattedDate,
    		shipTime: RATING_DEFAULTS.SHIP_TIME,
    		numberOfPackages: RATING_DEFAULTS.PACKAGE_COUNT,
    	};
    
    	const response = await client.post<unknown>(
    		`/api/deliverytimeintransit/${API_VERSIONS.TIME_IN_TRANSIT}/estimateddelivery`,
    		body,
    	);
    
    	return formatToolResponse(response);
    },
  • Input schema (Zod) definition for get_time_in_transit: shipFrom (postalCode + countryCode), shipTo (postalCode + countryCode), weight (positive number in lbs), and optional shipDate (YYYY-MM-DD).
    {
    	title: 'Get Time in Transit',
    	description:
    		'Get estimated delivery dates and transit times between two locations. Returns the expected delivery date and time for each available UPS service.',
    	inputSchema: {
    		shipFrom: z.object({
    			postalCode: z.string().describe('Origin ZIP/postal code'),
    			countryCode: z.string().length(2).default('US').describe('Origin country code'),
    		}),
    		shipTo: z.object({
    			postalCode: z.string().describe('Destination ZIP/postal code'),
    			countryCode: z.string().length(2).default('US').describe('Destination country code'),
    		}),
    		weight: z.number().positive().describe('Total shipment weight in lbs'),
    		shipDate: z
    			.string()
    			.optional()
    			.describe('Ship date in YYYY-MM-DD format (defaults to today)'),
    	},
  • Registration of the get_time_in_transit tool via server.registerTool() inside the addRatingTools function in src/tools/rating.ts.
    server.registerTool(
    	'get_time_in_transit',
    	{
    		title: 'Get Time in Transit',
    		description:
    			'Get estimated delivery dates and transit times between two locations. Returns the expected delivery date and time for each available UPS service.',
    		inputSchema: {
    			shipFrom: z.object({
    				postalCode: z.string().describe('Origin ZIP/postal code'),
    				countryCode: z.string().length(2).default('US').describe('Origin country code'),
    			}),
    			shipTo: z.object({
    				postalCode: z.string().describe('Destination ZIP/postal code'),
    				countryCode: z.string().length(2).default('US').describe('Destination country code'),
    			}),
    			weight: z.number().positive().describe('Total shipment weight in lbs'),
    			shipDate: z
    				.string()
    				.optional()
    				.describe('Ship date in YYYY-MM-DD format (defaults to today)'),
    		},
    	},
    	async ({ shipFrom, shipTo, weight, shipDate }) => {
    		const todayRaw = new Date().toISOString().split('T')[0] ?? '';
    		const formattedDate = shipDate ? shipDate.replace(/-/g, '') : todayRaw.replace(/-/g, '');
    
    		const body = {
    			originCountryCode: shipFrom.countryCode,
    			originPostalCode: shipFrom.postalCode,
    			destinationCountryCode: shipTo.countryCode,
    			destinationPostalCode: shipTo.postalCode,
    			weight: String(weight),
    			weightUnitOfMeasure: UNITS.WEIGHT_LBS,
    			shipDate: formattedDate,
    			shipTime: RATING_DEFAULTS.SHIP_TIME,
    			numberOfPackages: RATING_DEFAULTS.PACKAGE_COUNT,
    		};
    
    		const response = await client.post<unknown>(
    			`/api/deliverytimeintransit/${API_VERSIONS.TIME_IN_TRANSIT}/estimateddelivery`,
    			body,
    		);
    
    		return formatToolResponse(response);
    	},
    );
  • Helper function formatToolResponse used by get_time_in_transit to format the API response as MCP text content.
    export function formatToolResponse(response: unknown) {
    	return {
    		content: [{ type: 'text' as const, text: JSON.stringify(response, null, 2) }],
    	};
    }
  • API version constant TIME_IN_TRANSIT ('v1') used in the endpoint URL for get_time_in_transit.
    // ─── API Versions ────────────────────────────────────────────────────────────
    
    export const API_VERSIONS = {
    	SHIPPING: 'v2409',
    	RATING: 'v2403',
    	TRACKING: 'v1',
    	ADDRESS_VALIDATION: 'v2',
    	TIME_IN_TRANSIT: 'v1',
    	PICKUP: 'v1',
    	LOCATOR: 'v2',
    } as const;
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool returns estimated delivery dates and transit times, which implies a read operation with no side effects. However, it does not elaborate on behaviors like error handling, default values, or limitations (e.g., geographical scope). The disclosure is adequate but minimal.

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 two concise sentences that immediately convey the core purpose. Every word earns its place, with no redundancy or filler.

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

Completeness2/5

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

The tool has 4 parameters including nested objects and no output schema. The description provides no information about return format, expected values, or how to interpret results. An agent would lack essential context to correctly process the output, making the description incomplete for the tool's complexity.

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

Parameters2/5

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

The input schema provides descriptions for all parameters, but the tool description adds no additional meaning beyond the schema. Given 50% schema description coverage (per context signal), the description fails to compensate by explaining parameter structures, defaults (e.g., shipDate defaults to today, countryCode defaults to US), or relationships between parameters.

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 the verb 'Get', the resource 'estimated delivery dates and transit times', and the scope 'between two locations' and 'for each available UPS service'. This distinguishes it from sibling tools like track_package and get_rates.

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

Usage Guidelines2/5

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

The description does not provide any guidance on when to use this tool versus alternatives. It does not mention exclusions, prerequisites, or compare to siblings like track_package or get_rates. An agent would need to infer usage context from the tool name alone.

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/roscoej/ups-mcp'

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