uber_get_auth_url
Generate an Uber authorization URL for user authentication to enable AI assistants to book and manage rides through the MCP Uber Server.
Instructions
Get the Uber authorization URL for user to authenticate
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | Unique identifier for the user |
Implementation Reference
- src/index.ts:166-177 (handler)Handler for uber_get_auth_url tool: parses userId from arguments, generates authorization URL using UberClient, and returns a text response with the URL.case 'uber_get_auth_url': { const { userId } = AuthorizeSchema.parse(args); const authUrl = await uberClient.getAuthorizationUrl(userId); return { content: [ { type: 'text', text: `Please visit this URL to authorize Uber access: ${authUrl}`, }, ], }; }
- src/index.ts:35-37 (schema)Zod schema for input validation of uber_get_auth_url tool, defining the required userId parameter.const AuthorizeSchema = z.object({ userId: z.string().describe('Unique identifier for the user'), });
- src/index.ts:108-112 (registration)Registration of the uber_get_auth_url tool in the TOOLS array, including name, description, and input schema.{ name: 'uber_get_auth_url', description: 'Get the Uber authorization URL for user to authenticate', inputSchema: zodToJsonSchema(AuthorizeSchema), },
- src/uber-client.ts:23-32 (helper)UberClient method that constructs the Uber OAuth authorization URL using configuration parameters.async getAuthorizationUrl(state: string): Promise<string> { const params = new URLSearchParams({ client_id: this.config.clientId, response_type: 'code', redirect_uri: this.config.redirectUri, scope: 'profile request ride_request', state, }); return `${this.config.authBaseUrl}/oauth/v2/authorize?${params.toString()}`; }