Tools for agents: Exact tetrahedron volume and centroid

Compute signed solid volume, orientation and uniform tetrahedron centroid with exact rational arithmetic.

Connect with MCP

{
  "mcpServers": {
    "super-agent-tools": {
      "url": "https://app.getsupers.com/sites/agent-tetrahedron/mcp"
    }
  }
}
Streamable HTTP · No API key · Stateless

Use this URL in any client supporting remote Streamable HTTP MCP. Calls return structured JSON; inputs are processed without persistence.

Call measure_tetrahedron

Supply exactly four ordered 3D vertices A,B,C,D. Coordinates are integers or quoted finite decimal/fraction strings; JSON floats and booleans fail. Signed volume is det(B-A,C-A,D-A)/6, using the right-handed coordinate convention; swapping any two vertices reverses its sign. Absolute volume uses cubed input units. Orientation is positive, negative or degenerate based on the exact determinant, with no tolerance. For a nondegenerate tetrahedron, solid_centroid is the arithmetic mean of its four vertices and assumes uniform density. Coplanar or repeated vertices are accepted as degenerate with volume zero and solid_centroid=null; vertex_mean is still returned but is not advertised as the centroid of a lower-dimensional hull. Outputs are reduced rational strings. This measures one tetrahedron, not a general mesh volume, surface centroid, convex-hull repair or density-weighted mass. Near-degenerate rational inputs retain their exact nonzero volume.

Input and output schemas
{
  "name": "measure_tetrahedron",
  "title": "Exact tetrahedron volume and centroid",
  "description": "Measure signed and absolute tetrahedral volume and centroid using exact rational coordinates; classify degenerate tetrahedra explicitly.",
  "inputSchema": {
    "properties": {
      "vertices": {
        "maxItems": 4,
        "minItems": 4,
        "prefixItems": [
          {
            "maxItems": 3,
            "minItems": 3,
            "prefixItems": [
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            ],
            "type": "array"
          },
          {
            "maxItems": 3,
            "minItems": 3,
            "prefixItems": [
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            ],
            "type": "array"
          },
          {
            "maxItems": 3,
            "minItems": 3,
            "prefixItems": [
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            ],
            "type": "array"
          },
          {
            "maxItems": 3,
            "minItems": 3,
            "prefixItems": [
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            ],
            "type": "array"
          }
        ],
        "title": "Vertices",
        "type": "array"
      }
    },
    "required": [
      "vertices"
    ],
    "title": "measure_tetrahedronArguments",
    "type": "object"
  },
  "outputSchema": {
    "additionalProperties": true,
    "title": "measure_tetrahedronDictOutput",
    "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-tetrahedron/call
Content-Type: application/json

{
  "vertices": [
    [
      0,
      0,
      0
    ],
    [
      2,
      0,
      0
    ],
    [
      0,
      3,
      0
    ],
    [
      0,
      0,
      4
    ]
  ]
}

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.

Exact edge coordinates determine signed volume and a uniform centroid

Read the explanation

The fixture vertices are the origin, two along x, three along y and four along z. Their three edge vectors form a diagonal matrix with determinant two times three times four, or twenty four. Signed tetrahedron volume is that determinant divided by six, giving four cubed input units. At ten pixels per value determinant measures two hundred forty, divisor six sixty and volume four forty. These bars show the arithmetic relation, not comparable physical units. Orientation is positive under the right-handed vertex convention. This manual derivation does not claim an executed tool response. For uniform density the solid centroid is the arithmetic mean of the four vertices. Summed coordinates are two, three and four, so centroid is one half, three quarters and one. At two hundred pixels per coordinate the centroid component bars measure one hundred, one hundred fifty and two hundred. The assumed density is uniform; these are not density-weighted measurements or the centroid of a general triangle mesh. Reduced rational strings preserve the exact halves and quarters rather than approximating them as arbitrary display decimals. Keeping the first three fixture vertices and moving the fourth z coordinate from four to two halves the determinant from twenty four to twelve and the volume from four to two. Moving it to zero makes the vertices coplanar and volume zero. At sixty pixels per volume original four measures two hundred forty, halved two one hundred twenty and coplanar zero zero. Swapping vertices reverses signed orientation without changing absolute volume. Degenerate inputs return null solid centroid while still providing vertex mean; exact rational arithmetic uses no guessed tolerance. The offline client asset is absent, so these contract-based examples do not prove actual HTTP or MCP execution.

Exact Tetrahedron Volume and Centroid Evaluation

How does this tool compute signed solid tetrahedron volume, detect degeneracy, and calculate the uniform solid centroid using rational arithmetic?

The measure_tetrahedron function takes four ordered 3D points (A, B, C, D) and forms three relative edge vectors u = B - A, v = C - A, and w = D - A. It computes their scalar triple product via the determinant det([u, v, w]) = u · (v × w). Signed tetrahedral volume equals this determinant divided by 6, reflecting a right-handed orientation convention. Nondegenerate tetrahedra report their solid centroid as the arithmetic mean of all four vertices (A + B + C + D) / 4. All computations use exact rational arithmetic, avoiding floating-point rounding errors.

The tool accepts only integers or quoted finite decimal/fraction strings; raw JSON floats are rejected to preserve exactness. If the determinant is zero (e.g., coplanar or duplicate vertices), the tool sets degenerate to true and solid_centroid to null; vertex_mean is still reported, but it represents the arithmetic mean of the supplied points rather than a lower-dimensional centroid. It models a single solid tetrahedron of uniform density, not surface area, hollow shells, general polygonal meshes, or non-uniform mass distributions.

Try a worked example

With the default input vertices A=(0,0,0), B=(2,0,0), C=(0,3,0), and D=(0,0,4), edge vectors from A are u=(2,0,0), v=(0,3,0), and w=(0,0,4). The cross product v × w is (12, 0, 0), and the scalar triple product u · (v × w) equals 24. Dividing by 6 yields a signed and absolute volume of 4 with 'positive' orientation. Averaging the four coordinates produces vertex_mean and solid_centroid equal to ['1/2', '3/4', '1']. Clicking 'Run tool' evaluates this input and displays the structured JSON result.

Determinant and Scalar Triple Product Mechanism

The signed volume of a tetrahedron with vertices A, B, C, D corresponds to one-sixth the volume of the parallelpiped spanned by u = B - A, v = C - A, and w = D - A. In coordinates, this is evaluated as the determinant of the 3×3 matrix with rows u, v, and w, or equivalently the dot product of u with the cross product v × w. Swapping any two vertices changes the sign of the determinant, indicating an orientation flip under the right-handed coordinate system.

Degeneracy Classification and Null Centroid Handling

When four vertices lie on a single plane or line, or contain duplicate points, the scalar triple product evaluates to exactly zero. In such degenerate cases, volume is 0 and solid_centroid is returned as null. Although vertex_mean continues to provide the coordinate average of the four input tuples, it should not be treated as a physical centroid of an irregular degenerate planar polygon without proper 2D area weighting.