MCPcopy Create free account
hub / github.com/SecretiveShell/MCP-Bridge / initialize

Method initialize

mcp_bridge/mcp_clients/session.py:43–76  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

41 )
42
43 async def initialize(self) -> types.InitializeResult:
44 result = await self.send_request(
45 types.ClientRequest(
46 types.InitializeRequest(
47 method="initialize",
48 params=types.InitializeRequestParams(
49 protocolVersion=types.LATEST_PROTOCOL_VERSION,
50 capabilities=types.ClientCapabilities(
51 sampling=types.SamplingCapability(),
52 experimental=None,
53 roots=types.RootsCapability(
54 listChanged=True
55 ),
56 ),
57 clientInfo=types.Implementation(name="MCP-Bridge", version=version),
58 ),
59 )
60 ),
61 types.InitializeResult,
62 )
63
64 if result.protocolVersion not in SUPPORTED_PROTOCOL_VERSIONS:
65 raise RuntimeError(
66 "Unsupported protocol version from the server: "
67 f"{result.protocolVersion}"
68 )
69
70 await self.send_notification(
71 types.ClientNotification(
72 types.InitializedNotification(method="notifications/initialized")
73 )
74 )
75
76 return result
77
78 async def send_ping(self) -> types.EmptyResult:
79 """Send a ping request."""

Callers 4

lifespanFunction · 0.45
_maintain_sessionMethod · 0.45
_maintain_sessionMethod · 0.45
_maintain_sessionMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected