Skip to main content
Glama

datetime_diff

Compute the time difference between two datetime columns and add a numeric duration feature. Supports units like days, hours, minutes, seconds for metrics such as age, tenure, or delivery time.

Instructions

Compute time difference between two datetime columns (column_a - column_b). Units: days, hours, minutes, seconds. Creates a new numeric column. Create duration features between two dates (e.g., delivery time, age, tenure). Result is a numeric column ready for modeling. Example: datetime_diff(column_a="end_date", column_b="start_date", new_column="duration_days", unit="days")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
unitNodays
df_nameNo
column_aYes
column_bYes
new_columnYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

With no annotations, the description carries the full burden. It discloses that the tool creates a new numeric column and lists available units, which is useful. However, it does not state whether the operation modifies the dataframe in-place or returns a new one, nor does it explain behavior with missing values or non-datetime inputs. This leaves important behavioral gaps.

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 concise and front-loaded with the core function. It includes units, output type, use case, and an example in just four sentences, with no redundant information.

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?

The tool has moderate complexity with 5 parameters and no annotations. The description covers purpose, units, output, and example, but omits df_name semantics and does not clarify whether the operation alters the existing dataframe. These gaps prevent a perfect score, but overall it is fairly complete for a transformation tool.

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 0%, so the description must compensate. It explains column_a and column_b as datetime columns, new_column as the output name, and unit as days/hours/minutes/seconds via text and example. However, df_name is completely undocumented in both schema and description, leaving a gap in parameter semantics.

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 explicitly states the tool computes time difference between two datetime columns using column_a - column_b, which is a specific verb+resource. It also distinguishes from siblings like extract_datetime_parts and datetime_filter by clearly targeting duration calculation.

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?

The description provides clear context for when to use this tool: 'Create duration features between two dates (e.g., delivery time, age, tenure)'. However, it does not mention alternatives or when-not-to-use, so it falls 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.

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/AstyanM/mcp-data-science'

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