@@ -12,6 +12,9 @@ import {
1212 SpaceBetween ,
1313 ButtonDropdown ,
1414 Checkbox ,
15+ Modal ,
16+ Header ,
17+ Link ,
1518} from '@awsui/components-react' ;
1619import listAgentJobs from '../../graphql/queries/listAgentJobs' ;
1720import deleteAgentJob from '../../graphql/queries/deleteAgentJob' ;
@@ -40,6 +43,7 @@ const AgentQueryInput = ({ onSubmit, isSubmitting, selectedResult }) => {
4043 const [ availableAgents , setAvailableAgents ] = useState ( [ ] ) ;
4144 const [ selectedAgents , setSelectedAgents ] = useState ( [ ] ) ;
4245 const [ isLoadingAgents , setIsLoadingAgents ] = useState ( false ) ;
46+ const [ showMcpInfoModal , setShowMcpInfoModal ] = useState ( false ) ;
4347 const [ hoveredAgent , setHoveredAgent ] = useState ( null ) ;
4448 const [ hoverTimeout , setHoverTimeout ] = useState ( null ) ;
4549 const [ mousePosition , setMousePosition ] = useState ( { x : 0 , y : 0 } ) ;
@@ -81,6 +85,17 @@ const AgentQueryInput = ({ onSubmit, isSubmitting, selectedResult }) => {
8185 }
8286 } ;
8387
88+ const handleSelectAllAgents = ( e ) => {
89+ e . preventDefault ( ) ;
90+ e . stopPropagation ( ) ;
91+ const allSelected = selectedAgents . length === availableAgents . length ;
92+ if ( allSelected ) {
93+ setSelectedAgents ( [ ] ) ;
94+ } else {
95+ setSelectedAgents ( availableAgents . map ( ( agent ) => agent . agent_id ) ) ;
96+ }
97+ } ;
98+
8499 const fetchAvailableAgents = async ( ) => {
85100 try {
86101 setIsLoadingAgents ( true ) ;
@@ -90,11 +105,6 @@ const AgentQueryInput = ({ onSubmit, isSubmitting, selectedResult }) => {
90105
91106 const agents = response ?. data ?. listAvailableAgents || [ ] ;
92107 setAvailableAgents ( agents ) ;
93-
94- // Auto-select first agent if none selected
95- if ( agents . length > 0 && selectedAgents . length === 0 ) {
96- setSelectedAgents ( [ agents [ 0 ] . agent_id ] ) ;
97- }
98108 } catch ( err ) {
99109 logger . error ( 'Error fetching available agents:' , err ) ;
100110 setAvailableAgents ( [ ] ) ;
@@ -323,7 +333,7 @@ const AgentQueryInput = ({ onSubmit, isSubmitting, selectedResult }) => {
323333 // Create dropdown items with delete functionality
324334 const createDropdownItems = ( ) => {
325335 if ( queryHistory . length === 0 ) {
326- return [ { text : 'No previous queries found' , disabled : true } ] ;
336+ return [ { text : 'No previous questions found' , disabled : true } ] ;
327337 }
328338
329339 return queryHistory . map ( ( job ) => {
@@ -404,9 +414,14 @@ const AgentQueryInput = ({ onSubmit, isSubmitting, selectedResult }) => {
404414 < form onSubmit = { handleSubmit } >
405415 < SpaceBetween size = "l" >
406416 < Box >
407- < Box fontSize = "body-m" fontWeight = "bold" padding = { { bottom : 'xs' } } >
408- Select from available agents
409- </ Box >
417+ < SpaceBetween direction = "horizontal" size = "s" alignItems = "center" >
418+ < Box fontSize = "body-m" fontWeight = "bold" >
419+ Select from available agents
420+ </ Box >
421+ < Button variant = "link" onClick = { ( ) => setShowMcpInfoModal ( true ) } fontSize = "body-s" >
422+ 🚀 NEW: Integrate your own systems with MCP!
423+ </ Button >
424+ </ SpaceBetween >
410425 < div
411426 style = { {
412427 maxHeight : '200px' ,
@@ -454,6 +469,17 @@ const AgentQueryInput = ({ onSubmit, isSubmitting, selectedResult }) => {
454469 </ SpaceBetween >
455470 ) }
456471 </ div >
472+ { ! isLoadingAgents && availableAgents . length > 0 && (
473+ < Box padding = { { top : 's' } } >
474+ < Button
475+ type = "button"
476+ variant = { selectedAgents . length === availableAgents . length ? 'normal' : 'primary' }
477+ onClick = { handleSelectAllAgents }
478+ >
479+ { selectedAgents . length === availableAgents . length ? 'Deselect All Agents' : 'Select All Agents' }
480+ </ Button >
481+ </ Box >
482+ ) }
457483 { hoveredAgent && (
458484 < div
459485 style = { {
@@ -509,7 +535,7 @@ const AgentQueryInput = ({ onSubmit, isSubmitting, selectedResult }) => {
509535 selectedAgents . length > 0
510536 ? availableAgents . find ( ( agent ) => agent . agent_id === selectedAgents [ 0 ] ) ?. sample_queries ?. [ 0 ] ||
511537 'Enter your question here...'
512- : 'Select an agent first... '
538+ : 'Select at least one available agent to get started '
513539 }
514540 value = { currentInputText }
515541 onChange = { ( { detail } ) => updateAnalyticsState ( { currentInputText : detail . value } ) }
@@ -526,16 +552,16 @@ const AgentQueryInput = ({ onSubmit, isSubmitting, selectedResult }) => {
526552 disabled = { ! currentInputText . trim ( ) || selectedAgents . length === 0 || isSubmitting }
527553 fullWidth
528554 >
529- { isSubmitting ? 'Submitting...' : 'Submit query ' }
555+ { isSubmitting ? 'Submitting...' : 'Submit question ' }
530556 </ Button >
531557 < Button variant = "normal" onClick = { handleClearQuery } disabled = { isSubmitting } fullWidth >
532- Clear query
558+ Clear question
533559 </ Button >
534560 </ SpaceBetween >
535561 </ Box >
536562 </ Grid >
537563
538- < FormField label = "Previous queries" >
564+ < FormField >
539565 < ButtonDropdown
540566 items = { createDropdownItems ( ) }
541567 onItemClick = { handleDropdownItemClick }
@@ -544,16 +570,67 @@ const AgentQueryInput = ({ onSubmit, isSubmitting, selectedResult }) => {
544570 disabled = { isSubmitting }
545571 >
546572 { ( ( ) => {
547- if ( ! selectedOption ) return 'Select a previous query ' ;
573+ if ( ! selectedOption ) return 'Select a previous question ' ;
548574 if ( selectedOption . label ?. length > 40 ) {
549575 return `${ selectedOption . label . substring ( 0 , 40 ) } ...` ;
550576 }
551- return selectedOption . label || 'Selected query ' ;
577+ return selectedOption . label || 'Selected question ' ;
552578 } ) ( ) }
553579 </ ButtonDropdown >
554580 </ FormField >
555581 </ SpaceBetween >
556582 </ form >
583+
584+ < Modal
585+ onDismiss = { ( ) => setShowMcpInfoModal ( false ) }
586+ visible = { showMcpInfoModal }
587+ header = { < Header > Custom MCP Agents</ Header > }
588+ footer = {
589+ < Box float = "right" >
590+ < Button variant = "primary" onClick = { ( ) => setShowMcpInfoModal ( false ) } >
591+ Close
592+ </ Button >
593+ </ Box >
594+ }
595+ >
596+ < SpaceBetween size = "m" >
597+ < Box >
598+ < Box fontWeight = "bold" fontSize = "body-m" >
599+ What are MCP Agents?
600+ </ Box >
601+ < Box >
602+ Model Context Protocol (MCP) agents allow you to connect external tools and services to extend the
603+ capabilities of your document analysis workflow.
604+ </ Box >
605+ </ Box >
606+
607+ < Box >
608+ < Box fontWeight = "bold" fontSize = "body-m" >
609+ Adding Custom Agents
610+ </ Box >
611+ < Box >
612+ You can add your own MCP agents by configuring external MCP servers in AWS Secrets Manager. This allows
613+ you to integrate custom tools, APIs, and services specific to your organization's needs without any
614+ code changes or redeployments.
615+ </ Box >
616+ </ Box >
617+
618+ < Box >
619+ < Box fontWeight = "bold" fontSize = "body-m" >
620+ Learn More
621+ </ Box >
622+ < Box >
623+ For detailed setup instructions and examples, see the{ ' ' }
624+ < Link
625+ external
626+ href = "https://github.com/aws-samples/genaiic-idp-accelerator/blob/main/docs/custom-MCP-agent.md"
627+ >
628+ Custom MCP Agent Documentation
629+ </ Link >
630+ </ Box >
631+ </ Box >
632+ </ SpaceBetween >
633+ </ Modal >
557634 </ >
558635 ) ;
559636} ;
0 commit comments