Skip to main content
Glama

kmeans_cluster

Groups rows into clusters based on numeric columns, standardizing features automatically and storing the cluster assignment as a new column for segmentation or pattern discovery.

Instructions

K-Means clustering. Assigns each row to one of n_clusters groups based on numeric columns. Features are auto-standardized before clustering. Result is stored as a new column. Use for customer segmentation, anomaly grouping, or discovering natural data groups. Example: kmeans_cluster(columns=["Revenue","ChargeableWeight","Pieces"], n_clusters=4)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnsYes
df_nameNo
n_clustersNo
random_stateNo
cluster_columnNocluster

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 burden. It discloses key behaviors: features are auto-standardized and the result is stored as a new column. However, it does not mention potential side effects like overwriting an existing column, how missing values or non-numeric columns are handled, or whether the operation modifies the dataframe in place. These omissions leave some uncertainty.

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 well-structured: a clear opening statement, followed by key details, use cases, and a concrete example. No redundant or filler language is present.

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

Completeness3/5

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

The tool is relatively simple, but with 5 parameters, no annotations, and an output schema that is not visible, the description should cover more. It gives purpose, usage, and an example, but lacks detail on three important parameters and edge-case behavior. The output schema existence reduces the need to explain return values, but gaps remain.

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

Parameters2/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 compensate. It explains 'columns' (numeric columns) and 'n_clusters' (via example), but leaves 'df_name', 'random_state', and 'cluster_column' completely undiscussed. These parameters are not self-evident from their names alone, especially 'cluster_column' and 'df_name'.

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 function: 'K-Means clustering. Assigns each row to one of n_clusters groups based on numeric columns.' This uses a specific verb ('assigns') and resource (rows to clusters) and includes an example. It distinguishes from sibling tools like dbscan_cluster by explicitly naming the K-Means algorithm.

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 use contexts: 'Use for customer segmentation, anomaly grouping, or discovering natural data groups.' However, it does not explicitly mention alternatives or exclusion criteria, such as when DBSCAN might be more appropriate, 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