add
Calculate the sum of two integers by providing values for both numbers to perform addition operations.
Instructions
两个整数的和相加
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- modules/my_module/my_module.py:24-27 (handler)Handler function for the 'add' MCP tool. Adds two integers a and b, decorated with @server.tool() for registration.@server.tool() def add(a: int, b: int) -> int: """两个整数的和相加""" return a + b
- modules/my_module/my_module.py:16-32 (registration)The register method in MyModule class where the 'add' tool is registered using @server.tool() decorator.def register(self, server): @server.tool() def my_tool(param: str) -> str: """自定义工具""" return f"处理参数: {param}" # 一个简单的计算器 @server.tool() def add(a: int, b: int) -> int: """两个整数的和相加""" return a + b @server.resource("my://resource") def my_resource() -> str: """自定义资源""" return "资源内容"