delete_workout
Delete a specific workout from Garmin Connect using its workout ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workout_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/garmin_workouts_mcp/server.py:92-101 (handler)Handler function for the delete_workout tool. Sends a DELETE request to the Garmin workout API endpoint using the provided workout_id. Returns True on success, False on failure with error logging.
@mcp.tool def delete_workout(workout_id: str) -> bool: endpoint = GET_WORKOUT_ENDPOINT.format(workout_id=workout_id) try: _connectapi(endpoint, method="DELETE") logger.info("Deleted workout %s", workout_id) return True except Exception as exc: logger.error("Failed deleting workout %s: %s", workout_id, exc) return False - src/garmin_workouts_mcp/server.py:92-92 (registration)Registers the delete_workout function as an MCP tool via the @mcp.tool decorator.
@mcp.tool - Helper function that authenticates and makes API calls. Used by delete_workout to send the DELETE request to Garmin.
def _connectapi(endpoint: str, method: str = "GET", **kwargs) -> dict: _ensure_authenticated() return garth.connectapi(endpoint, method=method, **kwargs) - Endpoint URL template used by delete_workout to construct the specific workout URL.
GET_WORKOUT_ENDPOINT = "/workout-service/workout/{workout_id}" GET_ACTIVITY_ENDPOINT = "/activity-service/activity/{activity_id}"