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.server.fastmcp import FastMCP, Context
|
||||||
from mcp.types import TextContent, Annotations, EmbeddedResource, TextResourceContents
|
from mcp.types import TextContent, Annotations, EmbeddedResource, TextResourceContents
|
||||||
from strava_mcp_server.strava_client import StravaClient
|
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:
|
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"
|
location = ", ".join(location_parts) if location_parts else "N/A"
|
||||||
|
|
||||||
essential_data = {
|
full_name = (
|
||||||
"id": athlete.get("id"),
|
f"{athlete.get('firstname', '')} {athlete.get('lastname', '')}".strip()
|
||||||
"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"),
|
|
||||||
}
|
|
||||||
|
|
||||||
markdown_summary = f"""
|
markdown_summary = f"""
|
||||||
👤 **Profile for {essential_data["name"]}** (ID: {essential_data["id"]})
|
👤 **Profile for {full_name}** (ID: {athlete.get("id")})
|
||||||
- Username: {essential_data["username"] or "N/A"}
|
- Username: {athlete.get("username") or "N/A"}
|
||||||
- Location: {essential_data["location"]}
|
- Location: {location}
|
||||||
- Sex: {essential_data["sex"] or "N/A"}
|
- Sex: {athlete.get("sex") or "N/A"}
|
||||||
- Weight: {essential_data["weight"] or "N/A"} kg
|
- Weight: {athlete.get("weight") or "N/A"} kg
|
||||||
- Measurement Units: {essential_data["measurement_units"] or "N/A"}
|
- Measurement Units: {athlete.get("measurement_preference") or "N/A"}
|
||||||
- Strava Summit Member: {"Yes" if essential_data["is_premium"] else "No"}
|
- Strava Summit Member: {"Yes" if athlete.get("premium") else "No"}
|
||||||
- Profile Image (Medium): {essential_data["profile_medium"] or "N/A"}
|
- Profile Image (Medium): {athlete.get("profile_medium") or "N/A"}
|
||||||
- Joined Strava: {format_date_human(essential_data["created_at"])}
|
- Joined Strava: {format_date_human(athlete.get("created_at"))}
|
||||||
- Last Updated: {format_date_human(essential_data["updated_at"])}
|
- Last Updated: {format_date_human(athlete.get("updated_at"))}
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -69,7 +55,7 @@ def register(mcp: FastMCP, strava: StravaClient) -> None:
|
|||||||
resource=TextResourceContents(
|
resource=TextResourceContents(
|
||||||
uri="internal://athlete/profile",
|
uri="internal://athlete/profile",
|
||||||
mimeType="application/json",
|
mimeType="application/json",
|
||||||
text=json.dumps(essential_data, indent=2),
|
text=json.dumps(athlete, indent=2),
|
||||||
),
|
),
|
||||||
annotations=Annotations(audience=["assistant"]),
|
annotations=Annotations(audience=["assistant"]),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user