refactor: simplify athlete profile formatting and export full API response in tool output, plus add AGENTS.md documentation
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
Das Git Repo zu dem Projekt:
|
||||
"Strava MCP Server"
|
||||
findest du hier: https://git.hnrx.net/hnrx/strava-mcp-server
|
||||
|
||||
Issues: https://git.hnrx.net/hnrx/strava-mcp-server/issues
|
||||
@@ -2,7 +2,7 @@ import json
|
||||
from mcp.server.fastmcp import FastMCP, Context
|
||||
from mcp.types import TextContent, Annotations, EmbeddedResource, TextResourceContents
|
||||
from strava_mcp_server.strava_client import StravaClient
|
||||
from strava_mcp_server.utils import format_date_iso, format_date_human
|
||||
from strava_mcp_server.utils import format_date_human
|
||||
|
||||
|
||||
def register(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
@@ -28,34 +28,20 @@ def register(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
]
|
||||
location = ", ".join(location_parts) if location_parts else "N/A"
|
||||
|
||||
essential_data = {
|
||||
"id": athlete.get("id"),
|
||||
"username": athlete.get("username"),
|
||||
"name": f"{athlete.get('firstname')} {athlete.get('lastname')}".strip(),
|
||||
"location": location,
|
||||
"sex": athlete.get("sex"),
|
||||
"weight": athlete.get("weight"),
|
||||
"measurement_units": athlete.get("measurement_preference"),
|
||||
"is_premium": athlete.get("premium", False),
|
||||
"profile_medium": athlete.get("profile_medium"),
|
||||
"created_at": format_date_iso(athlete.get("created_at")),
|
||||
"updated_at": format_date_iso(athlete.get("updated_at")),
|
||||
"bio": athlete.get("bio"),
|
||||
"follower_count": athlete.get("follower_count"),
|
||||
"friend_count": athlete.get("friend_count"),
|
||||
}
|
||||
|
||||
full_name = (
|
||||
f"{athlete.get('firstname', '')} {athlete.get('lastname', '')}".strip()
|
||||
)
|
||||
markdown_summary = f"""
|
||||
👤 **Profile for {essential_data["name"]}** (ID: {essential_data["id"]})
|
||||
- Username: {essential_data["username"] or "N/A"}
|
||||
- Location: {essential_data["location"]}
|
||||
- Sex: {essential_data["sex"] or "N/A"}
|
||||
- Weight: {essential_data["weight"] or "N/A"} kg
|
||||
- Measurement Units: {essential_data["measurement_units"] or "N/A"}
|
||||
- Strava Summit Member: {"Yes" if essential_data["is_premium"] else "No"}
|
||||
- Profile Image (Medium): {essential_data["profile_medium"] or "N/A"}
|
||||
- Joined Strava: {format_date_human(essential_data["created_at"])}
|
||||
- Last Updated: {format_date_human(essential_data["updated_at"])}
|
||||
👤 **Profile for {full_name}** (ID: {athlete.get("id")})
|
||||
- Username: {athlete.get("username") or "N/A"}
|
||||
- Location: {location}
|
||||
- Sex: {athlete.get("sex") or "N/A"}
|
||||
- Weight: {athlete.get("weight") or "N/A"} kg
|
||||
- Measurement Units: {athlete.get("measurement_preference") or "N/A"}
|
||||
- Strava Summit Member: {"Yes" if athlete.get("premium") else "No"}
|
||||
- Profile Image (Medium): {athlete.get("profile_medium") or "N/A"}
|
||||
- Joined Strava: {format_date_human(athlete.get("created_at"))}
|
||||
- Last Updated: {format_date_human(athlete.get("updated_at"))}
|
||||
""".strip()
|
||||
|
||||
return [
|
||||
@@ -69,7 +55,7 @@ def register(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
resource=TextResourceContents(
|
||||
uri="internal://athlete/profile",
|
||||
mimeType="application/json",
|
||||
text=json.dumps(essential_data, indent=2),
|
||||
text=json.dumps(athlete, indent=2),
|
||||
),
|
||||
annotations=Annotations(audience=["assistant"]),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user