tealflow_snapshot_renv_environment
Record the current state of R package dependencies into renv.lock for a reproducible project environment. Use after installing or updating packages to create a consistent snapshot.
Instructions
Create an renv snapshot of the current R project environment.
This tool captures the current state of installed R packages and records them in renv.lock. This creates a reproducible record of your project's dependencies that can be restored later or shared with others.
When to use this tool:
After installing new packages
After updating existing packages
Before sharing your project with others
To create a reproducible checkpoint of your environment
Requirements:
renv must already be initialized (use tealflow_setup_renv_environment first)
Project must have an active renv environment
Args: project_path (str, optional): ABSOLUTE path to the R project directory. MUST be an absolute path (e.g., "/home/user/project" or "C:\Users\user\project"). Relative paths like "." will resolve to the MCP server's directory, not the user's project. Defaults to "." but should always be explicitly provided as an absolute path. response_format (str, optional): Output format - 'json' or 'markdown'. Defaults to 'json'.
Returns: str: JSON/markdown with status, message, and logs_excerpt.
Error Types: - filesystem_error: Project path does not exist - rscript_not_found: R is not installed or not in PATH - renv_not_initialized: renv has not been initialized in this project - snapshot_failed: Failed to create renv snapshot - execution_error: Unexpected error during snapshot
Examples: - Snapshot current directory: (no parameters needed) - Snapshot specific project: project_path="/path/to/project" - Get markdown output: response_format="markdown"
Note: This tool only snapshots packages that are used in your project code. Make sure you have library() calls in global.R or your R scripts for packages you want to include in the snapshot.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | No | . | |
| response_format | No | json |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |