Repository navigation
fix(mcp): a tool's Platforms line never lists values its platform enum rejects - #117
Merged
Merged
Conversation
…m rejects x-platforms holds product names (meta, x) while the platform parameter's enum holds stored values (facebook, twitter). Agents copied "meta" from the docstring and FastMCP rejected it before any HTTP call (literal_error). When the enum rejects an x-platforms value, the line now lists the enum; a narrower, valid x-platforms (e.g. google) is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
The MCP docstring builder appends
Platforms: <x-platforms>. On the ads operationsx-platformsholds product names (meta,x), while the same operation'splatformparameter is an enum of stored values (facebook,instagram,twitter, ...). Agents read the docstring, passplatform="meta", and FastMCP rejects it before any HTTP call (literal_error, Axiomzernio-mcperror_type=ValidationError, nostatus_code), e.g. onad_campaigns_list_ad_campaignsandad_campaigns_get_ad_tree.Fix
In
build_tool_description_lines: when the tool'splatform/platformsargument is a string enum and it rejects anyx-platformsvalue, the line becomesPlatforms (the platform parameter takes): <enum values>(read from the generatedLiteral, so it is exactly what FastMCP validates). Otherwise thePlatforms: <x-platforms>line is unchanged, so a narrower valid list such asgoogleagainst a wider enum keeps saying "google". Operations withoutx-platformsget no new line.Regenerated
generated_tools.py: 17 changed lines, allPlatformslines (13 ads tools,ad_audiences_list_ad_audiences,connect_ads,posts_unpublish_post,workflows_create_workflow). No signature or behaviour change: every tool accepts the same values as before.Validation
pytest tests: 3308 passed, 14 skipped; 2 new generator tests (contradicting enum -> enum line andmetastill rejected; no platform enum ->x-platformskept). The existing Google-only test is unchanged.search_tools/call_tool: the two tools' descriptions no longer listmeta/x;platform="facebook"passes validation,platform="meta"is still rejected.platform="facebook"and with no platform.develop(includes fix(mcp): a string anyOf/oneOf keeps every branch's enum values #116): same 17 lines.Follow-ups (API spec / API, not this repo)
GET /v1/ads/campaigns?platform=meta(orbogus) returns 200 with an empty list rather than a 400, so a wrong value reads as "no campaigns". The API should reject unknown values, or mapmeta-> facebook+instagram andx-> twitter.listAdSetsx-platformshasmicrosoftbut its enum doesn't; read ads endpoints omitopenaifromx-platformswhile their enum has it;connectAdsusesgoogleads/redditadswhere the ads endpoints usegoogle/reddit.workflows_create_workflow: itsx-platforms(hubspot, salesforce) describes CRM nodes, not theplatformchannel argument, so its line now lists the channels.🤖 Generated with Claude Code