Query Subgraph
query_subgraphRun a GraphQL query against a subgraph on The Graph network. subgraph_id is the deployment hash (starts with "Qm…" or the new "0x…" subgraph ID from thegraph.com/explorer). Returns the GraphQL data block plus any errors. Requires your own The Graph API key, passed as _apiKey.
Example tool call
This call uses example arguments supplied in the tool’s input schema.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "{ pools(first: 5) { id feeTier liquidity } }",
"_apiKey": "your-thegraph-api-key",
"subgraph_id": "5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV"
},
"name": "query_subgraph"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | GraphQL query string | |
| _apiKey | Yes | Your own The Graph API key (BYO — Pipeworx does not supply one). Free 100k queries/month after signup at https://thegraph.com/studio/apikeys. | |
| variables | No | Optional GraphQL variables object | |
| subgraph_id | Yes | Subgraph deployment ID (look up at thegraph.com/explorer; e.g., Uniswap v3 Ethereum is "5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV") |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | GraphQL query result data block, or null if not returned | |
| errors | Yes | Array of GraphQL errors, if any | |
| subgraph_id | Yes | Subgraph deployment ID provided in the query |