Skip to main content
Glama

uber_request_ride

Request an Uber ride by specifying user ID, product ID, start and destination coordinates, and fare ID. Simplify ride booking via the MCP Uber Server.

Instructions

Request an Uber ride

Input Schema

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

Implementation Reference

  • The handler function for the 'uber_request_ride' tool. It validates input with RequestRideSchema, checks user authentication, sets the access token, calls uberClient.requestRide, and returns the ride request details as JSON.
    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), }, ], }; }
  • Zod schema for input validation of the uber_request_ride tool parameters.
    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'), });
  • src/index.ts:123-127 (registration)
    Registration of the 'uber_request_ride' tool in the TOOLS array, specifying name, description, and input schema.
    { name: 'uber_request_ride', description: 'Request an Uber ride', inputSchema: zodToJsonSchema(RequestRideSchema), },
  • Core implementation in UberClient class that constructs the payload and makes the POST request to Uber's /v1.2/requests API 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; }

Other Tools

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

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