Skip to content

fix(mcp): a tool's Platforms line never lists values its platform enum rejects - #117

Merged
Ooscaar merged 1 commit into
developfrom
fix/mcp-platforms-line-vs-enum
Nov 19, 2026
Merged

Ooscaar merged 1 commit into
developfrom
fix/mcp-platforms-line-vs-enum

Conversation

@Ooscaar

@Ooscaar Ooscaar commented Nov 19, 2026

Copy link
Copy Markdown
Member

Problem

The MCP docstring builder appends Platforms: <x-platforms>. On the ads operations x-platforms holds product names (meta, x), while the same operation's platform parameter is an enum of stored values (facebook, instagram, twitter, ...). Agents read the docstring, pass platform="meta", and FastMCP rejects it before any HTTP call (literal_error, Axiom zernio-mcp error_type=ValidationError, no status_code), e.g. on ad_campaigns_list_ad_campaigns and ad_campaigns_get_ad_tree.

Fix

In build_tool_description_lines: when the tool's platform/platforms argument is a string enum and it rejects any x-platforms value, the line becomes Platforms (the platform parameter takes): <enum values> (read from the generated Literal, so it is exactly what FastMCP validates). Otherwise the Platforms: <x-platforms> line is unchanged, so a narrower valid list such as google against a wider enum keeps saying "google". Operations without x-platforms get no new line.

Regenerated generated_tools.py: 17 changed lines, all Platforms lines (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 and meta still rejected; no platform enum -> x-platforms kept). The existing Google-only test is unchanged.
  • In-memory FastMCP client via search_tools/call_tool: the two tools' descriptions no longer list meta/x; platform="facebook" passes validation, platform="meta" is still rejected.
  • Real API with a read-only key (GET only): both tools return 200 data with platform="facebook" and with no platform.
  • Rebased on 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 (or bogus) 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 map meta -> facebook+instagram and x -> twitter.
  • Spec inconsistencies surfaced: listAdSets x-platforms has microsoft but its enum doesn't; read ads endpoints omit openai from x-platforms while their enum has it; connectAds uses googleads/redditads where the ads endpoints use google/reddit.
  • workflows_create_workflow: its x-platforms (hubspot, salesforce) describes CRM nodes, not the platform channel argument, so its line now lists the channels.

🤖 Generated with Claude Code

…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>
@Ooscaar
Ooscaar merged commit 0a15ce2 into develop Nov 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant