Skip to main content
Glama

add_column

Add a new column to a dataframe with constant values, lists, or computed formulas to enhance data structure and analysis capabilities.

Instructions

Add a new column to the dataframe.

Returns: ColumnOperationResult with operation details

Examples: # Add column with constant value add_column(ctx, "status", "active")

# Add column with list of values
add_column(ctx, "scores", [85, 90, 78, 92, 88])

# Add computed column
add_column(ctx, "total", formula="price * quantity")

# Add column with complex formula
add_column(ctx, "full_name", formula="first_name + ' ' + last_name")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName for the new column to add
valueNoSingle value for all rows or list of values (one per row)
formulaNoSafe mathematical expression to compute column values (e.g., 'col1 + col2')

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successNoWhether operation completed successfully
operationYesType of operation performed
transformNoTransform description
part_indexNoPart index for split operations
nulls_filledNoNumber of null values filled
rows_removedNoNumber of rows removed (for remove_duplicates)
rows_affectedYesNumber of rows affected by operation
values_filledNoNumber of values filled (for fill_missing_values)
updated_sampleNoSample values after operation
original_sampleNoSample values before operation
columns_affectedYesNames of columns affected
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the return type ('ColumnOperationResult') which adds value, but doesn't address important behavioral aspects like whether this operation modifies the original dataframe in-place, what happens if a column with the same name already exists, or any performance considerations. The examples help but don't fully compensate for the lack of behavioral context.

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 appropriately sized and front-loaded with the core purpose statement. The examples are well-organized and demonstrate key use cases efficiently. However, the 'Returns:' section could be integrated more seamlessly, and the description could be slightly more concise by combining the purpose and return statement.

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?

Given the tool's moderate complexity (3 parameters, mutation operation), no annotations, but with 100% schema coverage and an output schema (implied by 'Returns: ColumnOperationResult'), the description is reasonably complete. The examples provide practical guidance, though it could benefit from more behavioral context about the mutation's effects and error conditions.

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?

With 100% schema description coverage, the baseline is 3. The description adds value through the examples that illustrate three distinct parameter usage patterns: constant value, list of values, and computed column via formula. This provides practical semantic context beyond the schema's technical descriptions, though it doesn't explain parameter interactions or constraints.

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 clearly states the specific action ('Add a new column') and resource ('to the dataframe'), distinguishing it from sibling tools like 'update_column', 'rename_columns', or 'remove_columns'. The verb+resource combination is precise and unambiguous.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'update_column' or 'transform_column_case'. While examples show different use cases, there's no explicit when/when-not guidance or mention of prerequisites for using this tool over others in the sibling list.

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/jonpspri/databeak'

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