1
1
---
2
2
name : getMentionedToolBoxes
3
3
cbbaseinfo :
4
- description : Extracts toolbox mentions from a user message object.
4
+ description : Extracts toolbox mentions from a user message object containing MCP references .
5
5
cbparameters :
6
6
parameters :
7
7
- name : userMessage
8
8
typeName : UserMessage
9
- description : Message object containing user input with toolbox mentions
9
+ description : Message object containing user input with toolbox mentions in mentionedMCPs array
10
10
returns :
11
11
signatureTypeName : Promise
12
- description : A promise resolving to an array of mentioned toolbox names
12
+ description : A promise resolving to a response object containing toolbox data and configuration
13
13
typeArgs :
14
- - type : any
14
+ - type : GetMentionedToolBoxesResponse
15
15
data :
16
16
name : getMentionedToolBoxes
17
17
category : tool
@@ -20,11 +20,71 @@ data:
20
20
<CBBaseInfo />
21
21
<CBParameters />
22
22
23
- ### Example
23
+ ### UserMessage Structure
24
24
``` 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
28
29
};
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
+ ` ` `
0 commit comments