slope calc
slope_calcCalculate the slope, y-intercept, line equation, angle, and distance between two points in a 2D Cartesian plane. Given coordinates (x1, y1) and (x2, y2), computes slope (rise/run), y-intercept, the equation in slope-intercept form (y = mx + b), angle in degrees relative to the x-axis, and Euclidean distance. Handles vertical and horizontal lines as special cases. Useful for surveying, civil engineering grade calculations, linear regression visualization, and physics kinematics problems.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"x1": "<x1>",
"y1": "<y1>",
"x2": "<x2>",
"y2": "<y2>"
},
"name": "slope_calc"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x1 | Yes | X-coordinate of the first point | |
| x2 | Yes | X-coordinate of the second point | |
| y1 | Yes | Y-coordinate of the first point | |
| y2 | Yes | Y-coordinate of the second point |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slope | Yes | Slope of the line (null for vertical lines) | |
| distance | Yes | Euclidean distance between the two points | |
| equation | Yes | Line equation in slope-intercept form or 'x = c' for vertical | |
| is_vertical | Yes | True if the line is vertical (undefined slope) | |
| y_intercept | Yes | Y-intercept of the line (null for vertical lines) | |
| angle_degrees | Yes | Angle of the line relative to the positive x-axis in degrees | |
| is_horizontal | Yes | True if the line is horizontal (slope = 0) |