Repository navigation
fix(prompts): honor field aliases when rendering prompts - #5836
Conversation
This comment has been minimized.
This comment has been minimized.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Prompt arguments are advertised from the Pydantic call schema, so an alias declared through Annotated metadata or a Field(...) default is listed under the alias. render() checked the required set against the advertised names, then converted and filtered the arguments by Python parameter name, silently dropping the alias key before validation: the request failed with `Name Missing required argument`, and sending the Python name failed the required check. Map advertised names back to their Python parameters for string conversion and keep alias keys in the signature filter; the type adapter validates them under the alias, as it does for tools. Co-Authored-By: Claude Code <noreply@anthropic.com>
28e9807 to
54c49cc
Compare
There was a problem hiding this comment.
Automated review by the FastMCP triage reviewer bot.
One alias case still fails: Field(alias="Name", validation_alias="Input") advertises Input, but the helper chooses Name. Rendering drops supplied values: required arguments error and optional arguments silently use defaults.
Please prefer string validation_alias over alias and add required/defaulted dual-alias tests, including typed JSON-string conversion.
Checks
Both failures reproduced on this revision; the existing 71 prompt-module tests pass.
Separate concise, PR-bound contributor feedback from retained triage reports. Keep internal reasoning and command transcripts out of both publication paths, with regression coverage from the #5836 review.
Prepared with Codex.
|
Fixed in 10852bd: string validation_alias now takes precedence over alias. Required and defaulted JSON-string cases pass; tests/prompts: 83 passed; applicable prek checks passed. |
There was a problem hiding this comment.
Automated review by the FastMCP triage reviewer bot.
The updated alias precedence fixes the earlier required/defaulted failures. Advertised string aliases now survive filtering and receive typed conversion without allowing callers to override injected dependencies. No additional consequential defect was confirmed in the exercised paths.
Checks
Copied PR tests fail in 8 alias cases on unchanged code; all 73 pass at 10852bd. Two additional probes pass, including real client dispatch, defaults, integer conversion, and dependency protection.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Revert "fix: preserve referenced schema definitions (#5588)" This reverts commit 5f1d152. * Revert "fix(server): rebuild tool argument errors instead of echoing pydantic's (#6107)" This reverts commit 8fba5f7. * Revert "Advertise the MCP Apps extension only when the server serves an app (#5062)" This reverts commit b89222b. * Revert "fix(tasks): retain results after tool removal (#5507)" This reverts commit 711575a. * Revert "fix(client): Prevent stale ClientGroup refreshes from replacing newer routes (#5543)" This reverts commit 365d5d2. * Revert "fix(prompts): honor field aliases when rendering prompts (#5836)" This reverts commit a450fd8. * Revert "Stop FastMCP callable caches from retaining dropped tools (#6147)" This reverts commit 713f247. * Revert "feat(auth): Add KeystoneTokenVerifier (#6264)" This reverts commit c33f3de. * Revert "fix(json-schema): keep x-unsupported-pattern when a format is set (#5731)" This reverts commit dc9849d. * Revert "Roll back the tool stamp when a tool registration is rejected (#5798)" This reverts commit d6566c5. * Revert "fix(server): validate cursors when pagination is disabled (#6045)" This reverts commit 4917bee. * Revert "Keep constraints on scalar schema references (#6041)" This reverts commit e5176c9.
Closes #5835
Prompt arguments with Pydantic aliases are advertised under their input names, but rendering previously filtered them by Python parameter name and discarded the values. Resolve advertised names back to their parameters for JSON-string conversion and preserve those input keys for Pydantic validation. When both
aliasand a stringvalidation_aliasare present, prefervalidation_alias, matching the advertised schema; supplied values then override defaults correctly. Injected dependencies remain excluded from caller arguments.Prepared with Codex.