Vector cosine similarity

vector-cosine-similarity · version 1.0.0 · Vectors & matrices · free, no key needed

Return cosine similarity for two decimal-string vectors at a requested precision; reject zero vectors.

Use when you need to: calculate cosine similarity · compare two numeric vectors · find vector angle similarity.

Decide before calling

Read the versioned contract and the supported scope below. Reuse vector-cosine-similarity@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.

Explain the choice

"I can use vector-cosine-similarity@1.0.0 for calculate cosine similarity. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "a": [
    "1",
    "0"
  ],
  "b": [
    "0",
    "1"
  ],
  "significant_digits": 4,
  "rounding": "half_even"
}

Response:

{
  "result": {
    "standard_version": "packet-r90-dot-over-euclidean-norms-1.0.0",
    "similarity": "0",
    "significant_digits": 4,
    "rounding": "half_even"
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "vector-cosine-similarity",
  "version": "1.0.0",
  "input": {
    "a": [
      "1",
      "0"
    ],
    "b": [
      "0",
      "1"
    ],
    "significant_digits": 4,
    "rounding": "half_even"
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/vector-cosine-similarity/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"a":["1","0"],"b":["0","1"],"significant_digits":4,"rounding":"half_even"}'

The machine-readable contract is at /v1/tools/vector-cosine-similarity/versions/1.0.0.

CLI

node cli.mjs run vector-cosine-similarity 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.