Skip to content

MCP-CustomTool: describe_entities filtering #3043

@souvikghosh04

Description

@souvikghosh04

Goal: Prevent duplication between custom tools and describe_entities

Files to Modify:

DescribeEntitiesTool.cs
Add filtering in entity loop (~line 150-160)
Skip entities where: entity.Source.Type == EntitySourceType.StoredProcedure && entity.Mcp?.CustomToolEnabled == true
Add XML comment explaining custom-tool exclusion

Code change:

foreach (KeyValuePair<string, Entity> entityEntry in runtimeConfig.Entities)
{
    string entityName = entityEntry.Key;
    Entity entity = entityEntry.Value;

    // Skip stored procedures exposed as custom tools - they appear in tools/list instead
    if (entity.Source.Type == EntitySourceType.StoredProcedure && 
        entity.Mcp?.CustomToolEnabled == true)
    {
        continue;
    }

    if (!ShouldIncludeEntity(entityName, entityFilter))
    {
        continue;
    }
    // ... rest of loop
}

Files to Create:
2. src/Azure.DataApiBuilder.Mcp.Tests/DescribeEntitiesFilteringTests.cs

Custom-tool SPs excluded from describe_entities
Regular SPs (without custom-tool) still appear
Tables/views unaffected by filtering
Count validation (entities.count reflects filtered list)
nameOnly parameter works with filtering

Deliverable: Clean separation between custom tools and entity discovery

Metadata

Metadata

Assignees

Labels

mcp-servermssqlan issue thats specific to mssql

Projects

Status

Todo

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions