continue-custom/core/tools/definitions/readCurrentlyOpenFile.ts
QiuYang Shen 1c0eaab939 Merge remote-tracking branch 'origin/init-tool-policy-in-tools-definitions' into init-tool-policy-in-tools-definitions
# Conflicts:
#	core/index.d.ts
#	core/tools/definitions/codebaseTool.ts
#	core/tools/definitions/createNewFile.ts
#	core/tools/definitions/createRuleBlock.ts
#	core/tools/definitions/editFile.ts
#	core/tools/definitions/fetchUrlContent.ts
#	core/tools/definitions/globSearch.ts
#	core/tools/definitions/grepSearch.ts
#	core/tools/definitions/ls.ts
#	core/tools/definitions/readCurrentlyOpenFile.ts
#	core/tools/definitions/readFile.ts
#	core/tools/definitions/requestRule.ts
#	core/tools/definitions/runTerminalCommand.ts
#	core/tools/definitions/searchAndReplaceInFile.ts
#	core/tools/definitions/searchWeb.ts
#	core/tools/definitions/viewDiff.ts
#	core/tools/definitions/viewRepoMap.ts
#	core/tools/definitions/viewSubdirectory.ts
2025-07-29 11:34:57 +08:00

30 lines
1.1 KiB
TypeScript

import { Tool } from "../..";
import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
import { createSystemMessageExampleCall } from "../systemMessageTools/buildToolsSystemMessage";
export const readCurrentlyOpenFileTool: Tool = {
type: "function",
displayTitle: "Read Currently Open File",
wouldLikeTo: "read the current file",
isCurrently: "reading the current file",
hasAlready: "viewed the current file",
readonly: true,
isInstant: true,
group: BUILT_IN_GROUP_NAME,
function: {
name: BuiltInToolNames.ReadCurrentlyOpenFile,
description:
"Read the currently open file in the IDE. If the user seems to be referring to a file that you can't see, try using this",
parameters: {
type: "object",
properties: {},
},
},
defaultToolPolicy: "allowedWithPermission",
systemMessageDescription: createSystemMessageExampleCall(
BuiltInToolNames.ReadCurrentlyOpenFile,
`To view the user's currently open file, use the ${BuiltInToolNames.ReadCurrentlyOpenFile} tool.
If the user is asking about a file and you don't see any code, use this to check the current file`,
[],
),
};