natural_log
Calculate the natural logarithm of a positive number. Returns an error for zero or negative input.
Instructions
Natural logarithm (ln). Errors on non-positive input.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes |
Implementation Reference
- cruncher.js:1484-1490 (handler)The handler function for the natural_log tool. It takes a 'value' argument, throws an error if value <= 0, and returns Math.log(value) (the natural logarithm).
natural_log: ({ value }) => { if (value <= 0) throw new Error( "Natural log is only defined for positive numbers.", ); return Math.log(value); }, - cruncher.js:480-496 (schema)Input schema for the natural_log tool. Defines the tool name, title, description ('Natural logarithm (ln). Errors on non-positive input.'), and inputSchema expecting a single 'value' of type number (required).
{ name: "natural_log", annotations: { title: "Natural Logarithm", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, description: "Natural logarithm (ln). Errors on non-positive input.", inputSchema: { type: "object", properties: { value: { type: "number" } }, required: ["value"], }, }, - cruncher.js:76-79 (registration)Registration of natural_log in the 'standard' tool tier list, ensuring the tool is included by default in the standard tool set.
"evaluate_expression", "add", "subtract", "multiply", "divide", "sqrt", "power", "absolute", "modulo", "factorial", "logarithm", "natural_log", "get_constant", - cruncher.js:148-149 (registration)Registration of natural_log as a MAIN_THREAD_TOOLS entry, meaning it runs in the main thread (no worker overhead) for fast execution.
"power", "sqrt", "logarithm", "natural_log", "absolute", // Constant lookup