Skip to main content
Glama

Cancel Pickup

cancel_pickup

Cancel a previously scheduled UPS pickup by providing the confirmation number.

Instructions

Cancel a previously scheduled UPS pickup by confirmation number.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
confirmationNumberYesPickup confirmation number from schedule_pickup

Implementation Reference

  • The 'cancel_pickup' tool handler registered on the MCP server. It makes a DELETE request to the UPS pickup API using the confirmationNumber parameter.
    server.registerTool(
    	'cancel_pickup',
    	{
    		title: 'Cancel Pickup',
    		description: 'Cancel a previously scheduled UPS pickup by confirmation number.',
    		inputSchema: {
    			confirmationNumber: z.string().describe('Pickup confirmation number from schedule_pickup'),
    		},
    	},
    	async ({ confirmationNumber }) => {
    		const response = await client.delete<unknown>(
    			`/api/pickupcreation/${API_VERSIONS.PICKUP}/pickup/${confirmationNumber}`,
    		);
    
    		return formatToolResponse(response);
    	},
    );
  • The addPickupTools function registers both 'schedule_pickup' and 'cancel_pickup' tools on the MCP server.
    export function addPickupTools(server: McpServer, client: UPSHttpClient): void {
    	server.registerTool(
    		'schedule_pickup',
    		{
    			title: 'Schedule Pickup',
    			description:
    				'Schedule a UPS package pickup at a specific address and time. Provide the pickup date, time window, address, and package details. Returns a confirmation number to reference or cancel the pickup.',
    			inputSchema: {
    				pickupDate: z.string().describe('Pickup date in YYYYMMDD format'),
    				readyTime: z.string().describe('Earliest pickup time in HHmm format (e.g. "0900")'),
    				closeTime: z.string().describe('Latest pickup time in HHmm format (e.g. "1700")'),
    				name: z.string().describe('Contact name at pickup location'),
    				phone: z.string().describe('Contact phone number'),
    				addressLine1: z.string().describe('Pickup street address'),
    				addressLine2: z.string().optional().describe('Address line 2'),
    				city: z.string().describe('City'),
    				stateProvinceCode: z.string().describe('State/province code'),
    				postalCode: z.string().describe('ZIP/postal code'),
    				countryCode: z.string().length(2).default('US').describe('Country code'),
    				packageCount: z.number().int().positive().describe('Number of packages'),
    				totalWeight: z.number().positive().describe('Total weight in lbs'),
    				serviceCode: z
    					.string()
    					.default(PICKUP.SERVICE_ON_CALL_AIR)
    					.describe('Pickup service code (003=On Call Air, 001=Daily)'),
    				specialInstructions: z.string().optional().describe('Special instructions for driver'),
    			},
    		},
    		async (params) => {
    			const accountNumber = client.getAccountNumber();
    
    			const pickupRequest = {
    				PickupCreationRequest: {
    					RatePickupIndicator: PICKUP.RATE_INDICATOR_YES,
    					Shipper: {
    						Account: {
    							AccountNumber: accountNumber ?? '',
    							AccountCountryCode: params.countryCode,
    						},
    					},
    					PickupDateInfo: {
    						CloseTime: params.closeTime,
    						ReadyTime: params.readyTime,
    						PickupDate: params.pickupDate,
    					},
    					PickupAddress: {
    						CompanyName: params.name,
    						ContactName: params.name,
    						AddressLine: [params.addressLine1, params.addressLine2].filter(Boolean),
    						City: params.city,
    						StateProvince: params.stateProvinceCode,
    						PostalCode: params.postalCode,
    						CountryCode: params.countryCode,
    						Phone: { Number: params.phone },
    					},
    					AlternateAddressIndicator: PICKUP.ALTERNATE_ADDRESS_YES,
    					PickupPiece: [
    						{
    							ServiceCode: params.serviceCode,
    							Quantity: String(params.packageCount),
    							DestinationCountryCode: params.countryCode,
    							ContainerCode: PICKUP.CONTAINER_PACKAGE,
    						},
    					],
    					TotalWeight: {
    						Weight: String(params.totalWeight),
    						UnitOfMeasurement: UNITS.WEIGHT_LBS,
    					},
    					OverweightIndicator: PICKUP.OVERWEIGHT_NO,
    					PaymentMethod: PICKUP.PAYMENT_ACCOUNT,
    					SpecialInstruction: params.specialInstructions ?? '',
    				},
    			};
    
    			const response = await client.post<unknown>(
    				`/api/pickupcreation/${API_VERSIONS.PICKUP}/pickup`,
    				pickupRequest,
    			);
    
    			return formatToolResponse(response);
    		},
    	);
    
    	server.registerTool(
    		'cancel_pickup',
    		{
    			title: 'Cancel Pickup',
    			description: 'Cancel a previously scheduled UPS pickup by confirmation number.',
    			inputSchema: {
    				confirmationNumber: z.string().describe('Pickup confirmation number from schedule_pickup'),
    			},
    		},
    		async ({ confirmationNumber }) => {
    			const response = await client.delete<unknown>(
    				`/api/pickupcreation/${API_VERSIONS.PICKUP}/pickup/${confirmationNumber}`,
    			);
    
    			return formatToolResponse(response);
    		},
    	);
    }
  • CancelPickupParams interface defining the input schema with a confirmationNumber field.
    export interface CancelPickupParams {
    	readonly confirmationNumber: string;
    }
  • CancelPickupResult interface defining the output schema with a status field.
    export interface CancelPickupResult {
    	readonly status: string;
    }
Behavior3/5

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

Without annotations, the description carries full burden; it conveys the mutation action but omits potential side effects, reversibility, or constraints like cancellable window.

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?

A single, front-loaded sentence efficiently conveys the tool's purpose without wasted 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?

Given the low complexity (one parameter, no output schema), the description is sufficient, though it could briefly note expected outcomes or error conditions.

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 coverage is 100% for the single parameter; the description restates the parameter without adding new meaning, matching the baseline score.

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 action (cancel), the resource (previously scheduled UPS pickup), and the required input (confirmation number), making it distinct from sibling tools like schedule_pickup.

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

Usage Guidelines3/5

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

The description implies use after scheduling a pickup but lacks explicit when-to-use or when-not-to-use guidance, such as prerequisites or state requirements.

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