Skip to main content
Glama

flag_from_long_table

Create a per-person 0/1 flag from multi-row files: set 1 if any row in selected columns matches a regex, otherwise 0; people with no rows are missing.

Instructions

Add a per-person 0/1 indicator from a file with several rows per participant (e.g. RXQ_RX prescriptions, DR1IFF foods). Flag = 1 if ANY row's value in ANY of columns matches the regex pattern (case-insensitive), e.g. table='RXQ_RX', columns=['RXDRSC1','RXDRSC2','RXDRSC3'], pattern='^G40' for ICD-10 epilepsy as the reason for use. People absent from the file are missing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
tableYes
columnsYes
patternYes
dataset_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations provided, the description carries the full disclosure burden and does so well: it reveals the case-insensitive regex behavior, the ANY-row/ANY-column aggregation logic, and the important missingness rule that people absent from the file are missing rather than 0. These behaviors go well beyond what the tool name or input schema alone would communicate.

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 dense but relevant, and the core behavior is front-loaded before the example. However, it is one long multi-clause sentence with no separation between rule, example, and missingness caveat, so a bit more structure would make it easier to scan.

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 mutation tool with no annotations and no output schema, the description covers the computation rule, regex behavior, and missingness, which is strong. It is slightly incomplete because it does not explicitly state the role of `dataset_id` and `name` or what the tool returns/updates, but the operation is otherwise unambiguous.

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

Parameters3/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 explain the parameters. It gives meaningful semantics and an example for `table`, `columns`, and `pattern`, but it never explicitly defines `dataset_id` or `name` (e.g., that `name` is the new variable's name), leaving two of five required parameters to be inferred from parameter titles alone.

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 action and resource: 'Add a per-person 0/1 indicator from a file with several rows per participant.' It fully defines the flag semantics (ANY row, ANY column, regex match) and even differentiates the intended long-table use case from a generic derived-variable operation by naming representative tables such as RXQ_RX and DR1IFF.

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 clearly states the context in which this tool applies: data with several rows per participant, such as prescriptions or food records. It does not explicitly name sibling alternatives or exclusion conditions (e.g., when to use derive_variable instead), 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.