greet
Generate personalized greetings in multiple languages by providing the recipient's name and preferred language. Ideal for creating tailored AI assistant interactions.
Instructions
Generate a personalized greeting
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | Language for the greeting | |
| name | Yes | Name of the person to greet |
Input Schema (JSON Schema)
{
"properties": {
"language": {
"description": "Language for the greeting",
"enum": [
"en",
"zh",
"es",
"fr"
],
"type": "string"
},
"name": {
"description": "Name of the person to greet",
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
}
Implementation Reference
- demo.ts:107-130 (handler)Handler for the 'greet' tool that extracts the person's name and optional language from arguments, selects the appropriate greeting from a predefined map, and returns it as text content.if (name === "greet") { const { name: personName, language = "en" } = args as { name: string; language?: string; }; const greetings: Record<string, string> = { en: `Hello, ${personName}! How are you today?`, zh: `你好,${personName}!今天过得怎么样?`, es: `¡Hola, ${personName}! ¿Cómo estás hoy?`, fr: `Bonjour, ${personName}! Comment allez-vous aujourd'hui?`, }; const greeting = greetings[language] || greetings.en; return { content: [ { type: "text", text: greeting, }, ], }; }
- demo.ts:43-61 (schema)Input schema definition for the 'greet' tool, specifying the required 'name' parameter and optional 'language' with supported enums.{ name: "greet", description: "Generate a personalized greeting", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the person to greet", }, language: { type: "string", description: "Language for the greeting", enum: ["en", "zh", "es", "fr"], }, }, required: ["name"], }, },