Skip to main content
Glama
stefanstranger

mcp-server-vanmoof

get_city_rides_thisweek

Retrieve weekly city ride summaries from VanMoof riders, including total rides, average distance, duration, and location data for analysis.

Instructions

    Retrieves total city 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:
        - City name
        - Average distance in km
        - Total Rides
        - Average duration in minutes
        - Location in latitude and longitude
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function decorated with @mcp.tool(), which registers and implements the 'get_city_rides_thisweek' tool. It authenticates with VanMoof API, retrieves necessary IDs and preferences, fetches this week's rides data, extracts city summary, processes average duration, adds location info, and returns the result.
    @mcp.tool()
    def get_city_rides_thisweek()-> Dict[str, Any]:
        """
        Retrieves total city 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:
            - City name
            - Average distance in km
            - Total Rides
            - Average duration in minutes
            - Location in latitude and longitude
        """
        # 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"}
        
        # Get the riders preferences and city
        riderPreferences = VanMoofAPI.get_rider_preferences()
        riderCity = riderPreferences.get('city')
        # Get city name from the city code
        cities = VanMoofAPI.get_vanmoof_cities()
        location= next((city['location'] for city in cities if city['code'] == riderCity), None)
    
        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('city', {})
        # Convert the average duration from milliseconds to minutes.
        result['averageDuration'] = round(result['averageDuration'] / 1000 / 60, 2)
        # Add the city name to the result
        result['location'] = location
            
        return result
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses authentication requirements and the return format (including specific data fields), which is valuable. However, it doesn't mention rate limits, error conditions beyond authentication failure, or whether this is a read-only operation (though 'retrieves' implies it).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is reasonably structured with clear sections but has some redundancy ('The a summary') and could be more front-loaded. The authentication information is buried after the return format rather than being prioritized. Most sentences earn their place, but the flow could be improved.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no parameters, no annotations, and no output schema, the description does a decent job explaining what it returns and authentication requirements. However, it doesn't clarify the scope ('thisweek' in the name vs 'total' in description) or how it differs from sibling tools, leaving some contextual gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the baseline is 4. The description appropriately doesn't discuss parameters since none exist, focusing instead on return values and authentication requirements.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves a total city rides summary from VanMoof riders, which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'get_rides_summary' or 'get_world_rides_thisweek' - the 'city' scope is implied but not contrasted with alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions authentication requirements but provides no guidance on when to use this tool versus similar siblings like 'get_rides_summary' or 'get_world_rides_thisweek'. There's no explicit when/when-not guidance or alternative tool recommendations for different use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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