read url tool

This commit is contained in:
Dallin Romney
2025-06-11 11:22:13 -07:00
parent 13db7fe9a5
commit aa7ba35b00
9 changed files with 45 additions and 2 deletions

View File

@@ -44,8 +44,8 @@ export const AllMediaTypes = [
2. EXTRACT NEW INFORMATION
New information will be pulled from the internet.
If you do not see a web search tool, let me know.
Fetch information from the internet using the search web and read url tools.
If you do not see either of these tools, stop and let me know.
Retrieve the following sites per these providers, and consider these notes on how to extract the information:
- "gemini": https://ai.google.dev/gemini-api/docs/models - maxCompletionTokens is called "Output token limit", contextLength is called "Input token limit"

View File

@@ -11,6 +11,7 @@ export enum BuiltInToolNames {
LSTool = "builtin_ls",
CreateRuleBlock = "builtin_create_rule_block",
RequestRule = "builtin_request_rule",
ReadUrl = "builtin_read_url",
// excluded from allTools for now
ViewRepoMap = "builtin_view_repo_map",

View File

@@ -10,6 +10,7 @@ import { grepSearchImpl } from "./implementations/grepSearch";
import { lsToolImpl } from "./implementations/lsTool";
import { readCurrentlyOpenFileImpl } from "./implementations/readCurrentlyOpenFile";
import { readFileImpl } from "./implementations/readFile";
import { readUrlImpl } from "./implementations/readUrl";
import { requestRuleImpl } from "./implementations/requestRule";
import { runTerminalCommandImpl } from "./implementations/runTerminalCommand";
import { searchWebImpl } from "./implementations/searchWeb";
@@ -151,6 +152,8 @@ async function callBuiltInTool(
return await runTerminalCommandImpl(args, extras);
case BuiltInToolNames.SearchWeb:
return await searchWebImpl(args, extras);
case BuiltInToolNames.ReadUrl:
return await readUrlImpl(args, extras);
case BuiltInToolNames.ViewDiff:
return await viewDiffImpl(args, extras);
case BuiltInToolNames.LSTool:

View File

@@ -14,6 +14,7 @@ export const editFileTool: Tool = {
hasAlready: "edited {{{ filepath }}}",
group: BUILT_IN_GROUP_NAME,
readonly: false,
isInstant: false,
function: {
name: BuiltInToolNames.EditExistingFile,
description:

View File

@@ -0,0 +1,28 @@
import { Tool } from "../..";
import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
export const readUrlTool: Tool = {
type: "function",
displayTitle: "Read URL",
wouldLikeTo: "fetch {{{ url }}}",
isCurrently: "fetching {{{ url }}}",
hasAlready: "viewed {{{ url }}}",
readonly: true,
isInstant: true,
group: BUILT_IN_GROUP_NAME,
function: {
name: BuiltInToolNames.ReadUrl,
description:
"Can be used to view the contents of a website using a URL. Do NOT use this for files.",
parameters: {
type: "object",
required: ["url"],
properties: {
url: {
type: "string",
description: "The URL to read",
},
},
},
},
};

View File

@@ -0,0 +1,6 @@
import { ToolImpl } from ".";
import { getUrlContextItems } from "../../context/providers/URLContextProvider";
export const readUrlImpl: ToolImpl = async (args, extras) => {
return getUrlContextItems(args.url, extras.fetch);
};

View File

@@ -7,6 +7,7 @@ import { grepSearchTool } from "./definitions/grepSearch";
import { lsTool } from "./definitions/lsTool";
import { readCurrentlyOpenFileTool } from "./definitions/readCurrentlyOpenFile";
import { readFileTool } from "./definitions/readFile";
import { readUrlTool } from "./definitions/readURL";
import { requestRuleTool } from "./definitions/requestRule";
import { runTerminalCommandTool } from "./definitions/runTerminalCommand";
import { searchWebTool } from "./definitions/searchWeb";
@@ -24,6 +25,7 @@ export const baseToolDefinitions = [
readCurrentlyOpenFileTool,
lsTool,
createRuleBlock,
readUrlTool,
// replacing with ls tool for now
// viewSubdirectoryTool,
// viewRepoMapTool,

View File

@@ -41,6 +41,7 @@ const toolCallIcons: Record<string, ComponentType> = {
[BuiltInToolNames.LSTool]: FolderIcon,
[BuiltInToolNames.ReadCurrentlyOpenFile]: DocumentTextIcon,
[BuiltInToolNames.ReadFile]: DocumentIcon,
[BuiltInToolNames.ReadUrl]: GlobeAltIcon,
[BuiltInToolNames.SearchWeb]: GlobeAltIcon,
[BuiltInToolNames.ViewDiff]: CodeBracketIcon,
[BuiltInToolNames.ViewRepoMap]: MapIcon,

View File

@@ -53,6 +53,7 @@ export const uiSlice = createSlice({
[BuiltInToolNames.GrepSearch]: "allowedWithoutPermission",
[BuiltInToolNames.FileGlobSearch]: "allowedWithoutPermission",
[BuiltInToolNames.SearchWeb]: "allowedWithoutPermission",
[BuiltInToolNames.ReadUrl]: "disabled",
[BuiltInToolNames.ViewDiff]: "allowedWithoutPermission",
[BuiltInToolNames.LSTool]: "allowedWithoutPermission",
[BuiltInToolNames.CreateRuleBlock]: "allowedWithPermission",