Skip to main content
Glama
soriat

MCP Elicitations Demo Server

by soriat

add

Adds two numbers interactively using the MCP Elicitations Demo Server. Input two numeric values to calculate their sum dynamically.

Instructions

Adds two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

Implementation Reference

  • The async handler function for the 'add' tool. It validates the input arguments using AddSchema, computes the sum of 'a' and 'b', and returns a structured text response containing the result.
    handler: async (args: any) => { const validatedArgs = AddSchema.parse(args); const sum = validatedArgs.a + validatedArgs.b; return { content: [ { type: "text" as const, text: `The sum of ${validatedArgs.a} and ${validatedArgs.b} is ${sum}.`, }, ], }; },
  • Zod schema (AddSchema) defining the input structure for the 'add' tool: two number fields 'a' and 'b' with descriptions.
    const AddSchema = z.object({ a: z.number().describe("First number"), b: z.number().describe("Second number"), });
  • Registration of the 'add' tool by including 'addTool' in the 'allTools' array, which is used by getTools() for listing tools and getToolHandler() for execution dispatching.
    const allTools = [ echoTool, addTool, longRunningOperationTool, printEnvTool, sampleLlmTool, sampleWithPreferencesTool, sampleMultimodalTool, sampleConversationTool, sampleAdvancedTool, getTinyImageTool, annotatedMessageTool, getResourceReferenceTool, elicitationTool, getResourceLinksTool, ];
  • src/tools/index.ts:8-8 (registration)
    Import statement that brings the 'addTool' into the index module for registration.
    import { addTool } from "./tool-add.js";

Other Tools

Related Tools

  • @kylekanouse/Test-MCP---DEMO-MCP-Dev-1
  • @wrtnlabs/calculator-mcp
  • @zhangzhefang-github/mcp-add-server
  • @dynstat/mcp-demo
  • @wudongjie/example-mcp-server
  • @githubpradeep/calc-mcp72

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/soriat/soria-mcp'

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