Home/Tools/cross_product

Cross product

Vector cross product of two 3-component vectors.

Endpoint: POST /api/v1/cross_product

When to use

Vector cross product of two 3-component vectors.

Input schema

Validated server-side with Zod. The same schema feeds OpenAPI and the MCP tool list.

{
  "type": "object",
  "properties": {
    "a": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          }
        ]
      },
      "minItems": 1,
      "description": "Vector of numbers or expression strings"
    },
    "b": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          }
        ]
      },
      "minItems": 1,
      "description": "Vector of numbers or expression strings"
    }
  },
  "required": [
    "a",
    "b"
  ],
  "additionalProperties": false
}

Response shape

All tools return { ok: true, result } on success and { ok: false, error } on failure. The result object contains:

FieldTypeDescription
vectorstring[]Resulting 3-component vector.

Example

Request

{
  "a": [
    1,
    0,
    0
  ],
  "b": [
    0,
    1,
    0
  ]
}

Response

{
  "ok": true,
  "result": {
    "vector": [
      "0",
      "0",
      "1"
    ]
  }
}

curl

curl -X POST https://tools.aieo.se/api/v1/cross_product \
  -H 'Content-Type: application/json' \
  -d '{"a":[1,0,0],"b":[0,1,0]}'

MCP call (JSON-RPC)

MCP clients call this tool as tools/call against /api/mcp:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "cross_product",
    "arguments": {
      "a": [
        1,
        0,
        0
      ],
      "b": [
        0,
        1,
        0
      ]
    }
  }
}

Common errors

  • Either vector is not 3-component.
    Nerdamer throws.
  • A required field is missing or has the wrong type.
    Zod validation error, e.g. `Required` or `Expected string, received number`.
  • Nerdamer cannot parse the expression (unbalanced parens, unknown function, stray characters).
    `Unexpected token …` or `… is not a valid expression`.