-
Notifications
You must be signed in to change notification settings - Fork 285
Commit 5ba8682
[MCP] describe_entities tool fixes and refactoring (#2900)
## Why make this change?
### Closes on
- #2827
Added fixes and refactored the describe_entities tool to support entity
metadata discovery for AI agents and LLM clients before performing CRUD
operations.
## What is this change?
- Expose entity descriptions with proper null handling
- Expose field description for entities of type stored-procedure with
parameter metadata
- Expose permissions for all entities with distinct values
- Added nameOnly parameter to return lightweight response (entity names
and descriptions only)
- Added entities parameter to filter results by specific entity names
- Implemented proper error handling using McpResponseBuilder pattern
- Added support for relationships, mappings, and primary key information
- Improved response structure with metadata section including mode and
count
## How was this tested?
Functional testing using Insomnia client by running DAB in localhost and
local SQL DB database
- MCP endpoint: http://localhost:5000/mcp
- JSON payload (details below)
- Validating the response
Expected (In-progress) format of entity description in response-
```
{
"entities": [
{
"name": "entity-name",
"description": "entity description",
"type": "Table",
"fields": [
{
"name": "field-name",
"type": "unknown",
"description": "field description"
}
],
"permissions": [
"CREATE",
"READ",
"UPDATE",
"DELETE"
],
"primaryKey": ["id"],
"relationships": [...],
"mappings": {...}
}
],
"count": 1,
"mode": "full"
}
```
## Sample Request(s)
```
POST http://localhost:5000/mcp
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "describe_entities"
},
"id": 1
}
```
```
POST http://localhost:5000/mcp
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "describe_entities",
"arguments": {
"nameOnly": true
}
},
"id": 2
}
```
```
POST http://localhost:5000/mcp
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "describe_entities",
"arguments": {
"entities": ["Book", "Publisher"]
}
},
"id": 1
}
```
---------
Co-authored-by: Anusha Kolan <[email protected]>1 parent c3515c8 commit 5ba8682Copy full SHA for 5ba8682
File tree
Expand file treeCollapse file tree
1 file changed
+334
-30
lines changedOpen diff view settings
Filter options
- src/Azure.DataApiBuilder.Mcp/BuiltInTools
Expand file treeCollapse file tree
1 file changed
+334
-30
lines changedOpen diff view settings
0 commit comments