echo
Echo back input text to verify communication and test connectivity in the MCP Server environment.
Instructions
Echo back the input text
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | The message to echo back |
Implementation Reference
- src/index.ts:113-122 (handler)The handler that implements the core logic of the 'echo' tool by validating the input message and echoing it back as text content.case 'echo': const message = validateString(args.message, 'message'); return { content: [ { type: 'text', text: message, } as TextContent, ], };
- src/index.ts:33-42 (schema)The JSON schema defining the input parameters for the 'echo' tool, specifying a required 'message' string.inputSchema: { type: 'object', properties: { message: { type: 'string', description: 'The message to echo back', }, }, required: ['message'], },
- src/index.ts:30-43 (registration)The registration of the 'echo' tool in the tools array, which is served via the ListToolsRequest handler.{ name: 'echo', description: 'Echo back the input text', inputSchema: { type: 'object', properties: { message: { type: 'string', description: 'The message to echo back', }, }, required: ['message'], }, },
- src/index.ts:13-18 (helper)Helper function for string input validation, used by the echo tool handler.const validateString = (value: unknown, fieldName: string): string => { if (typeof value !== 'string') { throw new Error(`${fieldName} must be a string`); } return value; };