@@ -75,7 +75,15 @@ export default function ToolManagement({
7575 const { t } = useTranslation ( "common" ) ;
7676 const queryClient = useQueryClient ( ) ;
7777
78- const editable = currentAgentId || isCreatingMode ;
78+ // Get current agent permission from store
79+ const currentAgentPermission = useAgentConfigStore (
80+ ( state ) => state . currentAgentPermission
81+ ) ;
82+
83+ // Check if current agent is read-only (only when agent is selected and permission is READ_ONLY)
84+ const isReadOnly = ! isCreatingMode && currentAgentId !== undefined && currentAgentPermission === "READ_ONLY" ;
85+
86+ const editable = ( currentAgentId || isCreatingMode ) && ! isReadOnly ;
7987
8088 // Get state from store
8189 const originalSelectedTools = useAgentConfigStore (
@@ -423,8 +431,16 @@ export default function ToolManagement({
423431 ) ;
424432 const isDisabledDueToVlm = isToolDisabledDueToVlm ( tool . name , isVlmConfigured ) ;
425433 const isDisabledDueToEmbedding = isToolDisabledDueToEmbedding ( tool . name , isEmbeddingConfigured ) ;
426- const isDisabled = isDisabledDueToVlm || isDisabledDueToEmbedding ;
427- return (
434+ const isDisabled = isDisabledDueToVlm || isDisabledDueToEmbedding || isReadOnly ;
435+ // Tooltip priority: permission > VLM > Embedding
436+ const tooltipTitle = isReadOnly
437+ ? t ( "agent.noEditPermission" )
438+ : isDisabledDueToVlm
439+ ? t ( "toolPool.vlmDisabledTooltip" )
440+ : isDisabledDueToEmbedding
441+ ? t ( "toolPool.embeddingDisabledTooltip" )
442+ : undefined ;
443+ const toolCard = (
428444 < div
429445 key = { tool . id }
430446 className = { `border-2 rounded-md p-2 flex items-center justify-between transition-all duration-300 ease-in-out min-h-[52px] shadow-sm ${
@@ -491,6 +507,13 @@ export default function ToolManagement({
491507 />
492508 </ div >
493509 ) ;
510+ return tooltipTitle ? (
511+ < Tooltip key = { tool . id } title = { tooltipTitle } >
512+ { toolCard }
513+ </ Tooltip >
514+ ) : (
515+ toolCard
516+ ) ;
494517 } ) }
495518 </ div >
496519 ) ,
@@ -513,8 +536,16 @@ export default function ToolManagement({
513536 const isSelected = originalSelectedToolIdsSet . has ( tool . id ) ;
514537 const isDisabledDueToVlm = isToolDisabledDueToVlm ( tool . name , isVlmConfigured ) ;
515538 const isDisabledDueToEmbedding = isToolDisabledDueToEmbedding ( tool . name , isEmbeddingConfigured ) ;
516- const isDisabled = isDisabledDueToVlm || isDisabledDueToEmbedding ;
517- return (
539+ const isDisabled = isDisabledDueToVlm || isDisabledDueToEmbedding || isReadOnly ;
540+ // Tooltip priority: permission > VLM > Embedding
541+ const tooltipTitle = isReadOnly
542+ ? t ( "agent.noEditPermission" )
543+ : isDisabledDueToVlm
544+ ? t ( "toolPool.vlmDisabledTooltip" )
545+ : isDisabledDueToEmbedding
546+ ? t ( "toolPool.embeddingDisabledTooltip" )
547+ : undefined ;
548+ const toolCard = (
518549 < div
519550 key = { tool . id }
520551 className = { `border-2 rounded-md p-2 flex items-center justify-between transition-all duration-300 ease-in-out min-h-[52px] shadow-sm ${
@@ -579,6 +610,13 @@ export default function ToolManagement({
579610 />
580611 </ div >
581612 ) ;
613+ return tooltipTitle ? (
614+ < Tooltip key = { tool . id } title = { tooltipTitle } >
615+ { toolCard }
616+ </ Tooltip >
617+ ) : (
618+ toolCard
619+ ) ;
582620 } ) }
583621 </ div >
584622 ) }
0 commit comments