Skip to main content
Glama
wanzunz

GitHub GraphQL API MCP

by wanzunz

call_github_graphql

Execute GraphQL queries to retrieve data from GitHub repositories, users, and organizations through the GitHub GraphQL API.

Instructions

A tool to execute GitHub GraphQL API queries. Before using, it's recommended to check the documentation first, and include ID fields in your queries for easier follow-up operations Args: graphql: The GraphQL query Returns: str: Execution result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
graphqlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'call_github_graphql' tool. It executes the GraphQL query against GitHub's API using the requests library, handles authentication via GITHUB_TOKEN environment variable, and returns the JSON response as a formatted string or an error message.
    @mcp.tool()
    def call_github_graphql(graphql: str) -> str:
        """A tool to execute GitHub GraphQL API queries. Before using, it's recommended to check the documentation first, and include ID fields in your queries for easier follow-up operations
        Args:
            graphql: The GraphQL query
        Returns:
            str: Execution result
        """
        try:
            # Set request headers including authorization
            headers = {
                "Content-Type": "application/json",
                "Accept": "application/json",
            }
            if GITHUB_TOKEN:
                headers["Authorization"] = f"Bearer {GITHUB_TOKEN}"
            # Send POST request
            response = requests.post(GITHUB_API_URL, headers=headers, json={'query': graphql})
    
            # Check response status
            if response.status_code == 200:
                # MCP tool output is expected to be a string; serialize JSON response.
                return json.dumps(response.json(), ensure_ascii=False)
            else:
                raise Exception(f"request failed: {response.status_code} - {response.text}")
        except Exception as e:
            return f"{e}."
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions checking documentation and including ID fields, which adds some operational context, but fails to address critical traits like authentication requirements, rate limits, error handling, or mutation vs. query behavior. For a GraphQL API tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves in practice.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the core purpose and usage recommendation in the first sentence. The Args and Returns sections are structured but could be more integrated. There's minimal waste, though the 'Returns: str: Execution result' is redundant given the output schema, slightly reducing efficiency.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (GraphQL API execution) and the presence of an output schema (which handles return values), the description is partially complete. It covers basic purpose and some usage tips but lacks details on authentication, error cases, or integration with sibling tools. Without annotations and with low schema coverage, it doesn't fully equip an agent for reliable tool invocation in a GitHub context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal meaning beyond the input schema: it names the single parameter 'graphql' and states it's 'The GraphQL query', which the schema already indicates as a string type. With 0% schema description coverage, the description doesn't compensate by explaining query syntax, validation rules, or examples. The baseline is 3 because the schema covers the parameter's existence and type, but the description fails to enhance understanding significantly.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'execute GitHub GraphQL API queries' with a specific verb (execute) and resource (GitHub GraphQL API queries). It distinguishes itself from sibling tools like graphql_schema_root_type and graphql_schema_type by focusing on query execution rather than schema exploration. However, it doesn't explicitly contrast with print_type_field, leaving some sibling differentiation incomplete.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance by recommending checking documentation first and including ID fields for follow-up operations, which suggests context for when to use this tool effectively. However, it lacks explicit when/when-not criteria or named alternatives to sibling tools, leaving the agent to infer optimal usage scenarios without clear boundaries.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wanzunz/github_graphql_api_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server