Skip to main content
Glama
wanzunz

GitHub GraphQL API MCP

by wanzunz

graphql_schema_root_type

Retrieve GitHub GraphQL schema documentation for query or mutation root types to understand available operations and structure API calls.

Instructions

A tool to query GitHub GraphQL schema root types. You need to provide the root type name (QUERY/MUTATION) Args: type_name: root type (QUERY or MUTATION) Returns: str: Documentation content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
type_nameYes

Implementation Reference

  • The main handler function implementing the 'graphql_schema_root_type' tool logic. It is registered via the @mcp.tool() decorator. Retrieves the specified GraphQL root type (QUERY, MUTATION, or SUBSCRIPTION) from the pre-loaded schema and generates a markdown-formatted documentation string listing the type name, description, and fields.
    @mcp.tool()
    def graphql_schema_root_type(type_name: str):
        """A tool to query GitHub GraphQL schema root types. You need to provide the root type name (QUERY/MUTATION)
    Args:
        type_name: root type (QUERY or MUTATION)
    Returns:
        str: Documentation content
    """
        try:
            op = OperationType[type_name.upper()]
        except Exception:
            return f"Invalid type_name: {type_name}. Expected one of: QUERY, MUTATION, SUBSCRIPTION."
    
        graphql_type = schema.get_root_type(op)
        doc_str = (f"# Type Name: {graphql_type.name}\n")
        if hasattr(graphql_type, 'description') and graphql_type.description:
            doc_str += (f"Description: {graphql_type.description}\n")
        else:
            doc_str += ("No description provided.\n")
    
        if hasattr(graphql_type, 'fields'):
            doc_str += ("## Fields:\n")
            for field_name, field in graphql_type.fields.items():
                field_description = getattr(field, "description", None) or "No description"
                doc_str += (f"### {field_name} \n ```markdown\n{field_description}\n```\n ")
        return doc_str

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