get_rider_preferences
Retrieve rider preferences from the VanMoof API to access personalized settings and configurations for bike customization.
Instructions
Retrieves rider preferences from the vanMoof API.
Returns:
The rider preferences if authentication is successful, otherwise None.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:162-188 (handler)The handler function that implements the core logic of the 'get_rider_preferences' tool. It authenticates with the VanMoof API, retrieves the rider ID, constructs the API URL, and returns the preferences data.def get_rider_preferences() -> Dict[str, Any]: """ Retrieves rider preferences from the vanMoof API. Returns: The rider preferences if authentication is successful, otherwise None. """ # Get the Bearer token from the authenticate method token = VanMoofAPI.get_vanmoof_token(VANMOOF_USERNAME, VANMOOF_PASSWORD) application_token = VanMoofAPI.get_application_token(token) if not application_token: return {"error": "Authentication failed"} # Get the riderId from the customer data # path to rider is data.uuid in the customer data json response riderId = VanMoofAPI.get_customer_data().get('data', {}).get('uuid') if not riderId: return {"error": "RiderId not found"} url = f"https://tenjin.vanmoof.com/api/v1/riders/{riderId}/preferences" headers = { "authorization": f"Bearer {application_token}", "api-key": "fcb38d47-f14b-30cf-843b-26283f6a5819" } response = requests.get(url, headers=headers) return response.json()
- server.py:161-161 (registration)The @mcp.tool() decorator registers the get_rider_preferences function as a tool in the FastMCP server.# Function to get rider preferences