diff --git a/NEWS.md b/NEWS.md index 2c0d5fe..5e4efdf 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,13 +1,14 @@ # mcptools (development version) -`mcp_server()` gains logical argument `session_tools`, allowing users to opt-out of presenting R sessions tools to clients. +* `mcp_session()` now (invisibly) returns 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 -Addressed an issue in tests on `r-devel-linux-x86_64-fedora-clang`. +* Addressed an issue in tests on `r-devel-linux-x86_64-fedora-clang`. # mcptools 0.1.0 -Initial CRAN submission. +* Initial CRAN submission. Before the initial release of the package, mcptools was called acquaint and supplied a default set of tools from btw, currently a GitHub-only package, when R was used as an MCP server. The direction of the dependency has been reversed; to use the same functionality from before, transition `acquaint::mcp_server()` to `btw::btw_mcp_server()` and `acquaint::mcp_session()` to `btw::btw_mcp_session()`. diff --git a/R/server.R b/R/server.R index 2365f62..a26049f 100644 --- a/R/server.R +++ b/R/server.R @@ -61,12 +61,14 @@ #' `mcp_session()`. Defaults to `TRUE`. #' #' @returns -#' `mcp_server()` and `mcp_session()` are both called primarily for side-effects. +#' `mcp_server()` and `mcp_session()` are both called primarily for their +#' side-effects. #' #' * `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 a promise via [promises::promise()]. +#' MCP servers. It returns 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 ec0a707..6bd3e90 100644 --- a/R/session.R +++ b/R/session.R @@ -23,8 +23,9 @@ mcp_session <- function() { i <- i + 1L } the$session <- i - schedule_handle_message_from_server() + + the$session_socket } handle_message_from_server <- function(data) { diff --git a/man/server.Rd b/man/server.Rd index 6dba642..ef5159d 100644 --- a/man/server.Rd +++ b/man/server.Rd @@ -23,12 +23,14 @@ tools (\code{list_r_sessions}, \code{select_r_session}) that work with \code{mcp_session()}. Defaults to \code{TRUE}.} } \value{ -\code{mcp_server()} and \code{mcp_session()} are both called primarily for side-effects. +\code{mcp_server()} and \code{mcp_session()} are both called primarily for their +side-effects. \itemize{ \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 a promise via \code{\link[promises:promise]{promises::promise()}}. +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. } } \description{ diff --git a/pkgdown/favicon/apple-touch-icon.png b/pkgdown/favicon/apple-touch-icon.png new file mode 100644 index 0000000..afe0fa5 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon.png differ diff --git a/pkgdown/favicon/favicon-96x96.png b/pkgdown/favicon/favicon-96x96.png new file mode 100644 index 0000000..bb69510 Binary files /dev/null and b/pkgdown/favicon/favicon-96x96.png differ diff --git a/pkgdown/favicon/favicon.ico b/pkgdown/favicon/favicon.ico new file mode 100644 index 0000000..660f70a Binary files /dev/null and b/pkgdown/favicon/favicon.ico differ diff --git a/pkgdown/favicon/favicon.svg b/pkgdown/favicon/favicon.svg new file mode 100644 index 0000000..b73b657 --- /dev/null +++ b/pkgdown/favicon/favicon.svg @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/pkgdown/favicon/site.webmanifest b/pkgdown/favicon/site.webmanifest new file mode 100644 index 0000000..4ebda26 --- /dev/null +++ b/pkgdown/favicon/site.webmanifest @@ -0,0 +1,21 @@ +{ + "name": "", + "short_name": "", + "icons": [ + { + "src": "/web-app-manifest-192x192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "/web-app-manifest-512x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} \ No newline at end of file diff --git a/pkgdown/favicon/web-app-manifest-192x192.png b/pkgdown/favicon/web-app-manifest-192x192.png new file mode 100644 index 0000000..08affba Binary files /dev/null and b/pkgdown/favicon/web-app-manifest-192x192.png differ diff --git a/pkgdown/favicon/web-app-manifest-512x512.png b/pkgdown/favicon/web-app-manifest-512x512.png new file mode 100644 index 0000000..4025863 Binary files /dev/null and b/pkgdown/favicon/web-app-manifest-512x512.png differ diff --git a/tests/testthat/test-session.R b/tests/testthat/test-session.R index f651a79..3839155 100644 --- a/tests/testthat/test-session.R +++ b/tests/testthat/test-session.R @@ -5,7 +5,7 @@ test_that("mcp_session returns early when not interactive", { test_that("mcp_session initializes appropriate globals", { local_mocked_bindings(interactive = function() TRUE) - mcp_session() + expect_s3_class(mcp_session(), "nanoSocket") expect_s3_class(the$session_socket, "nanoSocket") expect_type(the$session, "integer") })