Skip to main content
Glama

greet

Generate personalized greetings tailored to individual names and desired politeness levels. Perfect for client-server interactions showcasing TypeScript integration.

Instructions

Generates a personalized greeting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name of the person to greet.
politenessNoDesired politeness level.informal

Implementation Reference

  • The asynchronous handler function that implements the core logic of the 'greet' tool. It generates a personalized greeting based on the provided name and optional politeness level (formal or informal).
    async ({ name, politeness }) => { console.error(`Executing greet tool for: ${name}, Politeness: ${politeness}`); let greeting = ""; if (politeness === "formal") { greeting = `Esteemed greetings to you, ${name}. It is a pleasure.`; } else { greeting = `Hey ${name}! What's up?`; } return { content: [{ type: "text", text: greeting }], }; }
  • The input schema for the 'greet' tool, defining parameters 'name' (required string) and 'politeness' (optional enum: formal/informal, defaults to informal). Uses Zod for validation.
    { name: z.string().describe("The name of the person to greet."), politeness: z.enum(["formal", "informal"]).optional().default("informal").describe("Desired politeness level."), },
  • src/index.ts:24-43 (registration)
    The registration of the 'greet' tool on the MCP server using server.tool(), including name, description, input schema, and handler function.
    server.tool( "greet", "Generates a personalized greeting.", { name: z.string().describe("The name of the person to greet."), politeness: z.enum(["formal", "informal"]).optional().default("informal").describe("Desired politeness level."), }, async ({ name, politeness }) => { console.error(`Executing greet tool for: ${name}, Politeness: ${politeness}`); let greeting = ""; if (politeness === "formal") { greeting = `Esteemed greetings to you, ${name}. It is a pleasure.`; } else { greeting = `Hey ${name}! What's up?`; } return { content: [{ type: "text", text: greeting }], }; } );

Other Tools

Related 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/sanketshinde3001/MCP'

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