Repository navigation
Description
Summary
A prompt whose signature uses a Pydantic field alias is unusable through prompts/get. FunctionPrompt builds its advertised PromptArgument list from the Pydantic call schema, so Annotated[int, Field(alias="X")] is listed as argument X. But render() then filters incoming kwargs against inspect.signature(self.fn)'s Python parameter names, silently dropping X before validation: calling with {"X": "5"} raises PromptError (X Missing required argument, with input_value={}), and calling with {"x": "5"} fails the required check (Missing required arguments: {'X'}). The same alias works on a tool input schema because tools validate directly against the call schema without that signature filter.
Reproduction (current main adf90b6, offline)
from typing import Annotated
from pydantic import Field
from fastmcp import FastMCP
from fastmcp.prompts import Prompt
mcp = FastMCP("repro")
@mcp.prompt
def greet(name: Annotated[int, Field(alias="X")]) -> str:
return f"got {name}"Observed: advertised arguments [('X', True)]; Prompt.from_function(greet).render({"X": "5"}) raises PromptError: 1 validation error for call[greet] / X / Missing required argument (input {} after the alias was dropped); render({"x": "5"}) raises ValueError: Missing required arguments: {'X'}. Through client.get_prompt both variants fail with MCPError. An equivalent tool with the same annotation accepts {"X": 5} and returns 5.
Expected: a prompt advertising X renders successfully when the client sends {"X": "5"}, returning got 5 just like the tool.
Suggested fix
Preserve an advertised-name → Python-name mapping (from validation_alias/alias metadata) when constructing the prompt, accept advertised aliases in the render security filter, and resolve aliases for annotation lookup while keeping the wire key expected by the call adapter. Injected Context/Depends parameters must remain excluded.
Tests
A fix with six regression tests is ready (alias and validation_alias advertised + renderable, aliased non-string argument, client.get_prompt, alias with an injected parameter, ordinary-prompt control). I'll open the linked PR with the red/green evidence.
Activity
BlueX888 commentedon Oct 29, 2026
The fix is in #5836, reworked against current
main(0a125c1) — the prompt subsystem was refactored since the first revision but the bug is unchanged: arguments are advertised under the Pydantic alias, thenrender()filters them by the Python parameter name and drops the key before validation. The updated PR adds 7 tests (6 fail onmain), all passing with the fix.check-issue-linkrequires the PR author to be assigned to this issue, so a maintainer assigning @BlueX888 (or advising otherwise) would unblock that check; the code-level CI is otherwise running normally.fix(prompts): honor field aliases when rendering prompts (PrefectHQ#5836