{"record":{"id":"3287ffe16dadf9bf","repo":"PrefectHQ/fastmcp","slug":"elicitation-response-missing-required-value-fiel","errorCode":null,"errorMessage":"Elicitation response missing required 'value' field.","messagePattern":"Elicitation response missing required 'value' field\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/server/elicitation.py","lineNumber":325,"sourceCode":"    )\n\n\ndef handle_elicit_accept(\n    config: ElicitConfig, content: Any\n) -> AcceptedElicitation[Any]:\n    \"\"\"Handle an accepted elicitation response.\n\n    Args:\n        config: The elicitation configuration from parse_elicit_response_type\n        content: The response content from the client\n\n    Returns:\n        AcceptedElicitation with the extracted/validated data\n    \"\"\"\n    # For raw schemas (dict/nested-list syntax), extract value directly\n    if config.is_raw:\n        if not isinstance(content, dict) or \"value\" not in content:\n            raise ValueError(\"Elicitation response missing required 'value' field.\")\n        return AcceptedElicitation[Any](data=content[\"value\"])\n\n    # For typed schemas, validate with Pydantic\n    if config.response_type is not None:\n        type_adapter = get_cached_typeadapter(config.response_type)\n        validated_data = type_adapter.validate_python(content)\n        if isinstance(validated_data, ScalarElicitationType):\n            return AcceptedElicitation[Any](data=validated_data.value)\n        return AcceptedElicitation[Any](data=validated_data)\n\n    # For None response_type, expect empty response\n    if content:\n        raise ValueError(\n            f\"Elicitation expected an empty response, but received: {content}\"\n        )\n    return AcceptedElicitation[dict[str, Any]](data={})\n\n","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/server/elicitation.py#L307-L343","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nhandle_elicit_accept(config, content=None)\n// after\nhandle_elicit_accept(config, content={\"value\": \"low\"})","handlingStrategy":"type-guard","validationCode":"def has_value_content(content: object) -> bool:\n    return isinstance(content, dict) and \"value\" in content\n\nif not has_value_content(response.content):\n    raise ValueError(\"client returned malformed elicitation content\")","typeGuard":"def is_valid_raw_content(content: object) -> bool:\n    return isinstance(content, dict) and \"value\" in content","tryCatchPattern":"try:\n    accepted = await ctx.elicit(response_type={\"low\": {\"title\": \"Low\"}})\nexcept ValueError as e:\n    if \"missing required 'value'\" in str(e):\n        logger.warning(\"client returned malformed elicitation content; retrying with typed model\")\n        return None\n    raise","preventionTips":["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>}"],"tags":["elicitation","response-validation","fastmcp","mcp-client"],"backgroundTag":"missing-required-field","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}