|
|
|
@@ -267,6 +267,53 @@ def register(mcp: FastMCP, strava: StravaClient) -> None:
|
|
|
|
|
except Exception as e:
|
|
|
|
|
return [TextContent(type="text", text=f"Error fetching kudoers: {str(e)}")]
|
|
|
|
|
|
|
|
|
|
@mcp.resource("strava://activity/{activity_id}/map")
|
|
|
|
|
async def get_activity_map_resource(activity_id: int) -> str:
|
|
|
|
|
"""HTML map resource for a specific Strava activity."""
|
|
|
|
|
|
|
|
|
|
class DummyContext:
|
|
|
|
|
async def info(self, msg):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
async def warning(self, msg):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
async def error(self, msg):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
ctx = DummyContext()
|
|
|
|
|
result = await get_activity_map(ctx, activity_id)
|
|
|
|
|
if result and result.content:
|
|
|
|
|
return result.content[0].text
|
|
|
|
|
return "<html><body><p>Error loading map</p></body></html>"
|
|
|
|
|
|
|
|
|
|
@mcp.resource("strava://activity/last/map")
|
|
|
|
|
async def get_last_activity_map_resource() -> str:
|
|
|
|
|
"""HTML map resource for the most recent Strava activity."""
|
|
|
|
|
|
|
|
|
|
class DummyContext:
|
|
|
|
|
async def info(self, msg):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
async def warning(self, msg):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
async def error(self, msg):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
ctx = DummyContext()
|
|
|
|
|
try:
|
|
|
|
|
activities = await strava.list_activities(limit=1)
|
|
|
|
|
if not activities:
|
|
|
|
|
return "<html><body><p>Keine Strava-Aktivitäten gefunden.</p></body></html>"
|
|
|
|
|
last_id = activities[0]["id"]
|
|
|
|
|
result = await get_activity_map(ctx, last_id)
|
|
|
|
|
if result and result.content:
|
|
|
|
|
return result.content[0].text
|
|
|
|
|
except Exception as e:
|
|
|
|
|
return f"<html><body><p>Error loading last activity: {str(e)}</p></body></html>"
|
|
|
|
|
return "<html><body><p>Error loading map</p></body></html>"
|
|
|
|
|
|
|
|
|
|
@mcp.tool()
|
|
|
|
|
async def get_laps_by_activity_id(activity_id: int):
|
|
|
|
|
"""
|
|
|
|
|