| 463 | }; |
| 464 | |
| 465 | export const makeEchoMcpServer = ( |
| 466 | options: { |
| 467 | readonly name?: string; |
| 468 | readonly version?: string; |
| 469 | readonly toolName?: string; |
| 470 | readonly toolDescription?: string; |
| 471 | readonly inputName?: "name" | "value" | "marker"; |
| 472 | readonly text?: (value: string) => string; |
| 473 | } = {}, |
| 474 | ) => { |
| 475 | const inputName = options.inputName ?? "value"; |
| 476 | const server = new McpServer( |
| 477 | { |
| 478 | name: options.name ?? "executor-echo-mcp", |
| 479 | version: options.version ?? "1.0.0", |
| 480 | }, |
| 481 | { capabilities: {} }, |
| 482 | ); |
| 483 | |
| 484 | server.registerTool( |
| 485 | options.toolName ?? "echo", |
| 486 | { |
| 487 | description: options.toolDescription ?? "Echoes a string value", |
| 488 | inputSchema: { [inputName]: z.string() }, |
| 489 | }, |
| 490 | async (input) => ({ |
| 491 | content: [ |
| 492 | { |
| 493 | type: "text" as const, |
| 494 | text: options.text ? options.text(input[inputName]) : input[inputName], |
| 495 | }, |
| 496 | ], |
| 497 | }), |
| 498 | ); |
| 499 | |
| 500 | return server; |
| 501 | }; |
| 502 | |
| 503 | export const makeElicitationMcpServer = () => { |
| 504 | const server = new McpServer( |