Skip to content

Elicitation forms broken in latest version #518

@pommfresser

Description

@pommfresser

Hi, after updating to the newest release, elicitation forms are broken in some cases. The example forms from the repository are working, but my own setup with fastmcp as server does not work anymore.

The following is a PoC showing the issue:

server.py:

from typing import Optional

from fastmcp import Context
from fastmcp.server import FastMCP
from pydantic import BaseModel, Field

mcp = FastMCP("Test")

async def approval_form(ctx: Context):
    class Test(BaseModel):
        name: str = Field(description="Enter your name")
        description: str = Field(description="Description for text")
    result = await ctx.elicit(
        message="Test form",
        response_type=Test,
    )
    if result.action == "accept":
        return result.data, True
    else:
        return None, False

@mcp.tool("TestTool")
async def test_tool(ctx: Context, name: str):
    print("Called tool")
    data, approval = await approval_form(ctx)
    if not approval:
        return "User approval failed"
    return {"Status": "Success", "Name": data.name}

if __name__ == "__main__":
    mcp.run(
        transport="http",
        host="127.0.0.1",
        port=8080,
        path="/test"
    )

agent.py:

import asyncio

from fast_agent import FastAgent

fast = FastAgent("Test")

@fast.agent(
    name="Test",
    servers=["testMcpServer"]
)

async def main():
    async with fast.run() as agent:
        try:
            await agent.interactive()
        except Exception as e:
            print(e)

if __name__ == "__main__":
    asyncio.run(main())

fastagent.config.yaml

default_model: "passthrough"

mcp:
  servers:
    testMcpServer:
      transport: "http"
      url: "http://127.0.0.1:8080/test"

Calling the message from cli works: uv run agent.py --agent "Test" -m '***CALL_TOOL testMcpServer__TestTool {"name": "NAME"}'

But entering interactive mode and running ***CALL_TOOL testMcpServer__TestTool {"name": "NAME"} fails with WARNING: your terminal doesn't support cursor position requests (CPR).. I cannot see the form, but ELICITATION is shown.

Image

Entering the command ***CALL_TOOL testMcpServer__TestTool {"name": "NAME"} again ends in an endless Calling Tool run, which can be cancelled with <ESC>. After that, the form is shown.

I am very confused why this happens. As written above, I encountered this issue after updating to the newest release.

Thanks in advance!

Metadata

Metadata

Assignees

Labels

defectSomething isn't workingfixed - releaseIssue has been fixed, and has been releasedfixed - testingIssue has been fixed, and is in testing or awaiting release

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions