@@ -124,6 +124,7 @@ function renderToolEntry(toolKey, toolDefinition, toolConfig, isConfigOnly = fal
124124 </label>
125125 <h3 title="${ ! isServerActive ? 'Server is inactive' : '' } ">${ toolKey } </h3>
126126 <span class="tool-exposed-name">Exposed As: ${ exposedName } </span>
127+ <button class="reset-tool-overrides-button" title="Reset all overrides for this tool to defaults">Reset</button>
127128 </div>
128129 <div class="tool-details">
129130 <div>
@@ -142,6 +143,36 @@ function renderToolEntry(toolKey, toolDefinition, toolConfig, isConfigOnly = fal
142143
143144 toolListDiv . appendChild ( entryDiv ) ; // Append first, then query elements within it
144145
146+ // Add click listener to the new Reset button
147+ const resetButton = entryDiv . querySelector ( '.reset-tool-overrides-button' ) ;
148+ if ( resetButton ) {
149+ resetButton . addEventListener ( 'click' , ( e ) => {
150+ e . stopPropagation ( ) ; // Prevent a click on the button from also toggling collapse if it's in the header
151+ if ( confirm ( `Are you sure you want to reset all overrides for tool "${ toolKey } "?\nThis will remove any custom settings for its name, description, and enabled state from the configuration. You will need to save the tool configuration to make this permanent.` ) ) {
152+ if ( window . currentToolConfig && window . currentToolConfig . tools && window . currentToolConfig . tools [ toolKey ] ) {
153+ delete window . currentToolConfig . tools [ toolKey ] ;
154+ console . log ( `Overrides for tool ${ toolKey } marked for deletion.` ) ;
155+ // Mark main tool config as dirty (if such a flag exists, or rely on main save button's behavior)
156+ // To reflect changes immediately, re-render the tools list
157+ // This will pick up the deleted config for this toolKey and render it with defaults
158+ renderTools ( ) ;
159+ // Optionally, provide a status message or highlight the main save button
160+ if ( window . saveToolStatus ) { // Ensure saveToolStatus is accessed via window or defined in this scope
161+ window . saveToolStatus . textContent = `Overrides for '${ toolKey } ' reset. Click "Save & Reload" to apply.` ;
162+ window . saveToolStatus . style . color = 'orange' ;
163+ setTimeout ( ( ) => { if ( window . saveToolStatus ) window . saveToolStatus . textContent = '' ; } , 5000 ) ;
164+ }
165+ } else {
166+ // If the toolKey wasn't in currentToolConfig.tools, it means it was already using defaults.
167+ // However, the UI might show input values if the user typed them without saving.
168+ // Re-rendering will clear these UI-only changes.
169+ renderTools ( ) ; // Call renderTools to refresh the UI for this entry too
170+ alert ( `Tool "${ toolKey } " is already using default settings or has no saved overrides.` ) ;
171+ }
172+ }
173+ } ) ;
174+ }
175+
145176 // Add click listener to the header (h3) to toggle collapse
146177 const headerH3 = entryDiv . querySelector ( '.tool-header h3' ) ;
147178 if ( headerH3 ) {
0 commit comments