1+ import type { StructuredToolInterface } from '@langchain/core/tools'
12import type { LangChainAdapter } from '../adapters/langchain_adapter.js'
23import type { MCPClient } from '../client.js'
34import type { BaseConnector } from '../connectors/base.js'
@@ -16,7 +17,7 @@ const CurrentServerInputSchema = z.object({})
1617export class ServerManager {
1718 private activeServer : string | null = null
1819 private readonly initializedServers : Record < string , boolean > = { }
19- private readonly serverTools : Record < string , DynamicStructuredTool [ ] > = { }
20+ private readonly serverTools : Record < string , StructuredToolInterface [ ] > = { }
2021
2122 constructor (
2223 private readonly client : MCPClient ,
@@ -29,7 +30,7 @@ export class ServerManager {
2930 }
3031 }
3132
32- async getServerManagementTools ( ) : Promise < DynamicStructuredTool [ ] > {
33+ async getServerManagementTools ( ) : Promise < StructuredToolInterface [ ] > {
3334 const listServersTool = new DynamicStructuredTool ( {
3435 name : 'list_mcp_servers' ,
3536 description :
@@ -142,11 +143,11 @@ export class ServerManager {
142143 return `Successfully disconnected from MCP server '${ was } '.`
143144 }
144145
145- async getActiveServerTools ( ) : Promise < DynamicStructuredTool [ ] > {
146+ async getActiveServerTools ( ) : Promise < StructuredToolInterface [ ] > {
146147 return this . activeServer ? this . serverTools [ this . activeServer ] ?? [ ] : [ ]
147148 }
148149
149- async getAllTools ( ) : Promise < DynamicStructuredTool [ ] > {
150+ async getAllTools ( ) : Promise < StructuredToolInterface [ ] > {
150151 return [ ...( await this . getServerManagementTools ( ) ) , ...( await this . getActiveServerTools ( ) ) ]
151152 }
152153
@@ -161,7 +162,7 @@ export class ServerManager {
161162 }
162163 }
163164
164- private async ensureToolsFetched ( serverName : string , connector ?: BaseConnector ) : Promise < DynamicStructuredTool [ ] > {
165+ private async ensureToolsFetched ( serverName : string , connector ?: BaseConnector ) : Promise < StructuredToolInterface [ ] > {
165166 if ( this . serverTools [ serverName ] )
166167 return this . serverTools [ serverName ]
167168
0 commit comments