Skip to content

change the client to send the elicitation/create result immediately on SSE receipt, independent of the tools/call HTTP lifecycle #600

@Agent-Hellboy

Description

@Agent-Hellboy

I guess currently it depends on HTTP lifecycle.
but how?

here is the log message form my implementation

  INFO:     incoming POST /mcp/http
  2026-01-05 12:08:38,117 DEBUG pymcp.transports.mcp_http_streamable:mcp_http_streamable_post:290 [TRANSPORT][MCP_HTTP_STREAMABLE]
  [CLIENT->SERVER] request_received session_id=d4826a09-e53a-4e4f-b1f5-227d914abdcb client_host=10.163.2.82 method=tools/call id=5 phase=receive
  2026-01-05 12:08:38,117 DEBUG pymcp.core.state.cancellation:create_token:33 [DATA][CANCELLATION][TOKEN] created token=5 phase=create
  2026-01-05 12:08:38,118 DEBUG pymcp.core.state.elicitation:request_elicitation:51 [DATA][ELICITATION][SEND] queued_elicitation rpc_id=3ed6e74d-
  a9b1-444d-bd2d-ed08786ef48b session_id=d4826a09-e53a-4e4f-b1f5-227d914abdcb payload={"jsonrpc":"2.0","id":"3ed6e74d-a9b1-444d-bd2d-
  ed08786ef48b","method":"elicitation/create","params":{"mode":"form","message":"Provide environment and confirm deployment.","requestedSchema":
  {"type":"object","properties":{"environment":{"type":"string","title":"Environment","enum":["development","staging","production"]},"confirm":
  {"type":"boolean","title":"Confirm deploy?"}},"required":["environment","confirm"]}}}
  2026-01-05 12:08:38,118 DEBUG pymcp.transports.mcp_http_streamable:sse_stream:205 [TRANSPORT][MCP_HTTP_STREAMABLE][SERVER->CLIENT] sse_send
  session_id=d4826a09-e53a-4e4f-b1f5-227d914abdcb phase=stream_send
  2026-01-05 12:08:58,118 DEBUG pymcp.core.state.elicitation:request_elicitation:61 [DATA][ELICITATION][TIMEOUT] elicitation_timeout
  rpc_id=3ed6e74d-a9b1-444d-bd2d-ed08786ef48b session_id=d4826a09-e53a-4e4f-b1f5-227d914abdcb
  2026-01-05 12:08:58,118 DEBUG pymcp.core.state.cancellation:clear:101 [DATA][CANCELLATION][TOKEN] cleared token=5 phase=clear
  2026-01-05 12:08:58,119 DEBUG pymcp.transports.mcp_http_streamable:mcp_http_streamable_post:395 [TRANSPORT][MCP_HTTP_STREAMABLE]
  [SERVER->CLIENT] response_json session_id=d4826a09-e53a-4e4f-b1f5-227d914abdcb method=tools/call id=5 status=200 phase=respond
  INFO:     handled POST /mcp/http status=200 duration_ms=20002.8
  INFO:     incoming POST /mcp/http
  2026-01-05 12:08:58,180 DEBUG pymcp.transports.mcp_http_streamable:mcp_http_streamable_post:290 [TRANSPORT][MCP_HTTP_STREAMABLE]
  [CLIENT->SERVER] request_received session_id=d4826a09-e53a-4e4f-b1f5-227d914abdcb client_host=10.163.2.82 method=None id=3ed6e74d-a9b1-444d-
  bd2d-ed08786ef48b phase=receive
  2026-01-05 12:08:58,180 DEBUG pymcp.core.state.session:resolve_elicitation_response:470 [SESSION][ELICITATION][LATE] no_pending_future
  session_id=d4826a09-e53a-4e4f-b1f5-227d914abdcb rpc_id=3ed6e74d-a9b1-444d-bd2d-ed08786ef48b keys=['jsonrpc', 'id', 'result']
  payload={"jsonrpc":"2.0","id":"3ed6e74d-a9b1-444d-bd2d-ed08786ef48b","result":{"action":"accept","content":
  {"environment":"development","confirm":true}}}
  2026-01-05 12:08:58,180 DEBUG pymcp.transports.mcp_http_streamable:mcp_http_streamable_post:357 [TRANSPORT][MCP_HTTP_STREAMABLE]
  [CLIENT->SERVER] response_ignored session_id=d4826a09-e53a-4e4f-b1f5-227d914abdcb id=3ed6e74d-a9b1-444d-bd2d-ed08786ef48b body_keys=['jsonrpc',
  'id', 'result'] body={"jsonrpc":"2.0","id":"3ed6e74d-a9b1-444d-bd2d-ed08786ef48b","result":{"action":"accept","content":
  {"environment":"development","confirm":true}}} phase=ignore_response
  2026-01-05 12:08:58,180 DEBUG pymcp.transports.mcp_http_streamable:mcp_http_streamable_post:366 [TRANSPORT][MCP_HTTP_STREAMABLE]
  [CLIENT->SERVER] pending_elicitation_ids session_id=d4826a09-e53a-4e4f-b1f5-227d914abdcb pending=[]
  INFO:     handled POST /mcp/http status=202 duration_ms=1.6

What I did here is, from a server, I am waiting for Future to be resolved, but it never got resolved(it timed out) because the client didn't promptly respond back to my elicitation request sent over sse stream, it sent the response back after tools/call got over

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions