Skip to main content
Glama

uber_get_price_estimates

Obtain estimated ride costs between specified start and end locations for users. Enables AI assistants to provide accurate fare information for Uber rides.

Instructions

Get price estimates for a ride between two locations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endLatitudeYesDestination latitude
endLongitudeYesDestination longitude
startLatitudeYesStarting location latitude
startLongitudeYesStarting location longitude
userIdYesUnique identifier for the user

Implementation Reference

  • MCP server request handler for the uber_get_price_estimates tool. Validates input using PriceEstimateSchema, checks user authentication token, sets the token on UberClient, calls uberClient.getPriceEstimates, and returns the JSON stringified result.
    case 'uber_get_price_estimates': { const { userId, startLatitude, startLongitude, endLatitude, endLongitude } = PriceEstimateSchema.parse(args); const token = userTokens.get(userId); if (!token) { throw new Error('User not authenticated. Please authorize first.'); } uberClient.setAccessToken(token); const estimates = await uberClient.getPriceEstimates( startLatitude, startLongitude, endLatitude, endLongitude ); return { content: [ { type: 'text', text: JSON.stringify(estimates, null, 2), }, ], }; }
  • Zod schema defining the input parameters for the uber_get_price_estimates tool: userId, start/end latitude/longitude.
    const PriceEstimateSchema = z.object({ userId: z.string().describe('Unique identifier for the user'), 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'), });
  • src/index.ts:118-122 (registration)
    Registration of the uber_get_price_estimates tool in the MCP TOOLS array, including name, description, and input schema.
    { name: 'uber_get_price_estimates', description: 'Get price estimates for a ride between two locations', inputSchema: zodToJsonSchema(PriceEstimateSchema), },
  • UberClient method that performs the actual API call to Uber's /v1.2/estimates/price endpoint to fetch price estimates between start and end locations.
    async getPriceEstimates( startLat: number, startLng: number, endLat: number, endLng: number ): Promise<PriceEstimate[]> { const response = await this.api.get('/v1.2/estimates/price', { params: { start_latitude: startLat, start_longitude: startLng, end_latitude: endLat, end_longitude: endLng, }, }); return response.data.prices; }

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