Skip to main content
Glama

div

Perform division of two numbers using the Calculator MCP server for accurate mathematical calculations in structured workflows.

Instructions

Divide two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • The execute function (handle) for the 'div' tool, which divides input numbers a and b and returns the result as text content.
    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 division of ${a} and ${b} is ${result}` }] }; },
  • The schema definition for the 'div' tool, including name, description, and Zod-based input schema for parameters a and b.
    schema: { name: "div", description: "Divide two numbers", inputSchema: zodToJsonSchema(z.object({ a: z.number(), b: z.number() })), },
  • src/server.ts:7-9 (registration)
    Import of the 'div' tool (via index) and registration in the tools array used by the MCP server for listing and calling tools.
    import { add, div, mod, mul, sqrt, sub } from "./tools"; const tools = [add, div, mod, mul, sqrt, sub];

Other Tools

Related Tools

  • @githubpradeep/calc-mcp72
  • @githubpradeep/calc-mcp71
  • @YuheiNakasaka/arithmetic-mcp-server
  • @riteshbangal/BuildMcpServer
  • @avanishd-3/math-mcp
  • @kylekanouse/Test-MCP---DEMO-MCP-Dev-1

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/wrtnlabs/calculator-mcp'

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