@@ -177,6 +177,7 @@ const ToolsTab = ({
177177 error,
178178 resourceContent,
179179 onReadResource,
180+ serverSupportsTaskRequests,
180181} : {
181182 tools : Tool [ ] ;
182183 listTools : ( ) => void ;
@@ -195,6 +196,7 @@ const ToolsTab = ({
195196 error : string | null ;
196197 resourceContent : Record < string , string > ;
197198 onReadResource ?: ( uri : string ) => void ;
199+ serverSupportsTaskRequests : boolean ;
198200} ) => {
199201 const [ params , setParams ] = useState < Record < string , unknown > > ( { } ) ;
200202 const [ runAsTask , setRunAsTask ] = useState ( false ) ;
@@ -239,15 +241,17 @@ const ToolsTab = ({
239241 ] ;
240242 } ) ;
241243 setParams ( Object . fromEntries ( params ) ) ;
242- const taskSupport = getTaskSupport ( selectedTool ) ;
243- setRunAsTask ( taskSupport === "required" ) ;
244+ const toolTaskSupport = serverSupportsTaskRequests
245+ ? getTaskSupport ( selectedTool )
246+ : "forbidden" ;
247+ setRunAsTask ( toolTaskSupport === "required" ) ;
244248
245249 // Reset validation errors when switching tools
246250 setHasValidationErrors ( false ) ;
247251
248252 // Clear form refs for the previous tool
249253 formRefs . current = { } ;
250- } , [ selectedTool ] ) ;
254+ } , [ selectedTool , serverSupportsTaskRequests ] ) ;
251255
252256 const hasReservedMetadataEntry = metadataEntries . some ( ( { key } ) => {
253257 const trimmedKey = key . trim ( ) ;
@@ -264,7 +268,9 @@ const ToolsTab = ({
264268 return trimmedKey !== "" && ! hasValidMetaName ( trimmedKey ) ;
265269 } ) ;
266270
267- const taskSupport = getTaskSupport ( selectedTool ) ;
271+ const taskSupport = serverSupportsTaskRequests
272+ ? getTaskSupport ( selectedTool )
273+ : "forbidden" ;
268274
269275 return (
270276 < TabsContent value = "tools" >
0 commit comments