Skip to main content

Math.js Tool

[Source Code]

Math.js is a JavaScript library for evaluating mathematical expressions.

Installation

npm install @modelfusion/mathjs-tool

Usage

import { MathJsTool } from "@modelfusion/mathjs-tool";

const mathTool = new MathJsTool({
name: "math",
});

You can then use the tool with runTool or executeTool:

const result = await executeTool({
tool: mathTool,
args: {
expression: "2 + 2",
},
});