Skip to content

Separate default GitHub tools lists for local and remote modes#1828

Merged
pelikhan merged 4 commits intomainfrom
copilot/separate-github-tools-lists
Oct 16, 2025
Merged

Separate default GitHub tools lists for local and remote modes#1828
pelikhan merged 4 commits intomainfrom
copilot/separate-github-tools-lists

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 16, 2025

Overview

This PR separates the default GitHub MCP tools lists for local (Docker-based) and remote (hosted) server modes, allowing for different tool sets between the two deployment types.

Problem

Previously, a single DefaultGitHubTools constant was used for both local (Docker) and remote (hosted) GitHub MCP servers. This prevented customization of tool sets based on the deployment mode, even though the two modes may have different capabilities or requirements.

Solution

Created separate constants for each mode:

  • DefaultGitHubToolsLocal - Default tools for Docker-based GitHub MCP servers
  • DefaultGitHubToolsRemote - Default tools for hosted GitHub MCP servers at https://api.githubcopilot.com/mcp/
  • DefaultGitHubTools - Deprecated, now points to DefaultGitHubToolsLocal for backward compatibility

The compiler and engines now detect the mode from the workflow configuration and use the appropriate tool list:

tools:
  github:
    mode: local    # Uses DefaultGitHubToolsLocal
    
tools:
  github:
    mode: remote   # Uses DefaultGitHubToolsRemote

Implementation Details

Changes to pkg/constants/constants.go

  • Created DefaultGitHubToolsLocal with 67 default read-only GitHub tools
  • Created DefaultGitHubToolsRemote with 67 default read-only GitHub tools
  • Updated DefaultGitHubTools to alias DefaultGitHubToolsLocal for backward compatibility

Changes to pkg/workflow/compiler.go

Modified applyDefaultTools() to:

  1. Extract the mode using getGitHubType(githubTool)
  2. Select DefaultGitHubToolsRemote for remote mode, DefaultGitHubToolsLocal otherwise
  3. Apply the appropriate default tools based on mode

Changes to pkg/workflow/claude_engine.go

Modified computeAllowedClaudeToolsString() to:

  1. Extract the mode using getGitHubType(mcpConfig) when processing GitHub tools
  2. Select the appropriate default tools list based on mode
  3. Generate MCP tool permissions accordingly

Tests

Added pkg/workflow/github_tools_mode_test.go with comprehensive tests:

  • Verifies both new constants exist and contain expected tools
  • Validates backward compatibility via DefaultGitHubTools
  • Confirms mode-based tool selection in applyDefaultTools()
  • Tests local mode (default), explicit local mode, and remote mode

Current Behavior

Both lists currently contain the same 67 tools, maintaining existing behavior while providing the infrastructure to easily differentiate them when requirements are identified.

Validation

  • ✅ All unit tests passing (67 test files)
  • ✅ All integration tests passing
  • ✅ Build successful
  • ✅ All 64 workflows recompiled successfully
  • ✅ Code formatted and linted via make agent-finish
  • ✅ Zero errors, 12 warnings (pre-existing)

Backward Compatibility

All existing code continues to work without modification:

  • DefaultGitHubTools still exists and points to local mode tools
  • Workflows without explicit mode default to local mode
  • No breaking changes to the public API

Fixes #[issue-number]

Original prompt

Separate the default list of github tools for the local (docker) and remote servers since they are slightly different.

Store the lists in constants.go .


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits October 16, 2025 22:47
- Created DefaultGitHubToolsLocal constant for Docker-based servers
- Created DefaultGitHubToolsRemote constant for hosted servers
- Kept DefaultGitHubTools for backward compatibility (points to local)
- Updated compiler.go to use mode-specific constants
- Updated claude_engine.go to use mode-specific constants
- All tests passing

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Added TestGitHubToolsModeSeparation to verify constants exist
- Added TestApplyDefaultToolsUsesCorrectMode to verify mode-based selection
- All unit tests passing
- Build successful
- Workflows recompiled successfully

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review October 16, 2025 22:51
@github-actions
Copy link
Copy Markdown
Contributor

Agentic Changeset Generator triggered by this pull request.

Copilot AI changed the title [WIP] Separate default list of GitHub tools for local and remote servers Separate default GitHub tools lists for local and remote modes Oct 16, 2025
Copilot AI requested a review from pelikhan October 16, 2025 22:54
@pelikhan pelikhan merged commit 6678ca6 into main Oct 16, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/separate-github-tools-lists branch October 16, 2025 22:55
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