add
Calculate the sum of two numbers by providing both values as input parameters.
Instructions
Add two numbers together.
Args:
a: The first number
b: The second number
Returns:
The sum of a and b
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Input Schema (JSON Schema)
{
"properties": {
"a": {
"title": "A",
"type": "number"
},
"b": {
"title": "B",
"type": "number"
}
},
"required": [
"a",
"b"
],
"type": "object"
}
Implementation Reference
- server.py:27-38 (handler)The handler function for the 'add' tool. It takes two float arguments 'a' and 'b' and returns their sum.def add(a: float, b: float) -> float: """ Add two numbers together. Args: a: The first number b: The second number Returns: The sum of a and b """ return a + b
- server.py:26-26 (registration)The @mcp.tool() decorator registers the 'add' function as an MCP tool.@mcp.tool()
- server.py:27-27 (schema)Type signature defining input parameters a and b as floats, and return type as float, along with docstring describing the schema.def add(a: float, b: float) -> float: