GraphQL recipe library
These examples use the documented GraphQL root operations. They are not MCP tool input JSON. For Place Score queries, see the note below.
Resolve a city by name
graphql
query {
search(text: "Madrid", nodeType: "Cities", first: 5) {
edges { node { id title node_type country_code } }
pageInfo { hasNextPage endCursor }
}
}Use the city ID 27799 from the Madrid resolution example for subsequent queries.
Discover attractions recursively in Madrid
graphql
query {
descendantsOf(ancestorId: "27799", nodeType: "Attractions", first: 20) {
edges { node { id title category rating rating_votes address location { lat lon } } }
pageInfo { hasNextPage endCursor }
}
}Prioritize Place Score
graphql
query {
descendantsOf(
ancestorId: "27799"
nodeType: "Attractions"
place_score_gte: 80
orderBy: { field: PLACE_SCORE, direction: DESC }
first: 20
) {
edges { node { id title place_score rating rating_votes } }
pageInfo { hasNextPage endCursor }
}
}Search for a keyword within a city
graphql
query {
search(text: "rooftop", ancestor_id: "27799", nodeType: "Bars", first: 10) {
edges { node { id title category address } }
pageInfo { hasNextPage endCursor }
}
}Explore immediate neighbourhoods
graphql
query {
childrenOf(parentId: "27799", nodeType: "Neighbourhoods", first: 30) {
edges { node { id title node_type parent_id } }
pageInfo { hasNextPage endCursor }
}
}Get a detailed record
graphql
query {
node(id: "3127593") {
id title category tagline short_description address country_code
rating rating_votes location { lat lon }
}
}Lookup by slug
graphql
query {
bySlugId(slugId: "spain/madrid/attraction/museo-nacional-del-prado") {
id title slug_id node_type
}
}Global inventory counts
graphql
query {
nodeCount(nodeType: "Restaurants")
}Request variables instead of interpolating values
graphql
query GetPlace($id: String!) {
node(id: $id) { id title address }
}json
{"id":"3127593"}Use Python or JavaScript for complete HTTP request code.