Elicitation handler returning the SDK's ElicitResult is sent as an accept
Author: asasemahmedCreated Sep 28, 2026Updated Sep 28, 2026
Labelsbugclient
What happened?
If an elicitation handler returns mcp_types.ElicitResult(action="decline"), the client sends an accept whose content is the serialized result object. The server rejects it, and the tool call fails instead of seeing a decline.
Example Code
import asyncio
from dataclasses import dataclass
import mcp_types
from fastmcp import Client, Context, FastMCP
mcp = FastMCP("demo")
@dataclass
class Person:
name: str
@mcp.tool
async def ask_for_name(ctx: Context) -> str:
result = await ctx.elicit("What is your name?", response_type=Person)
return f"action={result.action}"
async def handler(message, response_type, params, context):
return mcp_types.ElicitResult(action="decline")
async def main():
async with Client(mcp, mode="legacy", elicitation_handler=handler) as client:
try:
print((await client.call_tool("ask_for_name")).data)
except Exception as e:
print(f"{type(e).__name__}: {e}")
asyncio.run(main())Output: MCPError: Invalid request parameters. The response the client sends back is action='accept' content={'_meta': None, 'action': 'decline', 'content': None}.
Version Information
FastMCP version: 4.0.11.dev11+89b00b7f
MCP version: 2.0.0
Python version: 3.12.14
Platform: Windows-11-10.0.26200-SP0Source: PrefectHQ/fastmcp