hello-world
Generate personalized greetings by providing a user name. This tool demonstrates basic MCP server functionality for AI assistant integration.
Instructions
Say hello to the user
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the user |
Input Schema (JSON Schema)
{
"properties": {
"name": {
"description": "The name of the user",
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
}
Implementation Reference
- src/index.ts:19-30 (handler)Handler function for the 'hello-world' tool that greets the user by name and returns structured MCP text content.async ({ name }) => { const response = `Hello ${name}`; return { content: [ { type: "text", text: response, }, ], }; }
- src/index.ts:16-18 (schema)Input schema using Zod for the 'hello-world' tool, defining a 'name' parameter.{ name: z.string().describe("The name of the user"), },
- src/index.ts:13-31 (registration)Registration of the 'hello-world' tool on the MCP server, including name, description, input schema, and handler reference.server.tool( "hello-world", "Say hello to the user", { name: z.string().describe("The name of the user"), }, async ({ name }) => { const response = `Hello ${name}`; return { content: [ { type: "text", text: response, }, ], }; } );