calculate_percentage
Calculate a percentage of a value by providing the base number and percentage to compute. This tool performs the mathematical operation to determine the percentage amount.
Instructions
Calculate a percentage of a value.
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": {
"value": "<value>",
"percentage": "<percentage>"
},
"name": "calculate_percentage"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes | ||
| percentage | Yes |
Implementation Reference
- server.py:116-119 (handler)The handler function for the 'calculate_percentage' tool, decorated with @mcp.tool() for registration in the MCP server. It calculates (value * percentage) / 100.
@mcp.tool() def calculate_percentage(value: float, percentage: float) -> float: """Calculate a percentage of a value.""" return (value * percentage) / 100