import { RequestsGetTool, RequestsPostTool } from "langchain/tools"; import { Plugin } from "../../types"; import { PluginType, RequestsGetToolInitConfig, RequestsGetToolRunArgs, RequestsGetToolExpose } from "../../types"; export default class RequestsGetToolPlugin implements Plugin { name = "requestsGetTool"; description = "Send HTTP GET requests to any URL and retrieve text content."; type = PluginType.Tool; RunConfigExample:RequestsGetToolRunArgs={ url: "" } InitConfigExample: RequestsGetToolInitConfig = {}; private tool: RequestsGetToolExpose["tool"] = null; expose(): RequestsGetToolExpose { return { name: this.name, description: this.description, type: this.type, InitConfigExample: this.InitConfigExample, RunConfigExample:this.RunConfigExample, tool: this.tool, }; } async init(config: RequestsGetToolInitConfig) { this.tool = new RequestsGetTool(); } async run(args: RequestsGetToolRunArgs): Promise { if (!this.tool) throw new Error("Tool is not initialized."); return await this.tool.invoke(args); } }