Skip to content

Add non-default find_duplicate tool gated by duplicate_detection flag - #3020

Draft
michaeljacholke wants to merge 1 commit into
mainfrom
mj/find-duplicate-tool
Draft

Add non-default find_duplicate tool gated by duplicate_detection flag#3020
michaeljacholke wants to merge 1 commit into
mainfrom
mj/find-duplicate-tool

Conversation

@michaeljacholke

Copy link
Copy Markdown
Contributor

Summary

Adds a read-only find_duplicate MCP tool that returns ranked duplicate candidates for an existing issue, gated behind a new opt-in duplicate_detection feature flag.

Why

Enables agents to answer "what likely duplicates this issue?" using GitHub's semantic-similarity endpoint, without adding schema cost to agents that haven't opted into duplicate detection. Semantic ranking stays server-side; the tool is a thin, read-only client.

Closes https://github.com/github/plan-track-agentic-toolkit/issues/690

What changed

  • Add find_duplicate tool (Issues toolset, read-only) calling GET /repos/{owner}/{repo}/issues/{issue_number}/semantically_similar
  • Add duplicate_detection feature flag to AllowedFeatureFlags (deliberately not in InsidersFeatureFlags so it's never implicitly enabled)
  • Map confidence_thresholdthreshold, perPageper_page, page; omit optional params when unset so the API's high-precision defaults apply
  • Preserve the full issue plus ranking metadata (score nullable, confidence, likely_duplicate); surface a clear error for legacy bare-issue responses instead of a success-shaped empty list
  • Add unit tests, tool snapshot, and regenerate docs/feature-flags.md

MCP impact

  • New tool added
    • Adds find_duplicate to the Issues toolset. It is non-default and only registered when the duplicate_detection feature flag is enabled via --features or X-MCP-Features.

Prompts tested (tool changes only)

  • "Find likely duplicates of issue #123 in octo-org/example"
  • "Are there any existing issues that duplicate #456? Only show high-confidence matches" (exercises confidence_threshold)
  • "Show the top 5 possible duplicates of issue #789" (exercises perPage/page)

Security / limits

  • Auth / permissions considered
    • Uses the caller's existing GitHub authentication; repository visibility and issue authorization are enforced by the API. The tool is read-only and mutates nothing.
  • Data exposure, filtering, or token/size limits considered
    • Results are scoped to the source issue's repository (API-enforced) and support pagination via perPage/page.

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

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

Docs

  • Updated (README / docs / examples)
    • Regenerated docs/feature-flags.md (documents the duplicate_detection opt-in and the read-only, single-repository find_duplicate tool). README needs no change — gated tools are intentionally excluded from its tool listing.

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.

1 participant