-
Notifications
You must be signed in to change notification settings - Fork 319
Open
Labels
Description
What?
Allow developers to provide query.graphql files with predefined queries.
This becomes a custom MCP tool registered in the MCP server.
This is primarily the Hot Chocolate functionality.
Behavior
- Predefined queries are entities in
dab-config.json. - Predefined queries are parameterized like stored procedures.
- Predefined queries have only DAB
executepermissions. - Predefined queries are available through REST (
/graphql/api/query-name). - Predefined queries are precompiled by Hot Chocolate.
- Predefined queries are not in the GraphQL schema.
- Predefined queries run against standard GraphQL.
- Predefined queries do not override permissions.
Prerequisite
- Hot Chocolate upgrade [Enh]: Upgrade Hot Chocolate #2826
- MCP Endpoint [Enh]: Add MCP endpoint
/mcp#2832
Why?
To enable persisted, complex queries against GraphQL.
- Also enables custom tools in MCP.
How
This is a feature of Hot Chocolate.
- Add
persisted-documentas newsource.typeenum - Update JSON schema
- Register
.graphqlfiles with Hot Chocolate for REST - Register
.graphqlfiles with Hot Chocolate for MCP - Add CLI flags for
dab add --mcp.custom-tool.enabled - Add CLI flags for
dab update --mcp.custom-tool.enabled - Update CLI
dab validate(see rules below)
Configuration
{
"entities": {
"MyCustomTool": {
"source": {
"object": "./query.graphql",
"type": "persisted-document",
"description": "", // not allowed for persisted-documents
"parameters": "", // not allowed for persisted-documents
},
"graphql": {
"enabled": false // true is not allowed
},
"rest": {
"enabled": true // visible as rest endpoint
},
"mcp": { // new
"custom-tool":{
"enabled": true,
"name": "" // not allowed for persisted documents
}
},
"permissions": {} // just like procs, only EXECUTE is allowed
}
}
}New properties
source.typeis not new but adds new enum:persisted-documentmcp.custom-tool.enabledregisters the document as an MCP tool
Rules
source.typemust bepersisted-document.source.objectmust point to a valid.graphqlfile.rest.enabledandrest.pathcontrol REST endpoint registration.mcp.custom-tool.enabledcontrol MCP tool registration.mcp.custo-tool.nameis only valid for stored procedures- Predefined queries only support
executepermission. - With
source.type = persisted-document, the following are not allowed:source.descriptionThis is defined inside the filesource.parametersThis is defined inside the filemappings(results can include nested fields)graphql(query is presented as a REST endpoint)permissions.include(query is presented as a REST endpoint)permissions.exclude(query is presented as a REST endpoint)permissions.policy(query is self-contained)mcp.custom-tool.nameThis is defined inside the file
Command line
dab add User --mcp.custom-tool.enabled true
dab update User --mcp.custom-tool.enabled trueReactions are currently unavailable