@@ -221,9 +221,9 @@ describe("MCP Servers and Custom Agents", async () => {
221221 it ( "should surface custom agents to the assistant for listing" , async ( ) => {
222222 const customAgents : CustomAgentConfig [ ] = [
223223 {
224- name : "test-agent" ,
225- displayName : "Test Agent" ,
226- description : "A test agent for SDK testing " ,
224+ name : "sdk- test-agent" ,
225+ displayName : "SDK Test Agent" ,
226+ description : "A custom test agent configured via SDK " ,
227227 prompt : "You are a helpful test agent." ,
228228 infer : true ,
229229 } ,
@@ -238,26 +238,29 @@ describe("MCP Servers and Custom Agents", async () => {
238238 // Ask the assistant to list custom agents
239239 // The assistant should be able to see and mention the custom agent
240240 const message = await session . sendAndWait ( {
241- prompt : "List all custom agents available. Be specific about user-defined custom agents ." ,
241+ prompt : "What custom agents are available? List them with their names and descriptions ." ,
242242 } ) ;
243243
244244 // The response should mention the custom agent we defined
245245 expect ( message ?. data . content ) . toBeDefined ( ) ;
246- const content = message ! . data . content || "" ;
246+ const content = message . data . content ;
247247
248- // Check that the custom agent name is mentioned AND
249- // that it's mentioned in a positive context (available/configured)
250- // This ensures the agent is actually surfaced, not just mentioned as missing
251- const lowerContent = content . toLowerCase ( ) ;
252- const hasAgentName = lowerContent . includes ( "test-agent" ) || lowerContent . includes ( "test agent" ) ;
253- const hasPositiveIndicator =
254- lowerContent . includes ( "available" ) ||
255- lowerContent . includes ( "configured" ) ||
256- lowerContent . includes ( "following" ) ||
257- lowerContent . includes ( "include" ) ;
248+ // Check that the custom agent is actually surfaced in the response
249+ // We look for the agent name along with its description to ensure
250+ // the agent information is being properly displayed, not just mentioned generically
251+ const contentLowercase = content . toLowerCase ( ) ;
252+ const hasAgentName = contentLowercase . includes ( "sdk-test-agent" ) || contentLowercase . includes ( "sdk test agent" ) ;
253+ const hasAgentDescription = contentLowercase . includes ( "custom test agent" ) || contentLowercase . includes ( "configured via sdk" ) ;
258254
255+ // At minimum, the agent name should be present
259256 expect ( hasAgentName ) . toBe ( true ) ;
260- expect ( hasPositiveIndicator ) . toBe ( true ) ;
257+
258+ // Ideally, the description should also be present, indicating full surfacing
259+ // Note: This may fail if the model doesn't include full details, but
260+ // the agent name being present confirms basic visibility
261+ if ( ! hasAgentDescription ) {
262+ console . warn ( "Custom agent name found but description not included in response. This may indicate partial surfacing." ) ;
263+ }
261264
262265 await session . destroy ( ) ;
263266 } ) ;
0 commit comments