Skip to main content
Glama

logarithm

Calculate logarithms with any base for mathematical and financial analysis. This tool computes logarithmic values to support complex calculations in AI code assistants.

Instructions

Calculate logarithm with any base

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
valueYes
baseNo

Implementation Reference

  • The handler function computes the logarithm of the given value using the specified base (defaults to natural log if base not provided) using the change of base formula.
    async ({ value, base = Math.E }) => { return Math.log(value) / Math.log(base); }
  • Defines the input schema with 'value' (required number) and 'base' (optional number), and output schema as a number.
    inputSchema: z.object({ value: z.number(), base: z.number().optional() }), outputSchema: z.number(),
  • index.js:175-188 (registration)
    Registers the 'logarithm' tool using ai.defineTool, including name, description, schemas, and inline 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); } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nbiish/mcp-calc-tools'

If you have feedback or need assistance with the MCP directory API, please join our Discord server