From 36336c518061514ab722046c77ae1af0fdc3d95c Mon Sep 17 00:00:00 2001 From: David Snelling Date: Mon, 23 Jun 2025 10:58:56 -0700 Subject: [PATCH] **refactor(mcpService): use enum for MCP request type** ### Changes: - **mcpService.ts**: - Updated `type` in `/mcp/tools` route to use `MCPRequestType.SYSTEM_INFO` enum instead of hardcoded string `'SYSTEM_INFO'`. - Removed redundant `infoType: 'availableTools'` from the MCP request payload. - Added `MCPRequestType` import from `@soulcraft/brainy`. ### Purpose: Replaced hardcoded request type string with an enum for improved type safety and maintainability. Removed unnecessary `infoType` parameter, aligning the request payload with updated requirements. --- cloud-wrapper/src/services/mcpService.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cloud-wrapper/src/services/mcpService.ts b/cloud-wrapper/src/services/mcpService.ts index a09c3800..15809564 100644 --- a/cloud-wrapper/src/services/mcpService.ts +++ b/cloud-wrapper/src/services/mcpService.ts @@ -1,7 +1,7 @@ import { WebSocketServer } from 'ws' import express from 'express' import cors from 'cors' -import { BrainyData, BrainyMCPService } from '@soulcraft/brainy' +import { BrainyData, BrainyMCPService, MCPRequestType } from '@soulcraft/brainy' import { v4 as uuidv4 } from 'uuid' /** @@ -177,10 +177,9 @@ function startRESTServer( app.get('/mcp/tools', async (req: any, res: any) => { try { const response = await mcpService.handleMCPRequest({ - type: 'SYSTEM_INFO', + type: MCPRequestType.SYSTEM_INFO, requestId: uuidv4(), - version: '1.0', - infoType: 'availableTools' + version: '1.0' }) res.json(response)