Skip to content

Commit 2105c5c

Browse files
add initialized notification (#77)
* Add nitialized message. * add NEWS entry --------- Co-authored-by: simonpcouch <[email protected]>
1 parent f05ea6c commit 2105c5c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# mcptools (development version)
22

3+
* `mcp_tools()` now sends and receives a `"notifications/initialized"` (#77 by @galachad).
34
* `mcp_session()` now returns invisibly the nanonext socket used for communicating with the server.
45
* `mcp_server()` gains logical argument `session_tools`, allowing users to opt-out of presenting R sessions tools to clients.
56

R/client.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ error_no_mcp_config <- function(call) {
195195

196196
add_mcp_server <- function(process, name) {
197197
response_initialize <- send_and_receive(process, mcp_request_initialize())
198+
send_and_receive(process, mcp_request_initialized())
198199
response_tools_list <- send_and_receive(process, mcp_request_tools_list())
199200

200201
the$mcp_servers[[name]] <- list(
@@ -419,7 +420,13 @@ mcp_request_initialize <- function() {
419420
}
420421

421422
# step 2: send initialized notification
422-
# This is a MAY in the protocol, so omitting.
423+
mcp_request_initialized <- function() {
424+
list(
425+
jsonrpc = "2.0",
426+
method = "notifications/initialized"
427+
)
428+
}
429+
423430

424431
# step 3: request the list of tools
425432
mcp_request_tools_list <- function() {

0 commit comments

Comments
 (0)