Skip to content

Commit 5ed61fe

Browse files
Pass responsibility to user
1 parent 5441767 commit 5ed61fe

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/mcp/client/session.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def __init__(
101101
logging_callback: LoggingFnT | None = None,
102102
message_handler: MessageHandlerFnT | None = None,
103103
client_info: types.Implementation | None = None,
104+
support_roots_list_changed: bool = False,
104105
) -> None:
105106
super().__init__(
106107
read_stream,
@@ -114,6 +115,7 @@ def __init__(
114115
self._list_roots_callback = list_roots_callback or _default_list_roots_callback
115116
self._logging_callback = logging_callback or _default_logging_callback
116117
self._message_handler = message_handler or _default_message_handler
118+
self._support_roots_list_changed = support_roots_list_changed
117119

118120
async def initialize(self) -> types.InitializeResult:
119121
sampling = (
@@ -122,10 +124,7 @@ async def initialize(self) -> types.InitializeResult:
122124
else None
123125
)
124126
roots = (
125-
# TODO: Should this be based on whether we
126-
# _will_ send notifications, or only whether
127-
# they're supported?
128-
types.RootsCapability(listChanged=True)
127+
types.RootsCapability(listChanged=self._support_roots_list_changed)
129128
if self._list_roots_callback is not _default_list_roots_callback
130129
else None
131130
)

0 commit comments

Comments
 (0)