add
Perform basic addition of two numbers. Input two numeric values, and the tool calculates their sum for quick computation tasks.
Instructions
Add two numbers together.
Args:
a: First number
b: 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
- src/mcpserver/server_1.py:5-17 (handler)The 'add' tool handler, registered via @mcp.tool() decorator. It adds two integers i and j and returns their sum. Includes type hints and docstring serving as schema.
@mcp.tool() def add(i:int , j:int) -> int: """ Adds two integers and returns the result. Args: i (int): The first integer to add. j (int): The second integer to add. Returns: int: The sum of i and j. """ return i+ j