@hashgraphonline/standards-agent-kit
Version:
A modular SDK for building on-chain autonomous agents using Hashgraph Online Standards, including HCS-10 for agent discovery and communication. https://hol.org
41 lines (40 loc) • 1.53 kB
JavaScript
import { z } from "zod";
import { BaseHCS10QueryTool } from "./standards-agent-kit.es10.js";
const ListConnectionsZodSchema = z.object({
includeDetails: z.boolean().optional().describe(
"Whether to include detailed information about each connection"
),
showPending: z.boolean().optional().describe("Whether to include pending connection requests")
});
class ListConnectionsTool extends BaseHCS10QueryTool {
constructor(params) {
super(params);
this.name = "list_connections";
this.description = "Lists all active HCS-10 connections. Use this FIRST before sending messages to check if you already have an active connection to a target agent. Shows connection details and agent information for each active connection.";
this.specificInputSchema = ListConnectionsZodSchema;
}
async executeQuery(args) {
const hcs10Builder = this.hcs10Builder;
const params = {};
if (args.includeDetails !== void 0) {
params.includeDetails = args.includeDetails;
}
if (args.showPending !== void 0) {
params.showPending = args.showPending;
}
await hcs10Builder.listConnections(params);
const result = await hcs10Builder.execute();
if (result.success && "rawResult" in result && result.rawResult) {
const raw = result.rawResult;
return {
success: true,
data: raw.formattedOutput || raw.message || "Connections listed"
};
}
return result;
}
}
export {
ListConnectionsTool
};
//# sourceMappingURL=standards-agent-kit.es14.js.map