Commit Graph

303 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] c27b90778a Regenerate toolsnaps with deterministic sorting
Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
2026-01-15 16:18:27 +00:00
copilot-swe-agent[bot] 87a1110c15 Implement recursive JSON key sorting for toolsnaps
Sort all JSON object keys alphabetically at every level in toolsnaps by
unmarshaling and remarshaling. This leverages Go's built-in behavior where
json.Marshal automatically sorts map keys alphabetically, ensuring
consistent field ordering and eliminating noop churn in diffs.

Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
2026-01-15 16:15:39 +01:00
copilot-swe-agent[bot] d18f26e559 Add GraphQL-Features header support for agent assignment API
- Add context-based GraphQL feature flag support
- Modify bearerAuthTransport to read features from context and add GraphQL-Features header
- Use issues_copilot_assignment_api_support feature flag for updateIssue mutation
- Export GetGraphQLFeatures function for use in HTTP transport layer

This allows the assign_copilot_to_issue tool to work with the non-GA agent assignment API
by sending the required GraphQL-Features header.

Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
2026-01-12 15:45:58 +01:00
copilot-swe-agent[bot] 88d117bd82 Add base_ref support to assign_copilot_to_issue tool
- Add optional base_ref parameter to tool schema
- Change from replaceActorsForAssignable to updateIssue mutation with agentAssignment
- Add AgentAssignmentInput and UpdateIssueInput structs for new GraphQL mutation
- Update all tests to use new mutation structure
- Add test case for base_ref functionality
- Update toolsnaps and documentation

Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
2026-01-12 15:45:58 +01:00
Sam Morrow c44ce2e2b8 chore: remove unused filterResourcesByURI function
Build and Test Go Project / build (ubuntu-latest) (push) Has been cancelled
Build and Test Go Project / build (windows-latest) (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
Docker / build (push) Has been cancelled
Build and Test Go Project / build (macos-latest) (push) Has been cancelled
GoReleaser Release / release (push) Has been cancelled
Publish to MCP Registry / publish (push) Has been cancelled
2026-01-12 14:19:11 +01:00
Sam Morrow 53a672040f fix: keep all resources registered for resources/read requests
The ForMCPRequest optimization was incorrectly filtering resources by
doing an exact string match between the URI template pattern and the
concrete URI. This would never match because templates like
'repo://{owner}/{repo}/contents{/path*}' don't match concrete URIs
like 'repo://owner/repo/contents/file.py'.

Instead of implementing template matching in the inventory, we simply
keep all resources registered for resources/read requests and let the
SDK handle URI template matching internally (which it already does
correctly via uritemplate.Regexp().MatchString()).

This fixes resources/read returning 'Resource not found' for valid URIs.
2026-01-12 14:19:11 +01:00
Sam Morrow 676956faf3 Fix resource handler to use deps from context
The RepositoryResourceContentsHandler was using closure-captured deps
instead of retrieving them from context at call time. This causes issues
on the remote server which injects per-request deps via context.

Changed to use MustDepsFromContext(ctx) pattern consistent with tool
handlers in NewTool and NewToolFromHandler.
2026-01-12 14:05:19 +01:00
Tommaso Moro b1ab893af3 bug fix (#1775) 2026-01-09 12:10:42 +00:00
Sam Morrow cc9e8645c1 Fix nil pointer dereference in completion handler
The CompleteParams.Context field is optional (marked omitempty) and can be
nil when clients don't send it. The code was accessing Context.Arguments
directly without checking if Context was nil first, causing a panic.

This fix adds a nil check for Context before accessing Arguments.
2026-01-07 15:44:58 +00:00
Matt Holloway 71862a93e4 update tests to use new mock pattern 2026-01-06 17:38:12 +00:00
Matt Holloway a57b4726e5 add http resp code checking for getProjectItem 2026-01-06 17:38:12 +00:00
Matt Holloway be5a449e48 fix project tools to add scope to newtool init 2026-01-06 17:38:12 +00:00
Matt Holloway 099f995615 revert "hold-bac feature flag" 2026-01-06 17:38:12 +00:00
Matt Holloway 304f07401e hold-bac feature flag 2026-01-06 17:38:12 +00:00
Matt Holloway 3cd0be2af2 update tool aliases 2026-01-06 17:38:12 +00:00
Matt Holloway 66a01645f8 initial projects consolidation 2026-01-06 17:38:12 +00:00
Copilot 80b0306557 Replace go-github-mock with stretchr/testify for actions/issues/projects tests (#1737)
* Initial plan

* migrate tests from go-github-mock to internal testify-based mock

Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>

* address feedback in testmock helper

Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>

* tweak testmock path matching edge case

Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>

* refine testmock options and path matching

Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>

* simplify matchPath and document delete endpoint

Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>

* Replace go-github-mock usage in tests with shared HTTP mock helper

Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>

* Replace go-github-mock usage in tests with shared HTTP mock helper

Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>

* fix tests and lint after mock cleanup

Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>

* Remove import completely

* Partial removal in repositories_test.go

* Final removal

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>
Co-authored-by: JoannaaKL <joannaakl@github.com>
2026-01-06 10:45:29 +01:00
Sam Morrow c428f72863 Don't filter read-only repo tools (work on public repos without scope) 2026-01-05 16:05:24 +00:00
Sam Morrow 4deaa8321e Remove empty filter.go and document OAuth scope challenges 2026-01-05 16:05:24 +00:00
Sam Morrow c2450ce96a Update pkg/scopes/filter.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-05 16:05:24 +00:00
Sam Morrow 46b8cb63ac Add PAT scope filtering for stdio server
Add the ability to filter tools based on token scopes for PAT users.
This uses an HTTP HEAD request to GitHub's API to discover token scopes.

New components:
- pkg/scopes/filter.go: HasRequiredScopes checks if scopes satisfy tool requirements
- pkg/scopes/fetcher.go: FetchTokenScopes gets scopes via HTTP HEAD to GitHub API
- pkg/github/scope_filter.go: CreateScopeFilter creates inventory.ToolFilter

Integration:
- Add --filter-by-scope flag to stdio command (disabled by default)
- When enabled, fetches token scopes on startup
- Tools requiring unavailable scopes are hidden from tool list
- Gracefully continues without filtering if scope fetch fails (logs warning)

This allows the OSS server to have similar scope-based tool visibility
as the remote server, and the filter logic can be reused by remote server.
2026-01-05 16:05:24 +00:00
Sam Morrow 48744ca556 Sort scope slices for deterministic output
Map iteration in Go is non-deterministic, which causes doc generation
to produce different output on each run. Sort the scope slices in:
- ScopeSet.ToSlice()
- ScopeSet.ToStringSlice()
- ExpandScopes()
2026-01-05 15:54:17 +00:00
Sam Morrow cec5a1ae0f Fix conflict and regenerate docs after rebase 2026-01-05 15:54:17 +00:00
Sam Morrow df9fc6a3b3 Use repo scope for star/unstar tools instead of public_repo
public_repo is implicit - the GitHub API handles the distinction between
public and private repos. Using repo as the required scope is more
consistent with our enforcement model:
- PATs: tools visible if token has repo scope
- OAuth: scope challenge requests repo scope
2026-01-05 15:54:17 +00:00
Sam Morrow 7796c08681 Add scope hierarchy and auto-derive accepted scopes
- Add ScopeHierarchy map defining parent-child scope relationships
- Add ExpandScopes() function to derive accepted scopes from required scopes
- Update NewTool/NewToolFromHandler to take []scopes.Scope and auto-derive AcceptedScopes
- Add new scope constants: NoScope, User, ReadUser, UserEmail, ReadPackages, WritePackages
- Update all tool files to use new signature with typed scopes
- Add comprehensive tests for ExpandScopes

The scope hierarchy allows automatic derivation of accepted scopes:
- repo → public_repo, security_events
- admin:org → write:org → read:org
- project → read:project
- write:packages → read:packages
- user → read:user, user:email

This enables the remote server to consume scope info directly from OSS tools.
2026-01-05 15:54:17 +00:00
copilot-swe-agent[bot] db179be4c3 Simplify scope implementation per feedback
- Replace NewToolWithScopes with updated NewTool that includes scope parameters
- All tools now use the same constructor with explicit scope requirements
- Documentation only shows accepted scopes when they differ from required
- Removed NewToolWithScopes and NewToolFromHandlerWithScopes helper functions

Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
2026-01-05 15:54:17 +00:00
copilot-swe-agent[bot] db9f4e8ddf Complete OAuth scope implementation for all tools
- Updated all remaining tools with OAuth scope information
- Added scope documentation generation to generate-docs command
- Documentation now shows Required and Accepted OAuth scopes for each tool
- All 100+ tools now have scope information defined
- Tests pass, linter passes, documentation generated successfully

Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
2026-01-05 15:54:17 +00:00
copilot-swe-agent[bot] 1e5931a2ab Update most tools with OAuth scope information
- Updated 60+ tools with required and accepted OAuth scopes
- Added scopes to: gists, git, notifications, projects, code scanning,
  dependabot, secret scanning, security advisories, actions, discussions,
  issues (partial), labels, pull requests (partial), repositories (partial), search (partial)
- Remaining: ~20 tools in issues, pullrequests, repositories, and search files

Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
2026-01-05 15:54:17 +00:00
copilot-swe-agent[bot] eb6db0fb5d Add scopes package and update ServerTool struct with scope fields
- Created pkg/scopes package with OAuth scope constants
- Added RequiredScopes and AcceptedScopes fields to ServerTool
- Added NewToolWithScopes helpers in dependencies.go
- Updated context tools (get_me, get_teams, get_team_members) with scopes

Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
2026-01-05 15:54:17 +00:00
Ksenia Bobrova 2b352ab0b9 Improvements to push_files tool (#1676)
Build and Test Go Project / build (macos-latest) (push) Has been cancelled
Build and Test Go Project / build (ubuntu-latest) (push) Has been cancelled
Build and Test Go Project / build (windows-latest) (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
Docker / build (push) Has been cancelled
GoReleaser Release / release (push) Has been cancelled
Publish to MCP Registry / publish (push) Has been cancelled
* Fallback to default branch in get_file_contents when main doesn't exist

* Addressing review comments

* Improvements to push_files tool

* Fixed copilot comments

* Addressing review comments

* Remove debug statement
2026-01-05 13:27:32 +01:00
Matt Holloway 6f7bf271ed refactor docs toolset gen 2026-01-05 10:14:37 +00:00
Matt Holloway cac11f2d34 exclude tools requiring ff from docs 2026-01-05 10:14:37 +00:00
majiayu000 116c574255 fix: filterToolsByName returns all matching tools for feature flag filtering
When multiple tools share the same name but have different feature flags
(like GetJobLogs and ActionsGetJobLogs both named "get_job_logs"),
filterToolsByName was only returning the first match. This caused the
remote server to fail with "unknown tool" error when the first matching
tool was disabled by feature flags, even though another variant was enabled.

The fix modifies filterToolsByName to return ALL tools with matching names,
allowing the feature flag filtering in AvailableTools to select the correct
variant based on the enabled flags.

Fixes #1714

Signed-off-by: majiayu000 <1835304752@qq.com>
2026-01-05 10:08:59 +00:00
Adam Holt 762845a8b7 Add API Error annotations to GitHub issue errors (#1566)
* Add API Error annotations to GitHub issue errors

* Return an error back.

---------

Co-authored-by: Matt Holloway <mattdholloway@github.com>
2026-01-02 14:19:06 +00:00
majiayu000 2cc6911d4b refactor: use consistent snake_case for issue_number parameter
Change the parameter name in assign_copilot_to_issue tool from
'issueNumber' (camelCase) to 'issue_number' (snake_case) to match
the naming convention used by all other tools in the issues toolset.

This improves API consistency and makes the tool parameters more
predictable for users and AI models.

Fixes #1239

Signed-off-by: majiayu000 <1835304752@qq.com>
2025-12-31 18:53:12 +00:00
Matt Holloway 43bea59a19 Change list workflow runs to allow empty resource id to list all runs in repo (#1682)
* change list workflow runs to allow empty resource id to list all runs in repo

* update docs
2025-12-29 10:25:17 +00:00
Ksenia Bobrova 942607595c Fallback to default branch in get_file_contents when main doesn't exist (#1669)
* Fallback to default branch in get_file_contents when main doesn't exist

* Addressing review comments
2025-12-23 15:24:23 +01:00
copilot-swe-agent[bot] 8ac1eb46ff Use typed IconTheme constants from Go SDK
Replace string conversions with mcp.IconThemeLight and mcp.IconThemeDark
constants to match the SDK's typed IconTheme field. This fixes the CI build
errors where string literals were being used instead of the proper IconTheme type.

Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
2025-12-22 23:18:29 +00:00
tommaso-moro b5be18c958 remove experiments toolset 2025-12-22 10:15:52 +00:00
Ksenia Bobrova 2f31c15393 get_file_contents fetch refs improvements (#1655)
* get_file_contents improvements

* Return custom errors when main ref is supplied

* Remove test for short sha

* Apply Copilot suggestion
2025-12-22 10:55:57 +01:00
triepod-ai 6c0bbb85ad chore: Update toolsnap for delete_project_item with destructiveHint
Add destructiveHint: true to the snapshot file to match the code change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-22 04:33:22 +00:00
triepod-ai 844137c378 feat: Add DestructiveHint to delete_project_item tool annotation
Add DestructiveHint: true to the delete_project_item tool to be
consistent with other delete operations (delete_file and
delete_workflow_run_logs) that properly indicate destructive behavior.

This helps LLMs better understand that this tool permanently removes
data and should be used with appropriate caution.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-22 04:33:22 +00:00
Adam Holt b79d1264d5 Add raw client error annotation and annotate GetFileContents (#1570)
* Add raw client error annotation and annotate GetFileContents

* Track response.

* add raw errors to context

* add raw api error test

* Update pkg/errors/error.go

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

* Add blank line after Error() method for readability

* add NewGitHubRawAPIErrorResponse back

---------

Co-authored-by: Matt Holloway <mattdholloway@pm.me>
Co-authored-by: Matt Holloway <mattdholloway@github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-19 14:23:06 +00:00
Tommaso Moro 63c7db030a Add aliases for new actions tools (#1652)
Build and Test Go Project / build (windows-latest) (push) Has been cancelled
Build and Test Go Project / build (ubuntu-latest) (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
Docker / build (push) Has been cancelled
Build and Test Go Project / build (macos-latest) (push) Has been cancelled
GoReleaser Release / release (push) Has been cancelled
License Check / license-check (push) Has been cancelled
Publish to MCP Registry / publish (push) Has been cancelled
* add aliases for new actions tools

* generate docs
2025-12-19 10:33:23 +00:00
copilot-swe-agent[bot] a8fafad82b Omit icon sizes field for backward compatibility
Build and Test Go Project / build (macos-latest) (push) Has been cancelled
Build and Test Go Project / build (ubuntu-latest) (push) Has been cancelled
Build and Test Go Project / build (windows-latest) (push) Has been cancelled
GoReleaser Release / release (push) Has been cancelled
License Check / license-check (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
Docker / build (push) Has been cancelled
Publish to MCP Registry / publish (push) Has been cancelled
- Remove Sizes field from octicons.Icons() to fix compatibility with older MCP clients
- Older clients like Cursor expect sizes to be a string, not an array
- The 2025-11-25 MCP spec changed sizes from string to array
- Omitting the optional Sizes field makes icons compatible with all clients
- Update tests and toolsnaps to reflect the change

Fixes #1644

Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
2025-12-18 19:45:29 +01:00
Matt Holloway c0bd7b2744 fix ring buffer panic (#1556) 2025-12-18 16:48:24 +01:00
Matt Holloway cc5f53620e refine pattern matching logic to prioritise non-wildcard handlers in multiHandlerTransport
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
Docker / build (push) Has been cancelled
Build and Test Go Project / build (macos-latest) (push) Has been cancelled
Build and Test Go Project / build (ubuntu-latest) (push) Has been cancelled
Build and Test Go Project / build (windows-latest) (push) Has been cancelled
GoReleaser Release / release (push) Has been cancelled
License Check / license-check (push) Has been cancelled
Publish to MCP Registry / publish (push) Has been cancelled
2025-12-18 16:00:31 +01:00
Matt Holloway 27c10515f6 update tests 2025-12-18 16:00:31 +01:00
Matt Holloway f325b35b3c update consolidated actions tools for new handler pattern 2025-12-18 16:00:31 +01:00
Matt Holloway e7f5ca4815 update tests 2025-12-18 16:00:31 +01:00