add
Add two integers together to calculate their sum. Use this tool to perform basic addition operations within the MCP Server Example.
Instructions
Adds two numbers a and b and returns the result!
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:5-5 (registration)Registers the 'add' function as an MCP tool using the FastMCP decorator.
@mcp.tool() - src/mcpserver/deployment.py:6-10 (handler)The handler function that implements the 'add' tool logic by adding two integers and returning the result.
def add(a: int, b: int) -> int: """ Adds two numbers a and b and returns the result! """ return a + b