UNPKG

@hashgraphonline/hedera-agent-kit

Version:

Build LLM-powered applications that interact with the Hedera Network. Create conversational agents that can understand user requests in natural language and execute Hedera transactions, or build backend systems that leverage AI for on-chain operations.

42 lines (34 loc) 982 B
import { z } from 'zod'; import { BaseHederaQueryTool, BaseHederaQueryToolParams, } from '../common/base-hedera-query-tool'; const GetNetworkInfoZodSchema = z.object({}); /** * Tool for retrieving network information. */ export class HederaGetNetworkInfoTool extends BaseHederaQueryTool< typeof GetNetworkInfoZodSchema > { name = 'hedera-get-network-info'; description = 'Retrieves network information from the Hedera network.'; specificInputSchema = GetNetworkInfoZodSchema; namespace = 'network'; constructor(params: BaseHederaQueryToolParams) { super(params); } protected async executeQuery(): Promise<unknown> { this.logger.info('Getting network information'); const networkInfo = await this.hederaKit.query().getNetworkInfo(); if (networkInfo === null) { return { success: false, error: 'Could not retrieve network information', }; } return { success: true, networkInfo, }; } }