power
Calculate exponential values by raising a base number to a specified power using mathematical exponentiation.
Instructions
Raise a number to a power.
Args:
base: The base number
exponent: The exponent (power to raise the base to)
Returns:
The result of base raised to the power of exponent (base^exponent)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base | Yes | ||
| exponent | Yes |
Implementation Reference
- server.py:92-103 (handler)The main handler function for the 'power' tool. It takes base and exponent as floats and returns base raised to the power of exponent using math.pow.def power(base: float, exponent: float) -> float: """ Raise a number to a power. Args: base: The base number exponent: The exponent (power to raise the base to) Returns: The result of base raised to the power of exponent (base^exponent) """ return math.pow(base, exponent)
- server.py:91-91 (registration)The @mcp.tool() decorator registers the power function as an MCP tool with the name 'power' derived from the function name.@mcp.tool()
- server.py:93-102 (schema)The docstring provides the description, input parameters (base, exponent), and return value description, which FastMCP uses to generate the tool's JSON schema.""" Raise a number to a power. Args: base: The base number exponent: The exponent (power to raise the base to) Returns: The result of base raised to the power of exponent (base^exponent) """