np_trace
Compute the sum of elements along the main diagonal of a 2D array, with optional offset for other diagonals.
Instructions
Return the sum along the main diagonal of the array.
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": {
"array": "<array>"
},
"name": "np_trace"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| array | Yes | The input array (must be at least 2D). | |
| offset | No | The diagonal offset (default: 0, main diagonal). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |