Skip to content

Add confirmed repository deletion tool - #3076

Open
SamMorrowDrums wants to merge 1 commit into
mainfrom
sammorrowdrums-add-delete-repository-tool
Open

Add confirmed repository deletion tool#3076
SamMorrowDrums wants to merge 1 commit into
mainfrom
sammorrowdrums-add-delete-repository-tool

Conversation

@SamMorrowDrums

@SamMorrowDrums SamMorrowDrums commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a destructive delete_repository MCP tool that deletes a repository only after the user enters the exact owner/repo name through elicitation. The tool is exposed only for MCP protocol 2026-07-28 and newer.

Why

Repository deletion needs a stronger confirmation boundary than ordinary write operations, and the remote server supports the required multi-round-trip elicitation only on the current MCP protocol.

N/A - no linked issue.

What changed

  • Added delete_repository with the delete_repo OAuth scope, destructive annotations, and exact repository-name confirmation.
  • Added reusable minimum-protocol filtering for tools/list and direct tools/call requests across stdio and remote HTTP transports.
  • Added unit, in-memory multi-round-trip, and remote HTTP protocol-gating coverage plus the generated tool snapshot and README documentation.

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
  • New tool added

The new schema accepts owner and repo; execution then requests repository_name through multi-round-trip form elicitation before calling GitHub's delete repository API.

Prompts tested (tool changes only)

  • "Delete the owner/repo repository" - automated in-memory MCP coverage verifies elicitation, exact matching, refusal paths, and successful deletion.

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

The tool requires the dedicated delete_repo OAuth scope, refuses declined or mismatched confirmation, and is filtered out for protocol versions before 2026-07-28 in both local and remote deployments.

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Note: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

Add a destructive delete_repository tool that requires an exact owner/repo confirmation through multi-round-trip elicitation. Gate the tool to MCP protocol 2026-07-28 and newer across local and remote transports.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4b04480c-c2e9-483e-9b0f-34830b76a2f8
@SamMorrowDrums
SamMorrowDrums requested a review from a team as a code owner August 14, 2026 22:44
Copilot AI balanced review requested due to automatic review settings August 14, 2026 22:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds protocol-gated, elicitation-confirmed repository deletion.

Changes:

  • Adds delete_repository with delete_repo scope and destructive annotations.
  • Filters tools by minimum MCP protocol version.
  • Adds schema, unit, transport, and documentation updates.
Show a summary per file
File Description
README.md Documents the new tool.
pkg/scopes/scopes.go Defines delete_repo.
pkg/scopes/scopes_test.go Tests scope expansion.
pkg/inventory/server_tool.go Adds minimum protocol metadata.
pkg/inventory/registry.go Installs protocol filtering.
pkg/inventory/protocol_version.go Implements listing/call filtering.
pkg/inventory/protocol_version_test.go Tests protocol gating.
pkg/http/handler_test.go Tests HTTP tool visibility.
pkg/github/tools.go Registers the deletion tool.
pkg/github/repositories.go Implements confirmation and deletion.
pkg/github/repositories_test.go Tests deletion and elicitation.
pkg/github/helper_test.go Adds the mock endpoint constant.
pkg/github/__toolsnaps__/delete_repository.snap Captures the tool schema.
internal/ghmcp/oauth.go Reuses the protocol constant.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 14/14 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread pkg/github/repositories_test.go
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.

2 participants