Skip to main content
Glama

get_correlation_matrix

Calculate pairwise correlations between numerical columns to analyze variable relationships, detect multicollinearity, and support feature selection in data analysis workflows.

Instructions

Calculate correlation matrix for numerical columns.

Computes pairwise correlations between numerical columns using various correlation methods. Essential for understanding relationships between variables and feature selection in analytical workflows.

Returns: Correlation matrix with pairwise correlation coefficients

Correlation Methods: 📊 Pearson: Linear relationships (default, assumes normality) 📈 Spearman: Monotonic relationships (rank-based, non-parametric) 🔄 Kendall: Concordant/discordant pairs (robust, small samples)

Examples: # Basic correlation analysis corr = await get_correlation_matrix(ctx)

# Analyze specific columns with Spearman correlation
corr = await get_correlation_matrix(ctx,
                                  columns=["price", "rating", "sales"],
                                  method="spearman")

# Filter correlations above threshold
corr = await get_correlation_matrix(ctx, min_correlation=0.5)

AI Workflow Integration: 1. Feature selection and dimensionality reduction 2. Multicollinearity detection before modeling 3. Understanding variable relationships 4. Data validation and quality assessment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNoCorrelation method: pearson (linear), spearman (rank), kendall (rank)pearson
columnsNoList of columns to include (None = all numeric columns)
min_correlationNoMinimum correlation threshold to include in results

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodYesCorrelation method used for analysis
successNoWhether operation completed successfully
columns_analyzedYesNames of columns included in correlation analysis
correlation_matrixYesCorrelation coefficients between columns
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by explaining what gets computed ('pairwise correlations'), the three correlation methods with their characteristics, and the return format ('correlation matrix with pairwise correlation coefficients'). It doesn't mention performance characteristics, data size limitations, or error conditions, but provides substantial 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 well-structured with clear sections (purpose, returns, methods, examples, integration), but could be more concise. Some sentences like 'Essential for understanding relationships between variables and feature selection in analytical workflows' could be tightened. However, every section adds value and the information is front-loaded with the core purpose first.

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 (statistical computation with multiple methods), no annotations, but with output schema present, the description is remarkably complete. It covers purpose, usage scenarios, parameter guidance, method details, examples, and integration workflows. The output schema handles return values, so the description appropriately focuses on when and how to use the 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 description coverage is 100%, so baseline is 3. The description adds value by providing examples that demonstrate parameter usage in context, explaining what 'columns=None' means ('all numeric columns'), and showing how 'min_correlation' filters results. The correlation methods section elaborates beyond the schema's enum descriptions with practical guidance about when to use each method.

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: 'Calculate correlation matrix for numerical columns' with specific verb ('calculate') and resource ('correlation matrix'). It distinguishes from siblings by focusing on correlation analysis rather than data manipulation, transformation, or other statistical functions like 'get_column_statistics' or 'get_statistics'.

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

Usage Guidelines5/5

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

The description provides explicit usage guidance through the 'AI Workflow Integration' section, listing four specific scenarios: feature selection, multicollinearity detection, understanding relationships, and data validation. This tells the agent exactly when to use this tool versus alternatives like general statistics tools or data quality checks.

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