diff --git a/package-lock.json b/package-lock.json index 50ca266..2ecda7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "aslobot-matrix", - "version": "1.3.0", + "version": "1.3.0-dev", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "aslobot-matrix", - "version": "1.3.0", + "version": "1.3.0-dev", "license": "ISC", "dependencies": { "@google/genai": "^1.34.0", diff --git a/src/services/ai/tools.ts b/src/services/ai/tools.ts index b378dbc..bf593c5 100644 --- a/src/services/ai/tools.ts +++ b/src/services/ai/tools.ts @@ -121,6 +121,20 @@ const tools: FunctionDeclaration[] = [ required: [], }, }, + { + name: "readWebsite", + description: "Returns a html of a website for AI analysis", + parametersJsonSchema: { + type: "object", + properties: { + url: { + type: "string", + description: "a full url of the website to fetch", + }, + }, + required: ["url"], + }, + }, { name: "generateImage", description: "Generates an image or a picture based on the prompt", @@ -295,6 +309,29 @@ const toolFunctions: AIToolFunction[] = [ }; }, }, + { + name: "readWebsite", + function: async (matrix, args) => { + if (!args.url) { + return { + message: "url is required", + }; + } + + matrix.client.sendTextMessage( + matrix.roomId, + `Downloading ${args.url}...`, + ); + + const response = await fetch(args.url); + const contents = await response.text(); + + return { + message: "website fetched", + html: contents, + }; + }, + }, { name: "generateImage", function: (matrix, args) => {