Skip to content

Commit 7228e60

Browse files
Bug fix for setting dml tools based on bool value as set in config (#2927)
## Why make this change? Bug fix for setting dml tools correctly. Closes on - #2942 ## What is this change? This fix addresses the inconsistency in config where `dml-tools` can be either set as bool or a dictionary object containing individual tool names and their bool values. Without this fix, we need to individually set each `dml-tools` to true currently. With this change, we will have the following scenarios- - set `dml-tools` to `true` will enable all dml tools (default is true) Sample- ```"dml-tools": true``` - set `dml-tools` to `false` will disable all dml tools Sample-```"dml-tools": false``` - individual tool names can be specified as dictionary object for `dml-tools` to turn them on (default is true if a tool is not specified). ## How was this tested? - [ ] Integration Tests - [ ] Unit Tests - [x] Manual testing using various combinations and scenarios **Scenario 1:** Enable all tools using a single boolean value `"dml-tools": true` Note: default is true so even if `dml-tools` unspecified it will default to true. **Scenario 2:** Disable `execute-entities` only and keep other tools enabled as default. ``` "dml-tools": { "execute-entities": false } ``` **Scenario 3:** Use full list of tools and enable or disable them ``` "dml-tools": { "execute-entity": true, "delete-record": false, "update-record": false, "read-records": false, "describe-entities": true } ``` --------- Co-authored-by: Aniruddh Munde <[email protected]>
1 parent ccc4f28 commit 7228e60

File tree

45 files changed

+740
-87
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+740
-87
lines changed

src/Cli.Tests/ConfigGeneratorTests.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,16 @@ public void TestSpecialCharactersInConnectionString()
165165
},
166166
""mcp"": {
167167
""enabled"": true,
168-
""path"": ""/mcp""
169-
},
168+
""path"": ""/mcp"",
169+
""dml-tools"":{
170+
""describe-entities"": true,
171+
""create-record"": true,
172+
""read-records"": true,
173+
""update-record"": true,
174+
""delete-record"": true,
175+
""execute-entity"":true
176+
}
177+
},
170178
""host"": {
171179
""cors"": {
172180
""origins"": [],

src/Cli.Tests/Snapshots/EndToEndTests.TestAddingStoredProcedureWithRestMethodsAndGraphQLOperations.verified.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,23 @@
1818
},
1919
Mcp: {
2020
Enabled: true,
21-
Path: /mcp
21+
Path: /mcp,
22+
DmlTools: {
23+
AllToolsEnabled: true,
24+
DescribeEntities: true,
25+
CreateRecord: true,
26+
ReadRecords: true,
27+
UpdateRecord: true,
28+
DeleteRecord: true,
29+
ExecuteEntity: true,
30+
UserProvidedAllToolsEnabled: false,
31+
UserProvidedDescribeEntities: true,
32+
UserProvidedCreateRecord: true,
33+
UserProvidedReadRecords: true,
34+
UserProvidedUpdateRecord: true,
35+
UserProvidedDeleteRecord: true,
36+
UserProvidedExecuteEntity: true
37+
}
2238
},
2339
Host: {
2440
Cors: {

src/Cli.Tests/Snapshots/EndToEndTests.TestConfigGeneratedAfterAddingEntityWithSourceAsStoredProcedure.verified.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,23 @@
1818
},
1919
Mcp: {
2020
Enabled: true,
21-
Path: /mcp
21+
Path: /mcp,
22+
DmlTools: {
23+
AllToolsEnabled: true,
24+
DescribeEntities: true,
25+
CreateRecord: true,
26+
ReadRecords: true,
27+
UpdateRecord: true,
28+
DeleteRecord: true,
29+
ExecuteEntity: true,
30+
UserProvidedAllToolsEnabled: false,
31+
UserProvidedDescribeEntities: true,
32+
UserProvidedCreateRecord: true,
33+
UserProvidedReadRecords: true,
34+
UserProvidedUpdateRecord: true,
35+
UserProvidedDeleteRecord: true,
36+
UserProvidedExecuteEntity: true
37+
}
2238
},
2339
Host: {
2440
Cors: {

src/Cli.Tests/Snapshots/EndToEndTests.TestConfigGeneratedAfterAddingEntityWithSourceWithDefaultType.verified.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,23 @@
1818
},
1919
Mcp: {
2020
Enabled: true,
21-
Path: /mcp
21+
Path: /mcp,
22+
DmlTools: {
23+
AllToolsEnabled: true,
24+
DescribeEntities: true,
25+
CreateRecord: true,
26+
ReadRecords: true,
27+
UpdateRecord: true,
28+
DeleteRecord: true,
29+
ExecuteEntity: true,
30+
UserProvidedAllToolsEnabled: false,
31+
UserProvidedDescribeEntities: true,
32+
UserProvidedCreateRecord: true,
33+
UserProvidedReadRecords: true,
34+
UserProvidedUpdateRecord: true,
35+
UserProvidedDeleteRecord: true,
36+
UserProvidedExecuteEntity: true
37+
}
2238
},
2339
Host: {
2440
Cors: {

src/Cli.Tests/Snapshots/EndToEndTests.TestConfigGeneratedAfterAddingEntityWithoutIEnumerables.verified.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,23 @@
1818
},
1919
Mcp: {
2020
Enabled: true,
21-
Path: /mcp
21+
Path: /mcp,
22+
DmlTools: {
23+
AllToolsEnabled: true,
24+
DescribeEntities: true,
25+
CreateRecord: true,
26+
ReadRecords: true,
27+
UpdateRecord: true,
28+
DeleteRecord: true,
29+
ExecuteEntity: true,
30+
UserProvidedAllToolsEnabled: false,
31+
UserProvidedDescribeEntities: true,
32+
UserProvidedCreateRecord: true,
33+
UserProvidedReadRecords: true,
34+
UserProvidedUpdateRecord: true,
35+
UserProvidedDeleteRecord: true,
36+
UserProvidedExecuteEntity: true
37+
}
2238
},
2339
Host: {
2440
Cors: {

src/Cli.Tests/Snapshots/EndToEndTests.TestInitForCosmosDBNoSql.verified.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,23 @@
1919
},
2020
Mcp: {
2121
Enabled: true,
22-
Path: /mcp
22+
Path: /mcp,
23+
DmlTools: {
24+
AllToolsEnabled: true,
25+
DescribeEntities: true,
26+
CreateRecord: true,
27+
ReadRecords: true,
28+
UpdateRecord: true,
29+
DeleteRecord: true,
30+
ExecuteEntity: true,
31+
UserProvidedAllToolsEnabled: false,
32+
UserProvidedDescribeEntities: true,
33+
UserProvidedCreateRecord: true,
34+
UserProvidedReadRecords: true,
35+
UserProvidedUpdateRecord: true,
36+
UserProvidedDeleteRecord: true,
37+
UserProvidedExecuteEntity: true
38+
}
2339
},
2440
Host: {
2541
Cors: {

src/Cli.Tests/Snapshots/EndToEndTests.TestUpdatingStoredProcedureWithRestMethods.verified.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,23 @@
1818
},
1919
Mcp: {
2020
Enabled: true,
21-
Path: /mcp
21+
Path: /mcp,
22+
DmlTools: {
23+
AllToolsEnabled: true,
24+
DescribeEntities: true,
25+
CreateRecord: true,
26+
ReadRecords: true,
27+
UpdateRecord: true,
28+
DeleteRecord: true,
29+
ExecuteEntity: true,
30+
UserProvidedAllToolsEnabled: false,
31+
UserProvidedDescribeEntities: true,
32+
UserProvidedCreateRecord: true,
33+
UserProvidedReadRecords: true,
34+
UserProvidedUpdateRecord: true,
35+
UserProvidedDeleteRecord: true,
36+
UserProvidedExecuteEntity: true
37+
}
2238
},
2339
Host: {
2440
Cors: {

src/Cli.Tests/Snapshots/EndToEndTests.TestUpdatingStoredProcedureWithRestMethodsAndGraphQLOperations.verified.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,23 @@
1818
},
1919
Mcp: {
2020
Enabled: true,
21-
Path: /mcp
21+
Path: /mcp,
22+
DmlTools: {
23+
AllToolsEnabled: true,
24+
DescribeEntities: true,
25+
CreateRecord: true,
26+
ReadRecords: true,
27+
UpdateRecord: true,
28+
DeleteRecord: true,
29+
ExecuteEntity: true,
30+
UserProvidedAllToolsEnabled: false,
31+
UserProvidedDescribeEntities: true,
32+
UserProvidedCreateRecord: true,
33+
UserProvidedReadRecords: true,
34+
UserProvidedUpdateRecord: true,
35+
UserProvidedDeleteRecord: true,
36+
UserProvidedExecuteEntity: true
37+
}
2238
},
2339
Host: {
2440
Cors: {

src/Cli.Tests/Snapshots/InitTests.CosmosDbNoSqlDatabase.verified.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,23 @@
1919
},
2020
Mcp: {
2121
Enabled: true,
22-
Path: /mcp
22+
Path: /mcp,
23+
DmlTools: {
24+
AllToolsEnabled: true,
25+
DescribeEntities: true,
26+
CreateRecord: true,
27+
ReadRecords: true,
28+
UpdateRecord: true,
29+
DeleteRecord: true,
30+
ExecuteEntity: true,
31+
UserProvidedAllToolsEnabled: true,
32+
UserProvidedDescribeEntities: true,
33+
UserProvidedCreateRecord: true,
34+
UserProvidedReadRecords: true,
35+
UserProvidedUpdateRecord: true,
36+
UserProvidedDeleteRecord: true,
37+
UserProvidedExecuteEntity: true
38+
}
2339
},
2440
Host: {
2541
Cors: {

src/Cli.Tests/Snapshots/InitTests.CosmosDbPostgreSqlDatabase.verified.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,23 @@
1515
},
1616
Mcp: {
1717
Enabled: true,
18-
Path: /mcp
18+
Path: /mcp,
19+
DmlTools: {
20+
AllToolsEnabled: true,
21+
DescribeEntities: true,
22+
CreateRecord: true,
23+
ReadRecords: true,
24+
UpdateRecord: true,
25+
DeleteRecord: true,
26+
ExecuteEntity: true,
27+
UserProvidedAllToolsEnabled: true,
28+
UserProvidedDescribeEntities: true,
29+
UserProvidedCreateRecord: true,
30+
UserProvidedReadRecords: true,
31+
UserProvidedUpdateRecord: true,
32+
UserProvidedDeleteRecord: true,
33+
UserProvidedExecuteEntity: true
34+
}
1935
},
2036
Host: {
2137
Cors: {

0 commit comments

Comments
 (0)