11---
22name :getMentionedToolBoxes
33cbbaseinfo :
4- description :Extracts toolbox mentions from a user message object.
4+ description :Extracts toolbox mentions from a user message object containing MCP references .
55cbparameters :
66parameters :
77 -name :userMessage
88typeName :UserMessage
9- description :Message object containing user input with toolbox mentions
9+ description :Message object containing user input with toolbox mentions in mentionedMCPs array
1010returns :
1111signatureTypeName :Promise
12- description :A promise resolving toan array of mentioned toolboxnames
12+ description :A promise resolving toa response object containing toolboxdata and configuration
1313typeArgs :
14- -type :any
14+ -type :GetMentionedToolBoxesResponse
1515data :
1616name :getMentionedToolBoxes
1717category :tool
@@ -20,11 +20,71 @@ data:
2020<CBBaseInfo />
2121<CBParameters />
2222
23- ###Example
23+ ###UserMessage Structure
2424``` js
25- const message = {
26- content: " Please use @analyticsTools and @dataProcessing" ,
27- mentionedMCPs: [" analyticsTools" ," dataProcessing" ]
25+ // UserMessage object structure
26+ const userMessage = {
27+ content: " Please use @sqlite and @filesystem for this task" ,
28+ mentionedMCPs: [" sqlite" ," filesystem" ]// Array of toolbox names mentioned
2829};
29- const mentioned = await codeboltMCP .getMentionedToolBoxes (message);
30- console .log (" Mentioned ToolBoxes:" , mentioned);
30+ ```
31+
32+ ###Response Structure
33+ ``` js
34+ // GetMentionedToolBoxesResponse object structure
35+ const response = {
36+ data: {
37+ mcpServers: {
38+ // Each server has configuration details
39+ " filesystem" : {
40+ command: " npx" ,
41+ args: [" -y" ," @modelcontextprotocol/server-filesystem" ]
42+ },
43+ " sqlite" : {
44+ command: " npx" ,
45+ args: [" -y" ," @modelcontextprotocol/server-sqlite" ],
46+ env: {
47+ // Optional environment variables
48+ }
49+ }
50+ },
51+ enabled: [],// Array of enabled toolbox names
52+ codeboltTools: []// Array of available Codebolt tool definitions
53+ },
54+ type: " getAvailableToolBoxesResponse"
55+ };
56+ ```
57+
58+ ###Example
59+ ``` js
60+ // Testing mentioned toolboxes from user message
61+ try {
62+ const message = {
63+ content: " Please use @sqlite and @filesystem for this task" ,
64+ mentionedMCPs: [" sqlite" ," filesystem" ]
65+ };
66+
67+ const mentionedToolBoxes = await codebolt .tools .getMentionedToolBoxes (message);
68+ console .log (' - Message content:' ,message .content );
69+ console .log (' - Mentioned MCPs:' ,message .mentionedMCPs );
70+
71+ // Extract available MCP servers from response
72+ const mcpServers = mentionedToolBoxes? .data ? .mcpServers || {};
73+ const availableServers = Object .keys (mcpServers);
74+ console .log (' - Available MCP servers:' , availableServers);
75+ console .log (' - Enabled toolboxes:' , mentionedToolBoxes? .data ? .enabled || []);
76+
77+ }catch (error) {
78+ console .log (' ⚠️ Getting mentioned toolboxes failed:' ,error .message );
79+ }
80+ ` ` `
81+
82+ ### Error Handling
83+ ` ` ` js
84+ try {
85+ const mentionedToolBoxes = await codebolt .tools .getMentionedToolBoxes (userMessage);
86+ console .log (" Successfully retrieved toolbox data" );
87+ }catch (error) {
88+ console .error (" Getting mentioned toolboxes failed:" ,error .message );
89+ }
90+ ` ` `