@@ -145,12 +145,14 @@ export function createIntegrationTestsSuite(
145145 it ( 'should list all default tools and Actors' , async ( ) => {
146146 client = await createClientFn ( ) ;
147147 const tools = await client . listTools ( ) ;
148- expect ( tools . tools . length ) . toEqual ( defaultTools . length + defaults . actors . length + 1 ) ;
148+ expect ( tools . tools . length ) . toEqual ( defaultTools . length + defaults . actors . length + 2 ) ;
149149
150150 const names = getToolNames ( tools ) ;
151151 expectToolNamesToContain ( names , DEFAULT_TOOL_NAMES ) ;
152152 expectToolNamesToContain ( names , DEFAULT_ACTOR_NAMES ) ;
153- expect ( names ) . toContain ( 'get-actor-output' ) ;
153+ expect ( names ) . toContain ( HelperTools . ACTOR_OUTPUT_GET ) ;
154+ // get-actor-run should be automatically included when call-actor is present
155+ expect ( names ) . toContain ( HelperTools . ACTOR_RUNS_GET ) ;
154156 await client . close ( ) ;
155157 } ) ;
156158
@@ -165,12 +167,14 @@ export function createIntegrationTestsSuite(
165167 const expectedActors = [ 'apify-slash-rag-web-browser' ] ;
166168
167169 const expectedTotal = expectedActorsTools . concat ( expectedDocsTools , expectedActors ) ;
168- expect ( names ) . toHaveLength ( expectedTotal . length + 1 ) ;
170+ expect ( names ) . toHaveLength ( expectedTotal . length + 2 ) ;
169171
170172 expectToolNamesToContain ( names , expectedActorsTools ) ;
171173 expectToolNamesToContain ( names , expectedDocsTools ) ;
172174 expectToolNamesToContain ( names , expectedActors ) ;
173- expect ( names ) . toContain ( 'get-actor-output' ) ;
175+ expect ( names ) . toContain ( HelperTools . ACTOR_OUTPUT_GET ) ;
176+ // get-actor-run should be automatically included when call-actor is present
177+ expect ( names ) . toContain ( HelperTools . ACTOR_RUNS_GET ) ;
174178
175179 await client . close ( ) ;
176180 } ) ;
@@ -204,11 +208,13 @@ export function createIntegrationTestsSuite(
204208 it ( 'should list all default tools and Actors when enableAddingActors is false' , async ( ) => {
205209 client = await createClientFn ( { enableAddingActors : false } ) ;
206210 const names = getToolNames ( await client . listTools ( ) ) ;
207- expect ( names . length ) . toEqual ( defaultTools . length + defaults . actors . length + 1 ) ;
211+ expect ( names . length ) . toEqual ( defaultTools . length + defaults . actors . length + 2 ) ;
208212
209213 expectToolNamesToContain ( names , DEFAULT_TOOL_NAMES ) ;
210214 expectToolNamesToContain ( names , DEFAULT_ACTOR_NAMES ) ;
211- expect ( names ) . toContain ( 'get-actor-output' ) ;
215+ expect ( names ) . toContain ( HelperTools . ACTOR_OUTPUT_GET ) ;
216+ // get-actor-run should be automatically included when call-actor is present
217+ expect ( names ) . toContain ( HelperTools . ACTOR_RUNS_GET ) ;
212218
213219 await client . close ( ) ;
214220 } ) ;
@@ -412,9 +418,11 @@ export function createIntegrationTestsSuite(
412418 const selectedToolName = actorNameToToolName ( ACTOR_PYTHON_EXAMPLE ) ;
413419 client = await createClientFn ( { enableAddingActors : true , tools : [ 'actors' ] } ) ;
414420 const names = getToolNames ( await client . listTools ( ) ) ;
415- // Only the actors category, get-actor-output and add-actor should be loaded
416- const numberOfTools = toolCategories . actors . length + 2 ;
421+ // Only the actors category, get-actor-output, get-actor-run, and add-actor should be loaded
422+ const numberOfTools = toolCategories . actors . length + 3 ;
417423 expect ( names ) . toHaveLength ( numberOfTools ) ;
424+ // get-actor-run should be automatically included when call-actor is present
425+ expect ( names ) . toContain ( HelperTools . ACTOR_RUNS_GET ) ;
418426 // Check that the Actor is not in the tools list
419427 expect ( names ) . not . toContain ( selectedToolName ) ;
420428
@@ -1038,11 +1046,13 @@ export function createIntegrationTestsSuite(
10381046 // Test with enableAddingActors = false via env var
10391047 client = await createClientFn ( { enableAddingActors : false , useEnv : true } ) ;
10401048 const names = getToolNames ( await client . listTools ( ) ) ;
1041- expect ( names . length ) . toEqual ( defaultTools . length + defaults . actors . length + 1 ) ;
1049+ expect ( names . length ) . toEqual ( defaultTools . length + defaults . actors . length + 2 ) ;
10421050
10431051 expectToolNamesToContain ( names , DEFAULT_TOOL_NAMES ) ;
10441052 expectToolNamesToContain ( names , DEFAULT_ACTOR_NAMES ) ;
1045- expect ( names ) . toContain ( 'get-actor-output' ) ;
1053+ expect ( names ) . toContain ( HelperTools . ACTOR_OUTPUT_GET ) ;
1054+ // get-actor-run should be automatically included when call-actor is present
1055+ expect ( names ) . toContain ( HelperTools . ACTOR_RUNS_GET ) ;
10461056
10471057 await client . close ( ) ;
10481058 } ) ;
@@ -1493,6 +1503,73 @@ export function createIntegrationTestsSuite(
14931503 expect ( searchActorsTool ?. _meta ?. [ 'openai/outputTemplate' ] ) . toBeDefined ( ) ;
14941504 expect ( searchActorsTool ?. _meta ?. [ 'openai/widgetAccessible' ] ) . toBe ( true ) ;
14951505
1506+ const fetchActorDetailsToolFromList = tools . tools . find ( ( tool ) => tool . name === HelperTools . ACTOR_GET_DETAILS ) ;
1507+ expect ( fetchActorDetailsToolFromList ) . toBeDefined ( ) ;
1508+ expect ( fetchActorDetailsToolFromList ?. _meta ) . toBeDefined ( ) ;
1509+ expect ( fetchActorDetailsToolFromList ?. _meta ?. [ 'openai/outputTemplate' ] ) . toBeDefined ( ) ;
1510+ expect ( fetchActorDetailsToolFromList ?. _meta ?. [ 'openai/widgetAccessible' ] ) . toBe ( true ) ;
1511+
1512+ const callActorTool = tools . tools . find ( ( tool ) => tool . name === HelperTools . ACTOR_CALL ) ;
1513+ expect ( callActorTool ) . toBeDefined ( ) ;
1514+ expect ( callActorTool ?. _meta ) . toBeDefined ( ) ;
1515+ expect ( callActorTool ?. _meta ?. [ 'openai/outputTemplate' ] ) . toBeDefined ( ) ;
1516+ expect ( callActorTool ?. _meta ?. [ 'openai/widgetAccessible' ] ) . toBe ( true ) ;
1517+
1518+ await client . close ( ) ;
1519+ } ) ;
1520+
1521+ it . runIf ( options . transport === 'sse' || options . transport === 'streamable-http' ) ( 'should use uiMode URL parameter when provided' , async ( ) => {
1522+ client = await createClientFn ( { uiMode : 'openai' } ) ;
1523+ const tools = await client . listTools ( ) ;
1524+ expect ( tools . tools . length ) . toBeGreaterThan ( 0 ) ;
1525+
1526+ // Verify that tools have OpenAI metadata when UI mode is enabled via URL parameter
1527+ const searchActorsTool = tools . tools . find ( ( tool ) => tool . name === HelperTools . STORE_SEARCH ) ;
1528+ expect ( searchActorsTool ) . toBeDefined ( ) ;
1529+ expect ( searchActorsTool ?. _meta ) . toBeDefined ( ) ;
1530+ expect ( searchActorsTool ?. _meta ?. [ 'openai/outputTemplate' ] ) . toBeDefined ( ) ;
1531+ expect ( searchActorsTool ?. _meta ?. [ 'openai/widgetAccessible' ] ) . toBe ( true ) ;
1532+
1533+ const fetchActorDetailsToolFromList = tools . tools . find ( ( tool ) => tool . name === HelperTools . ACTOR_GET_DETAILS ) ;
1534+ expect ( fetchActorDetailsToolFromList ) . toBeDefined ( ) ;
1535+ expect ( fetchActorDetailsToolFromList ?. _meta ) . toBeDefined ( ) ;
1536+ expect ( fetchActorDetailsToolFromList ?. _meta ?. [ 'openai/outputTemplate' ] ) . toBeDefined ( ) ;
1537+ expect ( fetchActorDetailsToolFromList ?. _meta ?. [ 'openai/widgetAccessible' ] ) . toBe ( true ) ;
1538+
1539+ const callActorTool = tools . tools . find ( ( tool ) => tool . name === HelperTools . ACTOR_CALL ) ;
1540+ expect ( callActorTool ) . toBeDefined ( ) ;
1541+ expect ( callActorTool ?. _meta ) . toBeDefined ( ) ;
1542+ expect ( callActorTool ?. _meta ?. [ 'openai/outputTemplate' ] ) . toBeDefined ( ) ;
1543+ expect ( callActorTool ?. _meta ?. [ 'openai/widgetAccessible' ] ) . toBe ( true ) ;
1544+
1545+ await client . close ( ) ;
1546+ } ) ;
1547+
1548+ it ( 'should automatically include get-actor-run when uiMode is enabled' , async ( ) => {
1549+ client = await createClientFn ( { uiMode : 'openai' } ) ;
1550+ const tools = await client . listTools ( ) ;
1551+ const toolNames = getToolNames ( tools ) ;
1552+
1553+ // When uiMode is enabled, default tools include call-actor, so get-actor-run should be included
1554+ expect ( toolNames ) . toContain ( HelperTools . ACTOR_CALL ) ;
1555+ expect ( toolNames ) . toContain ( HelperTools . ACTOR_RUNS_GET ) ;
1556+
1557+ await client . close ( ) ;
1558+ } ) ;
1559+
1560+ it . runIf ( options . transport === 'sse' || options . transport === 'streamable-http' ) ( 'should include get-actor-run without call-actor' , async ( ) => {
1561+ client = await createClientFn ( { uiMode : 'openai' , tools : [ 'docs' ] } ) ;
1562+ const tools = await client . listTools ( ) ;
1563+ const toolNames = getToolNames ( tools ) ;
1564+
1565+ // get-actor-run should be included when uiMode is enabled, even if call-actor is not present
1566+ expect ( toolNames ) . toContain ( HelperTools . ACTOR_RUNS_GET ) ;
1567+ // Docs tools should be present
1568+ expect ( toolNames ) . toContain ( HelperTools . DOCS_SEARCH ) ;
1569+ expect ( toolNames ) . toContain ( HelperTools . DOCS_FETCH ) ;
1570+ // call-actor should NOT be present since only 'docs' was selected
1571+ expect ( toolNames ) . not . toContain ( HelperTools . ACTOR_CALL ) ;
1572+
14961573 await client . close ( ) ;
14971574 } ) ;
14981575 } ) ;
0 commit comments