style: refactor codebase to adhere to PEP 8 formatting standards throughout all source files
This commit is contained in:
@@ -7,12 +7,17 @@ from strava_mcp_server.strava_client import StravaClient
|
||||
def _resource(uri: str, data) -> EmbeddedResource:
|
||||
return EmbeddedResource(
|
||||
type="resource",
|
||||
resource=TextResourceContents(uri=uri, mimeType="application/json", text=json.dumps(data, indent=2)),
|
||||
resource=TextResourceContents(
|
||||
uri=uri, mimeType="application/json", text=json.dumps(data, indent=2)
|
||||
),
|
||||
annotations=Annotations(audience=["assistant"]),
|
||||
)
|
||||
|
||||
|
||||
def _user_text(text: str) -> TextContent:
|
||||
return TextContent(type="text", text=text, annotations=Annotations(audience=["user"]))
|
||||
return TextContent(
|
||||
type="text", text=text, annotations=Annotations(audience=["user"])
|
||||
)
|
||||
|
||||
|
||||
def register(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
@@ -88,9 +93,16 @@ def register(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
md += "|--------|-------|------|---------|------|\n"
|
||||
for a in data:
|
||||
md += f"| {a['athlete']} | {a['sport_type']} | {a['name']} | {a['distance']} | {a['moving_time']} |\n"
|
||||
return [_user_text(md.strip()), _resource(f"internal://clubs/{club_id}/activities", data)]
|
||||
return [
|
||||
_user_text(md.strip()),
|
||||
_resource(f"internal://clubs/{club_id}/activities", data),
|
||||
]
|
||||
except Exception as e:
|
||||
return [TextContent(type="text", text=f"Error fetching club activities: {str(e)}")]
|
||||
return [
|
||||
TextContent(
|
||||
type="text", text=f"Error fetching club activities: {str(e)}"
|
||||
)
|
||||
]
|
||||
|
||||
@mcp.tool()
|
||||
async def get_club_members(club_id: int, limit: int = 30):
|
||||
@@ -118,6 +130,11 @@ def register(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
for m in data:
|
||||
loc = ", ".join(filter(None, [m["city"], m["country"]])) or "N/A"
|
||||
md += f"| {m['name']} | {loc} |\n"
|
||||
return [_user_text(md.strip()), _resource(f"internal://clubs/{club_id}/members", data)]
|
||||
return [
|
||||
_user_text(md.strip()),
|
||||
_resource(f"internal://clubs/{club_id}/members", data),
|
||||
]
|
||||
except Exception as e:
|
||||
return [TextContent(type="text", text=f"Error fetching club members: {str(e)}")]
|
||||
return [
|
||||
TextContent(type="text", text=f"Error fetching club members: {str(e)}")
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user