@@ -82,10 +82,18 @@ const options: ToolApprovalOption[] = [
8282 } ,
8383] ;
8484
85- function renderSubject ( onSelectOption : ( optionId : string , reason ?: string ) => void ) {
85+ function renderSubject (
86+ onSelectOption : ( optionId : string , reason ?: string ) => void ,
87+ props : { toolName ?: string ; argsText ?: string } = { toolName : 'shell' } ,
88+ ) {
8689 return render (
8790 < SlotsProvider overrides = { { ToolApprovalBar : ToolApprovalBarProbe } } >
88- < ToolApprovalContainer toolName = "shell" options = { options } onSelectOption = { onSelectOption } />
91+ < ToolApprovalContainer
92+ toolName = { props . toolName }
93+ argsText = { props . argsText }
94+ options = { options }
95+ onSelectOption = { onSelectOption }
96+ />
8997 </ SlotsProvider > ,
9098 ) ;
9199}
@@ -106,6 +114,26 @@ describe('ToolApprovalContainer', () => {
106114 expect ( onSelectOption ) . toHaveBeenNthCalledWith ( 2 , 'reject-now' ) ;
107115 } ) ;
108116
117+ it ( 'shows MCP inner tool name with server when args include both fields' , ( ) => {
118+ const onSelectOption = vi . fn ( ) ;
119+ renderSubject ( onSelectOption , {
120+ toolName : 'call_tool' ,
121+ argsText : JSON . stringify ( { mcp_server : 'github' , tool_name : 'search' } ) ,
122+ } ) ;
123+
124+ expect ( screen . getByTestId ( 'approval-probe' ) ) . toHaveAttribute ( 'data-tool-name' , 'search (github)' ) ;
125+ } ) ;
126+
127+ it ( 'falls back to toolName when MCP fields are missing' , ( ) => {
128+ const onSelectOption = vi . fn ( ) ;
129+ renderSubject ( onSelectOption , {
130+ toolName : 'shell' ,
131+ argsText : JSON . stringify ( { command : 'ls' } ) ,
132+ } ) ;
133+
134+ expect ( screen . getByTestId ( 'approval-probe' ) ) . toHaveAttribute ( 'data-tool-name' , 'shell' ) ;
135+ } ) ;
136+
109137 it ( 'requires, trims, and submits a denial reason with confirmation metadata' , ( ) => {
110138 const onSelectOption = vi . fn ( ) ;
111139 renderSubject ( onSelectOption ) ;
0 commit comments