| 349 | }; |
| 350 | |
| 351 | export const makeEchoMcpServer = ( |
| 352 | options: { |
| 353 | readonly name?: string; |
| 354 | readonly version?: string; |
| 355 | readonly toolName?: string; |
| 356 | readonly toolDescription?: string; |
| 357 | readonly inputName?: "name" | "value" | "marker"; |
| 358 | readonly text?: (value: string) => string; |
| 359 | } = {}, |
| 360 | ) => { |
| 361 | const inputName = options.inputName ?? "value"; |
| 362 | const server = new McpServer( |
| 363 | { |
| 364 | name: options.name ?? "executor-echo-mcp", |
| 365 | version: options.version ?? "1.0.0", |
| 366 | }, |
| 367 | { capabilities: {} }, |
| 368 | ); |
| 369 | |
| 370 | server.registerTool( |
| 371 | options.toolName ?? "echo", |
| 372 | { |
| 373 | description: options.toolDescription ?? "Echoes a string value", |
| 374 | inputSchema: { [inputName]: z.string() }, |
| 375 | }, |
| 376 | async (input) => ({ |
| 377 | content: [ |
| 378 | { |
| 379 | type: "text" as const, |
| 380 | text: options.text ? options.text(input[inputName]) : input[inputName], |
| 381 | }, |
| 382 | ], |
| 383 | }), |
| 384 | ); |
| 385 | |
| 386 | return server; |
| 387 | }; |
| 388 | |
| 389 | export const makeElicitationMcpServer = () => { |
| 390 | const server = new McpServer( |