File size: 635 Bytes
c2ea4ad
692e2cd
c2ea4ad
692e2cd
 
c2ea4ad
13f45d7
2a4d673
13f45d7
 
c2ea4ad
13f45d7
 
 
 
c2ea4ad
13f45d7
 
 
 
c2ea4ad
 
 
 
13f45d7
 
c2ea4ad
13f45d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from fastmcp import FastMCP

mcp = FastMCP(name='MathServer', stateless_http=True)


@mcp.tool(description='A simple add tool')
def add_two(a: int, b: int) -> int:
    return a + b


@mcp.tool(description='Subtract two numbers: a - b')
def subtract_two(a: int, b: int) -> int:
    return a - b


@mcp.tool(description='Multiply two numbers')
def multiply(a: int, b: int) -> int:
    return a * b


@mcp.tool(
    description='Divide two numbers: a / b. '
    'Raises ValueError on division by zero.'
)
def divide(a: float, b: float) -> float:
    if b == 0:
        raise ValueError('Division by zero is not allowed')
    return a / b