logarithm
Compute logarithms with custom bases using MCP Calc Tools. Input any numerical value and base to obtain accurate results for mathematical or financial calculations.
Instructions
Calculate logarithm with any base
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base | No | ||
| value | Yes |
Implementation Reference
- index.js:185-187 (handler)The handler function for the 'logarithm' tool, which calculates the logarithm of a value with a specified base (default natural log) using the change of base formula.async ({ value, base = Math.E }) => { return Math.log(value) / Math.log(base); }
- index.js:179-183 (schema)Input schema requires a 'value' (number) and optional 'base' (number, defaults to e). Output is a number.inputSchema: z.object({ value: z.number(), base: z.number().optional() }), outputSchema: z.number(),
- index.js:175-188 (registration)Registration of the 'logarithm' tool using ai.defineTool, including name, description, schema, and handler.ai.defineTool( { name: 'logarithm', description: 'Calculate logarithm with any base', inputSchema: z.object({ value: z.number(), base: z.number().optional() }), outputSchema: z.number(), }, async ({ value, base = Math.E }) => { return Math.log(value) / Math.log(base); } );