hello-world
Generate a personalized greeting by providing a user's name. This tool demonstrates basic functionality for MCP server development.
Instructions
Say hello to the user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the user |
Implementation Reference
- src/tools.ts:18-28 (handler)The handler function that executes the logic for the "hello-world" tool, taking a 'name' parameter and returning a text content block with the greeting message.handler: async ({ name }) => { const response = `Hello ${name}`; return { content: [ { type: "text", text: response, }, ], }; },
- src/tools.ts:15-17 (schema)The input schema for the "hello-world" tool, defining a required string parameter 'name' using Zod.schema: { name: z.string().describe("The name of the user"), },
- src/tools.ts:104-106 (registration)The registration loop in registerTools function that calls server.tool() to register the "hello-world" tool (among others) to the MCP server.for (const tool of toolsToRegister) { server.tool(tool.name, tool.description, tool.schema, tool.handler); }
- src/index.ts:32-32 (registration)The call to registerTools in the main server file, which triggers the registration of the "hello-world" tool.registerTools(server, enabledTools);
- src/index.ts:8-8 (registration)Import of the registerTools function used to register tools including "hello-world".import { registerTools } from "./tools.js";