Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d1a56a5
Draft changes for mcp config for stored proc entity
souvikghosh04 Nov 4, 2025
8f40b08
Merge branch 'main' of https://github.com/Azure/data-api-builder into…
souvikghosh04 Nov 4, 2025
6af20d8
draft changes for mcp property in store proc
souvikghosh04 Nov 5, 2025
5f31ac8
Merge branch 'main' of https://github.com/Azure/data-api-builder into…
souvikghosh04 Nov 10, 2025
19e14a5
Merge branch 'main' of https://github.com/Azure/data-api-builder into…
souvikghosh04 Nov 12, 2025
74acb17
Adding MCP config property for entities
souvikghosh04 Nov 13, 2025
50f2b6e
formatting errors fix
souvikghosh04 Nov 13, 2025
658a7c1
fiix formatting errors
souvikghosh04 Nov 13, 2025
def860b
Fix failing tests
souvikghosh04 Nov 13, 2025
06ba39f
Fix formatting
souvikghosh04 Nov 13, 2025
d6ff321
Fix failing tests and remove unnecessary changes
souvikghosh04 Nov 13, 2025
4565165
Fix snapshot files
souvikghosh04 Nov 14, 2025
ce22ed8
fix snapshot files
souvikghosh04 Nov 14, 2025
c25055c
Fix snapshot files
souvikghosh04 Nov 14, 2025
a7a5921
Fix snapshot postgresql
souvikghosh04 Nov 14, 2025
ae8429e
Regenerate dab-config.MsSql.json with correct property ordering
souvikghosh04 Nov 18, 2025
0992ab0
Regenerate all database config files with correct property ordering
souvikghosh04 Nov 19, 2025
6f3dec0
Update ConfigurationTests snapshots after config regeneration
souvikghosh04 Nov 19, 2025
ef4bf25
Fix stored procedure GraphQL operations from mutation to query
souvikghosh04 Nov 19, 2025
7daebc2
Fix config generator for correct stored procedure GraphQL operations
souvikghosh04 Nov 19, 2025
bd129d9
Fix DwSql stored procedure GraphQL operations
souvikghosh04 Nov 19, 2025
f93205b
Merge main branch into Usr/sogh/mcpconfigentities.v3
souvikghosh04 Nov 20, 2025
e17938d
Add dab-config.DwSql.json to csproj Content items to ensure it's copi…
souvikghosh04 Nov 21, 2025
53b8153
Add stored procedure operation post-processing to bash script for Lin…
souvikghosh04 Nov 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions config-generators/config-generator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,18 @@ foreach($databaseType in $databaseTypes){
$commandToExecute = "dotnet " + $pathToDabDLL + " " + $command;
Invoke-Expression $commandToExecute;
}

# Post-process MsSql and DwSql configs to fix stored procedure GraphQL operations
# The CLI currently ignores --graphql.operation parameter for stored procedures,
# defaulting them to 'mutation'. We manually fix specific procedures that should be 'query'.
if($databaseType -eq "mssql" -or $databaseType -eq "dwsql"){
$configContent = Get-Content $configFile -Raw | ConvertFrom-Json;
if($configContent.entities.GetBooks){
$configContent.entities.GetBooks.graphql.operation = "query";
}
if($configContent.entities.GetPublisher){
$configContent.entities.GetPublisher.graphql.operation = "query";
}
$configContent | ConvertTo-Json -Depth 100 | Set-Content $configFile -Encoding UTF8;
}
}
18 changes: 18 additions & 0 deletions config-generators/config-generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,22 @@ do
eval $command;
done <$commandFileNameWithPath;

