Skip to main content
Glama
dhinojosac

TypeScript MCP Server Template

by dhinojosac

Say Hello

sayHello

Generate personalized greetings by name using this TypeScript MCP server template tool for testing and demonstration purposes.

Instructions

Says hello to a person by name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The asynchronous handler function for the 'sayHello' tool. It validates the input arguments using SayHelloSchema and returns a text response greeting the provided name.
    async (args: { [x: string]: any }) => {
      const { name }: SayHelloArgs = validateToolArgs(SayHelloSchema, args);
    
      return {
        content: [
          {
            type: 'text',
            text: `Hello, ${name}!`,
          },
        ],
      };
    }
  • Zod schema defining the input structure for the sayHello tool, requiring a 'name' field validated against NameSchema.
    export const SayHelloSchema = z.object({
      name: NameSchema,
    });
  • src/server.ts:30-48 (registration)
    Registration of the 'sayHello' tool on the MCP server, including name, metadata (title, description), and the handler function with Zod validation.
    server.registerTool(
      'sayHello',
      {
        title: 'Say Hello',
        description: 'Says hello to a person by name',
      },
      async (args: { [x: string]: any }) => {
        const { name }: SayHelloArgs = validateToolArgs(SayHelloSchema, args);
    
        return {
          content: [
            {
              type: 'text',
              text: `Hello, ${name}!`,
            },
          ],
        };
      }
    );
  • Helper utility function used in the sayHello handler to validate tool arguments against the Zod schema, providing detailed error messages.
    export function validateToolArgs<T>(schema: z.ZodSchema<T>, args: unknown): T {
      try {
        return schema.parse(args);
      } catch (error) {
        if (error instanceof z.ZodError) {
          const errorMessages = error.errors
            .map(err => `${err.path.join('.')}: ${err.message}`)
            .join(', ');
          throw new Error(`Validation failed: ${errorMessages}`);
        }
        throw error;
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'says hello', which implies a read-only or output action, but doesn't clarify if it requires any permissions, has side effects, or details the response format. For a tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core functionality ('Says hello to a person by name') with zero wasted words. It is appropriately sized for a simple tool and earns its place by clearly stating the purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (0 parameters, no output schema, no annotations), the description is minimally adequate. It states what the tool does but lacks details on behavioral traits, usage context, or output. For such a simple tool, this is acceptable but leaves clear gaps, making it a baseline viable description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, meaning no parameters are documented in the schema. The description adds value by implying the tool might operate on a person's name, but since there are no parameters, it doesn't need to compensate for schema gaps. A baseline of 4 is appropriate as the description provides some semantic context without parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function with a specific verb ('says') and resource ('hello to a person by name'), making the purpose immediately understandable. However, it doesn't distinguish this tool from potential sibling tools (like 'calculate' or weather-related tools), which would require a 5. The description avoids being vague or tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, such as the sibling tools 'calculate', 'getWeatherAlerts', or 'getWeatherForecast'. It implies usage for greeting purposes but lacks explicit context, exclusions, or comparisons, leaving the agent without direction on tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/dhinojosac/calendar-mcp'

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