From c9b6294da9126ebb0330a3496424c66cc4b6096e Mon Sep 17 00:00:00 2001 From: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> Date: Wed, 24 Sep 2025 15:17:06 +0100 Subject: [PATCH] Return the socket invisibly (follow-up to #72) --- NEWS.md | 2 +- R/server.R | 5 +++-- R/session.R | 2 +- man/server.Rd | 5 +++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 5e4efdf..d1288da 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # mcptools (development version) -* `mcp_session()` now (invisibly) returns the nanonext socket used for communicating with the server. +* `mcp_session()` now returns invisibly the nanonext socket used for communicating with the server. * `mcp_server()` gains logical argument `session_tools`, allowing users to opt-out of presenting R sessions tools to clients. # mcptools 0.1.1 diff --git a/R/server.R b/R/server.R index a26049f..fa62996 100644 --- a/R/server.R +++ b/R/server.R @@ -67,8 +67,9 @@ #' * `mcp_server()` blocks the R process it's called in indefinitely and isn't #' intended for interactive use. #' * `mcp_session()` makes the interactive R session it's called in available to -#' MCP servers. It returns the \pkg{nanonext} socket used for communicating -#' with the server. Call [close()] on the socket to stop the session. +#' MCP servers. It returns invisibly the \pkg{nanonext} socket used for +#' communicating with the server. Call [close()] on the socket to stop the +#' session. #' #' @seealso #' - The "R as an MCP server" vignette at diff --git a/R/session.R b/R/session.R index 6bd3e90..d96a932 100644 --- a/R/session.R +++ b/R/session.R @@ -25,7 +25,7 @@ mcp_session <- function() { the$session <- i schedule_handle_message_from_server() - the$session_socket + invisible(the$session_socket) } handle_message_from_server <- function(data) { diff --git a/man/server.Rd b/man/server.Rd index ef5159d..a544e2d 100644 --- a/man/server.Rd +++ b/man/server.Rd @@ -29,8 +29,9 @@ side-effects. \item \code{mcp_server()} blocks the R process it's called in indefinitely and isn't intended for interactive use. \item \code{mcp_session()} makes the interactive R session it's called in available to -MCP servers. It returns the \pkg{nanonext} socket used for communicating -with the server. Call \code{\link[=close]{close()}} on the socket to stop the session. +MCP servers. It returns invisibly the \pkg{nanonext} socket used for +communicating with the server. Call \code{\link[=close]{close()}} on the socket to stop the +session. } } \description{