# Post-process MsSql and DwSql config files to set stored procedures as query operations
if [[ $databaseType == "mssql" || $databaseType == "dwsql" ]]; then
# Use jq to modify the operation field for GetBooks and GetPublisher
if command -v jq &> /dev/null; then
tmp_file="${configFile}.tmp"
jq '
if .entities.GetBooks then
.entities.GetBooks.graphql.operation = "query"
else . end |
if .entities.GetPublisher then
.entities.GetPublisher.graphql.operation = "query"
else . end
' "$configFile" > "$tmp_file" && mv "$tmp_file" "$configFile"
else
echo "Warning: jq not found. Skipping stored procedure operation post-processing."
fi
fi

done
6 changes: 3 additions & 3 deletions config-generators/dwsql-commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ add Journal --config "dab-config.DwSql.json" --source "journals" --rest true --g
add ArtOfWar --config "dab-config.DwSql.json" --source "aow" --rest true --graphql false --permissions "anonymous:*" --source.key-fields "NoteNum"
add stocks_view_selected --config "dab-config.DwSql.json" --source stocks_view_selected --source.type "view" --source.key-fields "categoryid,pieceid" --permissions "anonymous:*" --rest true --graphql true
add GetBook --config "dab-config.DwSql.json" --source "get_book_by_id" --source.type "stored-procedure" --permissions "anonymous:execute" --rest true --graphql false
add GetBooks --config "dab-config.DwSql.json" --source "get_books" --source.type "stored-procedure" --permissions "anonymous:execute" --rest true --graphql true
add GetBooks --config "dab-config.DwSql.json" --source "get_books" --source.type "stored-procedure" --permissions "anonymous:execute" --rest true --graphql true --graphql.operation "query"
add GetPublisher --config "dab-config.DwSql.json" --source "get_publisher_by_id" --source.type "stored-procedure" --permissions "anonymous:execute" --rest true --graphql true --graphql.operation "query"
add GetAuthorsHistoryByFirstName --config "dab-config.DwSql.json" --source "get_authors_history_by_first_name" --source.type "stored-procedure" --source.params "firstName:Aaron" --permissions "anonymous:execute" --rest true --graphql SearchAuthorByFirstName
add CountBooks --config "dab-config.DwSql.json" --source "count_books" --source.type "stored-procedure" --permissions "anonymous:execute" --rest true --graphql true
Expand Down Expand Up @@ -152,8 +152,8 @@ update InsertBook --config "dab-config.DwSql.json" --permissions "authenticated:
update DeleteLastInsertedBook --config "dab-config.DwSql.json" --permissions "authenticated:execute"
update UpdateBookTitle --config "dab-config.DwSql.json" --permissions "authenticated:execute"
update InsertAndDisplayAllBooksUnderGivenPublisher --config "dab-config.DwSql.json" --permissions "authenticated:execute"
update GetPublisher --config "dab-config.DwSql.json" --permissions "authenticated:execute"
update GetBooks --config "dab-config.DwSql.json" --permissions "authenticated:execute" --graphql.operation "Query" --rest.methods "Get"
update GetPublisher --config "dab-config.DwSql.json" --permissions "authenticated:execute" --graphql.operation "query"
update GetBooks --config "dab-config.DwSql.json" --permissions "authenticated:execute" --graphql.operation "query" --rest.methods "Get"
update GetBook --config "dab-config.DwSql.json" --permissions "authenticated:execute" --rest.methods "Get"
update CountBooks --config "dab-config.DwSql.json" --permissions "authenticated:execute"
update Sales --config "dab-config.DwSql.json" --permissions "authenticated:*"
Expand Down
6 changes: 3 additions & 3 deletions config-generators/mssql-commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ add User_AutogenRelationshipColumn --config "dab-config.MsSql.json" --source "us
add User_AutogenToNonAutogenRelationshipColumn --config "dab-config.MsSql.json" --source "users" --permissions "anonymous:*" --rest true --graphql true
add User_RepeatedReferencingColumnToOneEntity --config "dab-config.MsSql.json" --source "users" --permissions "anonymous:*" --rest true --graphql true
add UserProfile_RepeatedReferencingColumnToTwoEntities --config "dab-config.MsSql.json" --source "user_profiles" --permissions "anonymous:*" --rest true --graphql true
add GetBooks --config "dab-config.MsSql.json" --source "get_books" --source.type "stored-procedure" --permissions "anonymous:execute" --rest true --graphql true
add GetBooks --config "dab-config.MsSql.json" --source "get_books" --source.type "stored-procedure" --permissions "anonymous:execute" --rest true --graphql true --graphql.operation "query"
add GetBook --config "dab-config.MsSql.json" --source "get_book_by_id" --source.type "stored-procedure" --permissions "anonymous:execute" --rest true --graphql false
add GetPublisher --config "dab-config.MsSql.json" --source "get_publisher_by_id" --source.type "stored-procedure" --permissions "anonymous:execute" --rest true --graphql true --graphql.operation "query"
add InsertBook --config "dab-config.MsSql.json" --source "insert_book" --source.type "stored-procedure" --source.params "title:randomX,publisher_id:1234" --permissions "anonymous:execute" --rest true --graphql true
Expand Down Expand Up @@ -176,8 +176,8 @@ update User_RepeatedReferencingColumnToOneEntity --config "dab-config.MsSql.json
update UserProfile_RepeatedReferencingColumnToTwoEntities --config "dab-config.MsSql.json" --relationship book --target.entity Book --cardinality one --relationship.fields "userid:id"
update UserProfile_RepeatedReferencingColumnToTwoEntities --config "dab-config.MsSql.json" --relationship publisher --target.entity Publisher --cardinality one --relationship.fields "userid:id"
update GetBook --config "dab-config.MsSql.json" --permissions "authenticated:execute" --rest.methods "Get"
update GetPublisher --config "dab-config.MsSql.json" --permissions "authenticated:execute"
update GetBooks --config "dab-config.MsSql.json" --permissions "authenticated:execute" --graphql.operation "Query" --rest.methods "Get"
update GetPublisher --config "dab-config.MsSql.json" --permissions "authenticated:execute" --graphql.operation "query"
update GetBooks --config "dab-config.MsSql.json" --permissions "authenticated:execute" --graphql.operation "query" --rest.methods "Get"
update InsertBook --config "dab-config.MsSql.json" --permissions "authenticated:execute"
update CountBooks --config "dab-config.MsSql.json" --permissions "authenticated:execute"
update DeleteLastInsertedBook --config "dab-config.MsSql.json" --permissions "authenticated:execute"
Expand Down
135 changes: 113 additions & 22 deletions schemas/dab.draft.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@
"properties": {
"type": {
"type": "string",
"enum": ["table", "view", "stored-procedure"],
"enum": [ "table", "view", "stored-procedure" ],
"description": "Database object type"
},
"object": {
Expand All @@ -774,12 +774,24 @@
"description": "Array of parameter objects with metadata",
"items": {
"type": "object",
"required": ["name"],
"required": [ "name" ],
"properties": {
"name": { "type": "string", "description": "Parameter name" },
"required": { "type": "boolean", "description": "Is parameter required" },
"default": { "type": ["string", "number", "boolean", "null"], "description": "Default value" },
"description": { "type": "string", "description": "Parameter description. Since descriptions for multiple parameters are provided as a comma-separated string, individual parameter descriptions must not contain a comma (',')." }
"name": {
"type": "string",
"description": "Parameter name"
},
"required": {
"type": "boolean",
"description": "Is parameter required"
},
"default": {
"type": [ "string", "number", "boolean", "null" ],
"description": "Default value"
},
"description": {
"type": "string",
"description": "Parameter description. Since descriptions for multiple parameters are provided as a comma-separated string, individual parameter descriptions must not contain a comma (',')."
}
}
}
}
Expand All @@ -793,7 +805,7 @@
"description": "List of fields to be used as primary keys. Mandatory field for views when generated through the CLI."
}
},
"required": ["type", "object"]
"required": [ "type", "object" ]
}
]
},
Expand All @@ -803,12 +815,24 @@
"items": {
"type": "object",
"properties": {
"name": { "type": "string", "description": "Database column name." },
"alias": { "type": "string", "description": "Exposed name for the field." },
"description": { "type": "string", "description": "Field description." },
"primary-key": { "type": "boolean", "description": "Indicates whether this field is a primary key." }
"name": {
"type": "string",
"description": "Database column name."
},
"alias": {
"type": "string",
"description": "Exposed name for the field."
},
"description": {
"type": "string",
"description": "Field description."
},
"primary-key": {
"type": "boolean",
"description": "Indicates whether this field is a primary key."
}
},
"required": ["name"]
"required": [ "name" ]
},
"uniqueItems": true
},
Expand All @@ -828,7 +852,7 @@
"type": "array",
"items": {
"type": "string",
"enum": ["get", "post", "put", "patch", "delete"]
"enum": [ "get", "post", "put", "patch", "delete" ]
}
},
"enabled": {
Expand All @@ -839,13 +863,13 @@
},
"anyOf": [
{
"required": ["path"]
"required": [ "path" ]
},
{
"required": ["methods"]
"required": [ "methods" ]
},
{
"required": ["enabled"]
"required": [ "enabled" ]
}
]
}
Expand All @@ -865,7 +889,7 @@
},
"operation": {
"type": "string",
"enum": ["mutation", "query"]
"enum": [ "mutation", "query" ]
},
"enabled": {
"type": "boolean",
Expand All @@ -875,18 +899,43 @@
},
"anyOf": [
{
"required": ["type"]
"required": [ "type" ]
},
{
"required": ["operation"]
"required": [ "operation" ]
},
{
"required": ["enabled"]
"required": [ "enabled" ]
}
]
}
]
},
"mcp": {
"oneOf": [
{
"type": "boolean",
"description": "Enable/disable DML tools. When true, all DML tools are enabled. When false, all DML tools are disabled. For stored procedures only: true also enables custom-tool as false by default."
},
{
"type": "object",
"description": "Granular MCP configuration. For stored procedures: can specify both custom-tool and dml-tools. For tables/views: only dml-tools is allowed.",
"additionalProperties": false,
"properties": {
"custom-tool": {
"type": "boolean",
"description": "Enable/disable the custom tool. Only applicable for stored-procedure entities.",
"default": false
},
"dml-tools": {
"type": "boolean",
"description": "Enable/disable the dml-tools.",
"default": true
}
}
}
]
},
"permissions": {
"type": "array",
"description": "Permissions assigned to this entity"
Expand All @@ -908,7 +957,7 @@
"properties": {
"cardinality": {
"type": "string",
"enum": ["one", "many"]
"enum": [ "one", "many" ]
},
"target.entity": {
"type": "string"
Expand Down Expand Up @@ -942,7 +991,7 @@
}
}
},
"required": ["cardinality", "target.entity"]
"required": [ "cardinality", "target.entity" ]
}
}
},
Expand Down Expand Up @@ -1145,6 +1194,48 @@
]
}
}
},
{
"if": {
"properties": {
"source": {
"type": "object",
"properties": {
"type": {
"const": "stored-procedure"
}
}
}
}
},
"then": {
"comment": "For stored procedures, both custom-tool and dml-tools are allowed in mcp"
},
"else": {
"comment": "For tables and views, only dml-tools is allowed in mcp",
"if": {
"properties": {
"mcp": {
"type": "object"
}
}
},
"then": {
"properties": {
"mcp": {
"type": "object",
"additionalProperties": false,
"properties": {
"dml-tools": {
"type": "boolean",
"description": "Enable/disable the dml-tools.",
"default": true
}
}
}
}
}
}
}
]
}
Expand Down
Loading
Loading