**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.
This commit is contained in:
parent
37c4da58f7
commit
36336c5180
1 changed files with 3 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import { WebSocketServer } from 'ws'
|
import { WebSocketServer } from 'ws'
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
import cors from 'cors'
|
import cors from 'cors'
|
||||||
import { BrainyData, BrainyMCPService } from '@soulcraft/brainy'
|
import { BrainyData, BrainyMCPService, MCPRequestType } from '@soulcraft/brainy'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -177,10 +177,9 @@ function startRESTServer(
|
||||||
app.get('/mcp/tools', async (req: any, res: any) => {
|
app.get('/mcp/tools', async (req: any, res: any) => {
|
||||||
try {
|
try {
|
||||||
const response = await mcpService.handleMCPRequest({
|
const response = await mcpService.handleMCPRequest({
|
||||||
type: 'SYSTEM_INFO',
|
type: MCPRequestType.SYSTEM_INFO,
|
||||||
requestId: uuidv4(),
|
requestId: uuidv4(),
|
||||||
version: '1.0',
|
version: '1.0'
|
||||||
infoType: 'availableTools'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
res.json(response)
|
res.json(response)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue