Skip to main content
Glama
Coalesce-Software-Inc

coalesce-transform-mcp

Official

Convert Join to Aggregation

convert_join_to_aggregation
Idempotent

Transform a join node into an aggregated fact table with GROUP BY. Automatically generates JOIN clauses, infers datatypes, and sets column attributes.

Instructions

Convert an existing join node into an aggregated fact table with GROUP BY. This is the REQUIRED follow-up after creating a multi-predecessor node — it completes the join setup.

This tool automatically:

  • Generates JOIN ON clauses from common columns between predecessors

  • Writes the complete FROM/JOIN/ON/GROUP BY clause to the node's joinCondition (no separate update needed)

  • Replaces columns with GROUP BY dimensions + aggregate measures

  • Infers datatypes from transform functions (COUNT → NUMBER, SUM → NUMBER(38,4), etc.)

  • Sets column-level attributes (isBusinessKey on GROUP BY columns, isChangeTracking on aggregates)

  • Validates that all non-aggregate columns are in GROUP BY

  • Runs intelligent config completion

Use this to transform a simple join (row-level) into an aggregated fact table (summary-level).

Example: Convert order detail join to customer metrics: { workspaceID: "1", nodeID: "fact-node-id", groupByColumns: ['"STG_ORDER_HEADER"."CUSTOMER_ID"'], aggregates: [ { name: "TOTAL_ORDERS", function: "COUNT", expression: 'DISTINCT "STG_ORDER_HEADER"."ORDER_ID"' }, { name: "LIFETIME_VALUE", function: "SUM", expression: '"STG_ORDER_HEADER"."ORDER_TOTAL"' }, { name: "AVG_ORDER_VALUE", function: "AVG", expression: '"STG_ORDER_HEADER"."ORDER_TOTAL"' } ], joinType: "INNER JOIN" }

Args:

  • workspaceID (string, required): The workspace ID

  • nodeID (string, required): The node ID of the join to convert

  • groupByColumns (string[], required): Columns to group by (dimensions)

  • aggregates (array, required): Aggregate columns with functions and expressions

  • joinType (string, optional): JOIN type (default: INNER JOIN)

  • maintainJoins (boolean, optional): Generate JOINs (default: true)

  • repoPath (string, optional): Local repo path for config completion

Returns: Updated node with new columns, joinCondition, GROUP BY analysis, and config completion results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIDYesThe node ID of the join to convert
joinTypeNoType of JOIN to use. Defaults to INNER JOIN.
repoPathNoOptional path to local Coalesce repository for intelligent config completion
aggregatesYesAggregate columns with their functions and expressions
workspaceIDYesThe workspace ID
maintainJoinsNoIf true (default), analyzes predecessors, generates JOIN SQL, and writes the joinCondition to the node. If false, only replaces columns with aggregates without generating joins.
groupByColumnsYesColumns to group by (dimensions). Use fully-qualified names like '"TABLE"."COLUMN"'.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIDNo
createdNo
warningNo
nextStepsNo
validationNo
joinSuggestionsNo
configCompletionNo
nodeTypeValidationNo
configCompletionSkippedNo
Behavior5/5

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

Annotations declare readOnlyHint=false, idempotentHint=true, destructiveHint=false. The description adds rich behavioral details: it automatically generates JOIN ON clauses, writes the complete FROM/JOIN/ON/GROUP BY clause, replaces columns, infers datatypes, sets column-level attributes, validates GROUP BY, and runs config completion. No contradiction with annotations.

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 well-structured: purpose statement, bullet list of automatic actions, example, then parameter list. It is front-loaded with the main purpose. While somewhat verbose, every sentence adds value given the tool's complexity.

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?

Despite having 7 parameters, the description covers all aspects: what it does, how it works, what it returns, and provides an example. The output schema is implied to exist, and the description explains the return value sufficiently.

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 100%, so baseline is 3. The description's 'Args' section reiterates parameters with brief descriptions, but also provides a concrete example with values mapped to parameters, which adds meaningful context beyond the schema definitions.

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 converts a join node into an aggregated fact table with GROUP BY. It distinguishes itself from sibling tools like 'apply_join_condition' by specifying it is the required follow-up after creating a multi-predecessor node. A concrete example is provided.

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 explicitly states this is the required follow-up after creating a multi-predecessor node, providing clear context. It does not explicitly list when not to use it or alternatives, but the context is strong enough.

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/Coalesce-Software-Inc/coalesce-transform-mcp'

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