Skip to main content
Glama
gogouravr

FastMCP Demo

by gogouravr

hello

Generate personalized greetings by providing a name to create custom hello messages for user interactions.

Instructions

A simple greeting tool that says hello

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name to greet

Implementation Reference

  • The specific handler logic for the 'hello' tool within the CallToolRequestSchema request handler. It greets the user by name or defaults to 'World'.
    if (name === "hello") { const userName = (args?.name as string) || "World"; return { content: [ { type: "text", text: `Hello, ${userName}! Welcome to MCP!`, }, ], }; }
  • The tool metadata and input schema definition for 'hello' returned in ListTools response.
    { name: "hello", description: "A simple greeting tool that says hello", inputSchema: { type: "object", properties: { name: { type: "string", description: "The name to greet", }, }, required: ["name"], }, }, {
  • The registration of the ListToolsRequestSchema handler, which advertises the available tools including 'hello'.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "hello", description: "A simple greeting tool that says hello", inputSchema: { type: "object", properties: { name: { type: "string", description: "The name to greet", }, }, required: ["name"], }, }, { name: "calculate", description: "Perform basic arithmetic calculations", inputSchema: { type: "object", properties: { operation: { type: "string", enum: ["add", "subtract", "multiply", "divide"], description: "The arithmetic operation to perform", }, a: { type: "number", description: "First number", }, b: { type: "number", description: "Second number", }, }, required: ["operation", "a", "b"], }, }, ], }; }); // Handle tool execution
  • The execute handler for the 'hello' tool in the FastMCP example, returning a simple greeting string.
    execute: async (args) => { return `Hello, ${args.name}! Welcome to MCP!`; },
  • The complete registration of the 'hello' tool using FastMCP's addTool API, including schema (via Zod), description, and inline handler.
    server.addTool({ name: "hello", description: "A simple greeting tool that says hello", parameters: z.object({ name: z.string().describe("The name to greet"), }), execute: async (args) => { return `Hello, ${args.name}! Welcome to MCP!`; }, });
Install Server

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/gogouravr/fast-mcp'

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