Skip to content

Commit 17836c8

Browse files
committed
tool-resolve
1 parent c421739 commit 17836c8

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "agent-swarm-kit",
3-
"version": "1.1.67",
3+
"version": "1.1.68",
44
"description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
55
"author": {
66
"name": "Petr Tripolsky",

src/client/ClientAgent.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,22 @@ export class ClientAgent implements IAgent {
690690
`ClientAgent agentName=${this.params.agentName} clientId=${this.params.clientId} _resolveTools`
691691
);
692692
const seen = new Set<string>();
693-
const agentToolList: IAgentTool[] = this.params.tools
694-
? this.params.tools
695-
: [];
693+
const agentToolList: IAgentTool[] = [];
694+
if (this.params.tools) {
695+
await Promise.all(
696+
this.params.tools.map(async (tool) => {
697+
const { function: upperFn, ...other } = tool;
698+
const fn =
699+
typeof upperFn === "function"
700+
? await upperFn(this.params.clientId, this.params.agentName)
701+
: upperFn;
702+
agentToolList.push({
703+
...other,
704+
function: fn,
705+
});
706+
})
707+
);
708+
}
696709
const mcpToolList = await this.params.mcp.listTools(this.params.clientId);
697710
if (mcpToolList.length) {
698711
return agentToolList

0 commit comments

Comments
 (0)