add
Add two numbers together to calculate their sum. This tool performs basic addition by taking two numeric inputs and returning the total result.
Instructions
Add two numbers together.
Args:
a: The first number
b: The second number
Returns:
The sum of a and b
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"a": "<a>",
"b": "<b>"
},
"name": "add"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server.py:26-38 (handler)The handler function for the 'add' tool, decorated with @mcp.tool() which also serves as registration. It takes two float arguments, adds them, and returns the sum. The docstring provides the schema description.
@mcp.tool() 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