PrefectHQ/fastmcp · error · ValueError
Elicitation response missing required 'value' field.
Error message
Elicitation response missing required 'value' field.
What it means
For raw schema forms (dict or nested-list shorthand like {"low": {"title": ...}} or [["a","b"]]), FastMCP expects the user's accepted response content to be an object with a single 'value' field. If the client's response content is not a dict or lacks 'value', handle_elicit_accept cannot extract the answer and raises.
Source
Thrown at fastmcp_slim/fastmcp/server/elicitation.py:325
)
def handle_elicit_accept(
config: ElicitConfig, content: Any
) -> AcceptedElicitation[Any]:
"""Handle an accepted elicitation response.
Args:
config: The elicitation configuration from parse_elicit_response_type
content: The response content from the client
Returns:
AcceptedElicitation with the extracted/validated data
"""
# For raw schemas (dict/nested-list syntax), extract value directly
if config.is_raw:
if not isinstance(content, dict) or "value" not in content:
raise ValueError("Elicitation response missing required 'value' field.")
return AcceptedElicitation[Any](data=content["value"])
# For typed schemas, validate with Pydantic
if config.response_type is not None:
type_adapter = get_cached_typeadapter(config.response_type)
validated_data = type_adapter.validate_python(content)
if isinstance(validated_data, ScalarElicitationType):
return AcceptedElicitation[Any](data=validated_data.value)
return AcceptedElicitation[Any](data=validated_data)
# For None response_type, expect empty response
if content:
raise ValueError(
f"Elicitation expected an empty response, but received: {content}"
)
return AcceptedElicitation[dict[str, Any]](data={})
View on GitHub (pinned to 1f02114297)
Solutions
- Check the responding client's elicitation implementation — it must wrap the answer in {"value": ...} per the generated schema
- Inspect the raw response content (log it in middleware) to confirm what was actually returned
- In tests, always return content of the form {"value": <answer>} for raw-syntax elicitations
- If the response path is custom (proxy/middleware), stop altering the content payload
Example fix
// before
handle_elicit_accept(config, content=None)
// after
handle_elicit_accept(config, content={"value": "low"}) Defensive patterns
Strategy: type-guard
Validate before calling
def has_value_content(content: object) -> bool:
return isinstance(content, dict) and "value" in content
if not has_value_content(response.content):
raise ValueError("client returned malformed elicitation content") Type guard
def is_valid_raw_content(content: object) -> bool:
return isinstance(content, dict) and "value" in content Try / catch
try:
accepted = await ctx.elicit(response_type={"low": {"title": "Low"}})
except ValueError as e:
if "missing required 'value'" in str(e):
logger.warning("client returned malformed elicitation content; retrying with typed model")
return None
raise Prevention
- Raw dict/list-shorthand elicitations always expect {"value": ...} back — verify your client does this
- Log raw response content in middleware when debugging client mismatches
- Prefer typed (BaseModel/dataclass/Enum) response types, which use Pydantic validation instead of raw extraction
- In tests, build accept content as {"value": <answer>}
When it happens
Trigger: ctx.elicit() with a dict or [[...]] response_type, then the accepted response's content is None, a scalar, or a dict without the 'value' key — typically a client that returned a malformed or non-standard accept payload.
Common situations: Custom or non-conforming MCP clients echoing back wrong content shapes; middleware or proxies transforming the elicitation response; writing tests that construct AcceptedElicitation content manually and forgetting the 'value' wrapper.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- Elicitation expected an empty response, but received: {conte
- ctx.elicit() requires a response_type. The empty-schema form
- response_title and response_description are only supported w
- Dict response_type cannot be empty.
- Invalid list response_type format. Received: {lst}
AI-assisted analysis of PrefectHQ/fastmcp@1f02114297 (2026-08-29).
Data as JSON: /api/errors/3287ffe16dadf9bf.
Report an issue: GitHub.