mul
Multiply two numbers to compute their product. Solves basic arithmetic multiplication needs.
Instructions
Multiply two numbers
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- src/tools/mul.ts:12-18 (handler)The async handler function that performs multiplication: extracts params a and b, computes a * b, and returns a text result.
handle: async (params) => { const a = params.a as number; const b = params.b as number; const result = a * b; return { content: [{ type: "text", text: `The product of ${a} and ${b} is ${result}` }] }; }, }; - src/tools/mul.ts:7-11 (schema)The schema definition for the 'mul' tool: name 'mul', description 'Multiply two numbers', inputSchema expecting {a: number, b: number}.
schema: { name: "mul", description: "Multiply two numbers", inputSchema: zodToJsonSchema(z.object({ a: z.number(), b: z.number() })), }, - src/server.ts:7-9 (registration)Import of 'mul' from './tools' and inclusion in the tools array used for registration.
import { add, div, mod, mul, sqrt, sub } from "./tools"; const tools = [add, div, mod, mul, sqrt, sub]; - src/tools/index.ts:4-4 (helper)Re-export of the 'mul' module via './mul'.
export * from "./mul";