uber_cancel_ride
Cancel an ongoing Uber ride request by providing user and request IDs to manage ride bookings.
Instructions
Cancel an ongoing ride request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | Unique identifier for the user | |
| requestId | Yes | Ride request ID to cancel |
Implementation Reference
- src/index.ts:270-289 (handler)Handler for the uber_cancel_ride tool: parses arguments using CancelRideSchema, retrieves and sets user access token, calls uberClient.cancelRide(requestId), and returns a success message.case 'uber_cancel_ride': { const { userId, requestId } = CancelRideSchema.parse(args); const token = userTokens.get(userId); if (!token) { throw new Error('User not authenticated. Please authorize first.'); } uberClient.setAccessToken(token); await uberClient.cancelRide(requestId); return { content: [ { type: 'text', text: 'Ride cancelled successfully', }, ], }; }
- src/index.ts:67-70 (schema)Zod input schema definition for the uber_cancel_ride tool, specifying userId and requestId parameters.const CancelRideSchema = z.object({ userId: z.string().describe('Unique identifier for the user'), requestId: z.string().describe('Ride request ID to cancel'), });
- src/index.ts:133-137 (registration)Registration of the uber_cancel_ride tool in the TOOLS array, including name, description, and input schema.{ name: 'uber_cancel_ride', description: 'Cancel an ongoing ride request', inputSchema: zodToJsonSchema(CancelRideSchema), },
- src/uber-client.ts:96-98 (helper)Core helper method in UberClient that performs the HTTP DELETE request to the Uber API to cancel a ride by requestId.async cancelRide(requestId: string): Promise<void> { await this.api.delete(`/v1.2/requests/${requestId}`); }