data-api-builder icon indicating copy to clipboard operation
data-api-builder copied to clipboard

Align successful response for built-in mcp tools to all use the mcp utility function

Open aaronburtle opened this issue 2 months ago • 1 comments

in read we are calling a private BuildSuccessfulResult which is hard coding the response dictionary to use "status", and "result" as keys.


        private static CallToolResult BuildSuccessResult(
            string entityName,
            JsonElement engineRootElement,
            ILogger? logger)
        {
            // Build normalized response
            Dictionary<string, object?> normalized = new()
            {
                ["status"] = "success",
                ["result"] = engineRootElement // only requested values
            };

Then in delete we are using the built in helper from the mcp response builder and using "entity", "keyDetails", and "message"


               Dictionary<string, object?> responseData = new()
               {
                   ["entity"] = entityName,
                   ["keyDetails"] = McpJsonHelper.FormatKeyDetails(keys),
                   ["message"] = "Record deleted successfully"
               };


Update is using a private function like read is, create is aligned with delete, using the utility with "entity", and "message".

we should have all these use the mcp response helper and try to use the same keys in the response data.

aaronburtle avatar Oct 23 '25 15:10 aaronburtle

Logs, error messages should also be standardized and refactored.

souvikghosh04 avatar Oct 27 '25 16:10 souvikghosh04