Skip to main content
Glama
stefanstranger

mcp-server-vanmoof

get_world_rides_thisweek

Retrieve weekly global ride statistics from VanMoof riders, including average distance, total rides, and average duration metrics.

Instructions

Retrieves total world rides summary from VanMoof riders. Returns: The a summary of the total rides of the VanMoof rider city if authentication is successful, otherwise None. The following information is returned: - Average distance in km - Total Rides - Average duration in minutes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'get_world_rides_thisweek' MCP tool. It authenticates with the VanMoof API, retrieves rider and bike data, queries the weekly rides endpoint for the current week, extracts the 'world' summary from the carousel, converts average duration to minutes, and returns the result.
    @mcp.tool() def get_world_rides_thisweek()-> Dict[str, Any]: """ Retrieves total world rides summary from VanMoof riders. Returns: The a summary of the total rides of the VanMoof rider city if authentication is successful, otherwise None. The following information is returned: - Average distance in km - Total Rides - Average duration in minutes """ # 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 customerData = VanMoofAPI.get_customer_data() riderId = customerData.get('data', {}).get('uuid') if not riderId: return {"error": "RiderId not found"} bikeId = customerData.get('data', {}).get('bikes', [{}])[0].get('id') if not bikeId: return {"error": "BikeId not found"} country = customerData.get('data', {}).get('country') if not country: return {"error": "CountryCode not found"} last_seen_week = datetime.now().strftime("%Y-%m-%d") # Ensure last_seen_week is the Monday of the week date_obj = datetime.strptime(last_seen_week, "%Y-%m-%d") monday = date_obj - timedelta(days=date_obj.weekday()) last_seen_week = monday.strftime("%Y-%m-%d") url = f"https://tenjin.vanmoof.com/api/v1/rides/{riderId}/{bikeId}/weekly" querystring = {"lastSeenWeek": last_seen_week, "limit": str(1)} headers = { "authorization": f"Bearer {application_token}", "api-key": "fcb38d47-f14b-30cf-843b-26283f6a5819", "cache-control": "no-cache, private", "accept-language": f"{country.lower()}_{country.upper()}", "accept-encoding": "gzip", "timezone": timezone_name, "accept": "*/*", } response = requests.get(url, headers=headers, params=querystring) result = response.json().get('carousel', {}).get('world', {}) # Convert the average duration from milliseconds to minutes. result['averageDuration'] = round(result['averageDuration'] / 1000 / 60, 2) return result

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/stefanstranger/mcp-server-vanmoof'

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