53 lines
801 B
Markdown
53 lines
801 B
Markdown
---
|
|
name: calculator
|
|
description: "Perform basic arithmetic operations: addition, subtraction, multiplication, and division"
|
|
---
|
|
|
|
# calculator
|
|
|
|
Perform basic arithmetic operations: addition, subtraction, multiplication, and division.
|
|
|
|
## Input
|
|
|
|
The input is a JSON object provided via standard input:
|
|
|
|
```json
|
|
{
|
|
"a": 10,
|
|
"op": "+",
|
|
"b": 5
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
- `a` (number, required): First operand
|
|
- `op` (string, required): Operator, one of `+`, `-`, `*`, `/`
|
|
- `b` (number, required): Second operand
|
|
|
|
## Output
|
|
|
|
Returns a JSON object to standard output:
|
|
|
|
```json
|
|
{
|
|
"result": 15
|
|
}
|
|
```
|
|
|
|
## Errors
|
|
|
|
On failure, returns a JSON object:
|
|
|
|
```json
|
|
{
|
|
"error": "division by zero"
|
|
}
|
|
```
|
|
|
|
## Notes
|
|
|
|
- This skill is non-interactive.
|
|
- Output is always valid JSON.
|
|
- No output is written to stderr.
|