hello_tool
Generate personalized greetings by inputting a name. Built on the MCP Starter Server, this tool simplifies interaction with AI assistant tools using the ModelContextProtocol.
Instructions
Hello tool
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the person to greet |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"name": {
"description": "The name of the person to greet",
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
}
Implementation Reference
- index.ts:24-34 (handler)The handler function that logs the name and returns a text response greeting the person by name.async ({ name }) => { console.error("Hello tool", { name }); return { content: [ { type: "text", text: `Hello, ${name}!`, }, ], }; }
- index.ts:21-23 (schema)Input schema defining the 'name' parameter as a string with description.{ name: z.string().describe("The name of the person to greet"), },
- index.ts:18-35 (registration)Registration of the 'hello_tool' using server.tool, including name, description, input schema, and handler.server.tool( "hello_tool", "Hello tool", { name: z.string().describe("The name of the person to greet"), }, async ({ name }) => { console.error("Hello tool", { name }); return { content: [ { type: "text", text: `Hello, ${name}!`, }, ], }; } );