factorial
Calculate the factorial of an integer by multiplying all positive integers up to that number. Use this tool to compute mathematical permutations and combinations.
Instructions
计算整数阶乘
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- calculator.py:43-46 (handler)The 'factorial' tool handler, decorated with @mcp.tool() for registration in FastMCP. Computes the factorial of an integer n using math.factorial(n). Includes input type hint (int) and output (int), with docstring describing the function.
@mcp.tool() def factorial(n: int) -> int: """计算整数阶乘""" return math.factorial(n)