Skip to main content
Glama

group_by_aggregate

Group data and compute aggregations like sum, mean, and count to analyze patterns across segments for insights and reporting.

Instructions

Group data and compute aggregations for analytical insights.

Performs GROUP BY operations with multiple aggregation functions per column. Essential for segmentation analysis and understanding patterns across different data groups.

Returns: Grouped aggregation results with statistics per group

Aggregation Functions: 📊 count, mean, median, sum, min, max 📈 std, var (statistical measures) 🎯 first, last (positional) 📋 nunique (unique count)

Examples: # Sales analysis by region result = await group_by_aggregate(ctx, group_by=["region"], aggregations={"sales": ["sum", "mean", "count"]})

# Multi-dimensional grouping
result = await group_by_aggregate(ctx,
                                group_by=["category", "region"],
                                aggregations={
                                    "price": ["mean", "std"],
                                    "quantity": ["sum", "count"]
                                })

AI Workflow Integration: 1. Segmentation analysis and market research 2. Feature engineering for categorical interactions 3. Data summarization for reporting and insights 4. Understanding group-based patterns and trends

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
group_byYesList of columns to group by for segmentation analysis
aggregationsYesDict mapping column names to list of aggregation functions

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupsYes
successNoWhether operation completed successfully
total_groupsYes
group_by_columnsYes
aggregated_columnsYes
Behavior4/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 effectively describes the tool's behavior by detailing the aggregation functions available, providing example usage patterns, and explaining the return format ('grouped aggregation results with statistics per group'). It lacks explicit mention of performance characteristics or error handling, but covers core operational behavior well.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections but is somewhat verbose. Sentences like 'Essential for segmentation analysis and understanding patterns across different data groups' could be more concise. The examples and AI workflow integration add value but contribute to length, making it less front-loaded than ideal.

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

Completeness5/5

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

Given the tool's complexity (analytical grouping with multiple functions), no annotations, and the presence of an output schema, the description is complete. It covers purpose, usage, behavior, parameters through examples, and return values, providing sufficient context for an AI agent to understand and invoke the tool effectively.

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?

The input schema has 100% description coverage, so the baseline is 3. The description adds some value by listing aggregation functions and providing examples that illustrate how parameters work together, but does not significantly enhance the schema's documentation of group_by and aggregations parameters beyond what is already covered.

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 tool's purpose with specific verbs ('group data and compute aggregations') and distinguishes it from siblings by focusing on analytical segmentation rather than data manipulation or basic statistics. It explicitly mentions 'GROUP BY operations' and 'analytical insights,' differentiating it from tools like get_column_statistics or get_value_counts.

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 ('essential for segmentation analysis and understanding patterns across different data groups') and includes AI workflow integration examples. However, it does not explicitly state when NOT to use it or name specific alternatives among sibling tools, such as get_value_counts for simpler grouping.

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