diff --git a/oclif.manifest.json b/oclif.manifest.json index 76933d3a..d608ad77 100644 --- a/oclif.manifest.json +++ b/oclif.manifest.json @@ -1,5 +1,5 @@ { - "version": "6.1.3", + "version": "6.1.4", "commands": { "authCommand": { "id": "authCommand", diff --git a/src/mcp/server.ts b/src/mcp/server.ts index f180c827..d7490efd 100644 --- a/src/mcp/server.ts +++ b/src/mcp/server.ts @@ -93,33 +93,37 @@ export class DevCycleMCPServer { toolConfig.outputSchema = config.outputSchema } - this.server.registerTool(name, toolConfig, async (args: unknown) => { - try { - const result = await handler(args) + this.server.registerTool( + name, + toolConfig as any, + async (args: unknown) => { + try { + const result = await handler(args) + + // If the handler returned a plain string, send it as-is + if (typeof result === 'string') { + return { + content: [ + { + type: 'text' as const, + text: result, + }, + ], + } + } - // If the handler returned a plain string, send it as-is - if (typeof result === 'string') { return { content: [ { type: 'text' as const, - text: result, + text: JSON.stringify(result, null, 2), }, ], } + } catch (error) { + return handleToolError(error, name) } - - return { - content: [ - { - type: 'text' as const, - text: JSON.stringify(result, null, 2), - }, - ], - } - } catch (error) { - return handleToolError(error, name) - } - }) + }, + ) } }