11from __future__ import annotations
22
33import logging
4+ import warnings
45import weakref
56from collections .abc import Callable , Generator , Mapping , Sequence
67from contextlib import contextmanager
2627from typing_extensions import TypeVar
2728from uncalled_for import SharedContext
2829
30+ import fastmcp
31+ from fastmcp .exceptions import FastMCPDeprecationWarning
2932from fastmcp .resources .base import ResourceResult
3033from fastmcp .server .elicitation import (
3134 AcceptedElicitation ,
@@ -1130,9 +1133,11 @@ async def elicit(
11301133 "value" field will be generated for the MCP interaction and
11311134 automatically deconstructed into the primitive type upon response.
11321135
1133- If the response_type is None, the generated schema will be that of an
1134- empty object in order to comply with the MCP protocol requirements.
1135- Clients must send an empty object ("{}")in response.
1136+ Passing ``response_type=None`` (or omitting it) is deprecated and will
1137+ be removed in a future version. The resulting empty-schema form-mode
1138+ request is ambiguous and causes some clients (e.g. VS Code) to hang on
1139+ an empty form. Pass an explicit ``response_type`` describing the data
1140+ you want back.
11361141
11371142 Args:
11381143 message: A human-readable message explaining what information is needed
@@ -1153,6 +1158,17 @@ async def elicit(
11531158 contexts. In background task mode (SEP-1686), it will set the task
11541159 status to "input_required" and wait for the client to provide input.
11551160 """
1161+ if response_type is None and fastmcp .settings .deprecation_warnings :
1162+ warnings .warn (
1163+ "Calling ctx.elicit() without a response_type is deprecated "
1164+ "and will be removed in a future version. The empty-schema "
1165+ "form-mode request is ambiguous under the current MCP spec "
1166+ "and causes some clients (e.g. VS Code) to render an empty, "
1167+ "non-functional form. Pass an explicit response_type "
1168+ "describing the data you expect back." ,
1169+ FastMCPDeprecationWarning ,
1170+ stacklevel = 2 ,
1171+ )
11561172 config = parse_elicit_response_type (
11571173 response_type ,
11581174 response_title = response_title ,
0 commit comments