Skip to content

Commit 52e1069

Browse files
committed
refactor: Update serverTools type to use StructuredToolInterface for consistency
1 parent 5496746 commit 52e1069

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/agents/server_manager.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { StructuredToolInterface } from '@langchain/core/tools'
12
import type { LangChainAdapter } from '../adapters/langchain_adapter.js'
23
import type { MCPClient } from '../client.js'
34
import type { BaseConnector } from '../connectors/base.js'
@@ -16,7 +17,7 @@ const CurrentServerInputSchema = z.object({})
1617
export 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

Comments
 (0)