-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Graphql toolset #645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Graphql toolset #645
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Introducing a new GraphQL toolset to enable arbitrary GraphQL queries against GitHub’s API, including implementation, tests, and documentation.
- Adds a
graphql
toolset in the default group - Implements
ExecuteGraphQLQuery
handler with error categorization - Provides unit/integration tests and updates docs/README
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
pkg/github/tools.go | Adds graphql toolset to DefaultToolsetGroup |
pkg/github/graphql_tools.go | Implements ExecuteGraphQLQuery tool and handler |
pkg/github/graphql_tools_test.go | Adds unit tests for GraphQL execution scenarios |
pkg/github/graphql_integration_test.go | Adds integration tests for GraphQL tools |
docs/remote-server.md | Includes GraphQL in the remote-server tools table |
docs/graphql-tools.md | Documents the new GraphQL tools and error categories |
README.md | Adds GraphQL toolset entry |
Comments suppressed due to low confidence (2)
docs/graphql-tools.md:53
- The documentation lists error categories like syntax, field, and type errors, but the implementation only categorizes
rate_limit
,authentication
,permission
,not_found
, andexecution_error
. Please align the docs with the actualerror_type
values or extend the implementation accordingly.
- **Syntax errors**: Malformed GraphQL syntax
pkg/github/graphql_tools_test.go:30
- Tests cover successful execution and missing parameters but do not exercise the error categorization branches (rate_limit, authentication, permission, not_found, execution_error). Add tests to simulate these error scenarios and verify the correct
error_type
is set.
tests := []struct {
|
||
client, err := getClient(ctx) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get GitHub client: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent error handling: returning a Go error here may cause the handler to propagate an internal error rather than returning a structured tool error. Consider using mcp.NewToolResultError
to return errors consistently.
return nil, fmt.Errorf("failed to get GitHub client: %w", err) | |
return mcp.NewToolResultError(fmt.Sprintf("failed to get GitHub client: %v", err)), nil |
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
Closes: TBD
Similar to the CLI support for running GraphQL queries, I am suggesting in this PR a
GraphQL
toolset which allows agent to compose and run any GraphQL query.Why is GraphQL a good fit for GitHub's MCP?
GraphQL allows discovery and context building:
Based on introspection, the agent can work its way through the schema and find possible ways of exposing information and making changes. This adds lots of unavailable information and actions the agent can't do so far.
Reading more data types
Access to more writing actions
More possibilities with less tools
No need to create a tool for each entity's CRUD operations and every mutations.
Up to date
New additions to the GraphQL schema are available in the MCP when they are released.