add
Add two integer numbers together using this arithmetic tool from MCPServerDemo. Perform basic addition calculations with specified values.
Instructions
add two numbers
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
- main.py:13-18 (handler)The 'add' tool is defined here using the @method decorator. It performs simple integer addition and returns a JSON-RPC Success result.
@method def add(a: int, b: int) -> Result: logger.info(f"Received add request with params: a={a}, b={b}") result = a + b logger.info(f"Add operation result: {result}") return Success(result)