Skip to main content
Glama
Ian3738
by Ian3738

data_transform

Clean and reshape R datasets in a fixed sequence: filter, mutate, recode, convert types, remove missing values and duplicates, arrange/select columns, pivot long/wide. Overwrite or save as new name.

Instructions

Clean and reshape a dataset. Operations run in a fixed order: filter, mutate, to_numeric, recode, to_factor, factor_levels, select, drop, rename, arrange, drop_na, distinct, slice_head, reshape. Writes back to the same name unless save_as is given.

Converting grouping variables to factors is the most common prerequisite for the test tools: to_factor=['group']. Ordered factors for an ordinal outcome need factor_levels={'severity': ['low','medium','high']}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesDataset name in the session.
dropNoRemove these columns.
filterNoR logical expression over the columns, e.g. 'age >= 18 & !is.na(score)'.
mutateNoNew/updated columns as {name: R expression}, e.g. {'bmi': 'weight / height^2'}.
recodeNoValue replacement, e.g. {'sex': {'1': 'male', '2': 'female'}}.
renameNo{new_name: old_name}.
selectNoKeep only these columns.
arrangeNoSort keys; prefix with '-' for descending.
drop_naNoDrop rows missing on these columns.
reshapeNoLong/wide conversion. To long: {'direction':'long','value_cols':['t1','t2'],'id_cols':['id'],'names_to':'time','values_to':'score'}. To wide: {'direction':'wide','names_from':'time','values_from':'score','id_cols':['id']}.
save_asNoSave the result under a new name instead of overwriting.
distinctNoRemove duplicate rows.
to_factorNoColumns to convert to factors (needed for grouping variables).
slice_headNoKeep only the first N rows.
to_numericNoColumns to coerce to numeric.
factor_levelsNoExplicit level order, e.g. {'dose': ['low','mid','high']}. Sets the reference level and ordinal order.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden, and it discloses two key behaviors: operations run in a fixed order, and results write back to the same name unless save_as is given. It stops short of describing all side effects (e.g., return visibility), but the most operationally important traits are covered.

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

Conciseness5/5

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

Two compact paragraphs with no filler: the first states purpose, pipeline order, and overwrite behavior; the second gives targeted usage tips for the most common downstream need. Every sentence earns its place.

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?

Given 16 parameters and no output schema, the description plus fully documented input schema covers everything needed to invoke the tool correctly. The fixed operation order and write-back behavior resolve the most likely ambiguities.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3. The description adds practical meaning beyond the schema by giving a realistic to_factor example and explaining that factor_levels sets reference and ordinal order for outcomes. This extra guidance helps the agent construct correct calls.

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 'Clean and reshape a dataset', a specific verb and resource, and then enumerates the exact pipeline operations. This clearly distinguishes it from sibling analysis/test tools, so an agent knows what this tool is for.

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?

It gives clear context by noting that converting grouping variables to factors is the most common prerequisite for the test tools, with concrete examples. It does not explicitly state when not to use it or name alternatives, but the implied workflow is strong enough for an agent to select it appropriately.

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

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/Ian3738/r-stats-mcp'

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