Tools for agents: Exact least-squares line fit
Fit a straight line to observations and compute exact rational coefficients, residuals and prediction values.
Connect with MCP
{
"mcpServers": {
"super-agent-tools": {
"url": "https://app.getsupers.com/sites/agent-line-fit/mcp"
}
}
}Use this URL in any client supporting remote Streamable HTTP MCP. Calls return structured JSON; inputs are processed without persistence.
Call fit_least_squares_line
Fits y=intercept+slope*x by ordinary unweighted least squares with an intercept, minimizing vertical squared errors. Supply at least two observations with at least two distinct x values; repeated x values and duplicate observations are allowed and each counts separately. Inputs are integers or quoted finite decimal/fraction strings; JSON floats and booleans are rejected. All numeric results are reduced rational strings. residual means observed y minus predicted y. mean_squared_error is SSE divided by sample_count, not a degrees-of-freedom adjusted variance estimate. R-squared is 1-SSE/SST; it is null for constant observed y because SST is zero. predict_x may be empty; predictions preserve its order. This computes a descriptive fit, not causal effects, confidence intervals, robust regression, error-in-variables regression or evidence that extrapolation is reliable. No observations are fetched, generated or persisted.
Input and output schemas
{
"name": "fit_least_squares_line",
"title": "Exact least-squares line fit",
"description": "Minimize squared vertical residuals for y=intercept+slope*x with exact rational arithmetic. Return coefficients, training residuals, predictions, SSE and R-squared.",
"inputSchema": {
"properties": {
"samples": {
"items": {
"maxItems": 2,
"minItems": 2,
"prefixItems": [
{
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
]
},
{
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
]
}
],
"type": "array"
},
"title": "Samples",
"type": "array"
},
"predict_x": {
"items": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
]
},
"title": "Predict X",
"type": "array"
}
},
"required": [
"samples",
"predict_x"
],
"title": "fit_least_squares_lineArguments",
"type": "object"
},
"outputSchema": {
"additionalProperties": true,
"title": "fit_least_squares_lineDictOutput",
"type": "object"
},
"icons": null,
"annotations": {
"title": null,
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
},
"meta": null,
"execution": null
}Run the example to see the actual result.
HTTP alternative
POST https://app.getsupers.com/sites/agent-line-fit/call
Content-Type: application/json
{
"samples": [
[
0,
1
],
[
1,
2
],
[
2,
2
]
],
"predict_x": [
"3/2",
3
]
}The HTTP and MCP interfaces execute the same implementation. Validation errors are returned explicitly. See the tool notes above for its supported inputs and behavior.