Skip to content

Deprecate ctx.elicit() without response_type#3916

Merged
jlowin merged 1 commit intomainfrom
fix/elicit-none-deprecation
Apr 14, 2026
Merged

Deprecate ctx.elicit() without response_type#3916
jlowin merged 1 commit intomainfrom
fix/elicit-none-deprecation

Conversation

@jlowin
Copy link
Copy Markdown
Member

@jlowin jlowin commented Apr 14, 2026

Calling ctx.elicit(message=...) without a response_type (or with response_type=None) generates a requestedSchema of {"type": "object", "properties": {}}. That's a valid JSON Schema but semantically meaningless under the current MCP spec's form-mode elicitation, and clients like VS Code render it as an empty form with a Submit button that does nothing — the tool call just hangs. See #3910.

This PR emits a FastMCPDeprecationWarning at call time pointing users at an explicit response_type. Behavior is unchanged for now so existing code keeps working; the None path will be removed in a future major. The warning respects fastmcp.settings.deprecation_warnings like the rest of FastMCP's deprecations.

@mcp.tool
async def confirm(ctx: Context) -> str:
    # Deprecated — triggers FastMCPDeprecationWarning, hangs in VS Code
    await ctx.elicit(message="Proceed?")

    # Preferred — real schema, renders correctly everywhere
    result = await ctx.elicit(message="Proceed?", response_type=bool)

Closes #3910

@marvin-context-protocol marvin-context-protocol Bot added enhancement Improvement to existing functionality. For issues and smaller PR improvements. server Related to FastMCP server implementation or server-side functionality. labels Apr 14, 2026
@jlowin jlowin merged commit f4f2ec0 into main Apr 14, 2026
9 checks passed
@jlowin jlowin deleted the fix/elicit-none-deprecation branch April 14, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement to existing functionality. For issues and smaller PR improvements. server Related to FastMCP server implementation or server-side functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ctx.elicit() without response_type sends empty schema, causing clients to hang

1 participant