Jofthomas commited on
Commit
13f45d7
·
1 Parent(s): 2a4d673

upgrade math

Browse files
Files changed (1) hide show
  1. math_server.py +21 -1
math_server.py CHANGED
@@ -1,8 +1,28 @@
1
  from mcp.server.fastmcp import FastMCP
 
 
 
2
 
3
  mcp = FastMCP(name="MathServer", stateless_http=True)
4
 
5
 
6
  @mcp.tool(description="A simple add tool")
7
- def add_two(a: int, b:int) -> int:
8
  return a + b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from mcp.server.fastmcp import FastMCP
2
+ from typing import List
3
+ import math
4
+ import statistics
5
 
6
  mcp = FastMCP(name="MathServer", stateless_http=True)
7
 
8
 
9
  @mcp.tool(description="A simple add tool")
10
+ def add_two(a: int, b: int) -> int:
11
  return a + b
12
+
13
+
14
+ @mcp.tool(description="Subtract two numbers: a - b")
15
+ def subtract_two(a: int, b: int) -> int:
16
+ return a - b
17
+
18
+
19
+ @mcp.tool(description="Multiply two numbers")
20
+ def multiply(a: int, b: int) -> int:
21
+ return a * b
22
+
23
+
24
+ @mcp.tool(description="Divide two numbers: a / b. Raises ValueError on division by zero.")
25
+ def divide(a: float, b: float) -> float:
26
+ if b == 0:
27
+ raise ValueError("Division by zero is not allowed")
28
+ return a / b