@@ -6,8 +6,8 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from
66import { defaults , HelperTools } from '../../src/const.js' ;
77import { addRemoveTools , defaultTools } from '../../src/tools/index.js' ;
88import { actorNameToToolName } from '../../src/tools/utils.js' ;
9- import { ACTOR_PYTHON_EXAMPLE , DEFAULT_ACTOR_NAMES , DEFAULT_TOOL_NAMES } from '../const.js' ;
10- import { type McpClientOptions } from '../helpers.js' ;
9+ import { ACTOR_MCP_SERVER_ACTOR_NAME , ACTOR_PYTHON_EXAMPLE , DEFAULT_ACTOR_NAMES , DEFAULT_TOOL_NAMES } from '../const.js' ;
10+ import { addActor , type McpClientOptions } from '../helpers.js' ;
1111
1212interface IntegrationTestsSuiteOptions {
1313 suiteName : string ;
@@ -227,6 +227,38 @@ export function createIntegrationTestsSuite(
227227 await client . close ( ) ;
228228 } ) ;
229229
230+ it ( 'should be able to add and call Actorized MCP server' , async ( ) => {
231+ const client = await createClientFn ( { enableAddingActors : true } ) ;
232+
233+ const toolNamesBefore = getToolNames ( await client . listTools ( ) ) ;
234+ const searchToolCountBefore = toolNamesBefore . filter ( ( name ) => name . includes ( HelperTools . STORE_SEARCH ) ) . length ;
235+ expect ( searchToolCountBefore ) . toBe ( 1 ) ;
236+
237+ // Add self as an Actorized MCP server
238+ await addActor ( client , ACTOR_MCP_SERVER_ACTOR_NAME ) ;
239+
240+ const toolNamesAfter = getToolNames ( await client . listTools ( ) ) ;
241+ const searchToolCountAfter = toolNamesAfter . filter ( ( name ) => name . includes ( HelperTools . STORE_SEARCH ) ) . length ;
242+ expect ( searchToolCountAfter ) . toBe ( 2 ) ;
243+
244+ // Find the search tool from the Actorized MCP server
245+ const actorizedMCPSearchTool = toolNamesAfter . find (
246+ ( name ) => name . includes ( HelperTools . STORE_SEARCH ) && name !== HelperTools . STORE_SEARCH ) ;
247+ expect ( actorizedMCPSearchTool ) . toBeDefined ( ) ;
248+
249+ const result = await client . callTool ( {
250+ name : actorizedMCPSearchTool as string ,
251+ arguments : {
252+ search : ACTOR_MCP_SERVER_ACTOR_NAME ,
253+ limit : 1 ,
254+ } ,
255+ } ) ;
256+ expect ( result . content ) . toBeDefined ( ) ;
257+
258+ await client . close ( ) ;
259+ } ) ;
260+
261+ // Session termination is only possible for streamable HTTP transport.
230262 it . runIf ( options . transport === 'streamable-http' ) ( 'should successfully terminate streamable session' , async ( ) => {
231263 const client = await createClientFn ( ) ;
232264 await client . listTools ( ) ;
0 commit comments