Advanced GraphQL
The MCP server includes 6 GraphQL tools for direct access to the Art Blocks Hasura API. Most users will never need these — the domain-specific tools cover common use cases. Use GraphQL for custom aggregations, sales history, cross-table joins, or any query not handled by the higher-level tools.
Tools
Recommended Workflow
explore_table → build_query → graphql_query
Discover the schema — Call
explore_tablewith the table you want to query. Forprojects_metadataandtokens_metadata, it returns a curated shortlist of the most useful fields organized by category, plus key relationships with suggested subfields. PassshowAllFields: truefor the full schema dump.Build a validated query — Call
build_querywith your desired fields and filters. It validates field names, adds suggestions for typos, and returns a ready-to-execute GraphQL query.Execute — Call
graphql_querywith the generated query. PasschainIdif your query needs chain filtering.
If you already know the schema, skip straight to build_query or graphql_query.
Key Tables
Always use the _metadata table variants — they include richer joined data and are optimized for read access.
query_optimizer automatically rewrites queries that reference the non-metadata variants.
projects_metadata — Common Fields
Key relationships: vertical, minter_configuration, featured_token, contract, artist_profiles, tags
tokens_metadata — Common Fields
Key relationships: project, image
Chain IDs
Pass chainId to graphql_query to make $chainId available as a variable in your query. Always filter by chain when querying multi-chain data to avoid cross-chain noise.
Example Queries
These examples show queries that require raw GraphQL — things the domain-specific tools don't cover.
Recent secondary sales
query {
purchases_metadata(
order_by: { block_timestamp: desc }
limit: 20
where: { chain_id: { _eq: 1 } }
) {
token_id
price_in_eth
block_timestamp
buyer_address
seller_address
}
}
Unique collectors for a project
# Fidenza by Tyler Hobbs (project 78 on Art Blocks V1 contract)
query {
tokens_metadata_aggregate(
where: {
project_id: { _eq: "0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-78" }
}
distinct_on: owner_address
) {
aggregate {
count
}
}
}
All tokens in a project (with features)
# Chromie Squiggle by Snowfro (project 0 on Art Blocks V1 contract)
query {
tokens_metadata(
where: {
project_id: { _eq: "0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270-0" }
}
order_by: { invocation: asc }
limit: 50
) {
token_id
invocation
owner_address
features
}
}
Projects using a specific script type
query {
projects_metadata(
where: {
script_type_and_version: { _ilike: "%three%" }
chain_id: { _eq: 1 }
complete: { _eq: false }
}
limit: 20
) {
id
name
artist_name
script_type_and_version
invocations
max_invocations
}
}
Tips
- Use
explore_tableto understand fields and relationships before writing a query — the curated view is much easier to scan than the full schema dump build_queryis the safest starting point — it validates fields and suggests corrections for typos- For unknown fields,
validate_fieldsis faster than running a fullgraphql_introspection - Always pass
chainIdwhen querying multi-chain data - The
idfield on projects follows the format<contract_address>-<project_index>and on tokens follows<contract_address>-<token_number>