add
Calculate the sum of two integer values to perform basic arithmetic operations within the MCP Test MCP server environment.
Instructions
Add two numbers together.
Args: a: First number b: Second number
Returns: The sum of a and b
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- Primary handler function for the 'add' MCP tool. Adds two integers a and b, logs the call, and returns the sum. Registered via @mcp.tool() decorator.@mcp.tool() def add(a: int, b: int) -> int: """ Add two numbers together. Args: a: First number b: Second number Returns: The sum of a and b """ logger.debug(f"Add tool called: {a} + {b}") return a + b
- tests/conftest.py:49-60 (handler)Mock handler for the 'add' tool in pytest fixtures. Used for testing without the full server. Simple addition without logging.@mcp.tool() async def add(a: int, b: int) -> int: """Add two integer numbers together. Args: a: First number b: Second number Returns: Sum of a and b """ return a + b