Skip to main content
Glama

derive_variable

Create derived variables from expressions over existing columns, with options to control how missing values are propagated (any, all, or none).

Instructions

Create a variable from an expression over existing columns, e.g. name='OBESE', expression='BMXBMI >= 30' (booleans become 0/1). missing: 'any' -> result missing if ANY referenced column is missing (default, conservative); 'all' -> missing only if ALL referenced columns are missing (for OR-type definitions); 'none' -> no propagation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
missingNoany
dataset_idYes
expressionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description carries the transparency burden and does solid work: it discloses boolean-to-0/1 coercion and a precise three-way missing-propagation policy. It doesn't cover side effects such as variable overwrite or persistence, but the core behavior is unusually explicit.

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?

The description is compact: main action, concrete example, and the full missing-option semantics. Every sentence adds information and the most important fact is front-loaded.

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 moderate-complexity creation tool, the description covers core invocation semantics and even explains edge-case missing propagation. It omits explicit dataset_id semantics and output/return expectations, but the required fields are otherwise well documented.

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 description coverage is 0%, so the description must compensate; it clearly illustrates name and expression and fully specifies missing's three allowed values. dataset_id is left implicit, though the schema title and required flag make it inferable.

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

Purpose4/5

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

The opening clause names a specific operation and resource ('Create a variable from an expression over existing columns') and the example disambiguates the intended semantics. It is clear, though it does not explicitly contrast with siblings such as flag_from_long_table or set_missing.

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?

The description implies when to use it (deriving variables from column expressions) and gives conditional guidance for missing='all' ('for OR-type definitions'). It never names alternatives or says when not to use it, so an agent must infer selection.

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