| 374 | }; |
| 375 | |
| 376 | export const makeEchoMcpServer = ( |
| 377 | options: { |
| 378 | readonly name?: string; |
| 379 | readonly version?: string; |
| 380 | readonly toolName?: string; |
| 381 | readonly toolDescription?: string; |
| 382 | readonly inputName?: "name" | "value" | "marker"; |
| 383 | readonly text?: (value: string) => string; |
| 384 | } = {}, |
| 385 | ) => { |
| 386 | const inputName = options.inputName ?? "value"; |
| 387 | const server = new McpServer( |
| 388 | { |
| 389 | name: options.name ?? "executor-echo-mcp", |
| 390 | version: options.version ?? "1.0.0", |
| 391 | }, |
| 392 | { capabilities: {} }, |
| 393 | ); |
| 394 | |
| 395 | server.registerTool( |
| 396 | options.toolName ?? "echo", |
| 397 | { |
| 398 | description: options.toolDescription ?? "Echoes a string value", |
| 399 | inputSchema: { [inputName]: z.string() }, |
| 400 | }, |
| 401 | async (input) => ({ |
| 402 | content: [ |
| 403 | { |
| 404 | type: "text" as const, |
| 405 | text: options.text ? options.text(input[inputName]) : input[inputName], |
| 406 | }, |
| 407 | ], |
| 408 | }), |
| 409 | ); |
| 410 | |
| 411 | return server; |
| 412 | }; |
| 413 | |
| 414 | export const makeElicitationMcpServer = () => { |
| 415 | const server = new McpServer( |