Skip to main content
Glama

uber_request_ride

Book an Uber ride by providing user ID, product selection, and pickup/destination coordinates to arrange transportation.

Instructions

Request an Uber ride

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userIdYesUnique identifier for the user
productIdYesUber product ID (from price estimates)
startLatitudeYesStarting location latitude
startLongitudeYesStarting location longitude
endLatitudeYesDestination latitude
endLongitudeYesDestination longitude
fareIdNoFare ID from price estimate

Implementation Reference

  • src/index.ts:123-127 (registration)
    Registration of the 'uber_request_ride' tool in the TOOLS array, including name, description, and input schema.
    { name: 'uber_request_ride', description: 'Request an Uber ride', inputSchema: zodToJsonSchema(RequestRideSchema), },
  • Zod schema defining the input parameters for the uber_request_ride tool.
    const RequestRideSchema = z.object({ userId: z.string().describe('Unique identifier for the user'), productId: z.string().describe('Uber product ID (from price estimates)'), startLatitude: z.number().describe('Starting location latitude'), startLongitude: z.number().describe('Starting location longitude'), endLatitude: z.number().describe('Destination latitude'), endLongitude: z.number().describe('Destination longitude'), fareId: z.string().optional().describe('Fare ID from price estimate'), });
  • MCP tool handler for 'uber_request_ride': parses input, authenticates user, calls UberClient.requestRide, and returns the ride request details.
    case 'uber_request_ride': { const { userId, productId, startLatitude, startLongitude, endLatitude, endLongitude, fareId } = RequestRideSchema.parse(args); const token = userTokens.get(userId); if (!token) { throw new Error('User not authenticated. Please authorize first.'); } uberClient.setAccessToken(token); const rideRequest = await uberClient.requestRide( productId, startLatitude, startLongitude, endLatitude, endLongitude, fareId ); return { content: [ { type: 'text', text: JSON.stringify(rideRequest, null, 2), }, ], }; }
  • Core implementation in UberClient class that makes the HTTP POST request to Uber's /v1.2/requests endpoint to request a ride.
    async requestRide( productId: string, startLat: number, startLng: number, endLat: number, endLng: number, fareId?: string ): Promise<RideRequest> { const payload: any = { product_id: productId, start_latitude: startLat, start_longitude: startLng, end_latitude: endLat, end_longitude: endLng, }; if (fareId) { payload.fare_id = fareId; } const response = await this.api.post('/v1.2/requests', payload); return response.data; }

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/199-mcp/mcp-uber'

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