Skip to main content
Glama
Mtar786
by Mtar786

add

Calculate the sum of two numbers using a straightforward, schema-defined API. Input values 'a' and 'b' to get the result. Designed for integration with AI assistants via the Example MCP Server.

Instructions

Add two numbers together

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • index.js:33-38 (handler)
    The handler function for the 'add' tool. It takes two numbers 'a' and 'b', computes their sum, and returns it as a text content block.
    async ({ a, b }) => { const sum = a + b; return { content: [{ type: "text", text: String(sum) }], }; }
  • The input schema for the 'add' tool, defining parameters 'a' and 'b' as numbers using Zod.
    { a: z.number(), b: z.number() },
  • index.js:29-39 (registration)
    The registration of the 'add' tool on the MCP server using server.tool(), specifying name, description, input schema, and handler function.
    server.tool( "add", "Add two numbers together", { a: z.number(), b: z.number() }, async ({ a, b }) => { const sum = a + b; return { content: [{ type: "text", text: String(sum) }], }; } );

Other Tools

Related Tools

  • @Joseph19820124/joseph_mcp_server
  • @minimind-org/mcp-server-typescript-template
  • @joeguo911/mcp-demo
  • @zhangzhefang-github/mcp-add-server
  • @wudongjie/example-mcp-server
  • @gemyago/typescript-mcp-boilerplate

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/Mtar786/mcpServer'

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