Skip to main content
Glama
by apetta

array_aggregate

Perform aggregation operations on 1D arrays including sumproduct, weighted average, and dot product calculations for mathematical analysis.

Instructions

Perform aggregation operations on 1D arrays.

Examples:

SUMPRODUCT: operation="sumproduct", array1=[1,2,3], array2=[4,5,6] Result: 32 (1×4 + 2×5 + 3×6)

WEIGHTED AVERAGE: operation="weighted_average", array1=[10,20,30], weights=[1,2,3] Result: 23.33... ((10×1 + 20×2 + 30×3) / (1+2+3))

DOT PRODUCT: operation="dot_product", array1=[1,2], array2=[3,4] Result: 11 (1×3 + 2×4)

GRADE CALCULATION: operation="weighted_average", array1=[85,92,78], weights=[0.3,0.5,0.2] Result: 86.5

Input Schema

NameRequiredDescriptionDefault
contextNoOptional annotation to label this calculation (e.g., 'Bond A PV', 'Q2 revenue'). Appears in results for easy identification.
output_modeNoOutput format: full (default), compact, minimal, value, or final. See batch_execute tool for details.full
operationYesAggregation operation
array1YesFirst 1D array (e.g., [1,2,3])
array2NoSecond 1D array for sumproduct/dot_product
weightsNoWeights for weighted_average (e.g., [1,2,3])

Input Schema (JSON Schema)

{ "properties": { "array1": { "description": "First 1D array (e.g., [1,2,3])", "items": { "type": "number" }, "type": "array" }, "array2": { "anyOf": [ { "type": "string" }, { "items": { "type": "number" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Second 1D array for sumproduct/dot_product" }, "context": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional annotation to label this calculation (e.g., 'Bond A PV', 'Q2 revenue'). Appears in results for easy identification." }, "operation": { "description": "Aggregation operation", "enum": [ "sumproduct", "weighted_average", "dot_product" ], "type": "string" }, "output_mode": { "default": "full", "description": "Output format: full (default), compact, minimal, value, or final. See batch_execute tool for details.", "enum": [ "full", "compact", "minimal", "value", "final" ], "type": "string" }, "weights": { "anyOf": [ { "type": "string" }, { "items": { "type": "number" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Weights for weighted_average (e.g., [1,2,3])" } }, "required": [ "array1", "operation" ], "type": "object" }

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/apetta/vibe-math-mcp'

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