feat: Auto-exclude built-in tools overridden by user-registered tools#523
Draft
feat: Auto-exclude built-in tools overridden by user-registered tools#523
Conversation
Auto-add user-registered tool names to excludedTools in session.create/resume RPC payloads so that SDK-registered tools override CLI built-in tools. - Node.js: mergeExcludedTools() helper + createSession/resumeSession updates - Python: inline merge logic in create_session/resume_session - Go: mergeExcludedTools() helper + CreateSession/ResumeSessionWithOptions updates - .NET: MergeExcludedTools() helper + CreateSessionAsync/ResumeSessionAsync updates - Tests added for all 4 SDKs - All 4 READMEs updated with "Overriding Built-in Tools" documentation Co-authored-by: patniko <26906478+patniko@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review code changes in branch
feat: Auto-exclude built-in tools overridden by user-registered tools
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When users register tools whose names collide with CLI built-ins (e.g.
edit_file,read_file), the CLI would intercept those calls instead of dispatching to the user's handler. The fix: automatically merge user-registered tool names intoexcludedToolsonsession.create/session.resume, so the CLI skips its built-in and the SDK dispatches locally.Changes
mergeExcludedTools()helper; applied increateSession+resumeSessiondict.fromkeys()for dedup; applied increate_session+resume_sessionmergeExcludedTools()helper with map-based dedup; applied inCreateSession+ResumeSessionWithOptionsMergeExcludedTools()internal static helper usingUnion(); applied inCreateSessionAsync+ResumeSessionAsync; addedInternalsVisibleTofor test projectExample (Node.js)
Backward-compatible: users with no name collisions see no behavior change.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/copilot_internal/user/opt/hostedtoolcache/node/22.22.0/x64/bin/node /opt/hostedtoolcache/node/22.22.0/x64/bin/node /home/REDACTED/work/copilot-sdk/copilot-sdk/nodejs/node_modules/@github/copilot/index.js --headless --no-auto-update --log-level debug --stdio ache/node/22.22.0/x64/bin/git(http block)/opt/hostedtoolcache/node/22.22.0/x64/bin/node /opt/hostedtoolcache/node/22.22.0/x64/bin/node /home/REDACTED/work/copilot-sdk/copilot-sdk/nodejs/node_modules/@github/copilot/index.js --headless --no-auto-update --log-level debug --stdio cal/bin/git(http block)/opt/hostedtoolcache/node/22.22.0/x64/bin/node /opt/hostedtoolcache/node/22.22.0/x64/bin/node /home/REDACTED/work/copilot-sdk/copilot-sdk/nodejs/node_modules/@github/copilot/index.js --headless --no-auto-update --log-level debug --stdio rgo/bin/git(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
i want to review the code in this branch
Chronological Review: 1. User asked about branch changes → on main, no changes 2. User asked for 10 recent issues → listed, recommended #518 3. User asked to find issue about overriding tools → found #411 4. User entered plan mode → analyzed codebase extensively via explore agents, created plan with 5 todos 5. User entered fleet mode → dispatched 4 parallel agents for SDK implementations 6. All 4 agents completed, then docs agent dispatched and completed 7. User asked to commit, push, and open PR → done successfullyIntent Mapping:
Technical Inventory:
Code changes across 13 files, all committed and pushed.
Recent Commands: git commit, git push, gh pr create → PR #522 created
1. Conversation Overview: - Primary Objectives: User wanted to explore the copilot-sdk repo, find a good issue to work on, then plan and implement Issue #411 ("Support overriding built-in tools"), and finally commit/push/open a PR. - Session Context: Started with repo exploration → issue review → found #411 about tool overrides → planned implementation → executed across all 4 SDKs in parallel → committed and opened PR #522. - User Intent Evolution: Browse issues → focus on #411 → plan → execute → ship.-
- Repo:
- 4 SDKs: Node.js (
- Issue Support overriding built-in tools #411: Users registering tools with names colliding with built-in CLI tools (e.g.,
- Solution: Auto-add user-registered tool names to
- Key architecture:
-
- Added
- Called in
- 4 new tests: tools added to excludedTools, deduplication, no-op, resumeSession
- Inline merge logic in both
- Uses
- 4 new tests in
- Added
- Called in
- Added
- Called in
- Added
- New file with 5 tests; all pass
- All 4 READMEs updated with "Overriding Built-in Tools" subsection + code examples
-
- Issue Support overriding built-in tools #411 comments confirmed: maintainer @SteveSandersonMS approved "override by name" approach
- No
- Backward-compatible: users not naming tools after built-ins see no change
-
- ✅ node-override — done
- ✅ python-override — done
- ✅ go-override — done
- ✅ dotnet-override — done
- ✅ docs-update — done
- ✅ Committed, pushed, PR opened
-
- All work complete. PR feat: Support overriding built-in tools #522 is open at feat: Support overriding built-in tools #522
- Branch:
- 13 files changed, 395 insertions, 9 deletions
-
- Last Agent Commands:
- Tool Results Summary: All succeeded. PR URL: https://github.com/git...
Technical Foundation:
github/copilot-sdkat/Users/patrick/projects/copilot-sdknodejs/), Python (python/), Go (go/), .NET (dotnet/)Bash,Read,Edit) couldn't override them — CLI handled them instead of dispatching to user's handler.excludedToolsin thesession.create/session.resumeRPC payload so CLI excludes its built-in and SDK dispatches locally.SessionConfig.tools→ mapped to RPC payload → CLI usesexcludedToolsto skip built-ins → SDK'stool.callhandler dispatches to user's registered handler.Codebase Status:
nodejs/src/client.ts:mergeExcludedTools()helper function (~L57)createSession(~L545) andresumeSession(~L623)nodejs/test/client.test.ts:python/copilot/client.py:create_session(~L483) andresume_session(~L658)dict.fromkeys()for deduplicationpython/test_client.py:TestExcludedToolsFromRegisteredToolsclass; all 26 tests passgo/client.go:mergeExcludedTools()helper (~L1355)CreateSession(~L464) andResumeSessionWithOptions(~L561)go/client_test.go:TestMergeExcludedToolswith 4 sub-testsdotnet/src/Client.cs:MergeExcludedTools()internal static helper (~L855)CreateSessionAsync(~L385) andResumeSessionAsync(~L470)dotnet/src/GitHub.Copilot.SDK.csproj:InternalsVisibleTofor test projectdotnet/test/MergeExcludedToolsTests.cs:Problem Resolution:
externalToolDefinitions/externalToolDispatcherfields exist despite issue description — theSessionConfig.tools+excludedToolsapproach is the correct mechanismProgress Tracking:
Active Work State:
support-tool-overridesRecent Operations:
git checkout -b support-tool-overrides && git add -A→ branch created, all changes stagedgit commit -m "feat: auto-exclude built-in tools overridden by user-registered tools..."→ committed asdc83960git push -u origin support-tool-overrides→ pushed successfullygh pr create --title "feat: Support overriding built-in tools" --body "..." --base main→ created PR feat: Support overriding built-in tools #522Created from Copilot CLI via the copilot delegate command.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.