Skip to contents

Uses sessioninfo::package_info() to provide information about the loaded, attached, or installed packages. The primary use case is to verify that a package is installed; check the version number of a specific packages; or determine which packages are already in use in a session.

Usage

btw_tool_session_package_info(
  packages = "attached",
  dependencies = "",
  .intent = ""
)

Arguments

packages

Which packages to show, or "loaded" to show all loaded packages, "attached" to show all attached packages, or "installed" to show all installed packages.

dependencies

Whether to include the dependencies when listing package information.

.intent

An optional string describing the intent of the tool use. When the tool is used by an LLM, the model will use this argument to explain why it called the tool.

Value

Returns a string describing the selected packages.

Examples

btw_tool_session_package_info("btw")
#> <btw::BtwPackageInfoToolResult>
#>  @ value  : chr "```\n package * version    date (UTC) lib source\n btw     * 0.0.4.9000 2025-07-31 [1] local\n\n [1] /home/runn"| __truncated__
#>  @ error  : NULL
#>  @ extra  :List of 1
#>  .. $ data:Classes ‘packages_info’ and 'data.frame':	1 obs. of  11 variables:
#>  ..  ..$ package      : chr "btw"
#>  ..  ..$ ondiskversion: chr "0.0.4.9000"
#>  ..  ..$ loadedversion: chr "0.0.4.9000"
#>  ..  ..$ path         : chr "/home/runner/work/_temp/Library/btw"
#>  ..  ..$ loadedpath   : chr "/home/runner/work/_temp/Library/btw"
#>  ..  ..$ attached     : logi TRUE
#>  ..  ..$ is_base      : logi FALSE
#>  ..  ..$ date         : chr "2025-07-31"
#>  ..  ..$ source       : chr "local"
#>  ..  ..$ md5ok        : logi NA
#>  ..  ..$ library      : Factor w/ 3 levels "/home/runner/work/_temp/Library",..: 1
#>  @ request: NULL