greeting
Generate customized greetings tailored to individual names and preferred styles (formal, casual, enthusiastic)
Instructions
Create personalized greetings
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the person to greet | |
| style | No | Style of greeting |
Implementation Reference
- src/index.ts:34-54 (handler)Handler function that generates a personalized greeting based on the provided name and style (formal, casual, or enthusiastic), returning it as MCP content.async ({ name, style = "casual" }) => { let greeting; switch (style) { case "formal": greeting = `Good day, ${name}. I hope you're having a pleasant experience.`; break; case "enthusiastic": greeting = `HEY THERE ${name.toUpperCase()}! 🎉 You're AWESOME!`; break; default: // casual greeting = `Hey ${name}! Nice to meet you! 👋`; } return { content: [{ type: "text", text: greeting }] }; }
- src/index.ts:30-33 (schema)Zod schema defining the input parameters for the greeting tool: required 'name' string and optional 'style' enum.{ name: z.string().describe("Name of the person to greet"), style: z.enum(["formal", "casual", "enthusiastic"]).optional().describe("Style of greeting"), },
- src/index.ts:27-55 (registration)Registration of the 'greeting' tool on the MCP server, including name, description, schema, and handler function.server.tool( "greeting", "Create personalized greetings", { name: z.string().describe("Name of the person to greet"), style: z.enum(["formal", "casual", "enthusiastic"]).optional().describe("Style of greeting"), }, async ({ name, style = "casual" }) => { let greeting; switch (style) { case "formal": greeting = `Good day, ${name}. I hope you're having a pleasant experience.`; break; case "enthusiastic": greeting = `HEY THERE ${name.toUpperCase()}! 🎉 You're AWESOME!`; break; default: // casual greeting = `Hey ${name}! Nice to meet you! 👋`; } return { content: [{ type: "text", text: greeting }] }; } );