(server: McpServer, opts: MCPToolOptions)
| 233 | const nonInteractiveInitInputs = initInputs.required({name: true}); |
| 234 | |
| 235 | export function registerInitMCPTool(server: McpServer, opts: MCPToolOptions): RegisteredTool { |
| 236 | return server.registerTool( |
| 237 | Init.name, |
| 238 | { |
| 239 | description: Init.description, |
| 240 | inputSchema: (opts.supportsElicitation ? initInputs : nonInteractiveInitInputs).shape, |
| 241 | // outputSchema: initOutputs.shape, // TODO once we know the output we can add this |
| 242 | }, |
| 243 | async (args, meta) => { |
| 244 | const cwd = await getMCPWorkingDirectory(server); |
| 245 | const logger = mcpLogger(server.server); |
| 246 | |
| 247 | const prompt = opts.supportsElicitation ? makeMCPElicitPrmompt(server) : null; |
| 248 | const result = await initAdapter(cwd, args, logger, prompt); |
| 249 | |
| 250 | return { |
| 251 | content: [ |
| 252 | { |
| 253 | type: 'text', |
| 254 | text: `Project created at ${result.projectPath}`, |
| 255 | }, |
| 256 | ], |
| 257 | }; |
| 258 | } |
| 259 | ); |
| 260 | } |
no test coverage detected