fix(mcp): emit lossless follower-stats JSON in _format_response#26
Merged
Merged
Conversation
accounts_get_follower_stats returned only "platform: username", dropping currentFollowers, growth and the daily series: the shared _format_response matched the generic accounts branch. Add a guard on the stats attr (unique to FollowerStatsResponse) before that branch, returning model_dump_json. Applied to the emitted file and the generator template so a regen keeps it. Crisp: https://app.crisp.chat/website/20dea5d6-a684-4c80-b097-2258b0b41421/inbox/session_30e968e1-b064-4020-9c16-dd9ff655b5df/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The MCP tool
accounts_get_follower_statsreturned only the account name (platform: username), dropping the follower count, growth and the daily series, even though the data exists server-side. Customer-origin: a developer pulling LinkedIn org follower stats (latest count 2274 + a week of daily snapshots) saw only the account name come back.Crisp: https://app.crisp.chat/website/20dea5d6-a684-4c80-b097-2258b0b41421/inbox/session_30e968e1-b064-4020-9c16-dd9ff655b5df/
What
_format_responseis a shared stringifier that pattern-matches on the response shape.FollowerStatsResponsehas anaccountsattr, so it fell into the generic account-list branch that prints only- {platform}: {username}and discardedcurrentFollowers,growthand thestatsseries.statsattr (unique toFollowerStatsResponseamong all response models) BEFORE the genericaccountsbranch, returningmodel_dump_json(by_alias=True, exclude_none=True)so the count, growth and series reach the LLM losslessly.generated_tools.pyand thegenerate_mcp_tools.pytemplate so a future regen keeps it.get_follower_statsdocstrings (aggregation->stats,granularity).mcp>=1.8.0to the existingdevextra so tests can importlate.mcp.generated_tools.The related model gap (
FollowerStatsResponsemissingstats/granularity) was already corrected ondevelopby an earlier OpenAPI regen, so no model change was needed here.