Skip to main content
Glama

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
NameRequiredDescriptionDefault
baseNo
valueYes

Implementation Reference

  • 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); }
  • 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); } );

Other Tools

Related Tools

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