Skip to main content
Glama
YuheiNakasaka

Arithmetic MCP Server

divide

Perform division operations by calculating the quotient of two numbers. Use this arithmetic tool to divide numerical values with precision.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • Handler function for the 'divide' tool. Performs division of a by b, returns result in Japanese text format. Handles division by zero error case.
    async ({ a, b }) => { if (b === 0) { return { content: [{ type: "text", text: "エラー: ゼロで割ることはできません" }], isError: true }; } return { content: [{ type: "text", text: `${a} と ${b} の割り算の結果: ${a / b}` }] }; }
  • Input schema for 'divide' tool: two numeric parameters 'a' and 'b' validated with Zod.
    { a: z.number(), b: z.number() },
  • src/index.ts:49-70 (registration)
    Registration of the 'divide' tool using McpServer.tool method, specifying name, schema, and handler.
    server.tool( "divide", { a: z.number(), b: z.number() }, async ({ a, b }) => { if (b === 0) { return { content: [{ type: "text", text: "エラー: ゼロで割ることはできません" }], isError: true }; } return { content: [{ type: "text", text: `${a} と ${b} の割り算の結果: ${a / b}` }] }; } );

Other 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/YuheiNakasaka/arithmetic-mcp-server'

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