@@ -114,86 +114,69 @@ pub async fn get_agent_capabilities(
114114 let account_id = compiled_mcp. account_id ;
115115 let environment_id = compiled_mcp. environment_id ;
116116
117- let agent_types = compiled_mcp. agent_types ( ) ;
118-
119117 tracing:: info!(
120- "Found {} agent types for domain {}: {:?}" ,
121- agent_types . len( ) ,
118+ "Found {} registered agent types for domain {}: {:?}" ,
119+ compiled_mcp . registered_agent_types . len( ) ,
122120 domain. 0 ,
123- agent_types
121+ compiled_mcp
122+ . registered_agent_types
124123 . iter( )
125- . map( |at| at . 0 . clone( ) )
124+ . map( |rat| rat . agent_type . type_name . 0 . clone( ) )
126125 . collect:: <Vec <_>>( )
127126 ) ;
128127
129- for agent_type_name in & agent_types {
130- match mcp_definition_lookup
131- . resolve_agent_type ( domain, agent_type_name)
132- . await
133- {
134- Ok ( registered_agent_type) => {
135- tracing:: debug!(
136- "Resolved agent type {} for domain {}: implemented by component {}, methods: {:?}" ,
137- agent_type_name. 0 ,
138- domain. 0 ,
139- registered_agent_type. implemented_by. component_id. 0 ,
140- registered_agent_type
141- . agent_type
142- . methods
143- . iter( )
144- . map( |m| m. name. clone( ) )
145- . collect:: <Vec <_>>( )
146- ) ;
128+ for registered_agent_type in & compiled_mcp. registered_agent_types {
129+ tracing:: debug!(
130+ "Processing agent type {} for domain {}: implemented by component {}, methods: {:?}" ,
131+ registered_agent_type. agent_type. type_name. 0 ,
132+ domain. 0 ,
133+ registered_agent_type. implemented_by. component_id. 0 ,
134+ registered_agent_type
135+ . agent_type
136+ . methods
137+ . iter( )
138+ . map( |m| m. name. clone( ) )
139+ . collect:: <Vec <_>>( )
140+ ) ;
141+
142+ let agent_type = & registered_agent_type. agent_type ;
143+ let component_id = registered_agent_type. implemented_by . component_id ;
144+
145+ if let Some ( prompt_hint) = & agent_type. constructor . prompt_hint {
146+ prompts. push ( AgentMcpPrompt :: from_constructor_hint (
147+ & agent_type. type_name ,
148+ & agent_type. description ,
149+ prompt_hint,
150+ ) ) ;
151+ }
147152
148- let agent_type = & registered_agent_type. agent_type ;
153+ for method in & agent_type. methods {
154+ if let Some ( prompt_hint) = & method. prompt_hint {
155+ prompts. push ( AgentMcpPrompt :: from_method_hint (
156+ & agent_type. type_name ,
157+ method,
158+ & agent_type. constructor ,
159+ prompt_hint,
160+ ) ) ;
161+ }
149162
150- let component_id = registered_agent_type. implemented_by . component_id ;
163+ let agent_method_mcp = McpAgentCapability :: from_agent_method (
164+ & account_id,
165+ & environment_id,
166+ & agent_type. type_name ,
167+ method,
168+ & agent_type. constructor ,
169+ component_id,
170+ ) ;
151171
152- if let Some ( prompt_hint) = & agent_type. constructor . prompt_hint {
153- prompts. push ( AgentMcpPrompt :: from_constructor_hint (
154- & agent_type. type_name ,
155- & agent_type. description ,
156- prompt_hint,
157- ) ) ;
172+ match agent_method_mcp {
173+ McpAgentCapability :: Tool ( agent_mcp_tool) => {
174+ tools. push ( * agent_mcp_tool) ;
158175 }
159-
160- for method in & agent_type. methods {
161- if let Some ( prompt_hint) = & method. prompt_hint {
162- prompts. push ( AgentMcpPrompt :: from_method_hint (
163- & agent_type. type_name ,
164- method,
165- & agent_type. constructor ,
166- prompt_hint,
167- ) ) ;
168- }
169-
170- let agent_method_mcp = McpAgentCapability :: from_agent_method (
171- & account_id,
172- & environment_id,
173- & agent_type. type_name ,
174- method,
175- & agent_type. constructor ,
176- component_id,
177- ) ;
178-
179- match agent_method_mcp {
180- McpAgentCapability :: Tool ( agent_mcp_tool) => {
181- tools. push ( * agent_mcp_tool) ;
182- }
183- McpAgentCapability :: Resource ( agent_mcp_resource) => {
184- resources. push ( * agent_mcp_resource) ;
185- }
186- }
176+ McpAgentCapability :: Resource ( agent_mcp_resource) => {
177+ resources. push ( * agent_mcp_resource) ;
187178 }
188179 }
189- Err ( e) => {
190- tracing:: error!(
191- "Failed to resolve agent type {} for domain {}: {}" ,
192- agent_type_name. 0 ,
193- domain. 0 ,
194- e
195- ) ;
196- }
197180 }
198181 }
199182
0 commit comments