Skip to main content
Glama
franccesco

Bloomy MCP

by franccesco

get_query_details

Retrieve comprehensive details about specific GraphQL queries, including argument requirements, return types, descriptions, and example usage. Outputs results in YAML format for clarity and integration.

Instructions

Get detailed information about specific GraphQL queries.

Retrieves argument requirements, return type information, descriptions, and
example usage for the specified queries.

Args:
    query_names: Comma-separated list of query names to get details for

Returns:
    A YAML-formatted string containing detailed information about the requested queries

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
query_namesYes

Implementation Reference

  • The handler function implementing the 'get_query_details' tool logic. It wraps get_operation_details to fetch query-specific schema details.
    def get_query_details(query_names: str) -> str:
        """Get detailed information about specific GraphQL queries.
    
        Retrieves argument requirements, return type information, descriptions, and
        example usage for the specified queries.
    
        Args:
            query_names: Comma-separated list of query names to get details for
    
        Returns:
            A YAML-formatted string containing detailed information about the requested queries
        """
        return get_operation_details(query_names, "query")
  • Registration of the get_query_details tool using the FastMCP tool decorator.
    mcp.tool()(get_query_details)
  • Core helper function that performs GraphQL schema introspection to gather operation details, formats them, and returns YAML. Called by get_query_details.
    def get_operation_details(operation_names: str, operation_type: str) -> str:
        """Get detailed information about specific GraphQL operations.
    
        Retrieves and formats detailed information about GraphQL queries or mutations,
        including arguments, return types, and example usage.
    
        Args:
            operation_names: Comma-separated list of operation names to get details for
            operation_type: Either "query" or "mutation"
    
        Returns:
            A YAML-formatted string containing detailed information about the requested operations
    
        Raises:
            Exception: If there's an error retrieving the operation details
        """
        type_name = "QueryType" if operation_type == "query" else "MutationType"
    
        details_query = gql(
            f"""
        {{
          __type(name: "{type_name}") {{
            fields(includeDeprecated: false) {{
              name
              description
              args {{
                name
                description
                type {{
                  kind
                  name
                  ofType {{
                    kind
                    name
                    ofType {{
                      kind
                      name
                      ofType {{
                        kind
                        name
                      }}
                    }}
                  }}
                }}
                defaultValue
              }}
              type {{
                kind
                name
                ofType {{
                  kind
                  name
                }}
              }}
            }}
          }}
        }}
        """
        )
    
        try:
            result = default_client.execute(details_query)
    
            # Parse the list of operation names
            operation_name_list = [name.strip() for name in operation_names.split(",")]
    
            # Collect all requested operations
            all_details = {}
    
            for operation_name in operation_name_list:
                # Find the specific operation
                operation_info = None
                for field in result["__type"]["fields"]:
                    if field["name"] == operation_name:
                        operation_info = field
                        break
    
                if not operation_info:
                    all_details[operation_name] = f"{operation_type.capitalize()} '{operation_name}' not found"
                    continue
    
                # Format arguments
                args = []
                for arg in operation_info["args"]:
                    type_info = format_type_info(arg["type"])
                    args.append(
                        {
                            "name": arg["name"],
                            "description": arg["description"] or "No description",
                            "type": type_info,
                            "required": type_info.endswith("!"),
                            "defaultValue": arg["defaultValue"],
                        }
                    )
    
                # Format return type
                return_type = format_type_info(operation_info["type"])
    
                # Create result structure
                details = {
                    "name": operation_name,
                    "description": operation_info["description"] or "No description",
                    "arguments": args,
                    "returnType": return_type,
                    "example": generate_operation_example(operation_name, args, operation_type),
                }
    
                all_details[operation_name] = details
    
            return yaml.dump(all_details, sort_keys=False)
    
        except Exception as e:
            return f"Error getting {operation_type} details: {str(e)}"
Install Server

Other Tools

Related 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/franccesco/bloomy-mcp'

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