Skip to main content
Glama

transform_data

Read-only

Derives a new dataset by applying ordered operations—query, select, drop, rename, fill, sort, sample, reshape, impute—to existing data, then returns a new data handle with recorded lineage.

Instructions

Derive a new dataset from a data_id (or data_path / inline data) by applying operations in order, and return a new data_id with the lineage recorded. Operations (each an object with op): query {expr} (pandas DataFrame.query), select {columns}, drop {columns}, rename {mapping}, dropna {columns?}, fillna {value | mapping}, assign {column, expr} (DataFrame.eval), sort {by, ascending?}, sample {n, seed?}, winsor {columns?, cuts?=[1,99], by?, trim?, method?} (replaces in place), wide_to_long {stubnames, i, j, sep?, suffix?}, long_to_wide {index, columns, values}, mice {columns?, m?} (single completed dataset), function {name, arguments?} (any sp. taking data= and returning a DataFrame). query / assign expressions are limited to columns (backticks for odd names), constants, operators, in / not in, math functions (log, exp, sqrt, abs, ...) and col.isnull()/isin()/between()/str.contains(); other attribute access, subscripts and @locals fail with error_kind='unsafe_expression'.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "operations": "<operations>"
    },
    "name": "transform_data"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNoOptional label for the new handle.
detailNoPayload depth; agent is the fullest.agent
data_idNoData handle (d_...) from load_data; replaces data_path.
data_csvNoSmall inline table as CSV text.
as_handleNoCache the fit and return its result_id.
data_pathNoAbsolute path of a data file on the server.
result_idNoHandle of an earlier fit made with as_handle=true.
operationsYesOrdered list of {op, ...} objects.
data_columnsNoLoad only these columns.
data_recordsNoSmall inline table as row objects.
data_sample_nNoUniform random subsample of this many rows (seed 0).
max_output_bytesNoResult byte budget (default 262144; 0 = none).

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations declare readOnlyHint=true and openWorldHint=false, and the description adds real context beyond that: results are a new handle with lineage recorded, `winsor` replaces values in place within the pipeline, `mice` yields a single completed dataset, and unsafe expressions fail with error_kind='unsafe_expression'. It does not state whether the source dataset is ever mutated or what happens on operation failure mid-pipeline, which keeps it below a 5.

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?

Front-loaded with purpose and return value before the dense op catalog, and the expression-safety constraint is placed last where it belongs. The single-sentence op enumeration is long but every item corresponds to an undocumented operation, so it is mostly earned content.

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

Completeness4/5

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

For a 12-parameter pipeline tool with an output schema, the description covers the hard part (the operation grammar and expression sandbox). Residual gaps are modest: no note on whether the source dataset is untouched after derivation, and no guidance on when to split work across multiple calls versus one long pipeline.

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?

Schema coverage is 100%, but the `operations` parameter is an opaque array of free-form objects that the schema cannot document — the description supplies that entirely, enumerating every op with its keys, defaults (cuts=[1,99], seed, m), and semantics (DataFrame.query vs DataFrame.eval). This is meaning the schema genuinely lacks.

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+resource ('Derive a new dataset') and states the input source, the ordered operation list, and the return value ('a new data_id with the lineage recorded'). An agent can distinguish this from load_data or describe_data without opening any schema.

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

Usage Guidelines3/5

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

Usage is implied by the mechanics rather than stated: it explains how to build pipelines but never says when to prefer this tool over siblings like call_function, describe_data, or load_data. The note that `function` accepts any sp.<name> taking data= implicitly overlaps with a call_function sibling, but no explicit routing or exclusion is given.

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