Skip to main content
Glama
soriat

MCP Elicitations Demo Server

by soriat

echo

Facilitates dynamic user input collection by echoing back submitted messages, demonstrating the MCP elicitation system's functionality.

Instructions

Echoes back the input!

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesMessage to echo

Implementation Reference

  • The handler function for the echo tool. Parses input args with EchoSchema and returns a text content response echoing the message.
    handler: async (args: any) => { const validatedArgs = EchoSchema.parse(args); return { content: [{ type: "text" as const, text: `Echo: ${validatedArgs.message}` }], }; },
  • Zod schema defining the input for the echo tool: a required string message.
    const EchoSchema = z.object({ message: z.string().describe("Message to echo"), });
  • echoTool is registered by inclusion in the allTools array, which populates tool lists and handlers for the MCP server.
    const allTools = [ echoTool, addTool, longRunningOperationTool, printEnvTool, sampleLlmTool, sampleWithPreferencesTool, sampleMultimodalTool, sampleConversationTool, sampleAdvancedTool, getTinyImageTool, annotatedMessageTool, getResourceReferenceTool, elicitationTool, getResourceLinksTool, ];
  • Registers the MCP server request handlers for listing tools (ListToolsRequestSchema) and calling tools (CallToolRequestSchema), delegating to getToolHandler for execution.
    export const setupTools = (server: Server) => { // Handle listing all available tools server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: getTools() }; }); // Handle tool execution server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; const handler = getToolHandler(name); if (handler) { return await handler(args, request, server); } throw new Error(`Unknown tool: ${name}`); }); };
  • Helper function that retrieves the handler for a tool by its name from the allTools array.
    export const getToolHandler = (name: string) => { const tool = allTools.find((t) => t.name === name); return tool?.handler; };

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/soriat/soria-mcp'

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