Skip to content

feat: add delete file tool and related functionality#4180

Closed
mossgowild wants to merge 3 commits intomicrosoft:mainfrom
mossgowild:delete-files-tool
Closed

feat: add delete file tool and related functionality#4180
mossgowild wants to merge 3 commits intomicrosoft:mainfrom
mossgowild:delete-files-tool

Conversation

@mossgowild
Copy link
Copy Markdown

This PR adds the delete file tool and related functionality.

Closes microsoft/vscode#295943

Changes

  • Add delete file tool implementation
  • Related functionality for file management

Copilot AI review requested due to automatic review settings March 4, 2026 07:26
@mossgowild
Copy link
Copy Markdown
Author

mossgowild commented Mar 4, 2026

@mossgowild please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a delete_files tool to the Copilot agent's toolkit, enabling the AI to delete files from the workspace. It is intended as a companion to the existing apply_patch tool, enabled only when apply_patch is not available (for models that don't support it). The implementation follows the pattern established by other file-manipulation tools (createFile, insertEdit, applyPatch).

Changes:

  • New DeleteFilesTool class with invoke, prepareInvocation, handleToolStream, and resolveInput implementations.
  • Tool registration in ToolName/ContributedToolName enums, toolCategories, allTools.ts, package.json, and package.nls.json.
  • Conditional tool enablement in getAgentTools: enabled only when ApplyPatch is disabled.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/extension/tools/node/deleteFilesTool.tsx New tool implementation that deletes files via workspaceEdit stream and returns EditFileResult TSX
src/extension/tools/node/allTools.ts Side-effect import to register the new tool and docTool
src/extension/tools/common/toolNames.ts Adds DeleteFiles to ToolName/ContributedToolName enums and toolCategories map
src/extension/intents/node/agentIntent.ts Enables DeleteFiles only when ApplyPatch is disabled
package.nls.json Localizable strings for the new tool's name and description
package.json Tool schema declaration and addition to the editFiles group

Comment thread src/extension/tools/node/deleteFilesTool.tsx Outdated
Comment thread src/extension/tools/node/deleteFilesTool.tsx Outdated
Comment thread src/extension/tools/node/deleteFilesTool.tsx
Comment thread src/extension/intents/node/agentIntent.ts
@mossgowild mossgowild closed this Mar 27, 2026
@mossgowild mossgowild deleted the delete-files-tool branch March 27, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add file deletion tool support for non-OpenAI models in agent mode

4 participants