@@ -21,49 +21,24 @@ interface ToolData {
2121 name : string ;
2222 description : string ;
2323 icon : string ;
24+ subTools ?: SubTool [ ] ;
2425}
2526
2627interface ExpandedToolProps {
2728 tool : ToolData ;
2829 onToolsSelected ?: ( toolId : string , subToolIds : string [ ] ) => void ;
2930}
3031
31- // Mock sub-tools data
32- const mockSubTools : SubTool [ ] = [
33- {
34- id : "1" ,
35- name : "describe_cronjob" ,
36- description :
37- "Get detailed information about a kubernetes cronjob including the recent job history" ,
38- } ,
39- {
40- id : "2" ,
41- name : "describe_cronjob" ,
42- description :
43- "Get detailed information about a kubernetes cronjob including the recent job history" ,
44- } ,
45- {
46- id : "3" ,
47- name : "describe_cronjob" ,
48- description :
49- "Get detailed information about a kubernetes cronjob including the recent job history" ,
50- } ,
51- {
52- id : "4" ,
53- name : "describe_cronjob" ,
54- description :
55- "Get detailed information about a kubernetes cronjob including the recent job history" ,
56- } ,
57- ] ;
58-
5932export default function ToolDetailsExpanded ( ) {
6033 const { expandedDrawerProps, closeExpandedStep } = useDrawer ( ) ;
6134 const props = expandedDrawerProps as ExpandedToolProps ;
6235 const [ selectedSubTools , setSelectedSubTools ] = useState < Set < string > > (
6336 new Set ( )
6437 ) ;
6538
66- const subTools = mockSubTools ;
39+ // Use sub-tools from the tool prop if available
40+ // Note: Sub-tools data should be fetched from the MCP Foundry API via the tool details endpoint
41+ const subTools : SubTool [ ] = props ?. tool ?. subTools || [ ] ;
6742
6843 const handleSelectAll = ( checked : boolean ) => {
6944 if ( checked ) {
@@ -129,48 +104,58 @@ export default function ToolDetailsExpanded() {
129104 </ Text_17_600_FFFFFF >
130105 </ div >
131106
132- { /* Select All */ }
133- < div className = "flex items-center gap-[0.75rem] px-[1rem] py-[0.75rem] border-b border-[#1F1F1F]" >
134- < Checkbox
135- checked = { isAllSelected }
136- onChange = { ( e ) => handleSelectAll ( e . target . checked ) }
137- />
138- < Text_14_400_EEEEEE > Select All</ Text_14_400_EEEEEE >
139- </ div >
140-
141- { /* Sub Tools List */ }
142- < div className = "max-h-[300px] overflow-y-auto" >
143- { subTools . map ( ( subTool ) => (
144- < div
145- key = { subTool . id }
146- className = "flex items-start gap-[0.75rem] px-[1rem] py-[1rem] border-b border-[#1F1F1F] last:border-b-0 cursor-pointer hover:bg-[#1F1F1F]/30"
147- onClick = { ( ) =>
148- handleSubToolSelect (
149- subTool . id ,
150- ! selectedSubTools . has ( subTool . id )
151- )
152- }
153- >
107+ { subTools . length > 0 ? (
108+ < >
109+ { /* Select All */ }
110+ < div className = "flex items-center gap-[0.75rem] px-[1rem] py-[0.75rem] border-b border-[#1F1F1F]" >
154111 < Checkbox
155- checked = { selectedSubTools . has ( subTool . id ) }
156- onChange = { ( e ) => {
157- e . stopPropagation ( ) ;
158- handleSubToolSelect ( subTool . id , e . target . checked ) ;
159- } }
160- onClick = { ( e ) => e . stopPropagation ( ) }
161- className = "mt-[2px]"
112+ checked = { isAllSelected }
113+ onChange = { ( e ) => handleSelectAll ( e . target . checked ) }
162114 />
163- < div className = "flex-1" >
164- < Text_14_400_EEEEEE className = "mb-[0.25rem]" >
165- { subTool . name }
166- </ Text_14_400_EEEEEE >
167- < Text_12_400_B3B3B3 className = "leading-[150%]" >
168- { subTool . description }
169- </ Text_12_400_B3B3B3 >
170- </ div >
115+ < Text_14_400_EEEEEE > Select All</ Text_14_400_EEEEEE >
171116 </ div >
172- ) ) }
173- </ div >
117+
118+ { /* Sub Tools List */ }
119+ < div className = "max-h-[300px] overflow-y-auto" >
120+ { subTools . map ( ( subTool ) => (
121+ < div
122+ key = { subTool . id }
123+ className = "flex items-start gap-[0.75rem] px-[1rem] py-[1rem] border-b border-[#1F1F1F] last:border-b-0 cursor-pointer hover:bg-[#1F1F1F]/30"
124+ onClick = { ( ) =>
125+ handleSubToolSelect (
126+ subTool . id ,
127+ ! selectedSubTools . has ( subTool . id )
128+ )
129+ }
130+ >
131+ < Checkbox
132+ checked = { selectedSubTools . has ( subTool . id ) }
133+ onChange = { ( e ) => {
134+ e . stopPropagation ( ) ;
135+ handleSubToolSelect ( subTool . id , e . target . checked ) ;
136+ } }
137+ onClick = { ( e ) => e . stopPropagation ( ) }
138+ className = "mt-[2px]"
139+ />
140+ < div className = "flex-1" >
141+ < Text_14_400_EEEEEE className = "mb-[0.25rem]" >
142+ { subTool . name }
143+ </ Text_14_400_EEEEEE >
144+ < Text_12_400_B3B3B3 className = "leading-[150%]" >
145+ { subTool . description }
146+ </ Text_12_400_B3B3B3 >
147+ </ div >
148+ </ div >
149+ ) ) }
150+ </ div >
151+ </ >
152+ ) : (
153+ < div className = "p-[1rem] text-center" >
154+ < Text_12_400_B3B3B3 >
155+ No sub-tools available for this tool.
156+ </ Text_12_400_B3B3B3 >
157+ </ div >
158+ ) }
174159 </ div >
175160 </ div >
176161 </ BudDrawerLayout >
0 commit comments