continue-custom/core/tools/definitions/readFile.ts
Dallin Romney caf5b56db4 merge main
2025-08-05 17:46:21 -07:00

34 lines
1.1 KiB
TypeScript

import { Tool } from "../..";
import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
export const readFileTool: Tool = {
type: "function",
displayTitle: "Read File",
wouldLikeTo: "read {{{ filepath }}}",
isCurrently: "reading {{{ filepath }}}",
hasAlready: "viewed {{{ filepath }}}",
readonly: true,
isInstant: true,
group: BUILT_IN_GROUP_NAME,
function: {
name: BuiltInToolNames.ReadFile,
description:
"Use this tool if you need to view the contents of an existing file.",
parameters: {
type: "object",
required: ["filepath"],
properties: {
filepath: {
type: "string",
description:
"The path of the file to read, relative to the root of the workspace (NOT uri or absolute path)",
},
},
},
},
systemMessageDescription: {
prefix: `To read a file with a known filepath, use the ${BuiltInToolNames.ReadFile} tool. For example, to read a file located at 'path/to/file.txt', you would respond with this:`,
exampleArgs: [["filepath", "path/to/the_file.txt"]],
},
defaultToolPolicy: "allowedWithoutPermission",
};