MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / _AlreadySentResponse

Class _AlreadySentResponse

src/codegraphcontext/api/mcp_sse.py:52–64  ·  view source on GitHub ↗

Placeholder for a response the MCP transport wrote itself. Both handlers below hand the raw ASGI ``send`` to the SDK, which emits the complete response. FastAPI still does ``await endpoint(request)`` followed by ``await response(...)``, so returning ``None`` raises ``TypeError: 'Non

Source from the content-addressed store, hash-verified

50
51
52class _AlreadySentResponse(Response):
53 """Placeholder for a response the MCP transport wrote itself.
54
55 Both handlers below hand the raw ASGI ``send`` to the SDK, which emits the
56 complete response. FastAPI still does ``await endpoint(request)`` followed
57 by ``await response(...)``, so returning ``None`` raises ``TypeError:
58 'NoneType' object is not callable`` and returning a real ``Response`` starts
59 a second response on a finished ASGI cycle. This satisfies FastAPI while
60 putting nothing on the wire.
61 """
62
63 async def __call__(self, scope, receive, send) -> None:
64 return
65
66
67class _SendTracker:

Callers 2

handle_sseFunction · 0.85
handle_messagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected