Skip to content

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

akenneth
Copy link

@akenneth akenneth commented Jul 6, 2025

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 ![image](https://github.com/user-attachments/assets/c45be177-d9e4-45ab-b994-772cabb5f859)

image

Access to more writing actions

image
image
image

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.

@akenneth akenneth marked this pull request as ready for review July 7, 2025 11:57
@Copilot Copilot AI review requested due to automatic review settings July 7, 2025 11:57
@akenneth akenneth requested a review from a team as a code owner July 7, 2025 11:57
Copy link
Contributor

@Copilot Copilot AI left a 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, and execution_error. Please align the docs with the actual error_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)
Copy link
Preview

Copilot AI Jul 7, 2025

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.

Suggested change
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.

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