You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Honoring incoming request role in determining allowed permissions for describe-entities MCP tool (#2956)
## Why make this change?
- Addresses follow ups to PR #2900
The `describe_entities` tool response format needed improvements to
better align with MCP specifications and provide more accurate,
user-scoped information. Key issues included non-specification compliant
response fields, overly broad permission reporting across all roles, and
inconsistent entity/field naming conventions that didn't prioritize
user-friendly aliases.
## What is this change?
- **Removed non-spec fields from response**: Eliminated `mode` and
`filter` fields that were not part of the MCP specification
- **Scoped permissions to current user's role**: Modified permissions
logic to only return permissions available to the requesting user's role
instead of all permissions across all roles
- **Implemented entity alias support**: Updated entity name resolution
to prefer GraphQL singular names (aliases) over configuration names,
falling back to entity name only when alias is absent
- **Fixed parameter metadata format**: Changed parameter default value
key from `@default` to `default` in JSON response
- **Enhanced field name resolution**: Updated field metadata to use
field aliases when available, falling back to field names when aliases
are absent
- **Added proper authorization context**: Integrated HTTP context and
authorization resolver to determine current user's role for permission
filtering
## How was this tested?
- [x] Manual Tests
## 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
}
```
0 commit comments