@@ -68,28 +68,42 @@ function renderTools() {
6868 discoveredTools . forEach ( tool => {
6969 const toolKey = `${ tool . serverName } --${ tool . name } ` ; // Unique key
7070 const config = currentToolConfig . tools [ toolKey ] || { } ; // Get config or empty object
71- renderToolEntry ( toolKey , tool , config ) ;
71+ // For discovered tools, their server is considered active by the proxy at connection time
72+ renderToolEntry ( toolKey , tool , config , false , true ) ; // isConfigOnly = false, isServerActive = true
7273 configuredToolKeys . delete ( toolKey ) ; // Remove from set as it's handled
7374 } ) ;
7475
75- // Render any remaining configured tools that were not discovered (maybe disabled server?)
76+ // Render any remaining configured tools that were not discovered
7677 configuredToolKeys . forEach ( toolKey => {
77- console . warn ( `Rendering configured tool "${ toolKey } " which was not discovered (server might be inactive).` ) ;
7878 const config = currentToolConfig . tools [ toolKey ] ;
79+ const serverKeyForConfigOnlyTool = toolKey . split ( '--' ) [ 0 ] ;
80+ let isServerActiveForConfigOnlyTool = true ; // Default to true if server config not found or active flag is missing/true
81+
82+ if ( window . currentServerConfig && window . currentServerConfig . mcpServers && window . currentServerConfig . mcpServers [ serverKeyForConfigOnlyTool ] ) {
83+ const serverConf = window . currentServerConfig . mcpServers [ serverKeyForConfigOnlyTool ] ;
84+ if ( serverConf . active === false || String ( serverConf . active ) . toLowerCase ( ) === 'false' ) {
85+ isServerActiveForConfigOnlyTool = false ;
86+ }
87+ }
88+ console . warn ( `Rendering configured tool "${ toolKey } " which was not discovered. Associated server active status: ${ isServerActiveForConfigOnlyTool } ` ) ;
7989 // We don't have the full tool definition here, just render based on config
80- renderToolEntry ( toolKey , null , config , true ) ; // Pass flag indicating it's config-only
90+ renderToolEntry ( toolKey , null , config , true , isServerActiveForConfigOnlyTool ) ; // Pass isConfigOnly and determined server active status
8191 } ) ;
8292
8393 if ( toolListDiv . innerHTML === '' ) {
8494 toolListDiv . innerHTML = '<p>No tools discovered or configured.</p>' ;
8595 }
8696}
8797
88- function renderToolEntry ( toolKey , toolDefinition , toolConfig , isConfigOnly = false ) {
98+ function renderToolEntry ( toolKey , toolDefinition , toolConfig , isConfigOnly = false , isServerActive = true ) { // Added isServerActive
8999 if ( ! toolListDiv ) return ; // Guard
90100 const entryDiv = document . createElement ( 'div' ) ;
91101 entryDiv . classList . add ( 'tool-entry' ) ;
92102 entryDiv . classList . add ( 'collapsed' ) ; // Add collapsed class by default
103+ if ( ! isServerActive ) {
104+ entryDiv . classList . add ( 'tool-server-inactive' ) ;
105+ entryDiv . title = 'This tool belongs to an inactive server. Enabling it will have no effect.' ;
106+ }
93107 entryDiv . dataset . toolKey = toolKey ; // Store the original key
94108
95109 // Determine the name and description exposed to the model
@@ -106,9 +120,9 @@ function renderToolEntry(toolKey, toolDefinition, toolConfig, isConfigOnly = fal
106120 entryDiv . innerHTML = `
107121 <div class="tool-header">
108122 <label class="inline-label tool-enable-label" title="Enable/Disable Tool">
109- <input type="checkbox" class="tool-enabled-input" ${ isEnabled ? 'checked' : '' } >
123+ <input type="checkbox" class="tool-enabled-input" ${ isEnabled ? 'checked' : '' } ${ ! isServerActive ? 'disabled' : '' } >
110124 </label>
111- <h3>${ toolKey } </h3>
125+ <h3 title=" ${ ! isServerActive ? 'Server is inactive' : '' } " >${ toolKey } </h3>
112126 <span class="tool-exposed-name">Exposed As: ${ exposedName } </span>
113127 </div>
114128 <div class="tool-details">
0 commit comments