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