Skip to main content
Glama

tealflow_generate_data_loading

Read-onlyIdempotent

Generate R code that loads discovered ADaM datasets and creates a teal_data object with join keys. Converts dataset lists from discovery into ready-to-use R code for Teal apps.

Instructions

Generate R code for loading discovered datasets and creating a teal_data object.

This tool generates complete R code that loads ADaM datasets from files and creates a teal_data object with appropriate join keys. It's designed to work seamlessly with the output from tealflow_discover_datasets.

IMPORTANT: This tool requires the datasets list from tealflow_discover_datasets. Pass the 'datasets_found' array directly to this tool.

Path Handling: If datasets are in the project directory, provide project_directory to generate relative paths. Otherwise, absolute paths will be used.

Args: datasets (list[dict[str, Any]]): List of dataset dictionaries from discovery. Each dictionary must contain: - name: Dataset name (e.g., "ADSL") - path: Absolute path to dataset file - format: File format ("Rds" or "csv") - is_standard_adam: Whether it's a standard ADaM dataset project_directory (str, optional): Absolute path to the project directory. If provided, dataset paths within this directory will use relative paths. If None or datasets are outside, absolute paths will be used. Defaults to None. response_format (str, optional): Output format - 'markdown' for human-readable or 'json' for machine-readable. Defaults to 'markdown'.

Returns: str: Generated R code for loading datasets

Markdown format includes:
- Complete R code in code block
- Usage instructions
- List of datasets included

JSON format includes:
- code: The generated R code
- datasets: List of dataset names
- file_path: Recommended file path (data.R)
- instructions: Step-by-step usage instructions

Generated Code Structure: 1. Library import (library(teal)) 2. Dataset loading (readRDS() for .Rds, read.csv() for .csv) 3. teal_data() object creation with all datasets 4. Join keys configuration: - For standard ADaM datasets: Uses default_cdisc_join_keys - For non-standard datasets: Includes warning comments

Workflow Integration: 1. Use tealflow_discover_datasets to find datasets 2. Pass the datasets_found array to this tool 3. Save the generated code as data.R in the project root 4. The app template will source this file

Examples: - Generate loading code: datasets=[...from discovery...] - Get JSON format: datasets=[...], response_format="json"

Note: - Datasets are sorted alphabetically for consistent output - Paths must be absolute (from discovery tool) - Currently supports Rds and csv formats - Extensible design for future format support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
datasetsYes
response_formatNomarkdown
project_directoryNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Despite strong annotations (readOnly, idempotent), the description adds substantial behavioral context: it clarifies the tool only generates code (it does not load data), mandates absolute paths, sorts datasets alphabetically, supports only Rds/csv formats, and details the generated code structure including join keys configuration. This goes well beyond what annotations convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but well-structured with clear sections (IMPORTANT, Path Handling, Args, Returns, Generated Code Structure, Workflow Integration, Examples, Note). Every section serves a purpose, though some redundancy exists (e.g., path handling repeated). It remains appropriately sized for a complex code-generation tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the full invocation context: prerequisites, parameter semantics, return formats (markdown/json), generated code structure, and integration steps. With an output schema present, it doesn't need to detail every field, but it provides enough for correct selection and use. The sibling tool relationships are clarified via workflow.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, but the description fully compensates. It defines each parameter in detail: 'datasets' list contains name, path, format, is_standard_adam; 'project_directory' controls relative vs absolute paths; 'response_format' changes the return structure. This adds complete meaning beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Generate R code for loading discovered datasets and creating a teal_data object.' This clearly distinguishes it from sibling tools like tealflow_generate_module_code, which focuses on module generation. The workflow integration section further clarifies its role in the discovery-to-app pipeline.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit workflow integration: use tealflow_discover_datasets first, pass the datasets_found array, save generated code as data.R. It also states that it is 'designed to work seamlessly' with discovery output. However, it does not explicitly name alternative tools or state when not to use this tool, so it stops short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Appsilon/TealFlowMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server