Skip to content

Commit 6b4df8d

Browse files
committed
fix operator precedence in calculate tool
1 parent a8f9627 commit 6b4df8d

File tree

3 files changed

+320
-87
lines changed

3 files changed

+320
-87
lines changed

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# MCP Calculator Server
22

3-
A Model Context Protocol (MCP) server that provides calculator functionality.
3+
A Model Context Protocol (MCP) server that provides calculator functionality with robust mathematical operations.
44

55
## Features
66

77
### Tools
8-
- **calculate**: Mathematical operations with proper operator precedence
8+
- **calculate**: Mathematical operations with proper operator precedence, parentheses support, and scientific notation
99
- **random_number**: Generate random numbers within specified ranges
1010

1111
### Resources
@@ -26,10 +26,18 @@ A Model Context Protocol (MCP) server that provides calculator functionality.
2626

2727
## Usage
2828

29-
```sh
29+
```bash
30+
# Install
3031
go install github.com/yinebebt/mcp-calculator-server@latest
3132

32-
TRANSPORT=stdio ./mcp-calculator-server
33+
# Run with stdio
34+
TRANSPORT=stdio mcp-calculator-server
35+
36+
# Run with HTTP
37+
mcp-calculator-server
38+
39+
# Test
40+
go test
3341
```
3442

3543
### MCP Client Configuration
@@ -42,4 +50,11 @@ For testing with MCP Client:
4250
"TRANSPORT": "stdio"
4351
}
4452
}
45-
```
53+
```
54+
55+
## Mathematical Features
56+
57+
- **Operator precedence**: `2+3*4 = 14`
58+
- **Parentheses**: `(2+3)*4 = 20`
59+
- **Scientific notation**: `1e2 = 100`
60+
- **Error detection**: Division by zero, invalid syntax, unmatched parentheses

0 commit comments

Comments
 (0)