INNER CODE UNIT · Python
_build_discover_payload
caiovicentino/polymarket-mcp-server · src/polymarket_mcp/server.py:139
def _build_discover_payload() -> dict[str, Any]:
"""Fresh discover payload for the cache (deterministic within the TTL)."""
return build_discover_result(
server_name=server.name,
server_version=__version__,
capabilities=_server_capabilities_dict(),
)
class _PreHandshakeStream:
"""Read-stream interceptor serving pre-handshake requests.
Installed in :func:`main` between the stdio transport and ``Server.run``:
- ``server/discover`` is answered here (before any session exists), so the
request never reaches the SDK union validation that produced -32602, nor
the pre-handshake ``RuntimeError`` that drops it on some SDK versions
(seam map: polymarket_mcp.discover docstring, issues #39/#40).
- A version-less ``initialize`` is served on this server's declared default