Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,98 @@
]
}
},
{
"name": "copilot_replaceFileContents",
"toolReferenceName": "replaceFileContents",
"displayName": "%copilot.tools.replaceFileContents.name%",
"userDescription": "%copilot.tools.replaceFileContents.description%",
"modelDescription": "Replace the entire contents of an existing file. Use this tool for complete file rewrites such as converting documentation formats, major refactoring that changes most lines, or restructuring entire files. For surgical edits that change only specific sections, prefer replace_string_in_file. This tool integrates with VS Code's undo stack and shows a diff preview for user confirmation.",
"inputSchema": {
"type": "object",
"properties": {
"filePath": {
"type": "string",
"description": "The absolute path to the file to replace."
},
"newContent": {
"type": "string",
"description": "The complete new content for the file. This will replace the entire file contents."
},
"explanation": {
"type": "string",
"description": "A brief explanation of why the file is being rewritten."
}
},
"required": [
"filePath",
"newContent",
"explanation"
]
}
},
{
"name": "copilot_insertAtLine",
"toolReferenceName": "insertAtLine",
"displayName": "%copilot.tools.insertAtLine.name%",
"userDescription": "%copilot.tools.insertAtLine.description%",
"modelDescription": "Insert content at a specific line number in a file. Use this tool when you need to add new content at a known location without matching existing text. This is ideal for adding imports, inserting methods into a class, or adding entries to a list. Line numbers are 1-indexed. By default, content is inserted before the specified line.",
"inputSchema": {
"type": "object",
"properties": {
"filePath": {
"type": "string",
"description": "The absolute path to the file to edit."
},
"line": {
"type": "number",
"description": "The 1-indexed line number where content should be inserted."
},
"content": {
"type": "string",
"description": "The content to insert."
},
"position": {
"type": "string",
"enum": ["before", "after"],
"description": "Whether to insert before or after the specified line. Defaults to 'before'."
}
},
"required": [
"filePath",
"line",
"content"
]
}
},
{
"name": "copilot_deleteLines",
"toolReferenceName": "deleteLines",
"displayName": "%copilot.tools.deleteLines.name%",
"userDescription": "%copilot.tools.deleteLines.description%",
"modelDescription": "Delete lines from a file by line number range. Use this tool when you need to remove content by position rather than by matching text. This is useful for removing deprecated code, cleaning up comments, or deleting generated sections. Line numbers are 1-indexed and inclusive.",
"inputSchema": {
"type": "object",
"properties": {
"filePath": {
"type": "string",
"description": "The absolute path to the file to edit."
},
"startLine": {
"type": "number",
"description": "The 1-indexed line number to start deleting from (inclusive)."
},
"endLine": {
"type": "number",
"description": "The 1-indexed line number to stop deleting at (inclusive)."
}
},
"required": [
"filePath",
"startLine",
"endLine"
]
}
},
{
"name": "copilot_editNotebook",
"toolReferenceName": "editNotebook",
Expand Down
6 changes: 6 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,12 @@
"copilot.tools.insertEdit.name": "Edit File",
"copilot.tools.replaceString.name": "Replace String in File",
"copilot.tools.multiReplaceString.name": "Multi-Replace String in Files",
"copilot.tools.replaceFileContents.name": "Replace File Contents",
"copilot.tools.replaceFileContents.description": "Replace the entire contents of a file",
"copilot.tools.insertAtLine.name": "Insert at Line",
"copilot.tools.insertAtLine.description": "Insert content at a specific line number",
"copilot.tools.deleteLines.name": "Delete Lines",
"copilot.tools.deleteLines.description": "Delete lines by line number range",
"copilot.tools.editNotebook.name": "Edit Notebook",
"copilot.tools.editNotebook.userDescription": "Edit a notebook file in the workspace",
"copilot.tools.runNotebookCell.name": "Run Notebook Cell",
Expand Down
9 changes: 9 additions & 0 deletions src/extension/tools/common/toolNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export enum ToolName {
CreateFile = 'create_file',
ReplaceString = 'replace_string_in_file',
MultiReplaceString = 'multi_replace_string_in_file',
ReplaceFileContents = 'replace_file_contents',
InsertAtLine = 'insert_at_line',
DeleteLines = 'delete_lines',
EditNotebook = 'edit_notebook_file',
RunNotebookCell = 'run_notebook_cell',
GetNotebookSummary = 'copilot_getNotebookSummary',
Expand Down Expand Up @@ -94,6 +97,9 @@ export enum ContributedToolName {
CreateFile = 'copilot_createFile',
ReplaceString = 'copilot_replaceString',
MultiReplaceString = 'copilot_multiReplaceString',
ReplaceFileContents = 'copilot_replaceFileContents',
InsertAtLine = 'copilot_insertAtLine',
DeleteLines = 'copilot_deleteLines',
EditNotebook = 'copilot_editNotebook',
RunNotebookCell = 'copilot_runNotebookCell',
GetNotebookSummary = 'copilot_getNotebookSummary',
Expand Down Expand Up @@ -169,6 +175,9 @@ export const toolCategories: Record<ToolName, ToolCategory> = {
[ToolName.CoreGetTerminalOutput]: ToolCategory.Core,
[ToolName.CoreManageTodoList]: ToolCategory.Core,
[ToolName.MultiReplaceString]: ToolCategory.Core,
[ToolName.ReplaceFileContents]: ToolCategory.Core,
[ToolName.InsertAtLine]: ToolCategory.Core,
[ToolName.DeleteLines]: ToolCategory.Core,
[ToolName.FindFiles]: ToolCategory.Core,
[ToolName.CreateDirectory]: ToolCategory.Core,
[ToolName.ReadProjectStructure]: ToolCategory.Core,
Expand Down
4 changes: 4 additions & 0 deletions src/extension/tools/node/allTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import './applyPatchTool';
import './codebaseTool';
import './createDirectoryTool';
import './createFileTool';
import './deleteLinesTool';
import './docTool';
import './editNotebookTool';
import './findFilesTool';
Expand All @@ -16,6 +17,7 @@ import './getErrorsTool';
import './getNotebookCellOutputTool';
import './getSearchViewResultsTool';
import './githubRepoTool';
import './insertAtLineTool';
import './insertEditTool';
import './installExtensionTool';
import './listDirTool';
Expand All @@ -28,6 +30,7 @@ import './newWorkspace/projectSetupInfoTool';
import './notebookSummaryTool';
import './readFileTool';
import './readProjectStructureTool';
import './replaceFileContentsTool';
import './replaceStringTool';
import './runNotebookCellTool';
import './scmChangesTool';
Expand All @@ -39,3 +42,4 @@ import './usagesTool';
import './userPreferencesTool';
import './vscodeAPITool';
import './vscodeCmdTool';

Loading