refactor: migrate tool outputs to use EmbeddedResource with typed JSON for assistant-facing data
CI/CD Pipeline / Lint & Check (push) Successful in 9s
CI/CD Pipeline / Build & Push Docker Image (push) Successful in 1m20s

This commit is contained in:
2026-05-12 23:23:23 +02:00
parent 3805ca3274
commit c69e362635
3 changed files with 39 additions and 23 deletions
+9 -5
View File
@@ -1,6 +1,6 @@
import json
from mcp.server.fastmcp import FastMCP, Context
from mcp.types import TextContent, Annotations
from mcp.types import ContentBlock, TextContent, Annotations, EmbeddedResource, TextResourceContents
from strava_mcp_server.strava_client import StravaClient
from strava_mcp_server.utils import parse_iso_to_unix, format_date_iso, format_date_human
@@ -12,7 +12,7 @@ def register(mcp: FastMCP, strava: StravaClient) -> None:
page: int = 1,
before: str | None = None,
after: str | None = None,
) -> list[TextContent]:
) -> list[ContentBlock]:
"""
List recent Strava activities for the authenticated user.
:param limit: Number of activities to return per page (default 10, max 200).
@@ -62,9 +62,13 @@ def register(mcp: FastMCP, strava: StravaClient) -> None:
text=markdown_summary.strip(),
annotations=Annotations(audience=["user"])
),
TextContent(
type="text",
text=json.dumps(essential_data, indent=2),
EmbeddedResource(
type="resource",
resource=TextResourceContents(
uri="internal://activities/list",
mimeType="application/json",
text=json.dumps(essential_data, indent=2)
),
annotations=Annotations(audience=["assistant"])
)
]