1616
1717 <v-card class =" ma-2" >
1818 <v-card-title >{{ $t('tool.builtin.title') }}</v-card-title >
19- <v-card-text >
19+ <v-card-text class = " pb-0 " >
2020 <v-row no-gutters >
2121 <v-col cols =" 6" sm =" 3" lg =" 2" ><v-checkbox v-model =" SystemInfo" label =" SystemInfo" density =" compact" hide-details ></v-checkbox ></v-col >
2222 <v-col cols =" 6" sm =" 3" lg =" 2" ><v-checkbox v-model =" Environment" label =" Environment" density =" compact" hide-details ></v-checkbox ></v-col >
3737 <v-col cols =" 6" sm =" 3" lg =" 2" ><v-checkbox v-model =" Http" label =" Http" density =" compact" hide-details ></v-checkbox ></v-col >
3838 </v-row >
3939 </v-card-text >
40+ <v-card-actions class =" pa-0" >
41+ <v-spacer />
42+ <v-switch v-model =" toggle.builtin" inset indeterminate hide-details @update:model-value =" onToggleBuiltIns" ></v-switch >
43+ <v-spacer />
44+ </v-card-actions >
4045 </v-card >
4146
4247 <v-card class =" ma-2" >
5863 </v-tooltip >
5964 </span >
6065 </v-card-title >
61- <v-card-text >
66+ <v-card-text class = " pb-0 " >
6267 <v-row no-gutters >
6368 <v-col cols =" 6" sm =" 4" lg =" 3" v-for =" (tool, ti) in server.tools" :key =" ti" >
6469 <v-checkbox density =" compact" hide-details
7479 </v-col >
7580 </v-row >
7681 </v-card-text >
82+ <v-card-actions class =" pa-0" >
83+ <v-spacer />
84+ <v-switch v-model =" toggle.mcp[name]" inset indeterminate hide-details @update:model-value =" onToggleMcp(name)" ></v-switch >
85+ <v-spacer />
86+ </v-card-actions >
7787 </v-card >
7888 </v-col >
7989 </v-row >
@@ -109,6 +119,11 @@ export default defineComponent({
109119 appbarHeight: 0 ,
110120 zoom: this .$appProfile .UI .Window .InitialZoom .Value ?? 1 ,
111121
122+ toggle: {
123+ builtin: null as boolean | null ,
124+ mcp: {} as Record <string , boolean | null >
125+ },
126+
112127 mcp: {
113128 loading: true ,
114129
@@ -120,71 +135,71 @@ export default defineComponent({
120135 ... mapState (useConfigStore , [' profile' ]),
121136 SystemInfo: {
122137 get() { return ! this .profile .LLM .Tool .BuiltIns .SystemInfo .Disable },
123- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .SystemInfo .Disable = ! value },
138+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .SystemInfo .Disable = ! value },
124139 },
125140 Environment: {
126141 get() { return ! this .profile .LLM .Tool .BuiltIns .Environment .Disable },
127- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .Environment .Disable = ! value },
142+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .Environment .Disable = ! value },
128143 },
129144 SystemTime: {
130145 get() { return ! this .profile .LLM .Tool .BuiltIns .SystemTime .Disable },
131- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .SystemTime .Disable = ! value },
146+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .SystemTime .Disable = ! value },
132147 },
133148 Stats: {
134149 get() { return ! this .profile .LLM .Tool .BuiltIns .Stats .Disable },
135- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .Stats .Disable = ! value },
150+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .Stats .Disable = ! value },
136151 },
137152 ChangeMode: {
138153 get() { return ! this .profile .LLM .Tool .BuiltIns .ChangeMode .Disable },
139- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .ChangeMode .Disable = ! value },
154+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .ChangeMode .Disable = ! value },
140155 },
141156 ChangeOwner: {
142157 get() { return ! this .profile .LLM .Tool .BuiltIns .ChangeOwner .Disable },
143- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .ChangeOwner .Disable = ! value },
158+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .ChangeOwner .Disable = ! value },
144159 },
145160 ChangeTimes: {
146161 get() { return ! this .profile .LLM .Tool .BuiltIns .ChangeTimes .Disable },
147- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .ChangeTimes .Disable = ! value },
162+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .ChangeTimes .Disable = ! value },
148163 },
149164 FileCreation: {
150165 get() { return ! this .profile .LLM .Tool .BuiltIns .FileCreation .Disable },
151- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .FileCreation .Disable = ! value },
166+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .FileCreation .Disable = ! value },
152167 },
153168 FileTempCreation: {
154169 get() { return ! this .profile .LLM .Tool .BuiltIns .FileTempCreation .Disable },
155- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .FileTempCreation .Disable = ! value },
170+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .FileTempCreation .Disable = ! value },
156171 },
157172 FileAppending: {
158173 get() { return ! this .profile .LLM .Tool .BuiltIns .FileAppending .Disable },
159- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .FileAppending .Disable = ! value },
174+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .FileAppending .Disable = ! value },
160175 },
161176 FileReading: {
162177 get() { return ! this .profile .LLM .Tool .BuiltIns .FileReading .Disable },
163- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .FileReading .Disable = ! value },
178+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .FileReading .Disable = ! value },
164179 },
165180 FileDeletion: {
166181 get() { return ! this .profile .LLM .Tool .BuiltIns .FileDeletion .Disable },
167- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .FileDeletion .Disable = ! value },
182+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .FileDeletion .Disable = ! value },
168183 },
169184 DirectoryCreation: {
170185 get() { return ! this .profile .LLM .Tool .BuiltIns .DirectoryCreation .Disable },
171- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .DirectoryCreation .Disable = ! value },
186+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .DirectoryCreation .Disable = ! value },
172187 },
173188 DirectoryTempCreation: {
174189 get() { return ! this .profile .LLM .Tool .BuiltIns .DirectoryTempCreation .Disable },
175- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .DirectoryTempCreation .Disable = ! value },
190+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .DirectoryTempCreation .Disable = ! value },
176191 },
177192 DirectoryDeletion: {
178193 get() { return ! this .profile .LLM .Tool .BuiltIns .DirectoryDeletion .Disable },
179- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .DirectoryDeletion .Disable = ! value },
194+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .DirectoryDeletion .Disable = ! value },
180195 },
181196 CommandExec: {
182197 get() { return ! this .profile .LLM .Tool .BuiltIns .CommandExec .Disable },
183- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .CommandExec .Disable = ! value },
198+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .CommandExec .Disable = ! value },
184199 },
185200 Http: {
186201 get() { return ! this .profile .LLM .Tool .BuiltIns .Http .Disable },
187- set(value : boolean ) { if ( this . profile . LLM . Tool . BuiltIns ) this .profile .LLM .Tool .BuiltIns .Http .Disable = ! value },
202+ set(value : boolean ) { this .profile .LLM .Tool .BuiltIns .Http .Disable = ! value },
188203 },
189204 },
190205 methods: {
@@ -222,6 +237,22 @@ export default defineComponent({
222237 config .Exclude .push (toolName )
223238 }
224239 },
240+ onToggleBuiltIns(value : unknown ){
241+ for (let [_, builtin] of Object .entries (this .profile .LLM .Tool .BuiltIns )) {
242+ if (' Disable' in builtin ) {
243+ builtin .Disable = ! value
244+ }
245+ }
246+ },
247+ onToggleMcp(serverName : string ) {
248+ if (this .toggle .mcp [serverName ]) {
249+ // enable all
250+ this .mcp .server [serverName ].config .Exclude = []
251+ } else {
252+ // disable all
253+ this .mcp .server [serverName ].config .Exclude = this .mcp .server [serverName ].tools .map (tool => tool .name )
254+ }
255+ }
225256 },
226257 mounted() {
227258 ListMcpTools ().then ((tools ) => {
@@ -230,6 +261,7 @@ export default defineComponent({
230261 config: this .profile .LLM .Tool .McpServer [name ],
231262 tools: tools [name ]
232263 }
264+ this .toggle .mcp [name ] = null
233265 }
234266 })
235267 .finally (() => this .mcp .loading = false )
0 commit comments