mul
Multiply two numbers quickly and accurately using the 'mul' tool. Input numerical values into the Calculator MCP server to obtain instant results for any multiplication task.
Instructions
Multiply two numbers
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- src/tools/mul.ts:12-17 (handler)The asynchronous handler function for the 'mul' tool that multiplies the input numbers 'a' and 'b' and returns a textual response with the product.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, specifying the name, description, and input schema (two numbers 'a' and 'b') converted to JSON schema via Zod.schema: { name: "mul", description: "Multiply two numbers", inputSchema: zodToJsonSchema(z.object({ a: z.number(), b: z.number() })), },
- src/server.ts:9-9 (registration)The 'mul' tool is registered by including it in the 'tools' array used by the MCP server for tool listing and calling.const tools = [add, div, mod, mul, sqrt, sub];
- src/server.ts:7-7 (registration)Import of the 'mul' tool from the tools module in the server setup.import { add, div, mod, mul, sqrt, sub } from "./tools";
- src/tools/index.ts:4-4 (registration)Re-export of the 'mul' tool from its implementation file via the tools index.export * from "./mul";