power
Calculate exponential values by raising a base number to a specified power. Use this mathematical tool to compute exponentiation operations for various applications.
Instructions
计算一个数字的幂
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base | Yes | 底数 | |
| exponent | Yes | 指数 |
Implementation Reference
- src/index.ts:186-197 (handler)Handler function for the 'power' tool. Extracts base and exponent from arguments, computes Math.pow(base, exponent), and returns the result as formatted text content.case "power": { const { base, exponent } = args as { base: number; exponent: number }; const result = Math.pow(base, exponent); return { content: [ { type: "text", text: `${base}^${exponent} = ${result}`, }, ], }; }
- src/index.ts:93-106 (schema)Input schema for the 'power' tool, defining 'base' and 'exponent' as required number properties.inputSchema: { type: "object", properties: { base: { type: "number", description: "底数", }, exponent: { type: "number", description: "指数", }, }, required: ["base", "exponent"], },
- src/index.ts:90-107 (registration)Registration of the 'power' tool in the tools array, including name, description, and input schema. This array is returned by the ListToolsRequest handler.{ name: "power", description: "计算一个数字的幂", inputSchema: { type: "object", properties: { base: { type: "number", description: "底数", }, exponent: { type: "number", description: "指数", }, }, required: ["base", "exponent"], }, },