add
Add two integers together using this simple arithmetic tool from the MCP Server Deployment Demo. Perform basic addition calculations for development testing and learning purposes.
Instructions
Adds two integers.
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": {
"x": "<x>",
"y": "<y>"
},
"name": "add"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | ||
| y | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcpserver/deployment.py:6-10 (handler)The handler function for the 'add' tool, which adds two integer inputs and returns their sum.
def add(x: int, y: int) -> int: """ Adds two integers. """ return x + y - src/mcpserver/deployment.py:5-5 (registration)The @mcp.tool() decorator registers the 'add' function as a tool on the FastMCP server instance.
@mcp.tool()