run_graphql_request
Execute GraphQL queries with specified variables to retrieve data or perform actions via the H3 CLI MCP Server. Handles query execution and returns results in a structured format.
Instructions
Run a GraphQL request with the given query and variables.
Args:
graphql_query (str): The GraphQL query to execute. This should be a valid GraphQL query string.
variables (str, optional): A JSON string containing variables for the GraphQL query. If provided, this must be a valid JSON string.
Example (as a string):
'{"pageInput": {"page_num": 1, "page_size": 5}, "op_id": "abc123"}'
Example (for a query with variables):
query weaknesses_page($pageInput: PageInput, $op_id: String!) {
weaknesses_page(pageInput: $pageInput, op_id: $op_id) {
weaknesses { id title severity }
}
}
Pass variables as:
'{"pageInput": {"page_num": 1, "page_size": 10}, "op_id": "abc123"}'
Returns:
Dict with output and status. The output field contains the GraphQL response.
Notes:
- If variables cannot be passed as a separate parameter due to MCP limitations, you can embed them directly in your query using variable definitions.
- If the variables parameter is not a valid JSON string, a clear error message will be returned.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
graphql_query | Yes | ||
variables | No |
Input Schema (JSON Schema)
{
"properties": {
"graphql_query": {
"title": "Graphql Query",
"type": "string"
},
"variables": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Variables"
}
},
"required": [
"graphql_query"
],
"title": "run_graphql_requestArguments",
"type": "object"
}