Skip to main content
Glama
gemyago

HelloWorld MCP Server

by gemyago

add

Calculate the sum of two numbers by providing both values as inputs to perform basic addition operations.

Instructions

Add two numbers together

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

Implementation Reference

  • Executes the 'add' tool: extracts numbers a and b from arguments, computes their sum, and formats a response message with the result.
    case 'add': { const { a, b } = args as { a: number; b: number }; const result = a + b; return { content: [ { type: 'text', text: `${a} + ${b} = ${result}`, }, ], }; }
  • Defines the input schema for the 'add' tool, requiring two number properties: a and b.
    inputSchema: { type: 'object', properties: { a: { type: 'number', description: 'First number', }, b: { type: 'number', description: 'Second number', }, }, required: ['a', 'b'], },
  • src/index.ts:42-59 (registration)
    Registers the 'add' tool in the ListTools response with its name, description, and input schema.
    { name: 'add', description: 'Add two numbers together', inputSchema: { type: 'object', properties: { a: { type: 'number', description: 'First number', }, b: { type: 'number', description: 'Second number', }, }, required: ['a', 'b'], }, },
  • Alternative or supporting implementation of the 'add' tool handler in the createTools factory function.
    add(args: { a: number; b: number }) { const result = args.a + args.b; return { content: [ { type: 'text', text: `${args.a} + ${args.b} = ${result}`, }, ], }; },
  • TypeScript interface definition specifying the input and output types for the 'add' tool.
    add(args: { a: number; b: number }): { content: Array<{ type: 'text'; text: string }>;

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/gemyago/typescript-mcp-boilerplate'

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