add
Calculate the sum of two integers to perform basic arithmetic operations in MCP server applications.
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
- src/mcpserver/deployment.py:8-12 (handler)The 'add' tool is implemented and registered here. The handler function adds two integer arguments and returns their sum. The @mcp.tool() decorator registers it with the MCP server.
# Add an addition tool @mcp.tool() def add(a: int, b: int) -> int: """Add two numbers""" return a + b