| 421 | }; |
| 422 | |
| 423 | export const makeEchoMcpServer = ( |
| 424 | options: { |
| 425 | readonly name?: string; |
| 426 | readonly version?: string; |
| 427 | readonly toolName?: string; |
| 428 | readonly toolDescription?: string; |
| 429 | readonly inputName?: "name" | "value" | "marker"; |
| 430 | readonly text?: (value: string) => string; |
| 431 | } = {}, |
| 432 | ) => { |
| 433 | const inputName = options.inputName ?? "value"; |
| 434 | const server = new McpServer( |
| 435 | { |
| 436 | name: options.name ?? "executor-echo-mcp", |
| 437 | version: options.version ?? "1.0.0", |
| 438 | }, |
| 439 | { capabilities: {} }, |
| 440 | ); |
| 441 | |
| 442 | server.registerTool( |
| 443 | options.toolName ?? "echo", |
| 444 | { |
| 445 | description: options.toolDescription ?? "Echoes a string value", |
| 446 | inputSchema: { [inputName]: z.string() }, |
| 447 | }, |
| 448 | async (input) => ({ |
| 449 | content: [ |
| 450 | { |
| 451 | type: "text" as const, |
| 452 | text: options.text ? options.text(input[inputName]) : input[inputName], |
| 453 | }, |
| 454 | ], |
| 455 | }), |
| 456 | ); |
| 457 | |
| 458 | return server; |
| 459 | }; |
| 460 | |
| 461 | export const makeElicitationMcpServer = () => { |
| 462 | const server = new McpServer( |